Respect min/max constraints in the block axis of block containers (#33203)

Consider a block container that establishes an inline formatting context
and has a definite `block-size` which is clamped by `min-block-size` or
`max-block-size`.

We were already sizing such container correctly, however, its contents
were resolving their percentages against the unclamped `block-size`
value.

This patch fixes the `ContainingBlock` that we pass to the contents so
that they resolve percentages correctly.

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
Oriol Brufau 2024-08-27 11:05:43 +02:00 committed by GitHub
parent fef44620cc
commit 5d43d88b6c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 60 additions and 19 deletions

View file

@ -81619,6 +81619,19 @@
{}
]
],
"max-height-applies-to-017.html": [
"3543b19ee33dbbd93e3b8455458123bf298bd4a1",
[
null,
[
[
"/css/CSS2/reference/ref-filled-green-100px-square.xht",
"=="
]
],
{}
]
],
"max-height-percentage-001.xht": [
"5ac6f609e9c68384771a207119363215ad8149ca",
[

View file

@ -1,2 +0,0 @@
[max-height-applies-to-014.xht]
expected: FAIL

View file

@ -0,0 +1,26 @@
<!DOCTYPE html>
<title>CSS Test: Max-Height applied to element with 'display' set to 'inline-block'</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.xht">
<meta name="assert" content="The percentage in #child should resolve against the 100px maximum of #parent, not against 200px.">
<style>
#parent {
display: inline-block;
height: 200px;
max-height: 100px;
background: red;
}
#child {
display: inline-block;
width: 100px;
height: 100%;
background: green;
}
</style>
<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
<div id="parent">
<span id="child"></span>
</div>