Skip to content

Commit

Permalink
Bug 1950354 [wpt PR 50926] - layout: Support stretch cross size for…
Browse files Browse the repository at this point in the history
… automatic min size in flexbox, a=testonly

Automatic update from web-platform-tests
layout: Support `stretch` cross size for automatic min size in flexbox

The computation of the automatic minimum size may involve transferring
a definite cross size into the main axis through the aspect ratio.
We were only considering numeric sizes as definite, but `stretch` can
also be definite.

Signed-off-by: Oriol Brufau <[email protected]>

--

wpt-commits: 1171011d28302ebc41ee5240fa3a88b98d4ad730
wpt-pr: 50926
  • Loading branch information
Loirooriol authored and moz-wptsync-bot committed Feb 28, 2025
1 parent d034783 commit b622c5d
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>Automatic minimum size of flex item with stretch cross size</title>
<link rel="author" title="Oriol Brufau" href="mailto:[email protected]">
<link rel="help" href="https://drafts.csswg.org/css-sizing-4/#stretch-fit-sizing">
<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">
<meta assert="A definite `stretch` cross size can be transferred through the
aspect ratio when computing the automatic minimum size of a flex item.">

<style>
div {
display: flex;
flex-direction: column;
height: 200px;
width: 200px;
background: red;
}
canvas {
width: stretch;
align-self: start;
flex-basis: 0;
background: green;
}
</style>

<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
<div class="flex">
<canvas width="100" height="100"></canvas>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>Automatic minimum size of flex item with stretch cross size</title>
<link rel="author" title="Oriol Brufau" href="mailto:[email protected]">
<link rel="help" href="https://drafts.csswg.org/css-sizing-4/#stretch-fit-sizing">
<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">
<meta assert="A definite `stretch` cross size can be transferred through the
aspect ratio when computing the automatic minimum size of a flex item.">

<style>
div {
display: flex;
flex-direction: row;
height: 200px;
width: 200px;
background: red;
}
canvas {
height: stretch;
align-self: start;
flex-basis: 0;
background: green;
}
</style>

<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
<div class="flex">
<canvas width="100" height="100"></canvas>
</div>

0 comments on commit b622c5d

Please sign in to comment.