diff --git a/components/layout/flexbox/layout.rs b/components/layout/flexbox/layout.rs index d0e65c800d8..b00bdfd5e9d 100644 --- a/components/layout/flexbox/layout.rs +++ b/components/layout/flexbox/layout.rs @@ -1552,7 +1552,7 @@ impl InitialFlexLineLayout<'_> { cross_axis, Size::Stretch, Au::zero, - Some(final_line_cross_size - item.item.pbm_auto_is_zero.cross), + Some(Au::zero().max(final_line_cross_size - item.item.pbm_auto_is_zero.cross)), || content_size.into(), // Tables have a special sizing in the block axis in that handles collapsed rows, // but it would prevent stretching. So we only recognize tables in the inline axis. diff --git a/tests/wpt/meta/MANIFEST.json b/tests/wpt/meta/MANIFEST.json index f21e2ece4ad..eba545b1959 100644 --- a/tests/wpt/meta/MANIFEST.json +++ b/tests/wpt/meta/MANIFEST.json @@ -255316,6 +255316,32 @@ {} ] ], + "flexbox-stretch-minimum-001.html": [ + "499a9076f3d18c693db904cee001f9896c052b45", + [ + null, + [ + [ + "/css/reference/ref-filled-green-200px-square.html", + "==" + ] + ], + {} + ] + ], + "flexbox-stretch-minimum-002.html": [ + "cfb1cd13b424d5ec1ffd5665f576eb4711bda9b9", + [ + null, + [ + [ + "/css/reference/ref-filled-green-200px-square.html", + "==" + ] + ], + {} + ] + ], "min-width-1.html": [ "a1a39073e88d4626be7c469611e3593415849e7a", [ diff --git a/tests/wpt/tests/css/css-sizing/stretch/flexbox-stretch-minimum-001.html b/tests/wpt/tests/css/css-sizing/stretch/flexbox-stretch-minimum-001.html new file mode 100644 index 00000000000..499a9076f3d --- /dev/null +++ b/tests/wpt/tests/css/css-sizing/stretch/flexbox-stretch-minimum-001.html @@ -0,0 +1,36 @@ + + +Non-negative content-box size of stretched flex item with `stretch` min cross size + + + + + + + + + + +

Test passes if there is a filled green square and no red.

+
+
+
+
diff --git a/tests/wpt/tests/css/css-sizing/stretch/flexbox-stretch-minimum-002.html b/tests/wpt/tests/css/css-sizing/stretch/flexbox-stretch-minimum-002.html new file mode 100644 index 00000000000..cfb1cd13b42 --- /dev/null +++ b/tests/wpt/tests/css/css-sizing/stretch/flexbox-stretch-minimum-002.html @@ -0,0 +1,36 @@ + + +Non-negative content-box size of stretched flex item with `stretch` min cross size + + + + + + + + + + +

Test passes if there is a filled green square and no red.

+
+
+
+