mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
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>
This commit is contained in:
parent
3bc0eeab8f
commit
1f13e8b596
7 changed files with 181 additions and 1 deletions
|
@ -1012,7 +1012,7 @@ fn layout_in_flow_non_replaced_block_level_same_formatting_context(
|
|||
let end_margin_can_collapse_with_children = collapsed_through ||
|
||||
(pbm.padding.block_end == Au::zero() &&
|
||||
pbm.border.block_end == Au::zero() &&
|
||||
computed_block_size.is_auto());
|
||||
!containing_block_for_children.size.block.is_definite());
|
||||
if end_margin_can_collapse_with_children {
|
||||
block_margins_collapsed_with_children
|
||||
.end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue