layout: Let min/max constraints avoid collapsing bottom margins (#36322)

When `block-size` was intrinsic and there was no block-end padding or
margin, we were allowing the block-end margin of the box to collapse
with the block-end margin of its contents.

However, due to `min-block-size` or `max-block-size`, the final size can
be different than the intrinsic size of the contents. In that case it
didn't make any sense to collapse end margins, only WebKit does it too.

This patch takes the final size into account, like Gecko and Blink. This
is under discussion in https://github.com/w3c/csswg-drafts/issues/12218,
but for now we will match Blink.

Testing: 2 tests are now passing. There is also 1 new failure, but that
test only passes in WebKit and I don't agree with it.

Fixes: #36321

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
Oriol Brufau 2025-09-30 18:12:31 +02:00 committed by GitHub
parent 439558133f
commit f724651e1a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 28 additions and 13 deletions

View file

@ -0,0 +1,2 @@
[margin-collapse-038.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[max-height-separates-margin.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[min-height-separates-margin.html]
expected: FAIL