Auto merge of #29927 - Loirooriol:bfc-root-contain-floats, r=mrobinson

Increase BFC root height to contain floats

<!-- Please describe your changes on the following line: -->

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #29823
- [X] There are tests for these changes

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
This commit is contained in:
bors-servo 2023-06-26 10:29:36 +02:00 committed by GitHub
commit 04359812c9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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