From 59c74c874a082dc2c4652747d768498c2d03d3ee Mon Sep 17 00:00:00 2001 From: Oriol Brufau Date: Thu, 29 Aug 2024 13:24:07 +0200 Subject: [PATCH] Obey `min-block-size` and `max-block-size` in floats (#33241) We were using the unclamped `box_size.block` instead of `block_size`. Signed-off-by: Oriol Brufau --- components/layout_2020/flow/float.rs | 2 +- tests/wpt/meta/MANIFEST.json | 26 +++++++++++++++++++ .../max-height-applies-to-018.html | 19 ++++++++++++++ .../normal-flow/max-width-applies-to-018.html | 19 ++++++++++++++ 4 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 tests/wpt/tests/css/CSS2/normal-flow/max-height-applies-to-018.html create mode 100644 tests/wpt/tests/css/CSS2/normal-flow/max-width-applies-to-018.html diff --git a/components/layout_2020/flow/float.rs b/components/layout_2020/flow/float.rs index df8861e2bde..b211f0bb80d 100644 --- a/components/layout_2020/flow/float.rs +++ b/components/layout_2020/flow/float.rs @@ -949,7 +949,7 @@ impl FloatBox { inline_size.into(), ), None => ( - box_size.block.auto_is(|| { + block_size.auto_is(|| { Length::from(independent_layout.content_block_size) .clamp_between_extremums( min_box_size.block, diff --git a/tests/wpt/meta/MANIFEST.json b/tests/wpt/meta/MANIFEST.json index 1657f9ac240..7f7a3ed28b2 100644 --- a/tests/wpt/meta/MANIFEST.json +++ b/tests/wpt/meta/MANIFEST.json @@ -81632,6 +81632,19 @@ {} ] ], + "max-height-applies-to-018.html": [ + "a4aa75876043e1905b15df966ee63eb6c398d01d", + [ + null, + [ + [ + "/css/reference/ref-filled-green-100px-square-only.html", + "==" + ] + ], + {} + ] + ], "max-height-percentage-001.xht": [ "5ac6f609e9c68384771a207119363215ad8149ca", [ @@ -82802,6 +82815,19 @@ {} ] ], + "max-width-applies-to-018.html": [ + "f934a87fd2c12ccb8d57d08b4eef6ae2aa49aca4", + [ + null, + [ + [ + "/css/reference/ref-filled-green-100px-square-only.html", + "==" + ] + ], + {} + ] + ], "max-width-percentage-001.xht": [ "05a715d28cbd6e1810b69ee258032b5a106c7905", [ diff --git a/tests/wpt/tests/css/CSS2/normal-flow/max-height-applies-to-018.html b/tests/wpt/tests/css/CSS2/normal-flow/max-height-applies-to-018.html new file mode 100644 index 00000000000..a4aa7587604 --- /dev/null +++ b/tests/wpt/tests/css/CSS2/normal-flow/max-height-applies-to-018.html @@ -0,0 +1,19 @@ + +CSS Test: Max-Height applied to element with 'float' set to 'left' + + + + + + + +

Test passes if there is a filled green square.

+
diff --git a/tests/wpt/tests/css/CSS2/normal-flow/max-width-applies-to-018.html b/tests/wpt/tests/css/CSS2/normal-flow/max-width-applies-to-018.html new file mode 100644 index 00000000000..f934a87fd2c --- /dev/null +++ b/tests/wpt/tests/css/CSS2/normal-flow/max-width-applies-to-018.html @@ -0,0 +1,19 @@ + +CSS Test: Max-Width applied to element with 'float' set to 'left' + + + + + + + +

Test passes if there is a filled green square.

+