Skip to content

Truly independent web browser

LibWeb: Collapse the margins of an empty last block in a BFC root

sideshowbarker56b0e9e56ab6
diff --git a/Libraries/LibWeb/Rust/src/layout/block_formatting_context.rs b/Libraries/LibWeb/Rust/src/layout/block_formatting_context.rs
index e4c45c77d38..d43c381c3eb 100644
--- a/Libraries/LibWeb/Rust/src/layout/block_formatting_context.rs
+++ b/Libraries/LibWeb/Rust/src/layout/block_formatting_context.rs
@@ -1057,8 +1057,9 @@ pub(crate) struct BlockFormattingContext<'pass> {
/// The in-flow children laid out ahead of the walks over them that are in progress, by slot.
in_flow_children_laid_out_ahead: RefCell<HashMap<u32, InFlowChildLaidOutAhead>>,
derived_baselines_of_root_box: Cell<DerivedBaselines>,
- /// The trailing collapsed margin of the run, and the index in `root_flow_children` of the child it hangs below.
- trailing_collapsed_margin: Cell<Option<(usize, CssPixels)>>,
+ /// The collapsed margin that the run's in-flow children leave at its end, and the last of them that margins don't
+ /// collapse through, where there's one.
+ trailing_collapsed_margin: Cell<Option<(Option<usize>, CssPixels)>>,
table_box_in_wrapper_border_box_inline_size: Cell<Option<CssPixels>>,
table_box_in_wrapper_border_box_block_size: Cell<Option<CssPixels>>,
/// The inline layout of the table box inside a table wrapper child, as sizing the wrapper last found it, which the
@@ -6600,14 +6601,15 @@ impl<'pass> BlockFormattingContext<'pass> {
// margin_bottom, and only the root's automatic block size consumes the aggregate.
let collapsed_margin = self.margin_state().current_collapsed_margin();
// NB: Only the automatic block size of a root with block-level children reads the trailing collapsed margin.
- if collapsed_margin != CssPixels::default() && !root_facts.children_are_inline() {
+ if !root_facts.children_are_inline() {
let index_of_last_child_margins_do_not_collapse_through =
self.root_flow_children.borrow().iter().rposition(|child| {
!self.facts(child.node).is_floating_or_absolutely_positioned() && !child.collapses_through
});
- if let Some(index) = index_of_last_child_margins_do_not_collapse_through {
- self.trailing_collapsed_margin.set(Some((index, collapsed_margin)));
- }
+ self.trailing_collapsed_margin.set(Some((
+ index_of_last_child_margins_do_not_collapse_through,
+ collapsed_margin,
+ )));
}
if let Some((Some(outside_marker), _)) = outside_marker_laid_out_before_contents {
@@ -7639,7 +7641,7 @@ pub(crate) fn automatic_block_size_for_bfc_root(
flow_children: &[RootFlowChild],
honors_size_containment: bool,
lowest_floating_descendant_bottom_margin_edge: Option<CssPixels>,
- trailing_collapsed_margin: Option<(usize, CssPixels)>,
+ trailing_collapsed_margin: Option<(Option<usize>, CssPixels)>,
) -> CssPixels {
let facts = NodeFacts::new(&pass, root);
// https://drafts.csswg.org/css-contain-2/#containment-size
@@ -7675,11 +7677,18 @@ pub(crate) fn automatic_block_size_for_bfc_root(
if !participates(child) || child.is_invisible_for_line_clamp {
continue;
}
+ // https://drafts.csswg.org/css2/#collapsing-margins
+ // NB: The margins of a box that margins collapse through collapse with those of the boxes around it, so
+ // the box reaches no further than the collapsed margin they all end with, which the box before it
+ // accounts for, or the run's start where there's no such box.
+ if child.collapses_through {
+ continue;
+ }
// Margins cannot collapse out of a BFC root: below the last real in-flow
// child, the run's trailing collapsed margin (which folds in any trailing
// collapse-through siblings) replaces that child's own bottom margin.
let margin_bottom = match trailing_collapsed_margin {
- Some((index_of_last_real_child, aggregate)) if index_of_last_real_child == index => aggregate,
+ Some((Some(index_of_last_real_child), aggregate)) if index_of_last_real_child == index => aggregate,
// NB: The margins of an empty box collapse through it into those of the boxes after it, which
// are placed past them, so its own bottom margin reaches no further than theirs.
_ if Some(index) != last_participant
@@ -7696,6 +7705,10 @@ pub(crate) fn automatic_block_size_for_bfc_root(
let child_bottom = child.border_box_block_end + margin_bottom;
bottom = Some(bottom.map_or(child_bottom, |value: CssPixels| value.max(child_bottom)));
}
+ // Where margins collapse through every in-flow child, their collapsed margin starts at the top content edge.
+ if let Some((None, aggregate)) = trailing_collapsed_margin {
+ bottom = Some(bottom.map_or(aggregate, |value| value.max(aggregate)));
+ }
}
// In addition, if the element has any floating descendants
// whose bottom margin edge is below the element's bottom content edge,
diff --git a/Libraries/LibWeb/Rust/src/layout/inline_formatting_context.rs b/Libraries/LibWeb/Rust/src/layout/inline_formatting_context.rs
index d8e7722d24f..df3af51eccd 100644
--- a/Libraries/LibWeb/Rust/src/layout/inline_formatting_context.rs
+++ b/Libraries/LibWeb/Rust/src/layout/inline_formatting_context.rs
@@ -3078,14 +3078,26 @@ impl<'context> InlineFormattingContext<'context> {
.last()
.map(line_box::LineBoxData::retained_metrics);
let baselines = formatting_context::derive_baselines_from_lines(&self.line_data.get_mut().line_boxes);
+ // https://drafts.csswg.org/css2/#adjoining-margins
+ // - no line boxes, no clearance, no padding and no border separate them (Note that certain zero-height line boxes
+ // (see 9.4.2) are ignored for this purpose.)
+ // NB: A line box that holds text, or ends with a forced break (not one that holds an interrupting block),
+ // separates them even where it's zero-height, e.g. with a zero font size.
+ let has_line_with_text = self.line_data.get_mut().line_boxes.iter().any(|line| {
+ (line.has_forced_break && line.block_level_box.is_none())
+ || line
+ .fragments
+ .iter()
+ .any(|fragment| fragment.box_cells.is_none() && fragment.text_length_in_code_units > 0)
+ });
block_formatting_context::ChildrenSummary {
baselines,
lines: Some(std::mem::take(self.line_data.get_mut())),
fragmentainer_stop_token: self.fragmentainer_stop_token.take(),
lines_are_unbreakable: self.lines_are_unbreakable.get(),
last_line,
- has_child_whose_margins_do_not_collapse_through: !self
- .children_let_margins_collapse_through(self.containing_block),
+ has_child_whose_margins_do_not_collapse_through: has_line_with_text
+ || !self.children_let_margins_collapse_through(self.containing_block),
..Default::default()
}
}
@@ -3095,9 +3107,32 @@ impl<'context> InlineFormattingContext<'context> {
fn children_let_margins_collapse_through(&self, node: Node) -> bool {
self.pass.children(node).all(|child| {
let facts = self.facts(child);
- if !facts.is_box() || facts.is_absolutely_positioned() || facts.is_floating() {
+ if facts.is_absolutely_positioned() || facts.is_floating() {
return true;
}
+ // https://drafts.csswg.org/css2/#inline-formatting
+ // Line boxes that contain no text, no preserved white space, no inline elements with non-zero margins,
+ // padding, or borders or other in-flow content (such as images, inline blocks or inline tables), and do not
+ // end with a preserved newline must be treated as zero-height line boxes for the purposes of determining
+ // the positions of any elements inside of them, and must be treated as not existing for any other purpose.
+ // NB: Only the inline-axis margins, padding, and borders of an inline box count here.
+ if !facts.is_box() {
+ let Some(sides) = self.entered_inline_box(child) else {
+ return true;
+ };
+ // NB: The sides of an inline box are relative to the layout frame, whose left and right are the inline
+ // axis in every writing mode.
+ let inline_edges = [
+ sides.margin_left,
+ sides.margin_right,
+ sides.border_left,
+ sides.border_right,
+ sides.padding_left,
+ sides.padding_right,
+ ];
+ return inline_edges.iter().all(|edge| *edge == CssPixels::default())
+ && self.children_let_margins_collapse_through(child);
+ }
let interrupting_block_collapses_through = self
.margins_collapse_through_interrupting_blocks
.borrow()
diff --git a/Tests/LibWeb/Layout/expected/abspos-box-bottom-with-max-height.txt b/Tests/LibWeb/Layout/expected/abspos-box-bottom-with-max-height.txt
index fbf12bdc455..cf093cf390b 100644
--- a/Tests/LibWeb/Layout/expected/abspos-box-bottom-with-max-height.txt
+++ b/Tests/LibWeb/Layout/expected/abspos-box-bottom-with-max-height.txt
@@ -1,7 +1,7 @@
Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
- BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 16 0+0+0] [BFC] children: not-inline
+ BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 8 0+0+0] [BFC] children: not-inline
BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 0 0+0+8] children: not-inline
BlockContainer <div> at [8,550] positioned [0+0+0 100 0+0+0] [0+0+0 50 0+0+0] [BFC] children: not-inline
SC for Viewport<#document> [0,0 800x600] (z-index: auto)
- SC for BlockContainer<HTML> [0,0 800x16] (z-index: auto)
+ SC for BlockContainer<HTML> [0,0 800x8] (z-index: auto)
diff --git a/Tests/LibWeb/Layout/expected/abspos-fit-content-height-uses-own-width.txt b/Tests/LibWeb/Layout/expected/abspos-fit-content-height-uses-own-width.txt
index 0838c71bfb1..8759295ae85 100644
--- a/Tests/LibWeb/Layout/expected/abspos-fit-content-height-uses-own-width.txt
+++ b/Tests/LibWeb/Layout/expected/abspos-fit-content-height-uses-own-width.txt
@@ -1,5 +1,5 @@
Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
- BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 16 0+0+0] [BFC] children: not-inline
+ BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 8 0+0+0] [BFC] children: not-inline
BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 0 0+0+8] children: not-inline
BlockContainer <div#box> at [0,0] positioned [0+0+0 200 0+0+0] [0+0+0 30 30+0+0] [BFC] children: inline
frag 0 from TextNode start: 0, length: 37, rect: [0,0 193.578125x10] baseline: 8
@@ -11,5 +11,5 @@ Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children
TextNode <#text> (not painted)
SC for Viewport<#document> [0,0 800x600] (z-index: auto)
- SC for BlockContainer<HTML> [0,0 800x16] (z-index: auto)
+ SC for BlockContainer<HTML> [0,0 800x8] (z-index: auto)
SC for BlockContainer<DIV>#box [0,0 200x30] (z-index: auto)
diff --git a/Tests/LibWeb/Layout/expected/abspos-flex-margin-limits-1.txt b/Tests/LibWeb/Layout/expected/abspos-flex-margin-limits-1.txt
index 9873df75906..c21e9eeb6ed 100644
--- a/Tests/LibWeb/Layout/expected/abspos-flex-margin-limits-1.txt
+++ b/Tests/LibWeb/Layout/expected/abspos-flex-margin-limits-1.txt
@@ -1,8 +1,8 @@
Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
- BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 16 0+0+0] [BFC] children: not-inline
+ BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 8 0+0+0] [BFC] children: not-inline
BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 0 0+0+8] children: not-inline
Box <div.container> at [8,8] positioned flex-container(row) [0+0+0 100 0+0+0] [0+0+0 100 0+0+0] [FFC] children: not-inline
BlockContainer <div.bottom-left> at [18,48] positioned [0+5+5 50 5+5+0] [500+5+5 50 5+5+0] [BFC] children: not-inline
SC for Viewport<#document> [0,0 800x600] (z-index: auto)
- SC for BlockContainer<HTML> [0,0 800x16] (z-index: auto)
+ SC for BlockContainer<HTML> [0,0 800x8] (z-index: auto)
diff --git a/Tests/LibWeb/Layout/expected/abspos-flex-margin-limits-2.txt b/Tests/LibWeb/Layout/expected/abspos-flex-margin-limits-2.txt
index 261d0aff131..c7498aa62d4 100644
--- a/Tests/LibWeb/Layout/expected/abspos-flex-margin-limits-2.txt
+++ b/Tests/LibWeb/Layout/expected/abspos-flex-margin-limits-2.txt
@@ -1,8 +1,8 @@
Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
- BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 16 0+0+0] [BFC] children: not-inline
+ BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 8 0+0+0] [BFC] children: not-inline
BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 0 0+0+8] children: not-inline
Box <div.container> at [8,8] positioned flex-container(row) [0+0+0 100 0+0+0] [0+0+0 100 0+0+0] [FFC] children: not-inline
BlockContainer <div.top-right> at [48,18] positioned [500+5+5 50 5+5+0] [0+5+5 50 5+5+0] [BFC] children: not-inline
SC for Viewport<#document> [0,0 800x600] (z-index: auto)
- SC for BlockContainer<HTML> [0,0 800x16] (z-index: auto)
+ SC for BlockContainer<HTML> [0,0 800x8] (z-index: auto)
diff --git a/Tests/LibWeb/Layout/expected/abspos-image-with-min-height-constraint.txt b/Tests/LibWeb/Layout/expected/abspos-image-with-min-height-constraint.txt
index c9def70ec20..40ab3ff2c54 100644
--- a/Tests/LibWeb/Layout/expected/abspos-image-with-min-height-constraint.txt
+++ b/Tests/LibWeb/Layout/expected/abspos-image-with-min-height-constraint.txt
@@ -1,7 +1,7 @@
Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline overflow: [0,0 808x608]
- BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 16 0+0+0] [BFC] children: not-inline
+ BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 8 0+0+0] [BFC] children: not-inline
BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 0 0+0+8] children: inline
ImageBox <img#zero-dimensions-but-min-percentages> at [8,8] positioned [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] children: not-inline
SC for Viewport<#document> [0,0 800x600] (z-index: auto)
- SC for BlockContainer<HTML> [0,0 800x16] (z-index: auto)
+ SC for BlockContainer<HTML> [0,0 800x8] (z-index: auto)
diff --git a/Tests/LibWeb/Layout/expected/blank.txt b/Tests/LibWeb/Layout/expected/blank.txt
index f30c80d9c8c..a714bf2c2ab 100644
--- a/Tests/LibWeb/Layout/expected/blank.txt
+++ b/Tests/LibWeb/Layout/expected/blank.txt
@@ -1,6 +1,6 @@
Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
- BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 16 0+0+0] [BFC] children: not-inline
+ BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 8 0+0+0] [BFC] children: not-inline
BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 0 0+0+8] children: not-inline
SC for Viewport<#document> [0,0 800x600] (z-index: auto)
- SC for BlockContainer<HTML> [0,0 800x16] (z-index: auto)
+ SC for BlockContainer<HTML> [0,0 800x8] (z-index: auto)
diff --git a/Tests/LibWeb/Layout/expected/block-and-inline/max-width-on-block-level-box-that-creates-fc.txt b/Tests/LibWeb/Layout/expected/block-and-inline/max-width-on-block-level-box-that-creates-fc.txt
index 4de8668570c..5e4deadfee2 100644
--- a/Tests/LibWeb/Layout/expected/block-and-inline/max-width-on-block-level-box-that-creates-fc.txt
+++ b/Tests/LibWeb/Layout/expected/block-and-inline/max-width-on-block-level-box-that-creates-fc.txt
@@ -1,5 +1,5 @@
Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
- BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 16 0+0+0] [BFC] children: not-inline
+ BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 8 0+0+0] [BFC] children: not-inline
BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 0 0+0+8] children: not-inline
BlockContainer <div.a> at [8,8] positioned [0+0+0 100 0+0+0] [0+0+0 80 0+0+0] [BFC] children: not-inline
Box <div.b> at [8,8] flex-container(row) [0+0+0 100 0+0+0] [0+0+0 80 0+0+0] [FFC] children: not-inline
@@ -17,5 +17,5 @@ Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children
TextNode <#text> (not painted)
SC for Viewport<#document> [0,0 800x600] (z-index: auto)
- SC for BlockContainer<HTML> [0,0 800x16] (z-index: auto)
+ SC for BlockContainer<HTML> [0,0 800x8] (z-index: auto)
SC for BlockContainer<DIV>.a [8,8 100x80] (z-index: auto)
diff --git a/Tests/LibWeb/Layout/expected/block-and-inline/percentage-height-abspos-box-with-percentage-height-child.txt b/Tests/LibWeb/Layout/expected/block-and-inline/percentage-height-abspos-box-with-percentage-height-child.txt
index e96c5f22b80..55867ef1b69 100644
--- a/Tests/LibWeb/Layout/expected/block-and-inline/percentage-height-abspos-box-with-percentage-height-child.txt
+++ b/Tests/LibWeb/Layout/expected/block-and-inline/percentage-height-abspos-box-with-percentage-height-child.txt
@@ -1,9 +1,9 @@
Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
- BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 16 0+0+0] [BFC] children: not-inline
+ BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 8 0+0+0] [BFC] children: not-inline
BlockContainer <body> at [8,8] positioned [8+0+0 784 0+0+8] [8+0+0 0 0+0+8] children: not-inline
BlockContainer <main> at [8,8] positioned [0+0+0 120 0+0+0] [0+0+0 0 0+0+0] [BFC] children: not-inline
BlockContainer <div#asset-grid> at [18,18] [0+10+0 100 0+10+0] [0+10+0 0 0+10+0] children: not-inline
BlockContainer <div#virtual-timeline> at [18,18] [0+0+0 100 0+0+0] [0+0+0 30 0+0+0] children: not-inline
SC for Viewport<#document> [0,0 800x600] (z-index: auto)
- SC for BlockContainer<HTML> [0,0 800x16] (z-index: auto)
+ SC for BlockContainer<HTML> [0,0 800x8] (z-index: auto)
diff --git a/Tests/LibWeb/Layout/expected/border-spacing-calc-dont-crash.txt b/Tests/LibWeb/Layout/expected/border-spacing-calc-dont-crash.txt
index 0bd176dea63..cb5b5f5184c 100644
--- a/Tests/LibWeb/Layout/expected/border-spacing-calc-dont-crash.txt
+++ b/Tests/LibWeb/Layout/expected/border-spacing-calc-dont-crash.txt
@@ -1,7 +1,7 @@
Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
- BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 16 0+0+0] [BFC] children: not-inline
+ BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 8 0+0+0] [BFC] children: not-inline
BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 0 0+0+8] children: not-inline
BlockContainer <div> at [8,8] [0+0+0 784 0+0+0] [0+0+0 0 0+0+0] children: not-inline
SC for Viewport<#document> [0,0 800x600] (z-index: auto)
- SC for BlockContainer<HTML> [0,0 800x16] (z-index: auto)
+ SC for BlockContainer<HTML> [0,0 800x8] (z-index: auto)
diff --git a/Tests/LibWeb/Layout/expected/crash-tests/html-with-only-a-template-tag.txt b/Tests/LibWeb/Layout/expected/crash-tests/html-with-only-a-template-tag.txt
index f30c80d9c8c..a714bf2c2ab 100644
--- a/Tests/LibWeb/Layout/expected/crash-tests/html-with-only-a-template-tag.txt
+++ b/Tests/LibWeb/Layout/expected/crash-tests/html-with-only-a-template-tag.txt
@@ -1,6 +1,6 @@
Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
- BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 16 0+0+0] [BFC] children: not-inline
+ BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 8 0+0+0] [BFC] children: not-inline
BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 0 0+0+8] children: not-inline
SC for Viewport<#document> [0,0 800x600] (z-index: auto)
- SC for BlockContainer<HTML> [0,0 800x16] (z-index: auto)
+ SC for BlockContainer<HTML> [0,0 800x8] (z-index: auto)
diff --git a/Tests/LibWeb/Layout/expected/css-invalid-psuedo-compound-selector.txt b/Tests/LibWeb/Layout/expected/css-invalid-psuedo-compound-selector.txt
index 0bd176dea63..cb5b5f5184c 100644
--- a/Tests/LibWeb/Layout/expected/css-invalid-psuedo-compound-selector.txt
+++ b/Tests/LibWeb/Layout/expected/css-invalid-psuedo-compound-selector.txt
@@ -1,7 +1,7 @@
Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
- BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 16 0+0+0] [BFC] children: not-inline
+ BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 8 0+0+0] [BFC] children: not-inline
BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 0 0+0+8] children: not-inline
BlockContainer <div> at [8,8] [0+0+0 784 0+0+0] [0+0+0 0 0+0+0] children: not-inline
SC for Viewport<#document> [0,0 800x600] (z-index: auto)
- SC for BlockContainer<HTML> [0,0 800x16] (z-index: auto)
+ SC for BlockContainer<HTML> [0,0 800x8] (z-index: auto)
diff --git a/Tests/LibWeb/Layout/expected/css-rect-value-with-calc-dont-crash.txt b/Tests/LibWeb/Layout/expected/css-rect-value-with-calc-dont-crash.txt
index 0bd176dea63..cb5b5f5184c 100644
--- a/Tests/LibWeb/Layout/expected/css-rect-value-with-calc-dont-crash.txt
+++ b/Tests/LibWeb/Layout/expected/css-rect-value-with-calc-dont-crash.txt
@@ -1,7 +1,7 @@
Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
- BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 16 0+0+0] [BFC] children: not-inline
+ BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 8 0+0+0] [BFC] children: not-inline
BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 0 0+0+8] children: not-inline
BlockContainer <div> at [8,8] [0+0+0 784 0+0+0] [0+0+0 0 0+0+0] children: not-inline
SC for Viewport<#document> [0,0 800x600] (z-index: auto)
- SC for BlockContainer<HTML> [0,0 800x16] (z-index: auto)
+ SC for BlockContainer<HTML> [0,0 800x8] (z-index: auto)
diff --git a/Tests/LibWeb/Layout/expected/css-transition-none.txt b/Tests/LibWeb/Layout/expected/css-transition-none.txt
index 0bd176dea63..cb5b5f5184c 100644
--- a/Tests/LibWeb/Layout/expected/css-transition-none.txt
+++ b/Tests/LibWeb/Layout/expected/css-transition-none.txt
@@ -1,7 +1,7 @@
Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
- BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 16 0+0+0] [BFC] children: not-inline
+ BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 8 0+0+0] [BFC] children: not-inline
BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 0 0+0+8] children: not-inline
BlockContainer <div> at [8,8] [0+0+0 784 0+0+0] [0+0+0 0 0+0+0] children: not-inline
SC for Viewport<#document> [0,0 800x600] (z-index: auto)
- SC for BlockContainer<HTML> [0,0 800x16] (z-index: auto)
+ SC for BlockContainer<HTML> [0,0 800x8] (z-index: auto)
diff --git a/Tests/LibWeb/Layout/expected/css-values/rect-non-token-contents-crash.txt b/Tests/LibWeb/Layout/expected/css-values/rect-non-token-contents-crash.txt
index 0bd176dea63..cb5b5f5184c 100644
--- a/Tests/LibWeb/Layout/expected/css-values/rect-non-token-contents-crash.txt
+++ b/Tests/LibWeb/Layout/expected/css-values/rect-non-token-contents-crash.txt
@@ -1,7 +1,7 @@
Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
- BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 16 0+0+0] [BFC] children: not-inline
+ BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 8 0+0+0] [BFC] children: not-inline
BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 0 0+0+8] children: not-inline
BlockContainer <div> at [8,8] [0+0+0 784 0+0+0] [0+0+0 0 0+0+0] children: not-inline
SC for Viewport<#document> [0,0 800x600] (z-index: auto)
- SC for BlockContainer<HTML> [0,0 800x16] (z-index: auto)
+ SC for BlockContainer<HTML> [0,0 800x8] (z-index: auto)
diff --git a/Tests/LibWeb/Layout/expected/dialog-open-modal.txt b/Tests/LibWeb/Layout/expected/dialog-open-modal.txt
index 4be5de598d4..89723a7d058 100644
--- a/Tests/LibWeb/Layout/expected/dialog-open-modal.txt
+++ b/Tests/LibWeb/Layout/expected/dialog-open-modal.txt
@@ -1,5 +1,5 @@
Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
- BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 16 0+0+0] [BFC] children: not-inline
+ BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 8 0+0+0] [BFC] children: not-inline
BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 0 0+0+8] children: not-inline
BlockContainer <(anonymous)> at [0,0] positioned [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
Box <dialog#modal> at [358.84375,292] positioned flex-container(row) [339.84375+3+16 82.3125 16+3+339.84375] [273+3+16 16 16+3+273] [FFC] children: not-inline
@@ -9,6 +9,6 @@ Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children
TextNode <#text> (not painted)
SC for Viewport<#document> [0,0 800x600] (z-index: auto)
- SC for BlockContainer<HTML> [0,0 800x16] (z-index: auto)
+ SC for BlockContainer<HTML> [0,0 800x8] (z-index: auto)
SC for BlockContainer(anonymous) [0,0 800x600] (z-index: auto)
SC for Box<DIALOG>#modal [358.84375,292 82.3125x16] (z-index: auto)
diff --git a/Tests/LibWeb/Layout/expected/dialog-open-non-modal.txt b/Tests/LibWeb/Layout/expected/dialog-open-non-modal.txt
index ea855310647..f1b8b8bce88 100644
--- a/Tests/LibWeb/Layout/expected/dialog-open-non-modal.txt
+++ b/Tests/LibWeb/Layout/expected/dialog-open-non-modal.txt
@@ -1,5 +1,5 @@
Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
- BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 16 0+0+0] [BFC] children: not-inline
+ BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 8 0+0+0] [BFC] children: not-inline
BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 0 0+0+8] children: not-inline
BlockContainer <dialog> at [358.84375,27] positioned [339.84375+3+16 82.3125 16+3+339.84375] [0+3+16 16 16+3+0] [BFC] children: inline
InlineNode <span> at [358.84375,27] [0+0+0 82.3125 0+0+0] [0+0+0 16 0+0+0]
@@ -9,4 +9,4 @@ Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children
TextNode <#text> (not painted)
SC for Viewport<#document> [0,0 800x600] (z-index: auto)
- SC for BlockContainer<HTML> [0,0 800x16] (z-index: auto)
+ SC for BlockContainer<HTML> [0,0 800x8] (z-index: auto)
diff --git a/Tests/LibWeb/Layout/expected/flex/abspos-flex-child-with-percentage-height.txt b/Tests/LibWeb/Layout/expected/flex/abspos-flex-child-with-percentage-height.txt
index 2b24c57f1f5..097250da39c 100644
--- a/Tests/LibWeb/Layout/expected/flex/abspos-flex-child-with-percentage-height.txt
+++ b/Tests/LibWeb/Layout/expected/flex/abspos-flex-child-with-percentage-height.txt
@@ -1,5 +1,5 @@
Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
- BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 16 0+0+0] [BFC] children: not-inline
+ BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 8 0+0+0] [BFC] children: not-inline
BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 0 0+0+8] children: not-inline
BlockContainer <div#containing-block> at [8,8] positioned [0+0+0 200 0+0+0] [0+0+0 300 0+0+0] [BFC] children: not-inline
Box <div#inner-flex> at [8,8] flex-container(row) [0+0+0 200 0+0+0] [0+0+0 0 0+0+0] [FFC] children: not-inline
@@ -8,4 +8,4 @@ Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children
BlockContainer <div> at [8,8] [0+0+0 300 0+0+-100] [0+0+0 300 0+0+0] children: not-inline
SC for Viewport<#document> [0,0 800x600] (z-index: auto)
- SC for BlockContainer<HTML> [0,0 800x16] (z-index: auto)
+ SC for BlockContainer<HTML> [0,0 800x8] (z-index: auto)
diff --git a/Tests/LibWeb/Layout/expected/grid/abspos-item-contained-by-grid-area.txt b/Tests/LibWeb/Layout/expected/grid/abspos-item-contained-by-grid-area.txt
index 9d0855a72b1..ba211731ab4 100644
--- a/Tests/LibWeb/Layout/expected/grid/abspos-item-contained-by-grid-area.txt
+++ b/Tests/LibWeb/Layout/expected/grid/abspos-item-contained-by-grid-area.txt
@@ -1,5 +1,5 @@
Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline overflow: [0,0 808x608]
- BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 16 0+0+0] [BFC] children: not-inline
+ BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 8 0+0+0] [BFC] children: not-inline
BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 0 0+0+8] children: not-inline
Box <div.gfc> at [8,8] positioned [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [GFC] children: not-inline
BlockContainer <div.grid-item> at [408,8] [0+0+0 400 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
@@ -9,4 +9,4 @@ Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children
TextNode <#text> (not painted)
SC for Viewport<#document> [0,0 800x600] (z-index: auto)
- SC for BlockContainer<HTML> [0,0 800x16] (z-index: auto)
+ SC for BlockContainer<HTML> [0,0 800x8] (z-index: auto)
diff --git a/Tests/LibWeb/Layout/expected/grid/grid-area-non-token-parts-crash.txt b/Tests/LibWeb/Layout/expected/grid/grid-area-non-token-parts-crash.txt
index 0bd176dea63..cb5b5f5184c 100644
--- a/Tests/LibWeb/Layout/expected/grid/grid-area-non-token-parts-crash.txt
+++ b/Tests/LibWeb/Layout/expected/grid/grid-area-non-token-parts-crash.txt
@@ -1,7 +1,7 @@
Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
- BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 16 0+0+0] [BFC] children: not-inline
+ BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 8 0+0+0] [BFC] children: not-inline
BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 0 0+0+8] children: not-inline
BlockContainer <div> at [8,8] [0+0+0 784 0+0+0] [0+0+0 0 0+0+0] children: not-inline
SC for Viewport<#document> [0,0 800x600] (z-index: auto)
- SC for BlockContainer<HTML> [0,0 800x16] (z-index: auto)
+ SC for BlockContainer<HTML> [0,0 800x8] (z-index: auto)
diff --git a/Tests/LibWeb/Layout/expected/grid/grid-column-non-token-parts-crash.txt b/Tests/LibWeb/Layout/expected/grid/grid-column-non-token-parts-crash.txt
index 0bd176dea63..cb5b5f5184c 100644
--- a/Tests/LibWeb/Layout/expected/grid/grid-column-non-token-parts-crash.txt
+++ b/Tests/LibWeb/Layout/expected/grid/grid-column-non-token-parts-crash.txt
@@ -1,7 +1,7 @@
Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
- BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 16 0+0+0] [BFC] children: not-inline
+ BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 8 0+0+0] [BFC] children: not-inline
BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 0 0+0+8] children: not-inline
BlockContainer <div> at [8,8] [0+0+0 784 0+0+0] [0+0+0 0 0+0+0] children: not-inline
SC for Viewport<#document> [0,0 800x600] (z-index: auto)
- SC for BlockContainer<HTML> [0,0 800x16] (z-index: auto)
+ SC for BlockContainer<HTML> [0,0 800x8] (z-index: auto)
diff --git a/Tests/LibWeb/Layout/expected/grid/grid-row-start-non-token-parts-crash.txt b/Tests/LibWeb/Layout/expected/grid/grid-row-start-non-token-parts-crash.txt
index 0bd176dea63..cb5b5f5184c 100644
--- a/Tests/LibWeb/Layout/expected/grid/grid-row-start-non-token-parts-crash.txt
+++ b/Tests/LibWeb/Layout/expected/grid/grid-row-start-non-token-parts-crash.txt
@@ -1,7 +1,7 @@
Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
- BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 16 0+0+0] [BFC] children: not-inline
+ BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 8 0+0+0] [BFC] children: not-inline
BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 0 0+0+8] children: not-inline
BlockContainer <div> at [8,8] [0+0+0 784 0+0+0] [0+0+0 0 0+0+0] children: not-inline
SC for Viewport<#document> [0,0 800x600] (z-index: auto)
- SC for BlockContainer<HTML> [0,0 800x16] (z-index: auto)
+ SC for BlockContainer<HTML> [0,0 800x8] (z-index: auto)
diff --git a/Tests/LibWeb/Layout/expected/grid/minmax-non-token-contents-crash.txt b/Tests/LibWeb/Layout/expected/grid/minmax-non-token-contents-crash.txt
index 0bd176dea63..cb5b5f5184c 100644
--- a/Tests/LibWeb/Layout/expected/grid/minmax-non-token-contents-crash.txt
+++ b/Tests/LibWeb/Layout/expected/grid/minmax-non-token-contents-crash.txt
@@ -1,7 +1,7 @@
Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
- BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 16 0+0+0] [BFC] children: not-inline
+ BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 8 0+0+0] [BFC] children: not-inline
BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 0 0+0+8] children: not-inline
BlockContainer <div> at [8,8] [0+0+0 784 0+0+0] [0+0+0 0 0+0+0] children: not-inline
SC for Viewport<#document> [0,0 800x600] (z-index: auto)
- SC for BlockContainer<HTML> [0,0 800x16] (z-index: auto)
+ SC for BlockContainer<HTML> [0,0 800x8] (z-index: auto)
diff --git a/Tests/LibWeb/Layout/expected/grid/repeat-non-token-contents-crash.txt b/Tests/LibWeb/Layout/expected/grid/repeat-non-token-contents-crash.txt
index 0bd176dea63..cb5b5f5184c 100644
--- a/Tests/LibWeb/Layout/expected/grid/repeat-non-token-contents-crash.txt
+++ b/Tests/LibWeb/Layout/expected/grid/repeat-non-token-contents-crash.txt
@@ -1,7 +1,7 @@
Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
- BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 16 0+0+0] [BFC] children: not-inline
+ BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 8 0+0+0] [BFC] children: not-inline
BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 0 0+0+8] children: not-inline
BlockContainer <div> at [8,8] [0+0+0 784 0+0+0] [0+0+0 0 0+0+0] children: not-inline
SC for Viewport<#document> [0,0 800x600] (z-index: auto)
- SC for BlockContainer<HTML> [0,0 800x16] (z-index: auto)
+ SC for BlockContainer<HTML> [0,0 800x8] (z-index: auto)
diff --git a/Tests/LibWeb/Layout/expected/height-of-absolute-position-box-with-padding.txt b/Tests/LibWeb/Layout/expected/height-of-absolute-position-box-with-padding.txt
index fb9fcb468b0..fb0e221aa98 100644
--- a/Tests/LibWeb/Layout/expected/height-of-absolute-position-box-with-padding.txt
+++ b/Tests/LibWeb/Layout/expected/height-of-absolute-position-box-with-padding.txt
@@ -1,5 +1,5 @@
Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
- BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 16 0+0+0] [BFC] children: not-inline
+ BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 8 0+0+0] [BFC] children: not-inline
BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 0 0+0+8] children: not-inline
BlockContainer <h1> at [76.578125,103.734375] positioned [0+1+0 126 0+1+0] [13.390625+1+44 38 44+1+13.390625] [BFC] children: inline
frag 0 from TextNode start: 0, length: 4, rect: [116.296875,103.734375 46.546875x20] baseline: 16
@@ -7,4 +7,4 @@ Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children
TextNode <#text> (not painted)
SC for Viewport<#document> [0,0 800x600] (z-index: auto)
- SC for BlockContainer<HTML> [0,0 800x16] (z-index: auto)
+ SC for BlockContainer<HTML> [0,0 800x8] (z-index: auto)
diff --git a/Tests/LibWeb/Layout/expected/layout-tree-update/dialog-backdrop-update.txt b/Tests/LibWeb/Layout/expected/layout-tree-update/dialog-backdrop-update.txt
index d1ae02a3a8a..4525f4a594d 100644
--- a/Tests/LibWeb/Layout/expected/layout-tree-update/dialog-backdrop-update.txt
+++ b/Tests/LibWeb/Layout/expected/layout-tree-update/dialog-backdrop-update.txt
@@ -1,5 +1,5 @@
Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
- BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 16 0+0+0] [BFC] children: not-inline
+ BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 8 0+0+0] [BFC] children: not-inline
BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 0 0+0+8] children: not-inline
BlockContainer <(anonymous)> at [0,0] positioned [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
BlockContainer <dialog#dialog> at [395.140625,292] positioned [376.140625+3+16 9.703125 16+3+376.140625] [273+3+16 16 16+3+273] [BFC] children: not-inline
@@ -9,6 +9,6 @@ Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children
TextNode <#text> (not painted)
SC for Viewport<#document> [0,0 800x600] (z-index: auto)
- SC for BlockContainer<HTML> [0,0 800x16] (z-index: auto)
+ SC for BlockContainer<HTML> [0,0 800x8] (z-index: auto)
SC for BlockContainer(anonymous) [0,0 800x600] (z-index: auto)
SC for BlockContainer<DIALOG>#dialog [395.140625,292 9.703125x16] (z-index: auto)
diff --git a/Tests/LibWeb/Layout/expected/layout-tree-update/dialog-removal.txt b/Tests/LibWeb/Layout/expected/layout-tree-update/dialog-removal.txt
index f30c80d9c8c..a714bf2c2ab 100644
--- a/Tests/LibWeb/Layout/expected/layout-tree-update/dialog-removal.txt
+++ b/Tests/LibWeb/Layout/expected/layout-tree-update/dialog-removal.txt
@@ -1,6 +1,6 @@
Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
- BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 16 0+0+0] [BFC] children: not-inline
+ BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 8 0+0+0] [BFC] children: not-inline
BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 0 0+0+8] children: not-inline
SC for Viewport<#document> [0,0 800x600] (z-index: auto)
- SC for BlockContainer<HTML> [0,0 800x16] (z-index: auto)
+ SC for BlockContainer<HTML> [0,0 800x8] (z-index: auto)
diff --git a/Tests/LibWeb/Layout/expected/layout-tree-update/maintain-single-backdrop-pseudo-element.txt b/Tests/LibWeb/Layout/expected/layout-tree-update/maintain-single-backdrop-pseudo-element.txt
index eee8026c966..f59442b2e1a 100644
--- a/Tests/LibWeb/Layout/expected/layout-tree-update/maintain-single-backdrop-pseudo-element.txt
+++ b/Tests/LibWeb/Layout/expected/layout-tree-update/maintain-single-backdrop-pseudo-element.txt
@@ -1,5 +1,5 @@
Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
- BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 16 0+0+0] [BFC] children: not-inline
+ BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 8 0+0+0] [BFC] children: not-inline
BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 0 0+0+8] children: not-inline
BlockContainer <(anonymous)> at [0,0] positioned [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
BlockContainer <dialog#d> at [315.15625,290] positioned [296.15625+3+16 169.6875 16+3+296.15625] [271+3+16 20 16+3+271] [BFC] children: inline
@@ -11,6 +11,6 @@ Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children
TextNode <#text> (not painted)
SC for Viewport<#document> [0,0 800x600] (z-index: auto)
- SC for BlockContainer<HTML> [0,0 800x16] (z-index: auto)
+ SC for BlockContainer<HTML> [0,0 800x8] (z-index: auto)
SC for BlockContainer(anonymous) [0,0 800x600] (z-index: auto)
SC for BlockContainer<DIALOG>#d [315.15625,290 169.6875x20] (z-index: auto)
diff --git a/Tests/LibWeb/Layout/expected/link-sheet.txt b/Tests/LibWeb/Layout/expected/link-sheet.txt
index 6a881a5fbf1..1da56c685ad 100644
--- a/Tests/LibWeb/Layout/expected/link-sheet.txt
+++ b/Tests/LibWeb/Layout/expected/link-sheet.txt
@@ -1,7 +1,7 @@
Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
- BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 16 0+0+0] [BFC] children: not-inline
+ BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 8 0+0+0] [BFC] children: not-inline
BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 0 0+0+8] children: not-inline
BlockContainer <div#foo> at [0,0] positioned [0+0+0 123 0+0+0] [0+0+0 456 0+0+0] [BFC] children: not-inline
SC for Viewport<#document> [0,0 800x600] (z-index: auto)
- SC for BlockContainer<HTML> [0,0 800x16] (z-index: auto)
+ SC for BlockContainer<HTML> [0,0 800x8] (z-index: auto)
diff --git a/Tests/LibWeb/Layout/expected/misc/create-iframes-using-innerhtml.txt b/Tests/LibWeb/Layout/expected/misc/create-iframes-using-innerhtml.txt
index 1eeac8bb23d..240b645304d 100644
--- a/Tests/LibWeb/Layout/expected/misc/create-iframes-using-innerhtml.txt
+++ b/Tests/LibWeb/Layout/expected/misc/create-iframes-using-innerhtml.txt
@@ -1,5 +1,5 @@
Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
- BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 16 0+0+0] [BFC] children: not-inline
+ BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 8 0+0+0] [BFC] children: not-inline
BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 0 0+0+8] children: not-inline
BlockContainer <div#container> at [8,8] [0+0+0 784 0+0+0] [0+0+0 0 0+0+0] children: not-inline
BlockContainer <div> at [8,8] positioned [0+0+0 1 0+0+0] [0+0+0 1 0+0+0] [BFC] children: inline
@@ -14,55 +14,55 @@ Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children
frag 8 from NavigableContainerViewport start: 0, length: 0, rect: [18,258 10x10] baseline: 30
frag 9 from NavigableContainerViewport start: 0, length: 0, rect: [18,288 10x10] baseline: 30
NavigableContainerViewport <iframe> at [18,18] [5+5+0 10 0+5+5] [5+5+0 10 0+5+5] children: not-inline (url: about:blank)
- Viewport <#document> at [0,0] [0+0+0 10 0+0+0] [0+0+0 10 0+0+0] [BFC] children: not-inline overflow: [0,0 10x16]
- BlockContainer <html> at [0,0] [0+0+0 10 0+0+0] [0+0+0 16 0+0+0] [BFC] children: not-inline
+ Viewport <#document> at [0,0] [0+0+0 10 0+0+0] [0+0+0 10 0+0+0] [BFC] children: not-inline
+ BlockContainer <html> at [0,0] [0+0+0 10 0+0+0] [0+0+0 10 0+0+0] [BFC] children: not-inline
BlockContainer <body> at [8,8] [8+0+0 0 0+0+8] [8+0+0 0 0+0+8] children: not-inline
NavigableContainerViewport <iframe> at [18,48] [5+5+0 10 0+5+5] [5+5+0 10 0+5+5] children: not-inline (url: about:blank)
- Viewport <#document> at [0,0] [0+0+0 10 0+0+0] [0+0+0 10 0+0+0] [BFC] children: not-inline overflow: [0,0 10x16]
- BlockContainer <html> at [0,0] [0+0+0 10 0+0+0] [0+0+0 16 0+0+0] [BFC] children: not-inline
+ Viewport <#document> at [0,0] [0+0+0 10 0+0+0] [0+0+0 10 0+0+0] [BFC] children: not-inline
+ BlockContainer <html> at [0,0] [0+0+0 10 0+0+0] [0+0+0 10 0+0+0] [BFC] children: not-inline
BlockContainer <body> at [8,8] [8+0+0 0 0+0+8] [8+0+0 0 0+0+8] children: not-inline
NavigableContainerViewport <iframe> at [18,78] [5+5+0 10 0+5+5] [5+5+0 10 0+5+5] children: not-inline (url: about:blank)
- Viewport <#document> at [0,0] [0+0+0 10 0+0+0] [0+0+0 10 0+0+0] [BFC] children: not-inline overflow: [0,0 10x16]
- BlockContainer <html> at [0,0] [0+0+0 10 0+0+0] [0+0+0 16 0+0+0] [BFC] children: not-inline
+ Viewport <#document> at [0,0] [0+0+0 10 0+0+0] [0+0+0 10 0+0+0] [BFC] children: not-inline
+ BlockContainer <html> at [0,0] [0+0+0 10 0+0+0] [0+0+0 10 0+0+0] [BFC] children: not-inline
BlockContainer <body> at [8,8] [8+0+0 0 0+0+8] [8+0+0 0 0+0+8] children: not-inline
NavigableContainerViewport <iframe> at [18,108] [5+5+0 10 0+5+5] [5+5+0 10 0+5+5] children: not-inline (url: about:blank)
- Viewport <#document> at [0,0] [0+0+0 10 0+0+0] [0+0+0 10 0+0+0] [BFC] children: not-inline overflow: [0,0 10x16]
- BlockContainer <html> at [0,0] [0+0+0 10 0+0+0] [0+0+0 16 0+0+0] [BFC] children: not-inline
+ Viewport <#document> at [0,0] [0+0+0 10 0+0+0] [0+0+0 10 0+0+0] [BFC] children: not-inline
+ BlockContainer <html> at [0,0] [0+0+0 10 0+0+0] [0+0+0 10 0+0+0] [BFC] children: not-inline
BlockContainer <body> at [8,8] [8+0+0 0 0+0+8] [8+0+0 0 0+0+8] children: not-inline
NavigableContainerViewport <iframe> at [18,138] [5+5+0 10 0+5+5] [5+5+0 10 0+5+5] children: not-inline (url: about:blank)
- Viewport <#document> at [0,0] [0+0+0 10 0+0+0] [0+0+0 10 0+0+0] [BFC] children: not-inline overflow: [0,0 10x16]
- BlockContainer <html> at [0,0] [0+0+0 10 0+0+0] [0+0+0 16 0+0+0] [BFC] children: not-inline
+ Viewport <#document> at [0,0] [0+0+0 10 0+0+0] [0+0+0 10 0+0+0] [BFC] children: not-inline
+ BlockContainer <html> at [0,0] [0+0+0 10 0+0+0] [0+0+0 10 0+0+0] [BFC] children: not-inline
BlockContainer <body> at [8,8] [8+0+0 0 0+0+8] [8+0+0 0 0+0+8] children: not-inline
NavigableContainerViewport <iframe> at [18,168] [5+5+0 10 0+5+5] [5+5+0 10 0+5+5] children: not-inline (url: about:blank)
- Viewport <#document> at [0,0] [0+0+0 10 0+0+0] [0+0+0 10 0+0+0] [BFC] children: not-inline overflow: [0,0 10x16]
- BlockContainer <html> at [0,0] [0+0+0 10 0+0+0] [0+0+0 16 0+0+0] [BFC] children: not-inline
+ Viewport <#document> at [0,0] [0+0+0 10 0+0+0] [0+0+0 10 0+0+0] [BFC] children: not-inline
+ BlockContainer <html> at [0,0] [0+0+0 10 0+0+0] [0+0+0 10 0+0+0] [BFC] children: not-inline
BlockContainer <body> at [8,8] [8+0+0 0 0+0+8] [8+0+0 0 0+0+8] children: not-inline
NavigableContainerViewport <iframe> at [18,198] [5+5+0 10 0+5+5] [5+5+0 10 0+5+5] children: not-inline (url: about:blank)
- Viewport <#document> at [0,0] [0+0+0 10 0+0+0] [0+0+0 10 0+0+0] [BFC] children: not-inline overflow: [0,0 10x16]
- BlockContainer <html> at [0,0] [0+0+0 10 0+0+0] [0+0+0 16 0+0+0] [BFC] children: not-inline
+ Viewport <#document> at [0,0] [0+0+0 10 0+0+0] [0+0+0 10 0+0+0] [BFC] children: not-inline
+ BlockContainer <html> at [0,0] [0+0+0 10 0+0+0] [0+0+0 10 0+0+0] [BFC] children: not-inline
BlockContainer <body> at [8,8] [8+0+0 0 0+0+8] [8+0+0 0 0+0+8] children: not-inline
NavigableContainerViewport <iframe> at [18,228] [5+5+0 10 0+5+5] [5+5+0 10 0+5+5] children: not-inline (url: about:blank)
- Viewport <#document> at [0,0] [0+0+0 10 0+0+0] [0+0+0 10 0+0+0] [BFC] children: not-inline overflow: [0,0 10x16]
- BlockContainer <html> at [0,0] [0+0+0 10 0+0+0] [0+0+0 16 0+0+0] [BFC] children: not-inline
+ Viewport <#document> at [0,0] [0+0+0 10 0+0+0] [0+0+0 10 0+0+0] [BFC] children: not-inline
+ BlockContainer <html> at [0,0] [0+0+0 10 0+0+0] [0+0+0 10 0+0+0] [BFC] children: not-inline
BlockContainer <body> at [8,8] [8+0+0 0 0+0+8] [8+0+0 0 0+0+8] children: not-inline
NavigableContainerViewport <iframe> at [18,258] [5+5+0 10 0+5+5] [5+5+0 10 0+5+5] children: not-inline (url: about:blank)
- Viewport <#document> at [0,0] [0+0+0 10 0+0+0] [0+0+0 10 0+0+0] [BFC] children: not-inline overflow: [0,0 10x16]
- BlockContainer <html> at [0,0] [0+0+0 10 0+0+0] [0+0+0 16 0+0+0] [BFC] children: not-inline
+ Viewport <#document> at [0,0] [0+0+0 10 0+0+0] [0+0+0 10 0+0+0] [BFC] children: not-inline
+ BlockContainer <html> at [0,0] [0+0+0 10 0+0+0] [0+0+0 10 0+0+0] [BFC] children: not-inline
BlockContainer <body> at [8,8] [8+0+0 0 0+0+8] [8+0+0 0 0+0+8] children: not-inline
NavigableContainerViewport <iframe> at [18,288] [5+5+0 10 0+5+5] [5+5+0 10 0+5+5] children: not-inline (url: about:blank)
- Viewport <#document> at [0,0] [0+0+0 10 0+0+0] [0+0+0 10 0+0+0] [BFC] children: not-inline overflow: [0,0 10x16]
- BlockContainer <html> at [0,0] [0+0+0 10 0+0+0] [0+0+0 16 0+0+0] [BFC] children: not-inline
+ Viewport <#document> at [0,0] [0+0+0 10 0+0+0] [0+0+0 10 0+0+0] [BFC] children: not-inline
+ BlockContainer <html> at [0,0] [0+0+0 10 0+0+0] [0+0+0 10 0+0+0] [BFC] children: not-inline
BlockContainer <body> at [8,8] [8+0+0 0 0+0+8] [8+0+0 0 0+0+8] children: not-inline
SC for Viewport<#document> [0,0 800x600] (z-index: auto)
- SC for BlockContainer<HTML> [0,0 800x16] (z-index: auto)
+ SC for BlockContainer<HTML> [0,0 800x8] (z-index: auto)
diff --git a/Tests/LibWeb/Layout/expected/misc/grid-template-block-components-whitespace-crash.txt b/Tests/LibWeb/Layout/expected/misc/grid-template-block-components-whitespace-crash.txt
index f30c80d9c8c..a714bf2c2ab 100644
--- a/Tests/LibWeb/Layout/expected/misc/grid-template-block-components-whitespace-crash.txt
+++ b/Tests/LibWeb/Layout/expected/misc/grid-template-block-components-whitespace-crash.txt
@@ -1,6 +1,6 @@
Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
- BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 16 0+0+0] [BFC] children: not-inline
+ BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 8 0+0+0] [BFC] children: not-inline
BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 0 0+0+8] children: not-inline
SC for Viewport<#document> [0,0 800x600] (z-index: auto)
- SC for BlockContainer<HTML> [0,0 800x16] (z-index: auto)
+ SC for BlockContainer<HTML> [0,0 800x8] (z-index: auto)
diff --git a/Tests/LibWeb/Layout/expected/misc/percentage-stroke-width-crash.txt b/Tests/LibWeb/Layout/expected/misc/percentage-stroke-width-crash.txt
index f30c80d9c8c..a714bf2c2ab 100644
--- a/Tests/LibWeb/Layout/expected/misc/percentage-stroke-width-crash.txt
+++ b/Tests/LibWeb/Layout/expected/misc/percentage-stroke-width-crash.txt
@@ -1,6 +1,6 @@
Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
- BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 16 0+0+0] [BFC] children: not-inline
+ BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 8 0+0+0] [BFC] children: not-inline
BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 0 0+0+8] children: not-inline
SC for Viewport<#document> [0,0 800x600] (z-index: auto)
- SC for BlockContainer<HTML> [0,0 800x16] (z-index: auto)
+ SC for BlockContainer<HTML> [0,0 800x8] (z-index: auto)
diff --git a/Tests/LibWeb/Layout/expected/position-absolute-from-edges.txt b/Tests/LibWeb/Layout/expected/position-absolute-from-edges.txt
index 6d0a4969c7f..9942d132ccd 100644
--- a/Tests/LibWeb/Layout/expected/position-absolute-from-edges.txt
+++ b/Tests/LibWeb/Layout/expected/position-absolute-from-edges.txt
@@ -1,5 +1,5 @@
Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
- BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 16 0+0+0] [BFC] children: not-inline
+ BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 8 0+0+0] [BFC] children: not-inline
BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 0 0+0+8] children: not-inline
BlockContainer <div#container> at [28,28] positioned [0+20+0 500 0+20+0] [0+20+0 400 0+20+0] [BFC] children: not-inline
BlockContainer <div#red> at [58,58] positioned [0+10+0 100 0+10+0] [0+10+0 100 0+10+0] [BFC] children: not-inline
@@ -8,4 +8,4 @@ Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children
BlockContainer <div#yellow> at [408,308] positioned [0+0+0 100 0+0+0] [0+0+0 100 0+0+0] [BFC] children: not-inline
SC for Viewport<#document> [0,0 800x600] (z-index: auto)
- SC for BlockContainer<HTML> [0,0 800x16] (z-index: auto)
+ SC for BlockContainer<HTML> [0,0 800x8] (z-index: auto)
diff --git a/Tests/LibWeb/Layout/expected/pseudo-element-with-custom-properties.txt b/Tests/LibWeb/Layout/expected/pseudo-element-with-custom-properties.txt
index 71bf5b483f4..0b71e228156 100644
--- a/Tests/LibWeb/Layout/expected/pseudo-element-with-custom-properties.txt
+++ b/Tests/LibWeb/Layout/expected/pseudo-element-with-custom-properties.txt
@@ -1,8 +1,8 @@
Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
- BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 16 0+0+0] [BFC] children: not-inline
+ BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 8 0+0+0] [BFC] children: not-inline
BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 0 0+0+8] children: not-inline
BlockContainer <div.hello> at [8,8] [0+0+0 784 0+0+0] [0+0+0 0 0+0+0] children: inline
BlockContainer <(anonymous)> at [8,8] positioned [0+0+0 500 0+0+0] [0+0+0 100 0+0+0] [BFC] children: not-inline
SC for Viewport<#document> [0,0 800x600] (z-index: auto)
- SC for BlockContainer<HTML> [0,0 800x16] (z-index: auto)
+ SC for BlockContainer<HTML> [0,0 800x8] (z-index: auto)
diff --git a/Tests/LibWeb/Layout/expected/table/abspos-table-inside-abspos-table.txt b/Tests/LibWeb/Layout/expected/table/abspos-table-inside-abspos-table.txt
index 1a91751446d..dd34a39b2b6 100644
--- a/Tests/LibWeb/Layout/expected/table/abspos-table-inside-abspos-table.txt
+++ b/Tests/LibWeb/Layout/expected/table/abspos-table-inside-abspos-table.txt
@@ -1,5 +1,5 @@
Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
- BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 16 0+0+0] [BFC] children: not-inline
+ BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 8 0+0+0] [BFC] children: not-inline
BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 0 0+0+8] children: not-inline
TableWrapper <(anonymous)> at [8,8] positioned [0+0+0 200 0+0+0] [0+0+0 100 0+0+0] [BFC] children: not-inline
Box <div#outer> at [8,8] table-box [0+0+0 200 0+0+0] [0+0+0 100 0+0+0] [TFC] children: not-inline
@@ -14,4 +14,4 @@ Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children
TextNode <#text> (not painted)
SC for Viewport<#document> [0,0 800x600] (z-index: auto)
- SC for BlockContainer<HTML> [0,0 800x16] (z-index: auto)
+ SC for BlockContainer<HTML> [0,0 800x8] (z-index: auto)
diff --git a/Tests/LibWeb/Layout/expected/table/propagate-style-update-to-wrapper.txt b/Tests/LibWeb/Layout/expected/table/propagate-style-update-to-wrapper.txt
index 929b6b87ba0..698f32e9c6c 100644
--- a/Tests/LibWeb/Layout/expected/table/propagate-style-update-to-wrapper.txt
+++ b/Tests/LibWeb/Layout/expected/table/propagate-style-update-to-wrapper.txt
@@ -1,5 +1,5 @@
Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
- BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 16 0+0+0] [BFC] children: not-inline
+ BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 8 0+0+0] [BFC] children: not-inline
BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 0 0+0+8] children: not-inline
TableWrapper <(anonymous)> at [8,8] positioned [0+0+0 6 0+0+0] [0+0+0 6 0+0+0] [BFC] children: not-inline
Box <table#t> at [8,8] table-box [0+0+0 6 0+0+0] [0+0+0 6 0+0+0] [TFC] children: not-inline
@@ -8,4 +8,4 @@ Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children
BlockContainer <td> at [11,11] table-cell [0+0+1 0 1+0+0] [0+0+1 0 1+0+0] [BFC] children: not-inline
SC for Viewport<#document> [0,0 800x600] (z-index: auto)
- SC for BlockContainer<HTML> [0,0 800x16] (z-index: auto)
+ SC for BlockContainer<HTML> [0,0 800x8] (z-index: auto)
diff --git a/Tests/LibWeb/Layout/expected/top-layer.txt b/Tests/LibWeb/Layout/expected/top-layer.txt
index 34938e298f2..e8c9cb11f1a 100644
--- a/Tests/LibWeb/Layout/expected/top-layer.txt
+++ b/Tests/LibWeb/Layout/expected/top-layer.txt
@@ -1,5 +1,5 @@
Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
- BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 16 0+0+0] [BFC] children: not-inline
+ BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 8 0+0+0] [BFC] children: not-inline
BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 0 0+0+8] children: not-inline
BlockContainer <(anonymous)> at [0,0] positioned [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
BlockContainer <dialog#dialog> at [196.671875,276] positioned [177.671875+3+16 406.65625 16+3+177.671875] [257+3+16 48 16+3+257] [BFC] children: not-inline
@@ -9,6 +9,6 @@ Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children
TextNode <#text> (not painted)
SC for Viewport<#document> [0,0 800x600] (z-index: auto)
- SC for BlockContainer<HTML> [0,0 800x16] (z-index: auto)
+ SC for BlockContainer<HTML> [0,0 800x8] (z-index: auto)
SC for BlockContainer(anonymous) [0,0 800x600] (z-index: auto)
SC for BlockContainer<DIALOG>#dialog [196.671875,276 406.65625x48] (z-index: auto)
diff --git a/Tests/LibWeb/Layout/expected/tree-builder/popover-backdrop.txt b/Tests/LibWeb/Layout/expected/tree-builder/popover-backdrop.txt
index 281217cebda..652c4f8b0e3 100644
--- a/Tests/LibWeb/Layout/expected/tree-builder/popover-backdrop.txt
+++ b/Tests/LibWeb/Layout/expected/tree-builder/popover-backdrop.txt
@@ -1,5 +1,5 @@
Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
- BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 16 0+0+0] [BFC] children: not-inline
+ BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 8 0+0+0] [BFC] children: not-inline
BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 0 0+0+8] children: not-inline
BlockContainer <(anonymous)> at [0,0] positioned [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
BlockContainer <div#block> at [0,0] positioned [0+0+0 120.5625 0+0+0] [0+0+0 16 0+0+0] [BFC] children: inline
@@ -12,7 +12,7 @@ Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children
TextNode <#text> (not painted)
SC for Viewport<#document> [0,0 800x600] (z-index: auto)
- SC for BlockContainer<HTML> [0,0 800x16] (z-index: auto)
+ SC for BlockContainer<HTML> [0,0 800x8] (z-index: auto)
SC for BlockContainer(anonymous) [0,0 800x600] (z-index: auto)
SC for BlockContainer<DIV>#block [0,0 120.5625x16] (z-index: auto)
SC for BlockContainer<DIV>#none [0,0 99.859375x16] (z-index: auto)
diff --git a/Tests/LibWeb/Layout/expected/tree-builder/pseudo-elements-on-void-and-replaced.txt b/Tests/LibWeb/Layout/expected/tree-builder/pseudo-elements-on-void-and-replaced.txt
index 13018e4b763..705b94c8e98 100644
--- a/Tests/LibWeb/Layout/expected/tree-builder/pseudo-elements-on-void-and-replaced.txt
+++ b/Tests/LibWeb/Layout/expected/tree-builder/pseudo-elements-on-void-and-replaced.txt
@@ -51,8 +51,8 @@ Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children
BlockContainer <div> at [8,161] [0+0+0 784 0+0+0] [0+0+0 16 0+0+0] children: inline
frag 0 from NavigableContainerViewport start: 0, length: 0, rect: [10,163 20x10] baseline: 14
NavigableContainerViewport <iframe.p> at [10,163] [0+2+0 20 0+2+0] [0+2+0 10 0+2+0] children: not-inline (url: about:blank)
- Viewport <#document> at [0,0] [0+0+0 20 0+0+0] [0+0+0 10 0+0+0] [BFC] children: not-inline overflow: [0,0 20x16]
- BlockContainer <html> at [0,0] [0+0+0 20 0+0+0] [0+0+0 16 0+0+0] [BFC] children: not-inline
+ Viewport <#document> at [0,0] [0+0+0 20 0+0+0] [0+0+0 10 0+0+0] [BFC] children: not-inline
+ BlockContainer <html> at [0,0] [0+0+0 20 0+0+0] [0+0+0 10 0+0+0] [BFC] children: not-inline
BlockContainer <body> at [8,8] [8+0+0 4 0+0+8] [8+0+0 0 0+0+8] children: not-inline
BlockContainer <div> at [8,177] [0+0+0 784 0+0+0] [0+0+0 20 0+0+0] children: inline
diff --git a/Tests/LibWeb/Text/expected/display_list/scrollable-in-fixed.txt b/Tests/LibWeb/Text/expected/display_list/scrollable-in-fixed.txt
index fca04c7475b..ce47dd6f5c0 100644
--- a/Tests/LibWeb/Text/expected/display_list/scrollable-in-fixed.txt
+++ b/Tests/LibWeb/Text/expected/display_list/scrollable-in-fixed.txt
@@ -13,7 +13,7 @@ ScrollNode scroll_node_index=s2 parent_scroll_node_index=s0 scrollport_rect=[33,
DisplayList:
CompositorWheelHitTestTarget@s0/e0 target_scroll_node_index=s0 rect=[0,0 800x600]
-CompositorWheelHitTestTarget@s1/e0 target_scroll_node_index=s0 rect=[0,0 800x21]
+CompositorWheelHitTestTarget@s1/e0 target_scroll_node_index=s0 rect=[0,0 800x13]
CompositorWheelHitTestTarget@s0/e0 target_scroll_node_index=s0 rect=[20,20 204x154]
FillRect@s0/e0 rect=[20,20 204x154] color=rgb(211, 211, 211)
FillRoundedRectRing@s0/e0 rect=[20,20 204x154] widths=[2,2,2,2] color=rgb(0, 0, 0)
diff --git a/Tests/LibWeb/Text/expected/display_list/sibling-scrollables-in-fixed.txt b/Tests/LibWeb/Text/expected/display_list/sibling-scrollables-in-fixed.txt
index 6364e787731..d53825812bb 100644
--- a/Tests/LibWeb/Text/expected/display_list/sibling-scrollables-in-fixed.txt
+++ b/Tests/LibWeb/Text/expected/display_list/sibling-scrollables-in-fixed.txt
@@ -19,7 +19,7 @@ ScrollNode scroll_node_index=s4 parent_scroll_node_index=s0 scrollport_rect=[230
DisplayList:
CompositorWheelHitTestTarget@s0/e0 target_scroll_node_index=s0 rect=[0,0 800x600]
-CompositorWheelHitTestTarget@s1/e0 target_scroll_node_index=s0 rect=[0,0 800x21]
+CompositorWheelHitTestTarget@s1/e0 target_scroll_node_index=s0 rect=[0,0 800x13]
CompositorWheelHitTestTarget@s0/e0 target_scroll_node_index=s0 rect=[10,10 324x224]
FillRect@s0/e0 rect=[10,10 324x224] color=rgb(211, 211, 211)
FillRoundedRectRing@s0/e0 rect=[10,10 324x224] widths=[2,2,2,2] color=rgb(0, 0, 0)
diff --git a/Tests/LibWeb/Text/expected/empty-last-block-margins-collapse-in-a-bfc-root.txt b/Tests/LibWeb/Text/expected/empty-last-block-margins-collapse-in-a-bfc-root.txt
new file mode 100644
index 00000000000..e6c0c6660e5
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/empty-last-block-margins-collapse-in-a-bfc-root.txt
@@ -0,0 +1,23 @@
+only: 40
+first: 60
+last: 60
+middle: 80
+top-only: 40
+bottom-only: 40
+unequal: 40
+flex: 40
+zero-height-text: 80
+two-empty: 40
+three-empty: 50
+block-then-two-empty: 60
+nested-empty-then-empty: 100
+negative: 10
+zero-height-preserved-newline: 80
+zero-height-br: 80
+zero-height-inline-border: 80
+zero-height-inline-padding: 80
+zero-height-inline-margin: 80
+zero-height-plain-span: 40
+zero-height-block-axis-border: 40
+vertical-inline-margin: 80
+interrupting-empty-block: 40
diff --git a/Tests/LibWeb/Text/input/empty-last-block-margins-collapse-in-a-bfc-root.html b/Tests/LibWeb/Text/input/empty-last-block-margins-collapse-in-a-bfc-root.html
new file mode 100644
index 00000000000..674d6d4e74c
--- /dev/null
+++ b/Tests/LibWeb/Text/input/empty-last-block-margins-collapse-in-a-bfc-root.html
@@ -0,0 +1,51 @@
+<!DOCTYPE html>
+<script src="include.js"></script>
+<style>
+ .root { display: flow-root; width: 300px; }
+ .empty { margin: 40px 0; }
+ .block { height: 20px; }
+</style>
+<div class="root" id="only"><div class="empty"></div></div>
+<div class="root" id="first"><div class="empty"></div><div class="block"></div></div>
+<div class="root" id="last"><div class="block"></div><div class="empty"></div></div>
+<div class="root" id="middle"><div class="block"></div><div class="empty"></div><div class="block"></div></div>
+<div class="root" id="top-only"><div class="empty" style="margin: 40px 0 0"></div></div>
+<div class="root" id="bottom-only"><div class="empty" style="margin: 0 0 40px"></div></div>
+<div class="root" id="unequal"><div class="empty" style="margin: 40px 0 30px"></div></div>
+<div class="root" id="flex" style="display: flex; flex-direction: column"><div><div class="empty"></div></div></div>
+<div class="root" id="zero-height-text"><div class="empty" style="font-size: 0">text</div></div>
+<div class="root" id="two-empty"><div style="margin: 40px 0 0"></div><div style="margin: 20px 0 30px"></div></div>
+<div class="root" id="three-empty"><div style="margin: 10px 0 50px"></div><div style="margin: 20px 0 0"></div><div style="margin: 0 0 30px"></div></div>
+<div class="root" id="block-then-two-empty"><div class="block"></div><div style="margin: 40px 0 0"></div><div style="margin: 20px 0 30px"></div></div>
+<div class="root" id="nested-empty-then-empty"><div><div style="margin-top: 100px"></div></div><div style="margin: 20px 0 30px"></div></div>
+<div class="root" id="negative"><div style="margin: 40px 0 -10px"></div><div style="margin: -30px 0 20px"></div></div>
+<div class="root" id="zero-height-preserved-newline"><div class="empty" style="white-space: pre; font-size: 0; line-height: 0">
+</div></div>
+<div class="root" id="zero-height-inline-border"><div class="empty" style="font-size: 0; line-height: 0"><span style="border-left: 1px solid"></span></div></div>
+<div class="root" id="zero-height-inline-padding"><div class="empty" style="font-size: 0; line-height: 0"><span style="padding-left: 1px"></span></div></div>
+<div class="root" id="zero-height-inline-margin"><div class="empty" style="font-size: 0; line-height: 0"><span style="margin-left: 1px"></span></div></div>
+<div class="root" id="zero-height-plain-span"><div class="empty" style="font-size: 0; line-height: 0"><span></span></div></div>
+<div class="root" id="zero-height-block-axis-border"><div class="empty" style="font-size: 0; line-height: 0"><span style="border-top: 1px solid"></span></div></div>
+<div class="root" id="vertical-inline-margin" style="writing-mode: vertical-lr; height: 100px; width: auto"><div style="margin-block: 40px; font-size: 0; line-height: 0"><span style="margin-inline-start: 1px"></span></div></div>
+<div class="root" id="interrupting-empty-block"><div class="empty"><span><div></div></span></div></div>
+<div class="root" id="zero-height-br"><div class="empty" style="font-size: 0; line-height: 0"><br></div></div>
+<script>
+ test(() => {
+ // The top and bottom margins of an empty block collapse through it, so a margin of 40px top and bottom takes
+ // up 40px, wherever the block is, and the margins of empty blocks in a row all collapse together. A line of text,
+ // or one ending with a forced break or holding an inline box with inline-axis margins, padding, or borders, keeps
+ // them apart, even where the line is zero-height.
+ const ids = [
+ "only", "first", "last", "middle", "top-only", "bottom-only", "unequal", "flex", "zero-height-text",
+ "two-empty", "three-empty", "block-then-two-empty", "nested-empty-then-empty", "negative",
+ "zero-height-preserved-newline", "zero-height-br", "zero-height-inline-border",
+ "zero-height-inline-padding", "zero-height-inline-margin", "zero-height-plain-span",
+ "zero-height-block-axis-border", "vertical-inline-margin", "interrupting-empty-block",
+ ];
+ for (const id of ids) {
+ // The block axis of a vertical writing mode is horizontal.
+ const rect = document.getElementById(id).getBoundingClientRect();
+ println(`${id}: ${id.startsWith("vertical-") ? rect.width : rect.height}`);
+ }
+ });
+</script>