servo/components/layout_2020/flow
Oriol Brufau 1f13e8b596
layout: Allow collapsing bottom margins with any indefinite block size (#36278)
According to CSS2, the bottom margin of a block container can collapse
with the bottom margin of its last in-flow child if `height` computes to
`auto`.

However, according to CSS Sizing, that was "legacy spec prose" and
should be interpreted as "behaves as `auto`".

Therefore, cyclic percentages and intrinsic keywords like `min-content`
shouldn't prevent margin collapse, because they behave as `auto`.

This change aligns Servo with Gecko and Blink, but diverges from WebKit.

https://www.w3.org/TR/CSS22/box.html#collapsing-margins
https://www.w3.org/TR/css-sizing/#behave-auto

Testing:
-
`tests/wpt/tests/css/css-sizing/margin-collapse-with-indefinite-block-size-001.html`
-
`tests/wpt/tests/css/css-sizing/margin-collapse-with-indefinite-block-size-002.html`
-
`tests/wpt/tests/css/css-sizing/margin-collapse-with-indefinite-block-size-003.html`
-
`tests/wpt/tests/css/css-sizing/margin-collapse-with-indefinite-block-size-004.html`
-
`tests/wpt/tests/css/css-sizing/margin-collapse-with-indefinite-block-size-005.html`

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
2025-04-02 12:10:04 +00:00
..
inline layout: Cache IndependentNonReplacedContents::layout() (#36082) 2025-03-24 12:33:44 +00:00
construct.rs layout: Simplify and generalize the usage of pseudo-elements (#36202) 2025-03-29 12:41:04 +00:00
float.rs Update rustfmt to the 2024 style edition (#35764) 2025-03-03 11:26:53 +00:00
mod.rs layout: Allow collapsing bottom margins with any indefinite block size (#36278) 2025-04-02 12:10:04 +00:00
root.rs layout: Cache IndependentNonReplacedContents::layout() (#36082) 2025-03-24 12:33:44 +00:00