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 <obrufau@igalia.com>
This commit is contained in:
Oriol Brufau 2024-08-29 13:24:07 +02:00 committed by GitHub
parent e8d0f85f52
commit 59c74c874a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 65 additions and 1 deletions

View file

@ -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,

View file

@ -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",
[

View file

@ -0,0 +1,19 @@
<!DOCTYPE html>
<title>CSS Test: Max-Height applied to element with 'float' set to 'left'</title>
<link rel="author" title="Oriol Brufau" href="obrufau@igalia.com">
<link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#min-max-heights">
<link rel="match" href="../../reference/ref-filled-green-100px-square-only.html">
<meta name="assert" content="The float should be 100px tall, not 200px.">
<style>
.float {
float: left;
width: 100px;
height: 200px;
max-height: 100px;
background: green;
}
</style>
<p>Test passes if there is a filled green square.</p>
<div class="float"></div>

View file

@ -0,0 +1,19 @@
<!DOCTYPE html>
<title>CSS Test: Max-Width applied to element with 'float' set to 'left'</title>
<link rel="author" title="Oriol Brufau" href="obrufau@igalia.com">
<link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#min-max-heights">
<link rel="match" href="../../reference/ref-filled-green-100px-square-only.html">
<meta name="assert" content="The float should be 100px wide, not 200px.">
<style>
.float {
float: left;
height: 100px;
width: 200px;
max-width: 100px;
background: green;
}
</style>
<p>Test passes if there is a filled green square.</p>
<div class="float"></div>