-
Notifications
You must be signed in to change notification settings - Fork 707
[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. R=ikilpatrick@chromium.org 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. R=ikilpatrick@chromium.org 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 discussion<heycam> Topic: overflow clip on SVG elements and flex layout<heycam> github: https://github.com//issues/7714 <heycam> khush: this concerns how the min width / min-height auto is computed for a flex child <heycam> ... spec says that if an element is a scroll container, the min-width/height will be 0 <heycam> ... but if not a scroll container, then it's content based min size <heycam> ... the two cases where it's not a scroll container, is if overflow is clip/hidden <heycam> ... previous change made replaced elements [...] <heycam> ... SVG has for a long time had `overflow: hidden` in the UA style sheet <heycam> ... now we're setting overflow:clip, it causes this layout behavior <heycam> ... before, min-width/height would be 0 <heycam> ... but now it's computing to the content based min size <heycam> Ian: we got many bugs <heycam> khush: fun part is that was accidentally rolled out to stable channel <heycam> ... have to keep this behavior for compat <heycam> ... options are to first add min-width/height:0 to the UA style sheet, which when combined with overlfow:clip gives you the preivous behavior <heycam> ... but now we have different compat problems <heycam> ... second option is to special case it <heycam> ... either in the layout computation spot. clip behaves this way except for SVG <heycam> ... other option is that we don't set the overflow:clip in the UA style sheet only for SVG, and at layout time the previous behavior continues to apply, but at paint time we use it as if it's clip <heycam> ... it'd have to be a used value time thing <emilio> q+ <heycam> ... used value would be different in paint time <heycam> fantasai: maybe should've gone over #7144 first <heycam> dholbert: I'm fond of the third option, keeping overflow:hidden SVG. is there a reason we need to change SVG? <heycam> Ian: mainly for consistency <heycam> ... we didn't perceive the compat risk <fantasai> +1 to keeping overflow:hidden on svg <heycam> ... only weird quirk is that at layout time, when we're looking at overflow, pretend overflow means clip at paint time <heycam> ... at paint time <heycam> s/layout time/paint time/ <heycam> dholbert: where is that used value magic? already exists? <heycam> ... seems orthogonal to this <heycam> fantasai: maybe we should switch to 7144 <Rossen_> ack emilio <heycam> emilio: I have a question. overflow:clip by default on SVG, it changes the sizing behavior <heycam> Ian: so min-content sizes <heycam> ... auto min size will be 0 <heycam> emilio: if I load the test case in the first comment, and set overflow:clip/hidden, I don't see any layout change <heycam> khush: flex layout was implemented first, so where it's supposed to check is this a scroll container or not, it looks at overflow value <heycam> ... assumes it's not a scroll container only if overlfow:visible, but we are also now checking for clip <heycam> ... this is a change in the process of landing <heycam> emilio: right now SVG is not a scroll container <heycam> Ian: but it does have overflow:hidden <heycam> emilio: right now that decision is based on scrollable overflow <heycam> Ian: computed overflow property value <heycam> emilio: and you are changing that? <heycam> ... but you want SVG to keep behaving the same way? <heycam> Ian: the flexbox auto min size thing likely needs to say look at the computed value of overflow, rather than "scroll container" <heycam> ... could make that narrower <heycam> ... it becomes a used value, after layout thing <heycam> emilio: I'm still confused <heycam> ... I see a different if I set overflow:visible on the SVG, but not if I set overflow:clip <heycam> Ian: we currently don't support overflow:clip <heycam> dholbert: in Firefox I see a difference <heycam> Ian: but that's not the compat concern <dholbert> (If I add `overflow:clip` to https://github.com//issues/7714#issue-1366802020 , then the green thing gets wider) <heycam> ... overflow visible/clip should behave the same <heycam> ... but we changed the UA style sheet from hidden to clip, and that broke things <heycam> emilio: maybe not change the UA style sheet? <heycam> ... since it doesn't create a scroll container either <heycam> Ian: at layout time you use the computed value of overflow, like we do right now <heycam> ... to determine if we apply the auto min size <heycam> ... and at paint time, we convert this to a used value of overflow:cip <heycam> emilio: but that's basically what happens now? <heycam> Ian: differences are overflow clip margin will start to apply <heycam> khush: in terms of the changes in the UA sheet, we can skip setting overflow:clip, but we still need the overflow clip margin box for it to work with these elements <heycam> khush: overflow-clip: margin-box <heycam> ... so we'll skip setting overflow:clip, leave it as hidden <heycam> emilio: proposed solution only changes the UA sheet? <heycam> emilio: do we need to add magic to make overflow:hidden to behave like overflow:clip for SVG, rather than letting authors do it? <heycam> Ian: we had a resolution that overflow:hidden would behave as overflow:clip <heycam> ... it basically behaves like that anyway <heycam> ... this is harmonizing <heycam> emilio: bit unfortunatey <heycam> s/unfortunatey/unfortunate/ <heycam> Ian: the coercion would apply to all the replaced elements, not just SVG <heycam> ... if they're overflow:hidden <heycam> emilio: as long as you're a replaced element <heycam> ... you don't get weird cases where there's only clip on one axis <heycam> ... as long as this is well tested <heycam> khush: I promise! <heycam> dholbert: the thing where you check the computed value for flex layout purposes, I think that already matches what we already do internally, and it's what the spec used to say <heycam> ... it results to 0 if overflow is hidden/scroll/auto <heycam> ... but the spec now says scroll container <heycam> ... so we might want to consider reverting that, and explicitly defer to computed overflow value <heycam> Ian: I think I'd prefer that <heycam> ... in summary, part 1: in the UA style sheet, we keep `svg { overflow: hidden; }`. part 2: in the flex spec, for auto min sizing, instead of saying scroll container, we read the computed overflow property value <heycam> ... part 3: which may already be specced, is overflow:hidden on replaced elements gets coerced to overflow:clip at paint time <heycam> dholbert: you can't do scrollTop on an <img> <heycam> khush: part 3 was resolved in #7144 <fantasai> +1 <heycam> khush: one other thing, for SVG, we're still keeping overflow-clip-margin in the UA sheet <heycam> RESOLVED: in the UA style sheet, we keep `svg { overflow: hidden; }` <heycam> RESOLVED: in the flex spec, for auto min sizing, instead of saying scroll container, we read the computed overflow property value <heycam> RESOLVED: overflow:hidden on replaced elements gets coerced to overflow:clip at paint time <heycam> <br dur="13m"> See 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. R=ikilpatrick@chromium.org 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. R=ikilpatrick@chromium.org 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. R=ikilpatrick@chromium.org 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. R=ikilpatrick@chromium.org Bug: 1358820 Change-Id: I79fb2e334ca72807ca6e3b12d85c1f8a33a9f086 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3884796 Auto-Submit: Khushal Sagar <khushalsagar@chromium.org> Reviewed-by: Ian Kilpatrick <ikilpatrick@chromium.org> Commit-Queue: Khushal Sagar <khushalsagar@chromium.org> Commit-Queue: Ian Kilpatrick <ikilpatrick@chromium.org> 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. R=ikilpatrick@chromium.org Bug: 1358820 Change-Id: I79fb2e334ca72807ca6e3b12d85c1f8a33a9f086 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3884796 Auto-Submit: Khushal Sagar <khushalsagar@chromium.org> Reviewed-by: Ian Kilpatrick <ikilpatrick@chromium.org> Commit-Queue: Khushal Sagar <khushalsagar@chromium.org> Commit-Queue: Ian Kilpatrick <ikilpatrick@chromium.org> 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. R=ikilpatrick@chromium.org Bug: 1358820 Change-Id: I79fb2e334ca72807ca6e3b12d85c1f8a33a9f086 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3884796 Auto-Submit: Khushal Sagar <khushalsagar@chromium.org> Reviewed-by: Ian Kilpatrick <ikilpatrick@chromium.org> Commit-Queue: Khushal Sagar <khushalsagar@chromium.org> Commit-Queue: Ian Kilpatrick <ikilpatrick@chromium.org> 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. R=ikilpatrick@chromium.org Bug: 1358820 Change-Id: I79fb2e334ca72807ca6e3b12d85c1f8a33a9f086 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3884796 Auto-Submit: Khushal Sagar <khushalsagar@chromium.org> Reviewed-by: Ian Kilpatrick <ikilpatrick@chromium.org> Commit-Queue: Khushal Sagar <khushalsagar@chromium.org> Commit-Queue: Ian Kilpatrick <ikilpatrick@chromium.org> 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. R=ikilpatrick@chromium.org Bug: 1358820 Change-Id: I79fb2e334ca72807ca6e3b12d85c1f8a33a9f086 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3884796 Auto-Submit: Khushal Sagar <khushalsagar@chromium.org> Reviewed-by: Ian Kilpatrick <ikilpatrick@chromium.org> Commit-Queue: Khushal Sagar <khushalsagar@chromium.org> Commit-Queue: Ian Kilpatrick <ikilpatrick@chromium.org> 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 Palmer <jopalmer@google.com> Reviewed-by: John Palmer <jopalmer@chromium.org> Reviewed-by: Morten Stenshorne <mstensho@chromium.org> Auto-Submit: Emilio Cobos Álvarez <emilio@chromium.org> Commit-Queue: Ian Kilpatrick <ikilpatrick@chromium.org> Reviewed-by: Ian Kilpatrick <ikilpatrick@chromium.org> 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 Palmer <jopalmer@google.com> Reviewed-by: John Palmer <jopalmer@chromium.org> Reviewed-by: Morten Stenshorne <mstensho@chromium.org> Auto-Submit: Emilio Cobos Álvarez <emilio@chromium.org> Commit-Queue: Ian Kilpatrick <ikilpatrick@chromium.org> Reviewed-by: Ian Kilpatrick <ikilpatrick@chromium.org> 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 Palmer <jopalmer@google.com> Reviewed-by: John Palmer <jopalmer@chromium.org> Reviewed-by: Morten Stenshorne <mstensho@chromium.org> Auto-Submit: Emilio Cobos Álvarez <emilio@chromium.org> Commit-Queue: Ian Kilpatrick <ikilpatrick@chromium.org> Reviewed-by: Ian Kilpatrick <ikilpatrick@chromium.org> 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 Palmer <jopalmer@google.com> Reviewed-by: John Palmer <jopalmer@chromium.org> Reviewed-by: Morten Stenshorne <mstensho@chromium.org> Auto-Submit: Emilio Cobos Álvarez <emilio@chromium.org> Commit-Queue: Ian Kilpatrick <ikilpatrick@chromium.org> Reviewed-by: Ian Kilpatrick <ikilpatrick@chromium.org> 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: