[go: up one dir, main page]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[css-values-4] Logical viewport units (vi, vb, etc) and writing-mode propagation #6873

Closed
andruud opened this issue Dec 9, 2021 · 4 comments
Labels
Closed Accepted by CSSWG Resolution css-contain-3 css-values-4 Current Work i18n-tracker Group bringing to attention of Internationalization, or tracked by i18n but not needing response.

Comments

@andruud
Copy link
Member
andruud commented Dec 9, 2021

[<lvi, svi, etc> are] equal to 1% of the size of the large viewport size, small viewport size, and dynamic viewport size (respectively) in the direction of the root element’s inline axis.

If writing-mode is propagated from body to the viewport, are these units supposed to resolve according to the propagated writing-mode (e.g. if used on e.g. the root element)? At the time we know what to propagate from body, it's too late to change any interpretation of *i,*b on root.

Can we specify that these units resolve against the computed value of writing-mode on the root element? This is what WebKit did in their implementation.

@fantasai
Copy link
Collaborator

I think that's probably fine. But now that I'm thinking about it... wouldn't we want it to resolve against the writing mode of the element on which it is used? E.g. if you're sizing a line of text to be 50% of the viewport, you'd want to use vi but you'd want it resolving against your own writing mode, not the root's writing mode...

@fantasai fantasai added Agenda+ css-values-4 Current Work i18n-tracker Group bringing to attention of Internationalization, or tracked by i18n but not needing response. labels Dec 10, 2021
@andruud
Copy link
Member Author
andruud commented Dec 13, 2021

Sounds good, as long as it's the computed value of writing-mode we're resolving against.

By the way, if we change vi/vb to resolve against the self-writing-mode, then we should probably make the same change for cqi/cbi.

@fantasai
Copy link
Collaborator

@andruud Agreed on both counts. :)

@css-meeting-bot
Copy link
Member

The CSS Working Group just discussed logical-viewport units and wm propagation, and agreed to the following:

  • RESOLVED: Writing-mode sensitive viewport units (and analogous units) use the writing mode of the element they're used on.
The full IRC log of that discussion <TabAtkins> Topic: logical-viewport units and wm propagation
<TabAtkins> github: https://github.com//issues/6873
<TabAtkins> fantasai: issue was raised to simplify some edges cases around writing modes and viewport units
<TabAtkins> fantasai: Also brought up the question - I think we got the issue wrong, as it says to resolve against the root element's writing mode, but I think generally you want the element's writing mode.
<TabAtkins> fantasai: So proposed resolution is to use the element's writing mode to resolve vi/vb, rather than the root element.
<fantasai_> s/edge cases around/edge cases around body propagation and/
<fantasai_> TabAtkins: I agree
<TabAtkins> smfr: Does tha tmake inheritance complicated?
<TabAtkins> fantasai_: No, they compute to lengths before inheritance
<TabAtkins> florian: Yeah, I think I remember that being what I wanted. If you're doing a font-size in viewport units, you want the logical axis you're using.
<TabAtkins> miriam: Might be confusing with container queries which have to be set up to be inline or block
<TabAtkins> miriam: So you set up a container with "inline", this might not match the container you've established.
<TabAtkins> emilio: What do we resolve our units against, the container or the element?
<Rossen_> q?
<TabAtkins> fantasai_: So this is about the container-relative units.
<TabAtkins> emilio: We added a way to resolve against different containers. It would be very bad if we resolved relative units against different axises for each property.
<TabAtkins> emilio: So think we should resolve them against the element's wm.
<TabAtkins> miriam: So when you use the "cq inline unit" it looks for the nearest container with inline containment.
<TabAtkins> miriam: Could potentially be confusing if the inline unit doesn't resolve against a container declaring "inline"
<fantasai_> TabAtkins: I agree that the potential of inline not matching inline is a general problem with mismatched writing modes, and agree that within an element you want inline to match what that element thinks its inline axis is
<TabAtkins> fantasai_: So proposed resolution is that viewport units (and analogues) use the writing mode of the element they're used on.
<TabAtkins> Rossen_: objections?
<TabAtkins> RESOLVED: Writing-mode sensitive viewport units (and analogous units) use the writing mode of the element they're used on.

chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Jan 17, 2022
Previously the unit 'qi' (for example) would resolve against the
nearest inline-axis container. However, according to a recent
resolution [1] writing-mode sensitive units resolve to a physical
axis based on the target element's writing mode.

This simplifies the container-relative unit resolution a bit, since
can always use PhysicalAxes when searching for the correct container.

Being able to resolve logical units in CSSToLengthConversionData also
prepares for implementation of the new viewport units [2], which
include a number of new logical variants as well. (They also resolve
to physical in the same way).

This CL should only affect code behind the CSSContainerRelativeUnits
runtime flag (status:test).

[1] w3c/csswg-drafts#6873
[2] https://crbug.com/1093055

Bug: 1223030, 1093055
Change-Id: I548a613609b46a38262d5de48e294dab1131853b
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Jan 17, 2022
Previously the unit 'qi' (for example) would resolve against the
nearest inline-axis container. However, according to a recent
resolution [1] writing-mode sensitive units resolve to a physical
axis based on the target element's writing mode.

This simplifies the container-relative unit resolution a bit, since
can always use PhysicalAxes when searching for the correct container.

Being able to resolve logical units in CSSToLengthConversionData also
prepares for implementation of the new viewport units [2], which
include a number of new logical variants as well. (They also resolve
to physical in the same way).

This CL should only affect code behind the CSSContainerRelativeUnits
runtime flag (status:test).

[1] w3c/csswg-drafts#6873
[2] https://crbug.com/1093055

Bug: 1223030, 1093055
Change-Id: I548a613609b46a38262d5de48e294dab1131853b
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Jan 20, 2022
Previously the unit 'qi' (for example) would resolve against the
nearest inline-axis container. However, according to a recent
resolution [1] writing-mode sensitive units resolve to a physical
axis based on the target element's writing mode.

This simplifies the container-relative unit resolution a bit, since
can always use PhysicalAxes when searching for the correct container.

Being able to resolve logical units in CSSToLengthConversionData also
prepares for implementation of the new viewport units [2], which
include a number of new logical variants as well. (They also resolve
to physical in the same way).

This CL should only affect code behind the CSSContainerRelativeUnits
runtime flag (status:test).

[1] w3c/csswg-drafts#6873
[2] https://crbug.com/1093055

Bug: 1223030, 1093055
Change-Id: I548a613609b46a38262d5de48e294dab1131853b
aarongable pushed a commit to chromium/chromium that referenced this issue Jan 20, 2022
Previously the unit 'qi' (for example) would resolve against the
nearest inline-axis container. However, according to a recent
resolution [1] writing-mode sensitive units resolve to a physical
axis based on the target element's writing mode.

This simplifies the container-relative unit resolution a bit, since
can always use PhysicalAxes when searching for the correct container.

Being able to resolve logical units in CSSToLengthConversionData also
prepares for implementation of the new viewport units [2], which
include a number of new logical variants as well. (They also resolve
to physical in the same way).

This CL should only affect code behind the CSSContainerRelativeUnits
runtime flag (status:test).

[1] w3c/csswg-drafts#6873
[2] https://crbug.com/1093055

Bug: 1223030, 1093055
Change-Id: I548a613609b46a38262d5de48e294dab1131853b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3387159
Reviewed-by: Xiaocheng Hu <xiaochengh@chromium.org>
Commit-Queue: Anders Hartvoll Ruud <andruud@chromium.org>
Cr-Commit-Position: refs/heads/main@{#961390}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Jan 20, 2022
Previously the unit 'qi' (for example) would resolve against the
nearest inline-axis container. However, according to a recent
resolution [1] writing-mode sensitive units resolve to a physical
axis based on the target element's writing mode.

This simplifies the container-relative unit resolution a bit, since
can always use PhysicalAxes when searching for the correct container.

Being able to resolve logical units in CSSToLengthConversionData also
prepares for implementation of the new viewport units [2], which
include a number of new logical variants as well. (They also resolve
to physical in the same way).

This CL should only affect code behind the CSSContainerRelativeUnits
runtime flag (status:test).

[1] w3c/csswg-drafts#6873
[2] https://crbug.com/1093055

Bug: 1223030, 1093055
Change-Id: I548a613609b46a38262d5de48e294dab1131853b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3387159
Reviewed-by: Xiaocheng Hu <xiaochengh@chromium.org>
Commit-Queue: Anders Hartvoll Ruud <andruud@chromium.org>
Cr-Commit-Position: refs/heads/main@{#961390}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Jan 20, 2022
Previously the unit 'qi' (for example) would resolve against the
nearest inline-axis container. However, according to a recent
resolution [1] writing-mode sensitive units resolve to a physical
axis based on the target element's writing mode.

This simplifies the container-relative unit resolution a bit, since
can always use PhysicalAxes when searching for the correct container.

Being able to resolve logical units in CSSToLengthConversionData also
prepares for implementation of the new viewport units [2], which
include a number of new logical variants as well. (They also resolve
to physical in the same way).

This CL should only affect code behind the CSSContainerRelativeUnits
runtime flag (status:test).

[1] w3c/csswg-drafts#6873
[2] https://crbug.com/1093055

Bug: 1223030, 1093055
Change-Id: I548a613609b46a38262d5de48e294dab1131853b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3387159
Reviewed-by: Xiaocheng Hu <xiaochengh@chromium.org>
Commit-Queue: Anders Hartvoll Ruud <andruud@chromium.org>
Cr-Commit-Position: refs/heads/main@{#961390}
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this issue Feb 5, 2022
…st element's writing-mode, a=testonly

Automatic update from web-platform-tests
[@container] Resolve logical units against element's writing-mode

Previously the unit 'qi' (for example) would resolve against the
nearest inline-axis container. However, according to a recent
resolution [1] writing-mode sensitive units resolve to a physical
axis based on the target element's writing mode.

This simplifies the container-relative unit resolution a bit, since
can always use PhysicalAxes when searching for the correct container.

Being able to resolve logical units in CSSToLengthConversionData also
prepares for implementation of the new viewport units [2], which
include a number of new logical variants as well. (They also resolve
to physical in the same way).

This CL should only affect code behind the CSSContainerRelativeUnits
runtime flag (status:test).

[1] w3c/csswg-drafts#6873
[2] https://crbug.com/1093055

Bug: 1223030, 1093055
Change-Id: I548a613609b46a38262d5de48e294dab1131853b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3387159
Reviewed-by: Xiaocheng Hu <xiaochengh@chromium.org>
Commit-Queue: Anders Hartvoll Ruud <andruud@chromium.org>
Cr-Commit-Position: refs/heads/main@{#961390}

--

wpt-commits: e328f1220b9604fb03a555a78af99c08ea9f0d61
wpt-pr: 32410
jamienicol pushed a commit to jamienicol/gecko that referenced this issue Feb 7, 2022
…st element's writing-mode, a=testonly

Automatic update from web-platform-tests
[@container] Resolve logical units against element's writing-mode

Previously the unit 'qi' (for example) would resolve against the
nearest inline-axis container. However, according to a recent
resolution [1] writing-mode sensitive units resolve to a physical
axis based on the target element's writing mode.

This simplifies the container-relative unit resolution a bit, since
can always use PhysicalAxes when searching for the correct container.

Being able to resolve logical units in CSSToLengthConversionData also
prepares for implementation of the new viewport units [2], which
include a number of new logical variants as well. (They also resolve
to physical in the same way).

This CL should only affect code behind the CSSContainerRelativeUnits
runtime flag (status:test).

[1] w3c/csswg-drafts#6873
[2] https://crbug.com/1093055

Bug: 1223030, 1093055
Change-Id: I548a613609b46a38262d5de48e294dab1131853b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3387159
Reviewed-by: Xiaocheng Hu <xiaochengh@chromium.org>
Commit-Queue: Anders Hartvoll Ruud <andruud@chromium.org>
Cr-Commit-Position: refs/heads/main@{#961390}

--

wpt-commits: e328f1220b9604fb03a555a78af99c08ea9f0d61
wpt-pr: 32410
webkit-commit-queue pushed a commit to WebKit/WebKit that referenced this issue May 21, 2022
… should be based on the current element's `writing-mode`

https://bugs.webkit.org/show_bug.cgi?id=234373
<rdar://problem/86832561>

Reviewed by Tim Nguyen.

Previously, we only looked at the root element's `writing-mode`. Looking at the current element's
`writing-mode` allows for non-root elements to have a `writing-mode` independent of the root element,
as well as having styles based on that. This was changed in <w3c/csswg-drafts#6873>.

Tests: CSSViewportUnits.AllSame
       CSSViewportUnits.MinimumViewportInsetWithWritingMode
       CSSViewportUnits.MaximumViewportInsetWithWritingMode
       CSSViewportUnits.EmptyUnobscuredSizeOverrides
       CSSViewportUnits.SameUnobscuredSizeOverrides
       CSSViewportUnits.DifferentUnobscuredSizeOverrides
       CSSViewportUnits.SVGDocument

* Source/WebCore/css/CSSPrimitiveValue.cpp:
(WebCore::lengthOfViewportPhysicalAxisForLogicalAxis):
(WebCore::CSSPrimitiveValue::computeNonCalcLengthDouble):

* Tools/TestWebKitAPI/Tests/WebKitCocoa/CSSViewportUnits.mm:
(changeCSSPropertyOfElements): Added.
(TEST.CSSViewportUnits.AllSame):
(TEST.CSSViewportUnits.MinimumViewportInsetWithWritingMode):
(TEST.CSSViewportUnits.MaximumViewportInsetWithWritingMode):
(TEST.CSSViewportUnits.EmptyUnobscuredSizeOverrides):
(TEST.CSSViewportUnits.SameUnobscuredSizeOverrides):
(TEST.CSSViewportUnits.DifferentUnobscuredSizeOverrides):
(TEST.CSSViewportUnits.SVGDocument):

Canonical link: https://commits.webkit.org/250835@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@294609 268f45cc-cd09-0410-ab3c-d52691b4dbfc
alancoon added a commit to WebKit/WebKit that referenced this issue Jun 3, 2022
    [css-values-4] logical `*vi`(inline) and `*vb` (block) viewport units should be based on the current element's `writing-mode`
    https://bugs.webkit.org/show_bug.cgi?id=234373
    <rdar://problem/86832561>

    Reviewed by Tim Nguyen.

    Previously, we only looked at the root element's `writing-mode`. Looking at the current element's
    `writing-mode` allows for non-root elements to have a `writing-mode` independent of the root element,
    as well as having styles based on that. This was changed in <w3c/csswg-drafts#6873>.

    Tests: CSSViewportUnits.AllSame
           CSSViewportUnits.MinimumViewportInsetWithWritingMode
           CSSViewportUnits.MaximumViewportInsetWithWritingMode
           CSSViewportUnits.EmptyUnobscuredSizeOverrides
           CSSViewportUnits.SameUnobscuredSizeOverrides
           CSSViewportUnits.DifferentUnobscuredSizeOverrides
           CSSViewportUnits.SVGDocument

    * Source/WebCore/css/CSSPrimitiveValue.cpp:
    (WebCore::lengthOfViewportPhysicalAxisForLogicalAxis):
    (WebCore::CSSPrimitiveValue::computeNonCalcLengthDouble):

    * Tools/TestWebKitAPI/Tests/WebKitCocoa/CSSViewportUnits.mm:
    (changeCSSPropertyOfElements): Added.
    (TEST.CSSViewportUnits.AllSame):
    (TEST.CSSViewportUnits.MinimumViewportInsetWithWritingMode):
    (TEST.CSSViewportUnits.MaximumViewportInsetWithWritingMode):
    (TEST.CSSViewportUnits.EmptyUnobscuredSizeOverrides):
    (TEST.CSSViewportUnits.SameUnobscuredSizeOverrides):
    (TEST.CSSViewportUnits.DifferentUnobscuredSizeOverrides):
    (TEST.CSSViewportUnits.SVGDocument):

    Canonical link: https://commits.webkit.org/250835@main
    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@294609 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Canonical link: https://commits.webkit.org/245886.622@safari-613-branch
git-svn-id: https://svn.webkit.org/repository/webkit/branches/safari-613-branch@295194 268f45cc-cd09-0410-ab3c-d52691b4dbfc
mjfroman pushed a commit to mjfroman/moz-libwebrtc-third-party that referenced this issue Oct 14, 2022
Previously the unit 'qi' (for example) would resolve against the
nearest inline-axis container. However, according to a recent
resolution [1] writing-mode sensitive units resolve to a physical
axis based on the target element's writing mode.

This simplifies the container-relative unit resolution a bit, since
can always use PhysicalAxes when searching for the correct container.

Being able to resolve logical units in CSSToLengthConversionData also
prepares for implementation of the new viewport units [2], which
include a number of new logical variants as well. (They also resolve
to physical in the same way).

This CL should only affect code behind the CSSContainerRelativeUnits
runtime flag (status:test).

[1] w3c/csswg-drafts#6873
[2] https://crbug.com/1093055

Bug: 1223030, 1093055
Change-Id: I548a613609b46a38262d5de48e294dab1131853b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3387159
Reviewed-by: Xiaocheng Hu <xiaochengh@chromium.org>
Commit-Queue: Anders Hartvoll Ruud <andruud@chromium.org>
Cr-Commit-Position: refs/heads/main@{#961390}
NOKEYCHECK=True
GitOrigin-RevId: 3a7fda23de74e6c6244766f6b640d4459bc6c9c4
webkit-commit-queue pushed a commit to anttijk/WebKit that referenced this issue Jun 30, 2023
https://bugs.webkit.org/show_bug.cgi?id=258722
rdar://111565488

Reviewed by Simon Fraser.

Correct handling for vertical writing mode per w3c/csswg-drafts#6873

* LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-units-in-at-container-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-units-selection-expected.txt:
* Source/WebCore/css/CSSPrimitiveValue.cpp:
(WebCore::CSSPrimitiveValue::computeNonCalcLengthDouble):

Resolve logical to to physical axis based on the element writing mode.
Also explicitly fall back to small viewport units to guarantee consistency.

Canonical link: https://commits.webkit.org/265654@main
mnutt pushed a commit to movableink/webkit that referenced this issue Jul 18, 2023
https://bugs.webkit.org/show_bug.cgi?id=258722
rdar://111565488

Reviewed by Simon Fraser.

Correct handling for vertical writing mode per w3c/csswg-drafts#6873

* LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-units-in-at-container-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-units-selection-expected.txt:
* Source/WebCore/css/CSSPrimitiveValue.cpp:
(WebCore::CSSPrimitiveValue::computeNonCalcLengthDouble):

Resolve logical to to physical axis based on the element writing mode.
Also explicitly fall back to small viewport units to guarantee consistency.

Canonical link: https://commits.webkit.org/265654@main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Closed Accepted by CSSWG Resolution css-contain-3 css-values-4 Current Work i18n-tracker Group bringing to attention of Internationalization, or tracked by i18n but not needing response.
Projects
None yet
Development

No branches or pull requests

4 participants