-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
… element. If the flex item is a non-replaced element and its min-width/min-height is 'auto', the spec has changed so that it has no transferred size suggestion now. https://drafts.csswg.org/css-flexbox-1/#min-size-auto This patch also updates WPT tests to fix #27878 Differential Revision: https://phabricator.services.mozilla.com/D112830 bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1703304 gecko-commit: fb14e6d29a44a79efc296cc727f92aa58ea4dacc gecko-reviewers: dholbert
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,15 +2,16 @@ | |
<title>CSS aspect-ratio: Row flexbox min-width</title> | ||
<link rel="author" title="Google LLC" href="https://www.google.com/"> | ||
<link rel="help" href="https://drafts.csswg.org/css-sizing-4/#aspect-ratio"> | ||
<link rel="help" href="https://drafts.csswg.org/css-sizing-4/#aspect-ratio-minimum"> | ||
<link rel="help" href="https://drafts.csswg.org/css-flexbox/#min-size-auto"> | ||
<link rel="match" href="../../reference/ref-filled-green-100px-square.xht" /> | ||
|
||
<p>Test passes if there is a filled green square and <strong>no red</strong>.</p> | ||
|
||
<div style="display: flex;"> | ||
<!-- transferred size: 100px. content size suggestion: 200px. | ||
min-width: min(100, 200). --> | ||
<div style="background: green; height: 100px; aspect-ratio: 1/1; flex-basis: 0;"> | ||
<div style="width: 200px;"></div> | ||
<!-- No transferred size suggestion since the flex item is non-replaced. | ||
Content size suggestion is 100px. --> | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
aethanyc
Author
Contributor
|
||
<div style="background: green; height: 100px; aspect-ratio: 1/2; flex-basis: 0;"> | ||
<div style="width: 100px;"></div> | ||
</div> | ||
</div> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,8 @@ | |
<link rel="author" title="Ting-Yu Lin" href="mailto:[email protected]"> | ||
<link rel="author" title="Mozilla" href="https://www.mozilla.org/"> | ||
<link rel="help" href="https://drafts.csswg.org/css-sizing-4/#aspect-ratio"> | ||
<link rel="help" href="https://drafts.csswg.org/css-sizing-4/#aspect-ratio-minimum"> | ||
<link rel="help" href="https://drafts.csswg.org/css-flexbox-1/#min-size-auto"> | ||
<link rel="match" href="../../reference/ref-filled-green-200px-square.html" /> | ||
<style> | ||
.flexContainer { | ||
|
@@ -21,54 +23,66 @@ | |
|
||
<p>Test passes if there is a filled green square and <strong>no red</strong>.</p> | ||
|
||
<!-- In all of the subtests here, each flex item's automatic minimum width is | ||
resolved directly from its content size suggestion. Notably, these items | ||
*do not* get a "transferred size suggestion", because they are all | ||
*non-replaced* elements; and "transferred size suggestion" is only used | ||
for resolving automatic minimum sizes on *replaced* elements. However, | ||
note that we do "transfer" sizes through the aspect ratio, as part of | ||
computing the content size suggestion and/or flex base size. --> | ||
|
||
<!-- In the following four flex containers, the aspect-ratio works with border-box. --> | ||
<div class="flexContainer" style="width: auto;"> | ||
<!-- The border-box height 25px is transferred to the main axis, | ||
yielding a resolved flex base size of 200px. --> | ||
yielding a resolved flex base size (border-box) of 200px. --> | ||
<div class="item" style="min-width:0; height: 25px; aspect-ratio: 8/1;"></div> | ||
</div> | ||
|
||
<div class="flexContainer"> | ||
<!-- The border-box height 25px is transferred to the main axis, | ||
yielding a resolved min-width:auto of 200px. --> | ||
<!-- The content size suggestion (border-box) is 200px because the | ||
border-box height 25px is transferred to the main axis. --> | ||
<div class="item" style="height: 25px; aspect-ratio: 8/1;"></div> | ||
</div> | ||
|
||
<div class="flexContainer"> | ||
<!-- The border-box min-height 25px is transferred to the main axis, | ||
yielding a resolved min-width:auto of 200px. --> | ||
<!-- The content size suggestion (border-box) is 200px because the | ||
border-box height 25px (enforced by min-height) is transferred to the | ||
main axis. --> | ||
<div class="item" style="min-height: 25px; aspect-ratio: 8/1;"></div> | ||
</div> | ||
|
||
<div class="flexContainer"> | ||
<!-- The border-box height 25px (clamped by max-height) is transferred to the main axis, | ||
yielding a resolved min-width:auto of 200px. --> | ||
<!-- The content size suggestion (border-box) is 200px because the | ||
border-box height 25px (clamped by max-height) is transferred to the | ||
main axis. --> | ||
<div class="item" style="max-height: 25px; height: 100px; aspect-ratio: 8/1;"></div> | ||
</div> | ||
|
||
<!-- In the following four flex containers, the aspect-ratio works with content-box | ||
because its value contains 'auto'. --> | ||
<div class="flexContainer" style="width: auto;"> | ||
<!-- The content-box height 10px is transferred to the main axis, | ||
yielding a resolved flex base size of 190px. --> | ||
yielding a resolved flex base size (content-box) of 190px. --> | ||
<div class="item" style="min-width:0; height: 25px; aspect-ratio: auto 19/1;"></div> | ||
</div> | ||
|
||
<div class="flexContainer"> | ||
<!-- The content-box height 10px is transferred to the main axis, | ||
yielding a resolved min-width:auto of 190px. --> | ||
<!-- The content size suggestion (content-box) is 190px because the | ||
content-box height 10px is transferred to the main axis. --> | ||
<div class="item" style="height: 25px; aspect-ratio: auto 19/1;"></div> | ||
</div> | ||
|
||
<div class="flexContainer"> | ||
<!-- The content-box min-height 10px is transferred to the main axis, | ||
yielding a resolved min-width:auto of 190px. --> | ||
<!-- The content size suggestion (content-box) is 190px because the | ||
content-box height 10px (enforced by min-height) is transferred to the | ||
main axis. --> | ||
<div class="item" style="min-height: 25px; aspect-ratio: auto 19/1;"></div> | ||
</div> | ||
|
||
<div class="flexContainer"> | ||
<!-- The content-box height 10px (clamped by max-height) is transferred | ||
to the main axis, yielding a resolved min-width:auto of 190px. --> | ||
<!-- The content size suggestion (content-box) is 190px because the | ||
content-box height 10px (clamped by max-height) is transferred to the | ||
main axis. --> | ||
<div class="item" style="max-height: 25px; height: 100px; aspect-ratio: auto 19/1;"></div> | ||
</div> | ||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,8 @@ | |
<link rel="author" title="Ting-Yu Lin" href="mailto:[email protected]"> | ||
<link rel="author" title="Mozilla" href="https://www.mozilla.org/"> | ||
<link rel="help" href="https://drafts.csswg.org/css-sizing-4/#aspect-ratio"> | ||
<link rel="help" href="https://drafts.csswg.org/css-sizing-4/#aspect-ratio-minimum"> | ||
<link rel="help" href="https://drafts.csswg.org/css-flexbox-1/#min-size-auto"> | ||
<link rel="match" href="../../reference/ref-filled-green-200px-square.html" /> | ||
<style> | ||
.flexContainer { | ||
|
@@ -19,60 +21,74 @@ | |
box-sizing: border-box; | ||
} | ||
.item > div { | ||
height: 500px; /* Set a large content size suggestion for flex item. */ | ||
height: 190px; /* Set the content size suggestion for flex item. */ | ||
} | ||
</style> | ||
|
||
<p>Test passes if there is a filled green square and <strong>no red</strong>.</p> | ||
|
||
<!-- In all of the subtests here, each flex item's automatic minimum height is | ||
resolved directly from its content size suggestion. Notably, these items | ||
*do not* get a "transferred size suggestion", because they are all | ||
*non-replaced* elements; and "transferred size suggestion" is only used | ||
for resolving automatic minimum sizes on *replaced* elements. However, | ||
note that we do "transfer" sizes through the aspect ratio, as part of | ||
computing the content size suggestion and/or flex base size. --> | ||
|
||
<!-- In the following four flex containers, the aspect-ratio works with border-box. --> | ||
<div class="flexContainer" style="height: auto;"> | ||
<!-- The border-box width 25px is transferred to the main axis, | ||
yielding a resolved flex base size of 200px. --> | ||
yielding a resolved flex base size (border-box) of 200px. --> | ||
<div class="item" style="min-height:0; width: 25px; aspect-ratio: 1/8;"><div></div></div> | ||
</div> | ||
|
||
<div class="flexContainer"> | ||
<!-- The border-box width 25px is transferred to the main axis, | ||
yielding a resolved min-height:auto of 200px. --> | ||
<div class="item" style="width: 25px; aspect-ratio: 1/8;"><div></div></div> | ||
<!-- The content size suggestion is 190px, i.e. the height of the item's | ||
child div. --> | ||
<div class="item" style="width: 25px; aspect-ratio: 1/1;"><div></div></div> | ||
</div> | ||
|
||
<div class="flexContainer"> | ||
<!-- The border-box min-width 25px is transferred to the main axis, | ||
yielding a resolved min-height:auto of 200px. --> | ||
<div class="item" style="min-width: 25px; aspect-ratio: 1/8;"><div></div></div> | ||
<!-- The content size suggestion is 190px, i.e. the height of the item's | ||
child div. --> | ||
<div class="item" style="min-width: 25px; aspect-ratio: 1/1;"><div></div></div> | ||
</div> | ||
|
||
<div class="flexContainer"> | ||
<!-- The border-box width 25px (clamped by max-width) is transferred to the main axis, | ||
yielding a resolved min-height:auto of 200px. --> | ||
<div class="item" style="max-width: 25px; width: 100px; aspect-ratio: 1/8;"><div></div></div> | ||
<!-- The content size suggestion is 200px because the border-box max-width | ||
25px is transferred to the main axis as the upper bound of its | ||
border-box height. --> | ||
<div class="item" style="max-width: 25px; width: 100px; aspect-ratio: 1/8;"> | ||
<div style="height: 500px"></div> | ||
</div> | ||
</div> | ||
|
||
<!-- In the following four flex containers, the aspect-ratio works with content-box | ||
because its value contains 'auto'. --> | ||
<div class="flexContainer" style="height: auto;"> | ||
<!-- The content-box width 10px is transferred to the main axis, | ||
yielding a resolved flex base size of 190px. --> | ||
yielding a resolved flex base size (content-box) of 190px. --> | ||
<div class="item" style="min-height:0; width: 25px; aspect-ratio: auto 1/19;"><div></div></div> | ||
</div> | ||
|
||
<div class="flexContainer"> | ||
<!-- The content-box width 10px is transferred to the main axis, | ||
yielding a resolved min-height:auto of 190px. --> | ||
<div class="item" style="width: 25px; aspect-ratio: auto 1/19;"><div></div></div> | ||
<!-- The content size suggestion is 190px, i.e. the height of the item's | ||
child div. --> | ||
<div class="item" style="width: 25px; aspect-ratio: auto 1/1;"><div></div></div> | ||
</div> | ||
|
||
<div class="flexContainer"> | ||
<!-- The content-box min-width 10px is transferred to the main axis, | ||
yielding a resolved min-height:auto of 190px. --> | ||
<div class="item" style="min-width: 25px; aspect-ratio: auto 1/19;"><div></div></div> | ||
<!-- The content size suggestion is 190px, i.e. the height of the item's | ||
child div. --> | ||
<div class="item" style="min-width: 25px; aspect-ratio: auto 1/1;"><div></div></div> | ||
</div> | ||
|
||
<div class="flexContainer"> | ||
<!-- The content-box width 10px (clamped by max-width) is transferred to the main axis, | ||
yielding a resolved min-height:auto of 190px. --> | ||
<div class="item" style="max-width: 25px; width: 100px; aspect-ratio: auto 1/19;"><div></div></div> | ||
<!-- The content size suggestion is 190px because the content-box max-width | ||
10px is transferred to the main axis as the upper bound of its | ||
content-box height.--> | ||
<div class="item" style="max-width: 25px; width: 100px; aspect-ratio: auto 1/19;"> | ||
<div style="height: 500px"></div> | ||
</div> | ||
</div> | ||
</html> |
@aethanyc I think this test is not right. I think the content size suggestion is 50px here, not 100px.
https://drafts.csswg.org/css-flexbox/#content-size-suggestion says
https://drafts.csswg.org/css-sizing-3/#intrinsic-sizes says:
https://jsfiddle.net/dgrogan/uv59y0jh/1/ sets up the described float and shows that both Gecko and Blink give a min-content size of 50px. The
min-width: 0px; max-width: none;
in the fiddle emulates the '(and no minimum or maximum size in that axis)' part of the definition.Maybe Gecko is honoring the aspect-ratio's automatic minimum size when calculating the flex item's content size suggestion? If so, I'm pretty sure that's wrong, based on the parenthetical part of the definition and the discussion in w3c/csswg-drafts#6418.
Thoughts?