You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[css-sizing-4] min/max size transfers across aspect-ratio #6071
Sizing constraints in either axis (the origin axis) are transferred through the preferred aspect ratio to the other axis (the destination axis) as follows:
First, any definite minimum size is converted and transferred from the origin to destination axis. This transferred minimum is capped by any definite preferred or maximum size in the destination axis.
Then, any definite maximum size is converted and transferred from the origin to destination. This transferred maximum is floored by any definite preferred or minimum size in the destination axis as well as by the transferred minimum, if any.
I think these should be defined as only impacting automatic or content-based sizes, rather than being defined as being an independent constraint clamped by the preferred size, because e.g. Flexbox makes a distinction between a size constraint applied to the "minimum size" vs a size constraint applied to the "preferred size" and it's otherwise not clear how this independent constraint would apply.
Key point: a flex item that has min-width: 0 has no minimum for flex shrinkage. Any constraints transferred through the aspect ratio have an effect on the minimum size only if they are applied via min-width: auto or min-width: min-content etc. They can still affect the flex base size also, if that is an automatic or content-based size, but they're not an independent minimum in the same way that min-width is.
So after discussing with fantasai, the css-sizing-4 transferred min/max size text should not apply in flexbox/grid. Instead, only the sizing inside those specs should apply. For flex:
Minimum sizes already applied per spec as part of content size suggestion in min-size: auto; should not apply for an explicit min size for compat with replaced elements
Capturing some thoughts from discussing with @fantasai and @bfgeek today:
auto preferred sizes defers to transferred constraints (min/max)
transferred constraints defer to explicit (non-auto) in-axis preferred sizes and constraints
in-axis automatic minimum defers to in-axis constraints only (ignores transferred constraints)
Some examples, all with aspect-ratio: 1/1:
max-height: 100px; width: auto; clamps the width to 100px (transferred constraint)
max-height: 100px; max-width: 200px; clamps the width to 100px (transferred constraint; you get two maxes, so the smaller one effectively applies)
max-height: 100px; width: 200px; the width is 200px (explicit width wins over transferred constraint)
max-height: 100px; min-width: 200px; the width is 200px (transferred max-height is floored by the explicit min-width, effectively becoming a max-width:200px)
max-height: 100px; min-width: auto; uses the auto minimum; the 100px doesn't clamp it.
This issue seems quite focused on flexbox but browsers don't agree in this basic non-flexbox testcase and I'm not sure who is right. I think #6071 (comment) means that it's WebKit who is right?
Activity
fantasai commentedon Mar 17, 2021
We need to go through https://drafts.csswg.org/css-flexbox/#min-size-auto and make sure that the new text is consistent with that; replaced elements at least should not have new behavior because of the new css-sizing-4 text.
fantasai commentedon Mar 17, 2021
Key point: a flex item that has
min-width: 0has no minimum for flex shrinkage. Any constraints transferred through the aspect ratio have an effect on the minimum size only if they are applied viamin-width: autoormin-width: min-contentetc. They can still affect the flex base size also, if that is an automatic or content-based size, but they're not an independent minimum in the same way thatmin-widthis.So the css-sizing-4 text is wrong here.
cbiesinger commentedon Mar 17, 2021
So after discussing with fantasai, the css-sizing-4 transferred min/max size text should not apply in flexbox/grid. Instead, only the sizing inside those specs should apply. For flex:
Revert "[AspectRatio] Fix flex-aspect-ratio-026.html in legacy"
Revert "[AspectRatio] Fix flex-aspect-ratio-026.html in legacy"
Revert "[AspectRatio] Fix flex-aspect-ratio-026.html in legacy"
Revert "[AspectRatio] Fix flex-aspect-ratio-026.html in legacy"
Revert r859812 and r860306
bfgeek commentedon Mar 25, 2021
What happens with grid minimum sizes here? E.g:
[css-sizing-4] Fix aspect-ratio min/max transfer rules to not violate…
Revert r859812 and r860306
Revert r859812 and r860306
Revert r859812 and r860306
Bug 1699663 [wpt PR 28149] - Revert r859812 and r860306, a=testonly
9 remaining items
tabatkins commentedon Jul 22, 2024
Capturing some thoughts from discussing with @fantasai and @bfgeek today:
Some examples, all with
aspect-ratio: 1/1:max-height: 100px; width: auto;clamps the width to 100px (transferred constraint)max-height: 100px; max-width: 200px;clamps the width to 100px (transferred constraint; you get two maxes, so the smaller one effectively applies)max-height: 100px; width: 200px;the width is 200px (explicit width wins over transferred constraint)max-height: 100px; min-width: 200px;the width is 200px (transferred max-height is floored by the explicit min-width, effectively becoming amax-width:200px)max-height: 100px; min-width: auto;uses the auto minimum; the 100px doesn't clamp it.bfgeek commentedon Jul 23, 2024
@tabatkins For the
width: autothere needs to be a distinction betweenwidth: auto; justify-self: initialandwidth: auto; justify-self: stretch.E.g.
width: auto; justify-self: stretchshould behave the same aswidth: stretch(a more explicit constraint than the transferred constraint).[layout] Fix two aspect-ratio tests.
[layout] Fix two aspect-ratio tests.
[layout] Fix two aspect-ratio tests.
[layout] Fix two aspect-ratio tests.
[layout] Fix two aspect-ratio tests.
bfgeek commentedon Aug 15, 2024
Given:
The tests:
Are incorrect I believe. Basically a transferred constraint is clamping the min-intrinsic size in these two test cases.
Bug 1912834 [wpt PR 47578] - [layout] Fix two aspect-ratio tests., a=…
Bug 1912834 [wpt PR 47578] - [layout] Fix two aspect-ratio tests., a=…
Bug 1912834 [wpt PR 47578] - [layout] Fix two aspect-ratio tests., a=…
Loirooriol commentedon Oct 25, 2024
This issue seems quite focused on flexbox but browsers don't agree in this basic non-flexbox testcase and I'm not sure who is right. I think #6071 (comment) means that it's WebKit who is right?
Details
Edit: changed Servo to align with WebKit, WPT: https://wpt.fyi/results/css/css-sizing/aspect-ratio/replaced-element-043.html
Bug 1699663 [wpt PR 28149] - Revert r859812 and r860306, a=testonly
Bug 1912834 [wpt PR 47578] - [layout] Fix two aspect-ratio tests., a=…