-
Notifications
You must be signed in to change notification settings - Fork 717
[css-sizing][css-flexbox] It's false that stretch
size behaves as stretch
alignment
#11784
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
BTW, same for a column flexbox: <!DOCTYPE html>
<style>
.container { display: flex; flex-direction: column; width: 100px; height: 100px; border: solid; flex-wrap: wrap; align-content: start }
.stretch { width: -moz-available; width: -webkit-fill-available; width: stretch }
</style>
<div class="container">
<div class="stretch" style="height: 75px; border: solid cyan">a</div>
<div class="stretch" style="height: 75px; border: solid magenta">b</div>
</div>
<div class="container">
<div class="stretch" style="height: 75px; border: solid cyan">a</div>
<div style="border: solid orange; width: 150px"></div>
<div class="stretch" style="height: 75px; border: solid magenta">b</div>
</div>
<div class="container">
<div style="height: 75px; border: solid cyan;">a</div>
<div style="height: 75px; border: solid magenta">b</div>
</div>
<div class="container">
<div style="height: 75px; border: solid cyan;">a</div>
<div style="border: solid orange; width: 150px"></div>
<div style="height: 75px; border: solid magenta">b</div>
</div> With |
height: stretch
behaves as stretch
alignmentheight: stretch
behaves as stretch
alignment
Maybe I could have merged this into #11293. But this one is more about flexbox, that one about abspos. |
I chatted with @bfgeek about this today. Currently our behavior for flex items is to treat width/height:stretch as equivalent to width/height:100%, rather than equivalent to stretch alignment. This equivalency is correct in most other places, but differs here, as you point out. However, the equivalency is also broken in abspos, where %s resolve against the original CB size but stretch alignment (and So, I'm inclined to say we should try and follow the spec's text. It's consistent with the behavior in all other locations, afaik, and presents a more useful behavior for this case. It does mean widening the delta between However, if it turns out this is an issue, I'm okay with resolving to match the 100% behavior in this case instead. |
Note that making a stretch size match stretch alignment presumably means that
False, see #11293 |
height: stretch
behaves as stretch
alignmentstretch
size behaves as stretch
alignment
Heads up @dholbert , this issue is talking about changing WDYT? |
Thanks for the heads-up! No concerns from me on changing that testcase's expectations. When I wrote that test, I don't think I was aware of the linked spec text (the text that gives |
So while experimenting with implementing this we've come to the conclusion that its not true that Specifically the difference comes from:
https://drafts.csswg.org/css-flexbox-1/#algo-cross-item For example:
https://www.software.hixie.ch/utilities/js/live-dom-viewer/?saved=13715 When determining the line-cross-size of a wrapping flexbox (typically of a column flexbox) the given available-size is always the container available size. In this stage Then when determining the final used cross size (the final layout of the flex-item)
https://drafts.csswg.org/css-flexbox-1/#algo-stretch
IMO I think this behaviour difference is fine/expected. I don't think we want to magically coerce (Also note that passing an indefinite available size doesn't work as that'll make the width I think that then the part of the sizing spec:
https://drafts.csswg.org/css-sizing-4/#stretch-fit-sizing ... is mostly true, but incorrect when it comes to flexbox for the above reason. (There are larger implications for any behaviour change away from this when we have things like |
In recent chrome canary we changed stretch to behave closer to Our deviation from the current spec (and, as a corollary, our spec-change proposal) can be summed up as
Whereas the current spec arguably* requires
Revisiting Oriol's example in #11784 (comment): (live): <!DOCTYPE html>
<style>
.container { display: flex; flex-direction: column; width: 100px; height: 100px; border: solid; flex-wrap: wrap; align-content: start }
.stretch { width: -moz-available; width: -webkit-fill-available; width: stretch }
</style>
<div class="container">
<div class="stretch" style="height: 75px; border: solid cyan">a</div>
<div class="stretch" style="height: 75px; border: solid magenta">b</div>
</div>
<div class="container">
<div class="stretch" style="height: 75px; border: solid cyan">a</div>
<div style="border: solid orange; width: 150px"></div>
<div class="stretch" style="height: 75px; border: solid magenta">b</div>
</div>
<div class="container">
<div style="height: 75px; border: solid cyan;">a</div>
<div style="height: 75px; border: solid magenta">b</div>
</div>
<div class="container">
<div style="height: 75px; border: solid cyan;">a</div>
<div style="border: solid orange; width: 150px"></div>
<div style="height: 75px; border: solid magenta">b</div>
</div> Blink's old behavior: In some of these flex items, the author asked to stretch, and the current spec arguably* says to match @dholbert @Loirooriol WDYT? Do you prefer Blink's "new" behavior, or the "spec" behavior? PS: On mentions of arguably*: I say arguably, because there's actually an interpretation of the spec that dictates our proposed behavior already. Namely, emphasis added,
When we are calculating the the flex-line cross-size, align-self doesn't apply! So we follow the 'Otherwise' 100% behavior. When we do so, the line ends up being the same width as the container, which has the same effect of stretching to the container in the end. |
@dholbert @Loirooriol We're looking to solidify Do either of you have a preference or concerns with the "new" behavior described? Your insights are always helpful! |
@davidsgrogan Hi! Sorry for delayed response. I think your proposed change (the "new behavior") makes sense; and I agree with the case you make in your footnote that it arguably already is what the spec is already asking for. |
I don't have a strong opinion, I'm also fine with the original browser behavior. I will give a try to implement one of the new behaviors in Servo in case it adds some unwanted complexity. |
This is the behavior described in w3c/csswg-drafts#11784 (comment) and the following comment. Change-Id: Ie3fd71de25a3e35d73d52be7152bab3ba8823320
This is the behavior described in w3c/csswg-drafts#11784 (comment) and the following comment. Change-Id: Ie3fd71de25a3e35d73d52be7152bab3ba8823320 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6569793 Reviewed-by: Ian Kilpatrick <ikilpatrick@chromium.org> Commit-Queue: David Grogan <dgrogan@chromium.org> Cr-Commit-Position: refs/heads/main@{#1463062}
This is the behavior described in w3c/csswg-drafts#11784 (comment) and the following comment. Change-Id: Ie3fd71de25a3e35d73d52be7152bab3ba8823320 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6569793 Reviewed-by: Ian Kilpatrick <ikilpatrick@chromium.org> Commit-Queue: David Grogan <dgrogan@chromium.org> Cr-Commit-Position: refs/heads/main@{#1463062}
This is the behavior described in w3c/csswg-drafts#11784 (comment) and the following comment. Change-Id: Ie3fd71de25a3e35d73d52be7152bab3ba8823320 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6569793 Reviewed-by: Ian Kilpatrick <ikilpatrick@chromium.org> Commit-Queue: David Grogan <dgrogan@chromium.org> Cr-Commit-Position: refs/heads/main@{#1463062}
…ew indefinite behavior, Automatic update from web-platform-tests [flex] Update stretch tests to reflect new indefinite behavior This is the behavior described in w3c/csswg-drafts#11784 (comment) and the following comment. Change-Id: Ie3fd71de25a3e35d73d52be7152bab3ba8823320 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6569793 Reviewed-by: Ian Kilpatrick <ikilpatrick@chromium.org> Commit-Queue: David Grogan <dgrogan@chromium.org> Cr-Commit-Position: refs/heads/main@{#1463062} -- wpt-commits: 4a9adb8c2eb1801445c7b281311447f22ec432c7 wpt-pr: 52674 Differential Revision: https://phabricator.services.mozilla.com/D250955
…ew indefinite behavior, Automatic update from web-platform-tests [flex] Update stretch tests to reflect new indefinite behavior This is the behavior described in w3c/csswg-drafts#11784 (comment) and the following comment. Change-Id: Ie3fd71de25a3e35d73d52be7152bab3ba8823320 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6569793 Reviewed-by: Ian Kilpatrick <ikilpatrick@chromium.org> Commit-Queue: David Grogan <dgrogan@chromium.org> Cr-Commit-Position: refs/heads/main@{#1463062} -- wpt-commits: 4a9adb8c2eb1801445c7b281311447f22ec432c7 wpt-pr: 52674 Differential Revision: https://phabricator.services.mozilla.com/D250955
…ew indefinite behavior, Automatic update from web-platform-tests [flex] Update stretch tests to reflect new indefinite behavior This is the behavior described in w3c/csswg-drafts#11784 (comment) and the following comment. Change-Id: Ie3fd71de25a3e35d73d52be7152bab3ba8823320 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6569793 Reviewed-by: Ian Kilpatrick <ikilpatrick@chromium.org> Commit-Queue: David Grogan <dgrogan@chromium.org> Cr-Commit-Position: refs/heads/main@{#1463062} -- wpt-commits: 4a9adb8c2eb1801445c7b281311447f22ec432c7 wpt-pr: 52674 Differential Revision: https://phabricator.services.mozilla.com/D250955
…ew indefinite behavior, Automatic update from web-platform-tests [flex] Update stretch tests to reflect new indefinite behavior This is the behavior described in w3c/csswg-drafts#11784 (comment) and the following comment. Change-Id: Ie3fd71de25a3e35d73d52be7152bab3ba8823320 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6569793 Reviewed-by: Ian Kilpatrick <ikilpatrickchromium.org> Commit-Queue: David Grogan <dgroganchromium.org> Cr-Commit-Position: refs/heads/main{#1463062} -- wpt-commits: 4a9adb8c2eb1801445c7b281311447f22ec432c7 wpt-pr: 52674 Differential Revision: https://phabricator.services.mozilla.com/D250955 UltraBlame original commit: 2443ea23af2704db221a0c693ab93b36f4fdf479
…ew indefinite behavior, Automatic update from web-platform-tests [flex] Update stretch tests to reflect new indefinite behavior This is the behavior described in w3c/csswg-drafts#11784 (comment) and the following comment. Change-Id: Ie3fd71de25a3e35d73d52be7152bab3ba8823320 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6569793 Reviewed-by: Ian Kilpatrick <ikilpatrickchromium.org> Commit-Queue: David Grogan <dgroganchromium.org> Cr-Commit-Position: refs/heads/main{#1463062} -- wpt-commits: 4a9adb8c2eb1801445c7b281311447f22ec432c7 wpt-pr: 52674 Differential Revision: https://phabricator.services.mozilla.com/D250955 UltraBlame original commit: 2443ea23af2704db221a0c693ab93b36f4fdf479
…ew indefinite behavior, Automatic update from web-platform-tests [flex] Update stretch tests to reflect new indefinite behavior This is the behavior described in w3c/csswg-drafts#11784 (comment) and the following comment. Change-Id: Ie3fd71de25a3e35d73d52be7152bab3ba8823320 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6569793 Reviewed-by: Ian Kilpatrick <ikilpatrickchromium.org> Commit-Queue: David Grogan <dgroganchromium.org> Cr-Commit-Position: refs/heads/main{#1463062} -- wpt-commits: 4a9adb8c2eb1801445c7b281311447f22ec432c7 wpt-pr: 52674 Differential Revision: https://phabricator.services.mozilla.com/D250955 UltraBlame original commit: 2443ea23af2704db221a0c693ab93b36f4fdf479
Uh oh!
There was an error while loading. Please reload this page.
https://drafts.csswg.org/css-sizing-4/#stretch-fit-sizing
We have interoperability against this:
Gecko, Blink and WebKit agree:
height: stretch
stretches against the containing block, whilealign-self: stretch
doesn't stretch.height: stretch
keeps stretching against the containing block, whilealign-self: stretch
stretches against the line.If the flex container doesn't have a definite height (remove
height: 100px
):Gecko and Blink don't stretch
height: stretch
, neither when computing line sizes nor once we know their size.align-self
stretches in the latter one:WebKit does that thing of stretching all ancestors with indefinite size, in this case filling the window:
The text was updated successfully, but these errors were encountered: