Increase BFC root height to contain floats

This commit is contained in:
Oriol Brufau 2023-06-25 22:56:57 +02:00
parent 9829931c27
commit e38083a96e
11 changed files with 9 additions and 22 deletions

View file

@ -96,10 +96,18 @@ impl BlockFormattingContext {
.collapsed_through .collapsed_through
); );
// The content height of a BFC root should include any float participating in that BFC
// (https://drafts.csswg.org/css2/#root-height), we implement this by imagining there is
// an element with `clear: both` after the actual contents.
let clearance = sequential_layout_state.map_or(Length::zero(), |sequential_layout_state| {
sequential_layout_state.calculate_clearance(ClearSide::Both)
});
IndependentLayout { IndependentLayout {
fragments: flow_layout.fragments, fragments: flow_layout.fragments,
content_block_size: flow_layout.content_block_size + content_block_size: flow_layout.content_block_size +
flow_layout.collapsible_margins_in_children.end.solve(), flow_layout.collapsible_margins_in_children.end.solve() +
clearance,
} }
} }
} }

View file

@ -1,2 +0,0 @@
[float-replaced-height-001.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[floats-005.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[floats-101.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[floats-145.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[block-formatting-context-height-001.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[block-formatting-context-height-002.xht]
expected: FAIL

View file

@ -1,3 +0,0 @@
[change-column-flex-width.html]
[#container 1]
expected: FAIL

View file

@ -1,2 +0,0 @@
[block_formatting_context_containing_floats_a.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[float_clearance_intrinsic_width_a.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[float_intrinsic_height.html]
expected: FAIL