-
Notifications
You must be signed in to change notification settings - Fork 719
[css-flexbox] overflow clip on SVG elements and flex layout #7714
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
Comments
SVG children resolve min-width/min-height: auto to 0 by default due to overflow:hidden in UA stylesheet. This changed with CSSOverflowForReplacedElements which added overflow:clip to these elements and as a result used the minimum size based on SVG's intrinsic size. Fix the above by retaining the old behaviour and treating overflow:clip same as overflow:hidden for these elements. The discussion for the final solution continues at: w3c/csswg-drafts#7714. [email protected] Bug:1358820 Change-Id: I79fb2e334ca72807ca6e3b12d85c1f8a33a9f086
SVG children resolve min-width/min-height: auto to 0 by default due to overflow:hidden in UA stylesheet. This changed with CSSOverflowForReplacedElements which added overflow:clip to these elements and as a result used the minimum size based on SVG's intrinsic size. Fix the above by retaining the old behaviour and treating overflow:clip same as overflow:hidden for these elements. The discussion for the final solution continues at: w3c/csswg-drafts#7714. [email protected] Bug:1358820 Change-Id: I79fb2e334ca72807ca6e3b12d85c1f8a33a9f086
A third option also is to not change the UA-stylesheet for SVGs (they remain |
Based on the resolution in #7144, Given the above, no change to the UA-stylesheet for SVG should behave the same as adding |
The CSS Working Group just discussed
The full IRC log of that discussionSee official minutes |
Quoting one resolution:
It wasn't explicitly stated, but I think it's implied that we'll need this change for the automatic minimum size for grid items as well. |
SVG elements use 'overflow:hidden' via UA CSS to clip to the content-box by default. This should be 'overflow:clip' but hidden ensures backwards compat with flex layout. The used value for painting is still clip. See w3c/csswg-drafts#7714 for details. [email protected] Bug:1358820 Change-Id: I79fb2e334ca72807ca6e3b12d85c1f8a33a9f086
SVG elements use 'overflow:hidden' via UA CSS to clip to the content-box by default. This should be 'overflow:clip' but hidden ensures backwards compat with flex layout. The used value for painting is still clip. See w3c/csswg-drafts#7714 for details. [email protected] Bug:1358820 Change-Id: I79fb2e334ca72807ca6e3b12d85c1f8a33a9f086
SVG elements use 'overflow:hidden' via UA CSS to clip to the content-box by default. This should be 'overflow:clip' but hidden ensures backwards compat with flex layout. The used value for painting is still clip. See w3c/csswg-drafts#7714 for details. [email protected] Bug:1358820 Change-Id: I79fb2e334ca72807ca6e3b12d85c1f8a33a9f086
SVG elements use 'overflow:hidden' via UA CSS to clip to the content-box by default. This should be 'overflow:clip' but hidden ensures backwards compat with flex layout. The used value for painting is still clip. See w3c/csswg-drafts#7714 for details. [email protected] Bug: 1358820 Change-Id: I79fb2e334ca72807ca6e3b12d85c1f8a33a9f086 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3884796 Auto-Submit: Khushal SagarReviewed-by: Ian Kilpatrick Commit-Queue: Khushal Sagar Commit-Queue: Ian Kilpatrick Cr-Commit-Position: refs/heads/main@{#1048721}
SVG elements use 'overflow:hidden' via UA CSS to clip to the content-box by default. This should be 'overflow:clip' but hidden ensures backwards compat with flex layout. The used value for painting is still clip. See w3c/csswg-drafts#7714 for details. [email protected] Bug: 1358820 Change-Id: I79fb2e334ca72807ca6e3b12d85c1f8a33a9f086 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3884796 Auto-Submit: Khushal SagarReviewed-by: Ian Kilpatrick Commit-Queue: Khushal Sagar Commit-Queue: Ian Kilpatrick Cr-Commit-Position: refs/heads/main@{#1048721}
SVG elements use 'overflow:hidden' via UA CSS to clip to the content-box by default. This should be 'overflow:clip' but hidden ensures backwards compat with flex layout. The used value for painting is still clip. See w3c/csswg-drafts#7714 for details. [email protected] Bug: 1358820 Change-Id: I79fb2e334ca72807ca6e3b12d85c1f8a33a9f086 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3884796 Auto-Submit: Khushal SagarReviewed-by: Ian Kilpatrick Commit-Queue: Khushal Sagar Commit-Queue: Ian Kilpatrick Cr-Commit-Position: refs/heads/main@{#1048721}
… root svg elements., a=testonly Automatic update from web-platform-tests blink: Remove 'overflow:clip' UA CSS for root svg elements. SVG elements use 'overflow:hidden' via UA CSS to clip to the content-box by default. This should be 'overflow:clip' but hidden ensures backwards compat with flex layout. The used value for painting is still clip. See w3c/csswg-drafts#7714 for details. [email protected] Bug: 1358820 Change-Id: I79fb2e334ca72807ca6e3b12d85c1f8a33a9f086 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3884796 Auto-Submit: Khushal SagarReviewed-by: Ian Kilpatrick Commit-Queue: Khushal Sagar Commit-Queue: Ian Kilpatrick Cr-Commit-Position: refs/heads/main@{#1048721} -- wpt-commits: 1647654b1e2904e6f729409e3cea8ed4d6bdde8c wpt-pr: 35837
… root svg elements., a=testonly Automatic update from web-platform-tests blink: Remove 'overflow:clip' UA CSS for root svg elements. SVG elements use 'overflow:hidden' via UA CSS to clip to the content-box by default. This should be 'overflow:clip' but hidden ensures backwards compat with flex layout. The used value for painting is still clip. See w3c/csswg-drafts#7714 for details. [email protected] Bug: 1358820 Change-Id: I79fb2e334ca72807ca6e3b12d85c1f8a33a9f086 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3884796 Auto-Submit: Khushal SagarReviewed-by: Ian Kilpatrick Commit-Queue: Khushal Sagar Commit-Queue: Ian Kilpatrick Cr-Commit-Position: refs/heads/main@{#1048721} -- wpt-commits: 1647654b1e2904e6f729409e3cea8ed4d6bdde8c wpt-pr: 35837
@fantasai @tabatkins grid also uses scroll container, do we want the same "look at the computed overflow value" instead? |
Ah I guess Daniel's comment is exactly my comment too :) |
…ching checks. The spec says scroll container, so overflow: visible and clip shouldn't be different. Note that the spec here is pending some edits from w3c/csswg-drafts#7714 tho. Differential Revision: https://phabricator.services.mozilla.com/D197052 bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1871412 gecko-commit: 0e434686366011fb0a899029d1ebd99e388d53bb gecko-reviewers: dholbert
…and grid stretching checks. r=dholbert The spec says scroll container, so overflow: visible and clip shouldn't be different. Note that the spec here is pending some edits from w3c/csswg-drafts#7714 tho. Differential Revision: https://phabricator.services.mozilla.com/D197052
…ching checks. The spec says scroll container, so overflow: visible and clip shouldn't be different. Note that the spec here is pending some edits from w3c/csswg-drafts#7714 tho. Differential Revision: https://phabricator.services.mozilla.com/D197052 bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1871412 gecko-commit: 0e434686366011fb0a899029d1ebd99e388d53bb gecko-reviewers: dholbert
…and grid stretching checks. r=dholbert The spec says scroll container, so overflow: visible and clip shouldn't be different. Note that the spec here is pending some edits from w3c/csswg-drafts#7714 tho. Differential Revision: https://phabricator.services.mozilla.com/D197052 UltraBlame original commit: 0e434686366011fb0a899029d1ebd99e388d53bb
…and grid stretching checks. r=dholbert The spec says scroll container, so overflow: visible and clip shouldn't be different. Note that the spec here is pending some edits from w3c/csswg-drafts#7714 tho. Differential Revision: https://phabricator.services.mozilla.com/D197052 UltraBlame original commit: 0e434686366011fb0a899029d1ebd99e388d53bb
…and grid stretching checks. r=dholbert The spec says scroll container, so overflow: visible and clip shouldn't be different. Note that the spec here is pending some edits from w3c/csswg-drafts#7714 tho. Differential Revision: https://phabricator.services.mozilla.com/D197052 UltraBlame original commit: 0e434686366011fb0a899029d1ebd99e388d53bb
@emilio @dholbert - We noticed some new tests came in. It looks like you were asserting that we don't read the computed value of the element in grid like we do in flexbox - is that understanding correct? (also the tests are kinda asserting unspecified things we believe - like if scrollbars are allowed on buttons etc, but we can fix that in the tests separately). |
Not quite. I think Gecko does treat grid/flex consistently[i] but we do seem to treat them differently from Chromium/WebKit. Looking at e.g. http://wpt.live/css/css-grid/stretch-grid-item-text-input-overflow.html (one of the recent test changes), I think the idea of the changes was: During code-review, I only noticed change (1) and didn't think too much about (2), but it does seem like (2) is in contradiction to the resolution here and is a divergence from other browsers, so we may need to rethink/revert that part. [i] RE treating grid/flex consistently, here's an example:
Firefox Nightly renders all 4 lines the same (no shrinking).
Mmm right, that seems to be https://wpt.fyi/results/css/css-grid/stretch-grid-item-button-overflow.html (which I think is just a button-flavored version of the |
(I posted https://bugzilla.mozilla.org/show_bug.cgi?id=1871412#c7 to discuss next-steps on our end.) |
|
The button case might be different / unspecified tho |
Note that this is a somewhat recent change tho, and in particular note whatwg/html#10025 which is a proposed tweak to that. |
Aha, indeed, I misdiagnosed what was going on with the So I think that means Firefox's rendering of http://wpt.live/css/css-grid/stretch-grid-item-text-input-overflow.html (and my data URI in my previous comment) is correct, because the computed value of And it looks like we're roughly in agreement on http://wpt.live/css/css-grid/stretch-grid-item-button-overflow.html, if we disregard the column of |
I filed bug 1873301 to track the behavioral difference for button scrollability, and I filed bug 1873300 on fixing the WPT to not depend on either of the possible behaviors. |
…ching checks. The spec says scroll container, so overflow: visible and clip shouldn't be different. Note that the spec here is pending some edits from w3c/csswg-drafts#7714 tho. Differential Revision: https://phabricator.services.mozilla.com/D197052 bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1871412 gecko-commit: 0e434686366011fb0a899029d1ebd99e388d53bb gecko-reviewers: dholbert
…pec. This is a prerequisite to fix https://issues.chromium.org/issues/40877677 and related issues because otherwise overflow: clip stops applying min-size: auto. CSSWG Resolution at: w3c/csswg-drafts#7714 Blink was doing the right thing only for flex, and only on replaced elements for some reason. Bug: 40877677 Change-Id: I49f57b725ae7feb18250f1e40b3856ec2231bfb1
…pec. This is a prerequisite to fix issue 40877677 and related issues because otherwise overflow: clip stops applying min-size: auto. Both the grid and flex specs mention "scroll container" already, which means that visible and clip should behave the same: * https://drafts.csswg.org/css-grid/#min-size-auto * https://drafts.csswg.org/css-flexbox/#min-size-auto There's technically a difference between "is scroll container" (what the spec says) and "overflow is not clip or visible", but the CSSWG already resolved on just looking at the overflow value in: w3c/csswg-drafts#7714 Blink was doing the right thing for flex only on replaced elements for some reason. For grid, most stuff works already due to it using ComputedStyle::IsScrollContainer, but there was one case missing, which I added a test for. Bug: 40877677 Change-Id: I49f57b725ae7feb18250f1e40b3856ec2231bfb1
…pec. This is a prerequisite to fix issue 40877677 and related issues because otherwise overflow: clip stops applying min-size: auto. Both the grid and flex specs mention "scroll container" already, which means that visible and clip should behave the same: * https://drafts.csswg.org/css-grid/#min-size-auto * https://drafts.csswg.org/css-flexbox/#min-size-auto There's technically a difference between "is scroll container" (what the spec says) and "overflow is not clip or visible", but the CSSWG already resolved on just looking at the overflow value in: w3c/csswg-drafts#7714 Blink was doing the right thing for flex only on replaced elements for some reason. For grid, most stuff works already due to it using ComputedStyle::IsScrollContainer, but there was one case missing, which I added a test for. Bug: 40877677 Change-Id: I49f57b725ae7feb18250f1e40b3856ec2231bfb1
…pec. This is a prerequisite to fix issue 40877677 and related issues because otherwise overflow: clip stops applying min-size: auto. Both the grid and flex specs mention "scroll container" already, which means that visible and clip should behave the same: * https://drafts.csswg.org/css-grid/#min-size-auto * https://drafts.csswg.org/css-flexbox/#min-size-auto There's technically a difference between "is scroll container" (what the spec says) and "overflow is not clip or visible", but the CSSWG already resolved on just looking at the overflow value in: w3c/csswg-drafts#7714 Blink was doing the right thing for flex only on replaced elements for some reason. For grid, most stuff works already due to it using ComputedStyle::IsScrollContainer, but there was one case missing, which I added a test for. Bug: 40877677 Change-Id: I49f57b725ae7feb18250f1e40b3856ec2231bfb1
…pec. This is a prerequisite to fix issue 40877677 and related issues because otherwise overflow: clip stops applying min-size: auto. Both the grid and flex specs mention "scroll container" already, which means that visible and clip should behave the same: * https://drafts.csswg.org/css-grid/#min-size-auto * https://drafts.csswg.org/css-flexbox/#min-size-auto There's technically a difference between "is scroll container" (what the spec says) and "overflow is not clip or visible", but the CSSWG already resolved on just looking at the overflow value in: w3c/csswg-drafts#7714 Blink was doing the right thing for flex only on replaced elements for some reason. For grid, most stuff works already due to it using ComputedStyle::IsScrollContainer, but there was one case missing, which I added a test for. Bug: 40877677 Change-Id: I49f57b725ae7feb18250f1e40b3856ec2231bfb1 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5505559 Reviewed-by: John PalmerReviewed-by: John Palmer Reviewed-by: Morten Stenshorne Auto-Submit: Emilio Cobos Álvarez Commit-Queue: Ian Kilpatrick Reviewed-by: Ian Kilpatrick Cr-Commit-Position: refs/heads/main@{#1295163}
…pec. This is a prerequisite to fix issue 40877677 and related issues because otherwise overflow: clip stops applying min-size: auto. Both the grid and flex specs mention "scroll container" already, which means that visible and clip should behave the same: * https://drafts.csswg.org/css-grid/#min-size-auto * https://drafts.csswg.org/css-flexbox/#min-size-auto There's technically a difference between "is scroll container" (what the spec says) and "overflow is not clip or visible", but the CSSWG already resolved on just looking at the overflow value in: w3c/csswg-drafts#7714 Blink was doing the right thing for flex only on replaced elements for some reason. For grid, most stuff works already due to it using ComputedStyle::IsScrollContainer, but there was one case missing, which I added a test for. Bug: 40877677 Change-Id: I49f57b725ae7feb18250f1e40b3856ec2231bfb1 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5505559 Reviewed-by: John PalmerReviewed-by: John Palmer Reviewed-by: Morten Stenshorne Auto-Submit: Emilio Cobos Álvarez Commit-Queue: Ian Kilpatrick Reviewed-by: Ian Kilpatrick Cr-Commit-Position: refs/heads/main@{#1295163}
…and grid items to match the spec., a=testonly Automatic update from web-platform-tests Fix automatic min size handling of flex and grid items to match the spec. This is a prerequisite to fix issue 40877677 and related issues because otherwise overflow: clip stops applying min-size: auto. Both the grid and flex specs mention "scroll container" already, which means that visible and clip should behave the same: * https://drafts.csswg.org/css-grid/#min-size-auto * https://drafts.csswg.org/css-flexbox/#min-size-auto There's technically a difference between "is scroll container" (what the spec says) and "overflow is not clip or visible", but the CSSWG already resolved on just looking at the overflow value in: w3c/csswg-drafts#7714 Blink was doing the right thing for flex only on replaced elements for some reason. For grid, most stuff works already due to it using ComputedStyle::IsScrollContainer, but there was one case missing, which I added a test for. Bug: 40877677 Change-Id: I49f57b725ae7feb18250f1e40b3856ec2231bfb1 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5505559 Reviewed-by: John PalmerReviewed-by: John Palmer Reviewed-by: Morten Stenshorne Auto-Submit: Emilio Cobos Álvarez Commit-Queue: Ian Kilpatrick Reviewed-by: Ian Kilpatrick Cr-Commit-Position: refs/heads/main@{#1295163} -- wpt-commits: fc9991bceed83699c5839775d403ca8bcf7e94b7 wpt-pr: 46009
…and grid items to match the spec., a=testonly Automatic update from web-platform-tests Fix automatic min size handling of flex and grid items to match the spec. This is a prerequisite to fix issue 40877677 and related issues because otherwise overflow: clip stops applying min-size: auto. Both the grid and flex specs mention "scroll container" already, which means that visible and clip should behave the same: * https://drafts.csswg.org/css-grid/#min-size-auto * https://drafts.csswg.org/css-flexbox/#min-size-auto There's technically a difference between "is scroll container" (what the spec says) and "overflow is not clip or visible", but the CSSWG already resolved on just looking at the overflow value in: w3c/csswg-drafts#7714 Blink was doing the right thing for flex only on replaced elements for some reason. For grid, most stuff works already due to it using ComputedStyle::IsScrollContainer, but there was one case missing, which I added a test for. Bug: 40877677 Change-Id: I49f57b725ae7feb18250f1e40b3856ec2231bfb1 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5505559 Reviewed-by: John PalmerReviewed-by: John Palmer Reviewed-by: Morten Stenshorne Auto-Submit: Emilio Cobos Álvarez Commit-Queue: Ian Kilpatrick Reviewed-by: Ian Kilpatrick Cr-Commit-Position: refs/heads/main@{#1295163} -- wpt-commits: fc9991bceed83699c5839775d403ca8bcf7e94b7 wpt-pr: 46009
This issue is related to the change in #7144 which included a change to add
overflow: clip
to svg elements in UA stylesheet. This causes a compat issue with the following test case:SVG has a min-width/min-height value of auto via default value for these properties. Before the resolution in #7144, SVG also had
overflow: hidden
applied to it via UA stylesheet.During flex layout, the minimum width computed for this SVG element with these inputs was 0. Theoretically this aligns with the spec based on the text here: "the used value of a main axis automatic minimum size on a flex item that is not a scroll container is its content-based minimum size". overflow: hidden causes the element to be a scroll container. But it's specifically not the case for SVG and neither of Chrome/Firefox/Safari make the element scrollable. The relevant spec text is here.
With the change in #7144, the SVG element now gets a value of 'clip' for 'overflow'. This value lines up with how 'hidden' is used on these elements in each browser above. But a side-effect of this is that min-width/min-height:auto now uses the content-based-minimum-size on this element which is incompatible with existing behaviour. The options to fix this are:
Leaning towards 2) since 'overflow: visible' is likely to be a common use by developers for SVG. SVG has respected overflow:visible to not clip content before #7144.
@bfgeek FYI.
The text was updated successfully, but these errors were encountered: