Skip to content

Truly independent web browser

LibWeb: Reuse box layouts across multicol balancing rounds

Aliaksandr Kalenik6300251faeef
diff --git a/Libraries/LibWeb/Rust/src/layout/block_formatting_context.rs b/Libraries/LibWeb/Rust/src/layout/block_formatting_context.rs
index 5b1aaea627c..e6a51d58154 100644
--- a/Libraries/LibWeb/Rust/src/layout/block_formatting_context.rs
+++ b/Libraries/LibWeb/Rust/src/layout/block_formatting_context.rs
@@ -34,6 +34,7 @@ enum ColumnExtent {
#[derive(Clone, Copy, PartialEq, Eq)]
enum ColumnLayoutUse {
+ ContentMeasurement,
BalancingProbe,
ContainerContent,
}
@@ -676,6 +677,7 @@ enum InFlowReuse {
in_open_top_margin_group: bool,
introduced_clearance: bool,
containing_block_position_in_root: FfiCssPixelPoint,
+ lowest_column_content_block_end_before_child: Option<CssPixels>,
},
}
@@ -1044,6 +1046,9 @@ pub(crate) struct BlockFormattingContext<'pass> {
laying_out_invisible_line_clamp_content: Cell<bool>,
break_mode: Cell<BreakMode>,
column_inline_items: OnceCell<std::rc::Rc<inline_level_iterator::InlineItemCache>>,
+ column_box_layouts: OnceCell<std::rc::Rc<fragmentation::ColumnBoxLayouts>>,
+ /// The lowest block end in the root, among the contents laid out so far, that a column tests against its own end.
+ lowest_column_content_block_end_in_root: Cell<Option<CssPixels>>,
/// The children of the run's root that its flow laid out, in tree order.
root_flow_children: RefCell<Vec<RootFlowChild>>,
/// The lines laid out in the run's root, which the run finishes once it has sized the root.
@@ -1210,6 +1215,8 @@ impl<'pass> BlockFormattingContext<'pass> {
laying_out_invisible_line_clamp_content: Cell::new(false),
break_mode: Cell::new(BreakMode::AllBreaks),
column_inline_items: OnceCell::new(),
+ column_box_layouts: OnceCell::new(),
+ lowest_column_content_block_end_in_root: Cell::new(None),
root_flow_children: RefCell::new(Vec::new()),
root_lines: RefCell::new(used_values::LineDataState::Empty),
column_early_breaks: RefCell::new(ColumnEarlyBreaks::default()),
@@ -3168,7 +3175,7 @@ impl<'pass> BlockFormattingContext<'pass> {
if baselines_in_containing_block.first.is_some() {
self.outside_marker_line.set(None);
}
- Some(BlockLevelBoxOutcome {
+ let outcome = BlockLevelBoxOutcome {
content_offset,
is_placed: laid_out.content_offset.is_some(),
cells,
@@ -3180,7 +3187,17 @@ impl<'pass> BlockFormattingContext<'pass> {
baselines_in_containing_block,
margin_box_block_end: laid_out.margin_box_block_end,
deferred_legend: laid_out.deferred_legend,
- })
+ };
+ if self.keeps_column_box_layouts() && !self.facts(node).is_floating() {
+ self.note_column_content_block_end(
+ containing_block_position_in_root.y
+ + self.block_offset_adjustment_from_pending_ancestor_block_start_margins(block_container.node)
+ + outcome.content_offset.y
+ + outcome.content_block_size()
+ + outcome.border_box_bottom(),
+ );
+ }
+ Some(outcome)
}
#[allow(clippy::too_many_arguments)]
@@ -3337,6 +3354,7 @@ impl<'pass> BlockFormattingContext<'pass> {
input.clone(),
containing_line_box_fragment,
containing_block_position_in_root,
+ continuation.is_some(),
) {
InFlowReuse::Hit { entry, fragment } => {
let in_open_top_margin_group = self.margin_state().has_open_top_margin_group();
@@ -4083,6 +4101,7 @@ impl<'pass> BlockFormattingContext<'pass> {
placed.map(|placed| (content_offset, placed)),
depends_on_percentage_block_size,
margins_left_by_contents,
+ broken_token_of_box.is_some(),
);
let broken_inside = broken_token_of_box.map(|token| BrokenInside {
token,
@@ -4230,12 +4249,25 @@ impl<'pass> BlockFormattingContext<'pass> {
node: Node,
block_container: Node,
containing_line_box_fragment: Option<used_values::LineBoxFragmentCoordinate>,
+ ) -> bool {
+ self.run.fragmentainer.is_none()
+ && self.run.fragments.is_some()
+ && self.in_flow_child_reads_only_its_key_and_floats_in_any_run(
+ node,
+ block_container,
+ containing_line_box_fragment,
+ )
+ }
+
+ fn in_flow_child_reads_only_its_key_and_floats_in_any_run(
+ &self,
+ node: Node,
+ block_container: Node,
+ containing_line_box_fragment: Option<used_values::LineBoxFragmentCoordinate>,
) -> bool {
let facts = self.facts(node);
let container_facts = self.facts(block_container);
!self.run.pass.reads_no_memoized_layout()
- && self.run.fragmentainer.is_none()
- && self.run.fragments.is_some()
&& !self.run.should_collect_devtools_layout_data
&& containing_line_box_fragment.is_none()
&& !self.is_line_clamp_container
@@ -4293,6 +4325,7 @@ impl<'pass> BlockFormattingContext<'pass> {
})
}
+ #[allow(clippy::too_many_arguments)]
fn probe_in_flow_reuse(
&self,
node: Node,
@@ -4301,7 +4334,42 @@ impl<'pass> BlockFormattingContext<'pass> {
input: LayoutInput,
containing_line_box_fragment: Option<used_values::LineBoxFragmentCoordinate>,
containing_block_position_in_root: FfiCssPixelPoint,
+ continues_from_previous_fragment: bool,
) -> InFlowReuse {
+ if let Some(fragmentainer) = self.run.fragmentainer.as_deref() {
+ if continues_from_previous_fragment
+ || !self.in_flow_child_reads_only_its_key_and_floats_in_any_run(
+ node,
+ block_container,
+ containing_line_box_fragment,
+ )
+ {
+ return InFlowReuse::Ineligible;
+ }
+ let key = self.in_flow_block_key_of(node, block_container, block_container_inline_size, input);
+ let validity = fc_run_cache::run_root_validity(&self.run.pass, node);
+ if fragmentainer.keeps_box_layouts {
+ return self.in_flow_reuse_storing_layout(key, validity, containing_block_position_in_root);
+ }
+ return fragmentainer
+ .box_layouts
+ .layout_of(node)
+ .filter(|layout| {
+ layout.entry.validity == validity
+ && layout.entry.key == key
+ && self.column_box_layout_stays_unbroken_here(
+ node,
+ block_container,
+ fragmentainer,
+ layout,
+ containing_block_position_in_root,
+ )
+ })
+ .map_or(InFlowReuse::Ineligible, |layout| InFlowReuse::Hit {
+ entry: layout.entry.clone(),
+ fragment: layout.fragment.clone(),
+ });
+ }
if !self.in_flow_child_may_be_reused(node, block_container, containing_line_box_fragment) {
return InFlowReuse::Ineligible;
}
@@ -4316,19 +4384,81 @@ impl<'pass> BlockFormattingContext<'pass> {
if let Some((entry, fragment)) = hit {
return InFlowReuse::Hit { entry, fragment };
}
+ self.in_flow_reuse_storing_layout(key, validity, containing_block_position_in_root)
+ }
+
+ fn in_flow_reuse_storing_layout(
+ &self,
+ key: in_flow_block_cache::InFlowBlockKey,
+ validity: fc_run_cache::FcRunCacheValidity,
+ containing_block_position_in_root: FfiCssPixelPoint,
+ ) -> InFlowReuse {
InFlowReuse::Store {
key,
validity,
abspos_containing_block_info_contributions_received: self
.abspos_containing_block_info_contributions_received(),
- host_findings_noted_so_far: pass.host_findings_noted_so_far(),
+ host_findings_noted_so_far: self.run.pass.host_findings_noted_so_far(),
float_reads_before_child: self.float_reads.take(),
float_count_before_child: self.floating_box_count(),
margins_before_box: self.margin_state().margins_since_reset,
in_open_top_margin_group: self.margin_state().has_open_top_margin_group(),
introduced_clearance: false,
containing_block_position_in_root,
+ lowest_column_content_block_end_before_child: self.lowest_column_content_block_end_in_root.take(),
+ }
+ }
+
+ /// Whether placing `layout` at the next position in this flow leaves every block end a column tests in the box
+ /// within this column, with nothing about the start of the column changing how the box lays out.
+ fn column_box_layout_stays_unbroken_here(
+ &self,
+ node: Node,
+ block_container: Node,
+ fragmentainer: &fragmentation::FragmentainerContext,
+ layout: &fragmentation::ColumnBoxLayout,
+ containing_block_position_in_root: FfiCssPixelPoint,
+ ) -> bool {
+ let entry = &layout.entry;
+ if self.discard_block_start_margin_of_next_child.get()
+ || self.margin_state().has_open_top_margin_group()
+ || !self.floats_read_by_contents_still_stand(node, entry, containing_block_position_in_root)
+ {
+ return false;
}
+ self.rebuild_float_bands();
+ let flow_position = self.flow_position();
+ let position_past_floats =
+ self.flow_position_past_floats_cleared_by(node, flow_position, containing_block_position_in_root);
+ let block_start_margin = {
+ let mut margin_state = self.margin_state().clone();
+ let mut margins_left_by_contents = entry.margins_left_by_contents.clone();
+ collapse_block_start_margin_of_reused_child(
+ &mut margin_state,
+ &entry.cells,
+ &mut margins_left_by_contents,
+ position_past_floats.is_some(),
+ )
+ };
+ let border_box_block_start_in_root = containing_block_position_in_root.y
+ + self.block_offset_adjustment_from_pending_ancestor_block_start_margins(block_container)
+ + position_past_floats.unwrap_or(flow_position)
+ + block_start_margin;
+ !fragmentainer.exceeds(border_box_block_start_in_root + layout.block_size_that_stays_unbroken)
+ }
+
+ pub(crate) fn keeps_column_box_layouts(&self) -> bool {
+ self.run
+ .fragmentainer
+ .as_deref()
+ .is_some_and(|fragmentainer| fragmentainer.keeps_box_layouts)
+ }
+
+ pub(crate) fn note_column_content_block_end(&self, block_end_in_root: CssPixels) {
+ let lowest = self.lowest_column_content_block_end_in_root.get();
+ self.lowest_column_content_block_end_in_root.set(Some(
+ lowest.map_or(block_end_in_root, |lowest| lowest.max(block_end_in_root)),
+ ));
}
fn floats_read_by_contents_still_stand(
@@ -4489,7 +4619,7 @@ impl<'pass> BlockFormattingContext<'pass> {
x: entry.content_inline_offset,
y: self.flow_position() + block_start_margin + metrics.border_box_top(false),
};
- // NB: A run that builds no fragments stores and reuses no in-flow layouts.
+ // NB: A balancing probe builds no fragments, so it only finds where the box goes.
let placed = formatting_context::place_child(
&self.run,
node,
@@ -4500,7 +4630,7 @@ impl<'pass> BlockFormattingContext<'pass> {
.with_in_flow_box_insets(insets),
content_offset,
None,
- Some(root),
+ self.run.fragments.is_some().then_some(root),
);
self.append_floating_boxes(
entry
@@ -4584,6 +4714,7 @@ impl<'pass> BlockFormattingContext<'pass> {
.collect()
}
+ #[allow(clippy::too_many_arguments)]
fn conclude_in_flow_reuse(
&self,
attempt: InFlowReuse,
@@ -4592,6 +4723,7 @@ impl<'pass> BlockFormattingContext<'pass> {
placed: Option<(FfiCssPixelPoint, fragment_tree::PlacedFragment)>,
depends_on_percentage_block_size: bool,
margins_left_by_contents: Option<BlockMarginState>,
+ broke_inside: bool,
) {
let node = sized_child.node;
let InFlowReuse::Store {
@@ -4605,10 +4737,15 @@ impl<'pass> BlockFormattingContext<'pass> {
in_open_top_margin_group,
introduced_clearance,
containing_block_position_in_root,
+ lowest_column_content_block_end_before_child,
} = attempt
else {
return;
};
+ let lowest_block_end_of_contents = self.lowest_column_content_block_end_in_root.get();
+ if let Some(block_end) = lowest_column_content_block_end_before_child {
+ self.note_column_content_block_end(block_end);
+ }
let float_reads_of_contents = self.float_reads.get();
// NB: Margins after a closed top margin group stay among the contents of the container whose flow this is.
self.float_reads.set(float_reads_before_child.including(FloatReads {
@@ -4664,6 +4801,29 @@ impl<'pass> BlockFormattingContext<'pass> {
depends_on_percentage_block_size,
fragment_identity: placed.fragment.identity,
};
+ if let Some(fragmentainer) = self.run.fragmentainer.as_deref() {
+ if broke_inside || in_open_top_margin_group {
+ return;
+ }
+ let border_box_block_size = used.border_box_block_size(false);
+ let border_box_block_start_in_root = containing_block_position_in_root.y
+ + self.block_offset_adjustment_from_pending_ancestor_block_start_margins(self.containing_block(node))
+ + content_offset.y
+ - used.border_box_top(false);
+ let block_size_that_stays_unbroken = lowest_block_end_of_contents
+ .map_or(border_box_block_size, |block_end| {
+ (block_end - border_box_block_start_in_root).max(border_box_block_size)
+ });
+ fragmentainer.box_layouts.keep(
+ node,
+ fragmentation::ColumnBoxLayout {
+ entry: std::sync::Arc::new(entry),
+ fragment: placed.fragment,
+ block_size_that_stays_unbroken,
+ },
+ );
+ return;
+ }
let committed_identity = arena.with_current_committed_fragment(node, |fragment| fragment.identity);
self.run
.pass
@@ -5898,7 +6058,7 @@ impl<'pass> BlockFormattingContext<'pass> {
consumed_block_size,
..
} = self.layout_column(
- ColumnLayoutUse::BalancingProbe,
+ ColumnLayoutUse::ContentMeasurement,
column_input.clone(),
ColumnExtent::UntilForcedBreak,
incoming,
@@ -5935,7 +6095,13 @@ impl<'pass> BlockFormattingContext<'pass> {
let mut tried_early_breaks: Vec<Node> = early_break_before.into_iter().collect();
let mut minimal_space_shortage_of_discarded_attempts = None;
let inline_items = self.column_inline_items.get_or_init(Default::default);
+ let box_layouts = self.column_box_layouts.get_or_init(Default::default);
+ // NB: The children of a root with inline children are lines, which leave no box to place in a later pass.
+ let keeps_box_layouts = column_layout_use == ColumnLayoutUse::ContentMeasurement
+ && self.run.fragments.is_some()
+ && !self.facts(self.run.box_).children_are_inline();
let builds_fragments = match column_layout_use {
+ ColumnLayoutUse::ContentMeasurement => keeps_box_layouts,
ColumnLayoutUse::BalancingProbe => false,
ColumnLayoutUse::ContainerContent => self.run.fragments.is_some(),
};
@@ -5950,6 +6116,8 @@ impl<'pass> BlockFormattingContext<'pass> {
honors_forced_breaks,
incoming.clone(),
inline_items.clone(),
+ box_layouts.clone(),
+ keeps_box_layouts,
early_break_before,
allows_early_break_requests,
));
@@ -6607,6 +6775,11 @@ impl<'pass> BlockFormattingContext<'pass> {
let margin_box_rect = floating_box.margin_box_rect_in_root_coordinate_space;
let bottom_margin_edge = margin_box_rect.bottom();
+ if self.keeps_column_box_layouts() {
+ self.note_column_content_block_end(
+ bottom_margin_edge + self.block_offset_adjustment_from_pending_ancestor_block_start_margins(node),
+ );
+ }
if let Some(fragmentainer) = self.run.fragmentainer.as_deref()
&& self.allows_unforced_breaks()
{
diff --git a/Libraries/LibWeb/Rust/src/layout/fragmentation.rs b/Libraries/LibWeb/Rust/src/layout/fragmentation.rs
index 55d7095e18e..c38a9abfa1b 100644
--- a/Libraries/LibWeb/Rust/src/layout/fragmentation.rs
+++ b/Libraries/LibWeb/Rust/src/layout/fragmentation.rs
@@ -221,6 +221,32 @@ pub(crate) struct LineRootFragmentation {
pub(crate) break_before_is_avoided: bool,
}
+/// The layout of a box in the pass that measures the contents of a multicol container, which later passes over the
+/// columns place wherever the box stays unbroken.
+pub(super) struct ColumnBoxLayout {
+ pub(super) entry: std::sync::Arc<in_flow_block_cache::InFlowBlockEntry>,
+ pub(super) fragment: std::sync::Arc<fragment_tree::Fragment>,
+ /// How far a column has to reach below the start of the box's border box for nothing in the box to break.
+ pub(super) block_size_that_stays_unbroken: CssPixels,
+}
+
+#[derive(Default)]
+pub(crate) struct ColumnBoxLayouts {
+ layouts_by_slot: RefCell<HashMap<u32, Rc<ColumnBoxLayout>>>,
+}
+
+impl ColumnBoxLayouts {
+ pub(super) fn keep(&self, node: Node, layout: ColumnBoxLayout) {
+ self.layouts_by_slot
+ .borrow_mut()
+ .insert(node.slot_index(), Rc::new(layout));
+ }
+
+ pub(super) fn layout_of(&self, node: Node) -> Option<Rc<ColumnBoxLayout>> {
+ self.layouts_by_slot.borrow().get(&node.slot_index()).cloned()
+ }
+}
+
#[derive(Clone, Debug, Default)]
pub(crate) struct FragmentainerOutcome {
pub(crate) outgoing: Option<Rc<BlockBreakToken>>,
@@ -236,6 +262,9 @@ pub(crate) struct FragmentainerContext {
pub(crate) honors_forced_breaks: bool,
pub(crate) incoming: Option<Rc<BlockBreakToken>>,
pub(crate) inline_items: Rc<inline_level_iterator::InlineItemCache>,
+ pub(crate) box_layouts: Rc<ColumnBoxLayouts>,
+ /// Whether this run keeps the layouts of its boxes for the passes after it, which place them instead.
+ pub(crate) keeps_box_layouts: bool,
pub(crate) early_break_before: Option<Node>,
pub(crate) allows_early_break_requests: bool,
outcome: RefCell<FragmentainerOutcome>,
@@ -245,11 +274,14 @@ pub(crate) struct FragmentainerContext {
}
impl FragmentainerContext {
+ #[allow(clippy::too_many_arguments)]
pub(crate) fn new(
block_size: Option<CssPixels>,
honors_forced_breaks: bool,
incoming: Option<Rc<BlockBreakToken>>,
inline_items: Rc<inline_level_iterator::InlineItemCache>,
+ box_layouts: Rc<ColumnBoxLayouts>,
+ keeps_box_layouts: bool,
early_break_before: Option<Node>,
allows_early_break_requests: bool,
) -> Self {
@@ -258,6 +290,8 @@ impl FragmentainerContext {
honors_forced_breaks,
incoming,
inline_items,
+ box_layouts,
+ keeps_box_layouts,
early_break_before,
allows_early_break_requests,
outcome: RefCell::new(FragmentainerOutcome::default()),
diff --git a/Libraries/LibWeb/Rust/src/layout/inline_formatting_context.rs b/Libraries/LibWeb/Rust/src/layout/inline_formatting_context.rs
index 89dc3c95f36..e9a056a85f0 100644
--- a/Libraries/LibWeb/Rust/src/layout/inline_formatting_context.rs
+++ b/Libraries/LibWeb/Rust/src/layout/inline_formatting_context.rs
@@ -2621,6 +2621,12 @@ impl<'context> InlineFormattingContext<'context> {
line_builder.update_last_line(false);
}
+ if self.parent.keeps_column_box_layouts()
+ && let Some(last_line) = self.line_data().line_boxes.iter().rfind(|line| !line.is_empty())
+ {
+ self.parent
+ .note_column_content_block_end(self.content_box_position_in_bfc_root().y + last_line.block_end);
+ }
let mut lines_are_fragmented = false;
let mut kept_lines_end = None;
if let Some(fragmentation) = fragmentation {
diff --git a/Tests/LibWeb/Text/expected/multicol-box-reuse-across-rounds.txt b/Tests/LibWeb/Text/expected/multicol-box-reuse-across-rounds.txt
new file mode 100644
index 00000000000..62196c7b7f5
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/multicol-box-reuse-across-rounds.txt
@@ -0,0 +1,3 @@
+list items in a wrapper that crosses every column: wrapper=0 item-0=0 item-1=2 item-2=2 item-3=2 item-4=0 item-5=3 item-6=3 item-7=3 item-8=0 item-9=2 item-10=2 item-11=2
+paragraphs directly in the container: paragraph-0=2 paragraph-1=2 paragraph-2=2 paragraph-3=2 paragraph-4=0 paragraph-5=3 paragraph-6=3 paragraph-7=3 paragraph-8=0 paragraph-9=2 paragraph-10=2 paragraph-11=2
+a box growing changes where the boxes after it land: grown-0=3 grown-1=3 grown-2=3 grown-3=0 grown-4=2 grown-5=2 grown-6=2 grown-7=0 grown-8=2 grown-9=2 grown-10=2 grown-11=2
diff --git a/Tests/LibWeb/Text/expected/multicol-box-reuse-geometry.txt b/Tests/LibWeb/Text/expected/multicol-box-reuse-geometry.txt
new file mode 100644
index 00000000000..a7547f54759
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/multicol-box-reuse-geometry.txt
@@ -0,0 +1,126 @@
+own padding end past the column end after block-in-inline lines, lead 0: height 90: 0,0 200x0 | 0,0 200x30 | 0,30 200x60 | 0,30 40.6875x10 + 0,40 200x10 + 0,50 26.515625x10 | 0,40 200x10 | 210,0 200x40 | 210,40 200x30
+own padding end past the column end after block-in-inline lines, lead 15: height 105: 0,0 200x15 | 0,15 200x30 | 0,45 200x60 | 0,45 40.6875x10 + 0,55 200x10 + 0,65 26.515625x10 | 0,55 200x10 | 210,0 200x40 | 210,40 200x30
+own padding end past the column end after block-in-inline lines, lead 30: height 120: 0,0 200x30 | 0,30 200x30 | 0,60 200x60 | 0,60 40.6875x10 + 0,70 200x10 + 0,80 26.515625x10 | 0,70 200x10 | 210,0 200x40 | 210,40 200x30
+own padding end past the column end after block-in-inline lines, lead 45: height 130: 0,0 200x45 | 0,45 200x30 | 210,0 200x60 | 210,0 40.6875x10 + 210,10 200x10 + 210,20 26.515625x10 | 210,10 200x10 | 210,60 200x40 | 210,100 200x30
+own padding end past the column end after block-in-inline lines, lead 60: height 130: 0,0 200x60 | 0,60 200x30 | 210,0 200x60 | 210,0 40.6875x10 + 210,10 200x10 + 210,20 26.515625x10 | 210,10 200x10 | 210,60 200x40 | 210,100 200x30
+own padding end past the column end after block-in-inline lines, lead 75: height 130: 0,0 200x75 | 0,75 200x30 | 210,0 200x60 | 210,0 40.6875x10 + 210,10 200x10 + 210,20 26.515625x10 | 210,10 200x10 | 210,60 200x40 | 210,100 200x30
+avoid box with overflowing lines after an empty formatting context, lead 0: height 50: 0,0 200x0 | 0,0 200x40 | 0,40 200x0 | 0,40 200x10 | 210,0 200x30
+avoid box with overflowing lines after an empty formatting context, lead 15: height 48: 0,0 200x15 | 0,15 200x32.5 + 210,0 200x7.5 | 210,7.5 200x0 | 210,7.5 200x10 | 210,17.5 200x30
+avoid box with overflowing lines after an empty formatting context, lead 30: height 55: 0,0 200x30 | 0,30 200x25 + 210,0 200x15 | 210,15 200x0 | 210,15 200x10 | 210,25 200x30
+avoid box with overflowing lines after an empty formatting context, lead 45: height 63: 0,0 200x45 | 0,45 200x17.5 + 210,0 200x22.5 | 210,22.5 200x0 | 210,22.5 200x10 | 210,32.5 200x30
+avoid box with overflowing lines after an empty formatting context, lead 60: height 70: 0,0 200x60 | 0,60 200x10 + 210,0 200x30 | 210,30 200x0 | 210,30 200x10 | 210,40 200x30
+avoid box with overflowing lines after an empty formatting context, lead 75: height 78: 0,0 200x75 | 0,75 200x2.5 + 210,0 200x37.5 | 210,37.5 200x0 | 210,37.5 200x10 | 210,47.5 200x30
+clear box with a float and a negative margin, lead 0: height 130: 0,0 30x30 | 0,0 200x0 | 0,0 200x40 | 0,-10 200x10 | 0,-10 30x90 | 0,-10 200x10 | 0,0 200x30
+clear box with a float and a negative margin, lead 15: height 145: 0,0 30x30 | 0,0 200x15 | 0,15 200x40 | 0,5 200x10 | 0,5 30x90 | 0,5 200x10 | 0,15 200x30
+clear box with a float and a negative margin, lead 30: height 160: 0,0 30x30 | 0,0 200x30 | 0,30 200x40 | 0,20 200x10 | 0,20 30x90 | 0,20 200x10 | 0,30 200x30
+clear box with a float and a negative margin, lead 45: height 175: 0,0 30x30 | 0,0 200x45 | 0,45 200x40 | 0,35 200x10 | 0,35 30x90 | 0,35 200x10 | 0,45 200x30
+clear box with a float and a negative margin, lead 60: height 190: 0,0 30x30 | 0,0 200x60 | 0,60 200x40 | 0,50 200x10 | 0,50 30x90 | 0,50 200x10 | 0,60 200x30
+clear box with a float and a negative margin, lead 75: height 205: 0,0 30x30 | 0,0 200x75 | 0,75 200x40 | 0,65 200x10 | 0,65 30x90 | 0,65 200x10 | 0,75 200x30
+float past the end of the box that contains it, lead 0: height 110: 0,0 200x0 | 0,0 200x30 | 0,30 200x20 | 0,30 30x80 | 0,50 200x40 | 0,90 200x20
+float past the end of the box that contains it, lead 15: height 125: 0,0 200x15 | 0,15 200x30 | 0,45 200x20 | 0,45 30x80 | 0,65 200x40 | 0,105 200x20
+float past the end of the box that contains it, lead 30: height 140: 0,0 200x30 | 0,30 200x30 | 0,60 200x20 | 0,60 30x80 | 0,80 200x40 | 0,120 200x20
+float past the end of the box that contains it, lead 45: height 80: 0,0 200x45 | 0,45 200x30 | 210,0 200x20 | 210,0 30x80 | 210,20 200x40 | 210,60 200x20
+float past the end of the box that contains it, lead 60: height 85: 0,0 200x60 | 0,60 200x25 + 210,0 200x5 | 210,5 200x20 | 210,5 30x80 | 210,25 200x40 | 210,65 200x20
+float past the end of the box that contains it, lead 75: height 93: 0,0 200x75 | 0,75 200x17.5 + 210,0 200x12.5 | 210,12.5 200x20 | 210,12.5 30x80 | 210,32.5 200x40 | 210,72.5 200x20
+descendant box past the end of its fixed-height parent, lead 0: height 60: 0,0 200x0 | 0,0 200x30 | 0,30 200x20 + 210,0 200x0 | 0,30 200x30 + 210,0 200x60 | 210,0 200x40 | 210,40 200x20
+descendant box past the end of its fixed-height parent, lead 15: height 70: 0,0 200x15 | 0,15 200x30 | 0,45 200x20 + 210,0 200x0 | 0,45 200x25 + 210,0 200x65 | 210,0 200x40 | 210,40 200x20
+descendant box past the end of its fixed-height parent, lead 30: height 80: 0,0 200x30 | 0,30 200x30 | 0,60 200x20 + 210,0 200x0 | 0,60 200x20 + 210,0 200x70 | 210,0 200x40 | 210,40 200x20
+descendant box past the end of its fixed-height parent, lead 45: height 88: 0,0 200x45 | 0,45 200x30 | 0,75 200x12.5 + 210,0 200x7.5 | 0,75 200x12.5 + 210,0 200x77.5 | 210,7.5 200x40 | 210,47.5 200x20
+descendant box past the end of its fixed-height parent, lead 60: height 90: 0,0 200x60 | 0,60 200x30 | 210,0 200x20 | 210,0 200x90 | 210,20 200x40 | 210,60 200x20
+descendant box past the end of its fixed-height parent, lead 75: height 103: 0,0 200x75 | 0,75 200x27.5 + 210,0 200x2.5 | 210,2.5 200x20 | 210,2.5 200x90 | 210,22.5 200x40 | 210,62.5 200x20
+lines past the end of their fixed-height parent, lead 0: height 80: 0,0 200x0 | 0,0 200x30 | 0,30 200x20 + 210,0 200x0 | 210,0 200x40 | 210,40 200x20
+lines past the end of their fixed-height parent, lead 15: height 85: 0,0 200x15 | 0,15 200x30 | 0,45 200x20 + 210,0 200x0 | 210,0 200x40 | 210,40 200x20
+lines past the end of their fixed-height parent, lead 30: height 90: 0,0 200x30 | 0,30 200x30 | 0,60 200x20 + 210,0 200x0 | 210,0 200x40 | 210,40 200x20
+lines past the end of their fixed-height parent, lead 45: height 100: 0,0 200x45 | 0,45 200x30 | 0,75 200x20 + 210,0 200x0 | 210,0 200x40 | 210,40 200x20
+lines past the end of their fixed-height parent, lead 60: height 110: 0,0 200x60 | 0,60 200x30 | 0,90 200x20 + 210,0 200x0 | 210,0 200x40 | 210,40 200x20
+lines past the end of their fixed-height parent, lead 75: height 120: 0,0 200x75 | 0,75 200x30 | 210,0 200x20 | 210,20 200x40 | 210,60 200x20
+orphans and widows at a moving boundary, lead 0: height 148: 0,0 200x0 | 0,0 200x100 | 0,105 200x42.5 + 210,0 200x40 | 210,45 200x100
+orphans and widows at a moving boundary, lead 15: height 155: 0,0 200x15 | 0,15 200x100 | 0,120 200x35 + 210,0 200x50 | 210,55 200x100
+orphans and widows at a moving boundary, lead 30: height 165: 0,0 200x30 | 0,30 200x100 | 0,135 200x30 + 210,0 200x50 | 210,55 200x100
+orphans and widows at a moving boundary, lead 45: height 180: 0,0 200x45 | 0,45 200x100 | 0,150 200x30 + 210,0 200x50 | 210,55 200x100
+orphans and widows at a moving boundary, lead 60: height 185: 0,0 200x60 | 0,60 200x100 | 210,0 200x80 | 210,85 200x100
+orphans and widows at a moving boundary, lead 75: height 185: 0,0 200x75 | 0,75 200x100 | 210,0 200x80 | 210,85 200x100
+early break before a descendant of a kept box, lead 0: height 110: 0,0 200x0 | 0,0 200x20 | 0,20 200x90 + 210,0 200x20 | 0,20 200x20 | 0,40 200x20 | 0,60 200x50 | 210,0 200x20 | 210,20 200x30
+early break before a descendant of a kept box, lead 15: height 120: 0,0 200x15 | 0,15 200x20 | 0,35 200x85 + 210,0 200x90 | 0,35 200x20 | 210,0 200x20 | 210,20 200x50 | 210,70 200x20 | 210,90 200x30
+early break before a descendant of a kept box, lead 30: height 120: 0,0 200x30 | 0,30 200x20 | 0,50 200x70 + 210,0 200x90 | 0,50 200x20 | 210,0 200x20 | 210,20 200x50 | 210,70 200x20 | 210,90 200x30
+early break before a descendant of a kept box, lead 45: height 103: 0,0 200x45 | 0,45 200x20 | 0,65 200x37.5 + 210,0 200x72.5 | 0,65 200x20 | 0,85 200x17.5 + 210,0 200x2.5 | 210,2.5 200x50 | 210,52.5 200x20 | 210,72.5 200x30
+early break before a descendant of a kept box, lead 60: height 110: 0,0 200x60 | 0,60 200x20 | 0,80 200x30 + 210,0 200x80 | 0,80 200x20 | 0,100 200x10 + 210,0 200x10 | 210,10 200x50 | 210,60 200x20 | 210,80 200x30
+early break before a descendant of a kept box, lead 75: height 118: 0,0 200x75 | 0,75 200x20 | 0,95 200x22.5 + 210,0 200x87.5 | 0,95 200x20 | 0,115 200x2.5 + 210,0 200x17.5 | 210,17.5 200x50 | 210,67.5 200x20 | 210,87.5 200x30
+column spanner between rows, lead 0: height 110: 0,0 200x0 | 0,0 200x40 | 210,0 200x30 | 0,40 410x15 | 0,55 200x30 | 0,90 200x20 + 210,55 200x30 | 210,90 200x0
+column spanner between rows, lead 15: height 125: 0,0 200x15 | 0,15 200x40 | 210,0 200x30 | 0,55 410x15 | 0,70 200x30 | 0,105 200x20 + 210,70 200x30 | 210,105 200x15
+column spanner between rows, lead 30: height 135: 0,0 200x30 | 0,30 200x25 + 210,0 200x20 | 210,25 200x30 | 0,55 410x15 | 0,70 200x30 | 0,105 200x30 + 210,70 200x20 | 210,95 200x30
+column spanner between rows, lead 45: height 150: 0,0 200x45 | 0,45 200x20 + 210,0 200x20 | 210,25 200x30 | 0,65 410x15 | 0,80 200x30 | 0,115 200x35 + 210,80 200x20 | 210,105 200x45
+column spanner between rows, lead 60: height 175: 0,0 200x60 | 210,0 200x40 | 210,45 200x30 | 0,75 410x15 | 0,90 200x30 | 0,125 200x50 | 210,90 200x60
+column spanner between rows, lead 75: height 178: 0,0 200x75 | 210,0 200x40 | 210,45 200x30 | 0,77.5 410x15 | 0,92.5 200x30 | 0,127.5 200x50 | 210,92.5 200x75
+max-height clamps the columns, lead 0: height 70: 0,0 200x70 | 0,0 95x0 | 0,0 95x70 + 105,0 95x50 | 210,0 95x70 + 315,0 95x20 | 315,25 95x45 + 420,0 95x70 + 525,0 95x40 | 525,45 95x25 + 630,0 95x40
+max-height clamps the columns, lead 15: height 70: 0,0 200x70 | 0,0 95x15 | 0,15 95x55 + 105,0 95x70 | 210,0 95x70 + 315,0 95x20 | 315,25 95x45 + 420,0 95x70 + 525,0 95x40 | 525,45 95x25 + 630,0 95x40
+max-height clamps the columns, lead 30: height 70: 0,0 200x70 | 0,0 95x30 | 0,30 95x40 + 105,0 95x70 + 210,0 95x20 | 210,25 95x45 + 315,0 95x50 | 420,0 95x70 + 525,0 95x70 + 630,0 95x20 | 630,25 95x45 + 735,0 95x20
+max-height clamps the columns, lead 45: height 70: 0,0 200x70 | 0,0 95x45 | 0,45 95x25 + 105,0 95x70 + 210,0 95x30 | 210,35 95x35 + 315,0 95x60 | 420,0 95x70 + 525,0 95x70 + 630,0 95x20 | 630,25 95x45 + 735,0 95x20
+max-height clamps the columns, lead 60: height 70: 0,0 200x70 | 0,0 95x60 | 105,0 95x70 + 210,0 95x50 | 315,0 95x70 + 420,0 95x20 | 420,25 95x45 + 525,0 95x70 + 630,0 95x40 | 630,45 95x25 + 735,0 95x40
+max-height clamps the columns, lead 75: height 70: 0,0 200x70 | 0,0 95x70 + 105,0 95x5 | 105,5 95x65 + 210,0 95x60 | 315,0 95x70 + 420,0 95x20 | 420,25 95x45 + 525,0 95x70 + 630,0 95x40 | 630,45 95x25 + 735,0 95x40
+column-fill auto with an indefinite height, lead 0: height 160: 0,0 200x160 | 0,0 95x0 | 0,0 95x90 | 105,0 95x60 | 105,0 95x60 | 105,65 95x90
+column-fill auto with an indefinite height, lead 15: height 160: 0,0 200x160 | 0,0 95x15 | 0,15 95x90 | 105,0 95x60 | 105,0 95x60 | 105,65 95x90
+column-fill auto with an indefinite height, lead 30: height 160: 0,0 200x160 | 0,0 95x30 | 0,30 95x90 | 105,0 95x60 | 105,0 95x60 | 105,65 95x90
+column-fill auto with an indefinite height, lead 45: height 160: 0,0 200x160 | 0,0 95x45 | 0,45 95x90 | 105,0 95x60 | 105,0 95x60 | 105,65 95x90
+column-fill auto with an indefinite height, lead 60: height 160: 0,0 200x160 | 0,0 95x60 | 0,60 95x90 | 105,0 95x60 | 105,0 95x60 | 105,65 95x90
+column-fill auto with an indefinite height, lead 75: height 170: 0,0 200x170 | 0,0 95x75 | 0,75 95x90 | 105,0 95x60 | 105,0 95x60 | 105,65 95x90
+floats beside text across columns, lead 0: height 115: 0,0 200x0 | 0,0 30x35 | 0,0 200x40 | 0,45 200x40 | 0,90 30x25 | 0,90 200x25 + 210,0 200x20 | 210,25 200x50
+floats beside text across columns, lead 15: height 130: 0,0 200x15 | 0,15 30x35 | 0,15 200x40 | 0,60 200x40 | 0,105 30x25 | 0,105 200x25 + 210,0 200x20 | 210,25 200x50
+floats beside text across columns, lead 30: height 145: 0,0 200x30 | 0,30 30x35 | 0,30 200x40 | 0,75 200x40 | 0,120 30x25 | 0,120 200x25 + 210,0 200x20 | 210,25 200x50
+floats beside text across columns, lead 45: height 120: 0,0 200x45 | 0,45 30x35 | 0,45 200x40 | 0,90 200x30 + 210,0 200x20 | 210,25 30x25 | 210,25 200x40 | 210,70 200x50
+floats beside text across columns, lead 60: height 125: 0,0 200x60 | 0,60 30x35 | 0,60 200x40 | 0,105 200x20 + 210,0 200x20 | 210,25 30x25 | 210,25 200x40 | 210,70 200x50
+floats beside text across columns, lead 75: height 140: 0,0 200x75 | 0,75 30x35 | 0,75 200x40 | 0,120 200x20 + 210,0 200x20 | 210,25 30x25 | 210,25 200x40 | 210,70 200x50
+collapsing margins at column starts, lead 0: height 90: 0,0 200x0 | 0,20 200x15 | 0,20 200x15 | 0,55 200x30 | 0,55 200x30 | 210,0 200x25 | 210,0 200x25 | 210,43 200x30
+collapsing margins at column starts, lead 15: height 100: 0,0 200x15 | 0,35 200x15 | 0,35 200x15 | 0,70 200x30 | 0,70 200x30 | 210,0 200x25 | 210,0 200x25 | 210,43 200x30
+collapsing margins at column starts, lead 30: height 115: 0,0 200x30 | 0,50 200x15 | 0,50 200x15 | 0,85 200x30 | 0,85 200x30 | 210,0 200x25 | 210,0 200x25 | 210,43 200x30
+collapsing margins at column starts, lead 45: height 116: 0,0 200x45 | 0,65 200x15 | 0,65 200x15 | 210,0 200x30 | 210,0 200x30 | 210,43 200x25 | 210,43 200x25 | 210,86 200x30
+collapsing margins at column starts, lead 60: height 120: 0,0 200x60 | 0,80 200x15 | 0,80 200x15 | 210,0 200x30 | 210,0 200x30 | 210,43 200x25 | 210,43 200x25 | 210,86 200x30
+collapsing margins at column starts, lead 75: height 128: 0,0 200x75 | 0,95 200x15 | 0,95 200x15 | 210,0 200x30 | 210,0 200x30 | 210,43 200x25 | 210,43 200x25 | 210,86 200x30
+list items with outside markers, lead 0: height 110: 0,0 200x0 | 0,0 200x110 + 210,0 200x100 | 20,0 180x30 | 20,30 180x60 | 20,90 180x20 | 230,0 180x70 | 230,70 180x30
+list items with outside markers, lead 15: height 120: 0,0 200x15 | 0,15 200x105 + 210,0 200x120 | 20,15 180x30 | 20,45 180x60 | 230,0 180x20 | 230,20 180x70 | 230,90 180x30
+list items with outside markers, lead 30: height 120: 0,0 200x30 | 0,30 200x90 + 210,0 200x120 | 20,30 180x30 | 20,60 180x60 | 230,0 180x20 | 230,20 180x70 | 230,90 180x30
+list items with outside markers, lead 45: height 135: 0,0 200x45 | 0,45 200x90 + 210,0 200x120 | 20,45 180x30 | 20,75 180x60 | 230,0 180x20 | 230,20 180x70 | 230,90 180x30
+list items with outside markers, lead 60: height 140: 0,0 200x60 | 0,60 200x80 + 210,0 200x140 | 20,60 180x30 | 20,90 180x50 + 230,0 180x20 | 230,20 180x20 | 230,40 180x70 | 230,110 180x30
+list items with outside markers, lead 75: height 145: 0,0 200x75 | 0,75 200x70 + 210,0 200x140 | 20,75 180x30 | 20,105 180x40 + 230,0 180x20 | 230,20 180x20 | 230,40 180x70 | 230,110 180x30
+wrappers around boxes crossing every column, lead 0: height 115: 0,0 200x115 + 210,0 200x110 | 0,0 200x115 + 210,0 200x110 | 0,0 200x0 | 0,0 200x30 | 0,35 200x40 | 0,80 200x10 | 0,95 200x20 + 210,0 200x30 | 210,35 200x30 | 210,70 200x40
+wrappers around boxes crossing every column, lead 15: height 130: 0,0 200x130 + 210,0 200x110 | 0,0 200x130 + 210,0 200x110 | 0,0 200x15 | 0,15 200x30 | 0,50 200x40 | 0,95 200x10 | 0,110 200x20 + 210,0 200x30 | 210,35 200x30 | 210,70 200x40
+wrappers around boxes crossing every column, lead 30: height 130: 0,0 200x130 + 210,0 200x130 | 0,0 200x130 + 210,0 200x130 | 0,0 200x30 | 0,30 200x30 | 0,65 200x40 | 0,110 200x10 | 210,0 200x50 | 210,55 200x30 | 210,90 200x40
+wrappers around boxes crossing every column, lead 45: height 138: 0,0 200x137.5 + 210,0 200x130 | 0,0 200x137.5 + 210,0 200x130 | 0,0 200x45 | 0,45 200x30 | 0,80 200x40 | 0,125 200x10 | 210,0 200x50 | 210,55 200x30 | 210,90 200x40
+wrappers around boxes crossing every column, lead 60: height 145: 0,0 200x145 + 210,0 200x145 | 0,0 200x145 + 210,0 200x145 | 0,0 200x60 | 0,60 200x30 | 0,95 200x40 | 210,0 200x10 | 210,15 200x50 | 210,70 200x30 | 210,105 200x40
+wrappers around boxes crossing every column, lead 75: height 153: 0,0 200x152.5 + 210,0 200x145 | 0,0 200x152.5 + 210,0 200x145 | 0,0 200x75 | 0,75 200x30 | 0,110 200x40 | 210,0 200x10 | 210,15 200x50 | 210,70 200x30 | 210,105 200x40
+positioned boxes inside kept boxes, lead 0: height 100: 0,0 200x0 | 0,0 200x30 | 0,20 200x30 | 0,20 200x30 | 0,70 200x30 | 0,70 200x30 | 20,70 10x90 | 210,0 200x10 | 210,0 200x10 | 210,15 10x10 | 210,15 200x40
+positioned boxes inside kept boxes, lead 15: height 90: 0,0 200x15 | 0,15 200x30 | 0,35 200x30 | 0,35 200x30 | 210,0 200x30 | 210,0 200x30 | 230,0 10x90 | 210,35 200x10 | 210,35 200x10 | 210,50 10x10 | 210,50 200x40
+positioned boxes inside kept boxes, lead 30: height 98: 0,0 200x30 | 0,30 200x30 | 0,50 200x30 | 0,50 200x30 | 210,0 200x30 | 210,0 200x30 | 230,0 10x90 | 210,35 200x10 | 210,35 200x10 | 210,50 10x10 | 210,50 200x40
+positioned boxes inside kept boxes, lead 45: height 110: 0,0 200x45 | 0,45 200x30 | 0,65 200x30 | 0,65 200x30 | 210,0 200x30 | 210,0 200x30 | 230,0 10x90 | 210,35 200x10 | 210,35 200x10 | 210,50 10x10 | 210,50 200x40
+positioned boxes inside kept boxes, lead 60: height 125: 0,0 200x60 | 0,60 200x30 | 0,80 200x30 | 0,80 200x30 | 210,0 200x30 | 210,0 200x30 | 230,0 10x90 | 210,35 200x10 | 210,35 200x10 | 210,50 10x10 | 210,50 200x40
+positioned boxes inside kept boxes, lead 75: height 125: 0,0 200x75 | 0,75 200x30 | 210,-15 200x30 | 210,-15 200x30 | 210,35 200x30 | 210,35 200x30 | 230,35 10x90 | 210,70 200x10 | 210,70 200x10 | 210,85 10x10 | 210,85 200x40
+forced breaks inside and at the start of kept boxes, lead 0: height 80: 0,0 200x80 + 210,0 200x20 | 0,0 200x20 | 210,0 200x20 | 210,20 200x0 | 210,20 200x30 | 210,20 200x15 | 210,35 200x15 | 420,0 200x30 | 420,35 200x40
+forced breaks inside and at the start of kept boxes, lead 15: height 80: 0,0 200x80 + 210,0 200x20 | 0,0 200x20 | 210,0 200x20 | 210,20 200x15 | 210,35 200x30 | 210,35 200x15 | 210,50 200x15 | 420,0 200x30 | 420,35 200x40
+forced breaks inside and at the start of kept boxes, lead 30: height 80: 0,0 200x80 + 210,0 200x20 | 0,0 200x20 | 210,0 200x20 | 210,20 200x30 | 210,50 200x30 | 210,50 200x15 | 210,65 200x15 | 420,0 200x30 | 420,35 200x40
+forced breaks inside and at the start of kept boxes, lead 45: height 95: 0,0 200x95 + 210,0 200x20 | 0,0 200x20 | 210,0 200x20 | 210,20 200x45 | 210,65 200x30 | 210,65 200x15 | 210,80 200x15 | 420,0 200x30 | 420,35 200x40
+forced breaks inside and at the start of kept boxes, lead 60: height 110: 0,0 200x110 + 210,0 200x20 | 0,0 200x20 | 210,0 200x20 | 210,20 200x60 | 210,80 200x30 | 210,80 200x15 | 210,95 200x15 | 420,0 200x30 | 420,35 200x40
+forced breaks inside and at the start of kept boxes, lead 75: height 125: 0,0 200x125 + 210,0 200x20 | 0,0 200x20 | 210,0 200x20 | 210,20 200x75 | 210,95 200x30 | 210,95 200x15 | 210,110 200x15 | 420,0 200x30 | 420,35 200x40
+boxes beside a float in the measure pass landing in a column without it, lead 0: height 70: 0,0 410x70 | 0,0 200x0 | 0,0 30x80 | 0,0 200x20 | 0,25 200x20 | 0,50 200x20 | 210,0 200x20 | 210,25 200x20 | 210,50 200x20 | 420,0 200x20
+boxes beside a float in the measure pass landing in a column without it, lead 15: height 70: 0,0 410x70 | 0,0 200x15 | 0,15 30x80 | 0,15 200x20 | 0,40 200x20 | 210,0 200x20 | 210,25 200x20 | 210,50 200x20 | 420,0 200x20 | 420,25 200x20
+boxes beside a float in the measure pass landing in a column without it, lead 30: height 70: 0,0 410x70 | 0,0 200x30 | 0,30 30x80 | 0,30 200x20 | 210,0 200x20 | 210,25 200x20 | 210,50 200x20 | 420,0 200x20 | 420,25 200x20 | 420,50 200x20
+boxes beside a float in the measure pass landing in a column without it, lead 45: height 70: 0,0 410x70 | 0,0 200x45 | 0,45 30x80 | 0,45 200x20 | 210,0 200x20 | 210,25 200x20 | 210,50 200x20 | 420,0 200x20 | 420,25 200x20 | 420,50 200x20
+boxes beside a float in the measure pass landing in a column without it, lead 60: height 70: 0,0 410x70 | 0,0 200x60 | 0,60 30x80 | 210,0 200x10 | 210,15 200x20 | 210,40 200x20 | 420,0 200x20 | 420,25 200x20 | 420,50 200x20 | 630,0 200x20
+boxes beside a float in the measure pass landing in a column without it, lead 75: height 70: 0,0 410x70 | 0,0 200x70 + 210,0 200x5 | 210,5 30x80 | 210,5 200x20 | 210,30 200x20 | 420,0 200x20 | 420,25 200x20 | 420,50 200x20 | 630,0 200x20 | 630,25 200x20
+clearance only in the measure pass, lead 0: height 70: 0,0 410x70 | 0,0 30x90 | 0,0 200x70 | 210,0 200x5 | 210,-15 200x10 | 210,-15 30x20 | 210,-15 200x10 | 210,-5 200x20
+clearance only in the measure pass, lead 15: height 70: 0,0 410x70 | 0,0 30x93 | 0,0 200x70 | 210,0 200x5 | 210,-18 200x10 | 210,-18 30x20 | 210,-18 200x10 | 210,-8 200x20
+clearance only in the measure pass, lead 30: height 70: 0,0 410x70 | 0,0 30x96 | 0,0 200x70 | 210,0 200x5 | 210,-21 200x10 | 210,-21 30x20 | 210,-21 200x10 | 210,-11 200x20
+clearance only in the measure pass, lead 45: height 70: 0,0 410x70 | 0,0 30x99 | 0,0 200x70 | 210,0 200x5 | 210,-24 200x10 | 210,-24 30x20 | 210,-24 200x10 | 210,-14 200x20
+clearance only in the measure pass, lead 60: height 70: 0,0 410x70 | 0,0 30x102 | 0,0 200x70 | 210,0 200x5 | 210,-27 200x10 | 210,-27 30x20 | 210,-27 200x10 | 210,-17 200x20
+clearance only in the measure pass, lead 75: height 70: 0,0 410x70 | 0,0 30x105 | 0,0 200x70 | 210,0 200x5 | 210,-30 200x10 | 210,-30 30x20 | 210,-30 200x10 | 210,-20 200x20
+percentage block sizes in a wrapper that breaks, lead 0: height 130: 0,0 200x130 + 210,0 200x110 | 0,0 200x0 | 0,0 200x48 | 0,48 200x72 | 0,120 200x10 + 210,0 200x50 | 210,50 200x24 | 210,110 200x20
+percentage block sizes in a wrapper that breaks, lead 15: height 130: 0,0 200x130 + 210,0 200x110 | 0,0 200x15 | 0,15 200x48 | 0,63 200x67 + 210,0 200x5 | 210,5 200x60 | 210,65 200x24 | 210,110 200x20
+percentage block sizes in a wrapper that breaks, lead 30: height 130: 0,0 200x130 + 210,0 200x110 | 0,0 200x30 | 0,30 200x48 | 0,78 200x52 + 210,0 200x20 | 210,20 200x60 | 210,80 200x24 | 210,110 200x20
+percentage block sizes in a wrapper that breaks, lead 45: height 130: 0,0 200x130 + 210,0 200x110 | 0,0 200x45 | 0,45 200x48 | 0,93 200x37 + 210,0 200x35 | 210,35 200x60 | 210,95 200x24 | 210,110 200x20
+percentage block sizes in a wrapper that breaks, lead 60: height 134: 0,0 200x134 + 210,0 200x106 | 0,0 200x60 | 0,60 200x48 | 0,108 200x26 + 210,0 200x46 | 210,46 200x60 | 210,106 200x24 | 210,106 200x20
+percentage block sizes in a wrapper that breaks, lead 75: height 149: 0,0 200x149 + 210,0 200x91 | 0,0 200x75 | 0,75 200x48 | 0,123 200x26 + 210,0 200x46 | 210,46 200x60 | 210,106 200x24 | 210,91 200x20
+empty boxes and size containment, lead 0: height 82: 0,0 200x0 | 0,7 200x0 | 0,7 200x30 | 0,42 200x40 | 0,82 200x0 | 210,0 200x40 | 210,45 200x15 | 210,60 200x10
+empty boxes and size containment, lead 15: height 97: 0,0 200x15 | 0,22 200x0 | 0,22 200x30 | 0,57 200x40 | 0,97 200x0 | 210,0 200x40 | 210,45 200x15 | 210,60 200x10
+empty boxes and size containment, lead 30: height 110: 0,0 200x30 | 0,37 200x0 | 0,37 200x30 | 210,0 200x40 | 210,40 200x0 | 210,40 200x40 | 210,85 200x15 | 210,100 200x10
+empty boxes and size containment, lead 45: height 110: 0,0 200x45 | 0,52 200x0 | 0,52 200x30 | 210,0 200x40 | 210,40 200x0 | 210,40 200x40 | 210,85 200x15 | 210,100 200x10
+empty boxes and size containment, lead 60: height 110: 0,0 200x60 | 0,67 200x0 | 0,67 200x30 | 210,0 200x40 | 210,40 200x0 | 210,40 200x40 | 210,85 200x15 | 210,100 200x10
+empty boxes and size containment, lead 75: height 116: 0,0 200x75 | 0,82 200x0 | 0,82 200x30 | 210,0 200x40 | 210,40 200x0 | 210,40 200x40 | 210,85 200x15 | 210,100 200x10
diff --git a/Tests/LibWeb/Text/input/multicol-box-reuse-across-rounds.html b/Tests/LibWeb/Text/input/multicol-box-reuse-across-rounds.html
new file mode 100644
index 00000000000..b375b5f30c9
--- /dev/null
+++ b/Tests/LibWeb/Text/input/multicol-box-reuse-across-rounds.html
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<script src="include.js"></script>
+<script src="layout-test.js"></script>
+<style>
+ body { margin: 0; font: 10px/10px SerenitySans; }
+ .list { columns: 3; column-gap: 10px; width: 310px; }
+ ol { margin: 0; padding: 0 0 0 20px; }
+ p { margin: 0 0 5px; }
+</style>
+<div class="list" id="in-wrapper"></div>
+<div class="list" id="direct"></div>
+<div class="list" id="grows"></div>
+<script>
+ const words = count => Array.from({ length: count }, (_, index) => `word${index}`).join(" ");
+ const lengths = [12, 24, 6, 18, 30, 12, 6, 24, 18, 12, 30, 6];
+
+ promiseTest(async () => {
+ if (document.readyState !== "complete") {
+ await new Promise(resolve => window.addEventListener("load", resolve, { once: true }));
+ }
+ await document.fonts.ready;
+ const byId = id => document.getElementById(id);
+ byId("in-wrapper").innerHTML = `<ol id="wrapper">${lengths.map((length, index) => `<li id="item-${index}">${words(length)}</li>`).join("")}</ol>`;
+ byId("direct").innerHTML = lengths.map((length, index) => `<p id="paragraph-${index}">${words(length)}</p>`).join("");
+ byId("grows").innerHTML = lengths.map((length, index) => `<p id="grown-${index}">${words(length)}</p>`).join("");
+
+ const output = [];
+ const report = (name, work, watchedIds) => {
+ const replays = id => work.events.filter(event => event.event === "reuse in-flow subtree" && event.box.endsWith(`#${id}`)).length;
+ output.push(`${name}: ${watchedIds.map(id => `${id}=${replays(id)}`).join(" ")}`);
+ };
+ const ids = prefix => lengths.map((_, index) => `${prefix}-${index}`);
+
+ report("list items in a wrapper that crosses every column", layoutWork(() => {
+ byId("in-wrapper").style.width = "340px";
+ }), ["wrapper", ...ids("item")]);
+ report("paragraphs directly in the container", layoutWork(() => {
+ byId("direct").style.width = "340px";
+ }), ids("paragraph"));
+ report("a box growing changes where the boxes after it land", layoutWork(() => {
+ byId("grown-1").firstChild.data = words(60);
+ }), ids("grown"));
+
+ output.forEach(line => println(line));
+ });
+</script>
diff --git a/Tests/LibWeb/Text/input/multicol-box-reuse-geometry.html b/Tests/LibWeb/Text/input/multicol-box-reuse-geometry.html
new file mode 100644
index 00000000000..72a12b0da2b
--- /dev/null
+++ b/Tests/LibWeb/Text/input/multicol-box-reuse-geometry.html
@@ -0,0 +1,90 @@
+<!DOCTYPE html>
+<script src="include.js"></script>
+<style>
+ body { margin: 0; font: 10px/10px SerenitySans; }
+ p { margin: 0 0 5px; }
+ .case { columns: 2; column-gap: 10px; width: 410px; margin-bottom: 20px; }
+ .left { float: left; width: 30px; }
+</style>
+<div id="cases"></div>
+<script>
+ const words = count => Array.from({ length: count }, (_, index) => `word${index}`).join(" ");
+ const block = height => `<div style="height: ${height}px"></div>`;
+ const lines = count => `<p>${words(count * 6)}</p>`;
+
+ const scenarios = {
+ "own padding end past the column end after block-in-inline lines": lead =>
+ `${block(lead)}${block(30)}<div style="padding-bottom: 30px"><span>one two<div style="height: 10px"></div>three</span></div>${block(40)}${block(30)}`,
+ "avoid box with overflowing lines after an empty formatting context": lead =>
+ `${block(lead)}${block(40)}<div style="overflow: hidden; height: 0"></div><div style="break-inside: avoid; height: 10px">${words(120)}</div>${block(30)}`,
+ "clear box with a float and a negative margin": lead =>
+ `<div class="left" style="height: 30px"></div>${block(lead)}${block(40)}<div style="clear: both"><div class="left" style="height: 90px"></div><div style="margin-top: -50px; height: 10px"></div></div>${block(30)}`,
+ "float past the end of the box that contains it": lead =>
+ `${block(lead)}${block(30)}<div style="height: 20px"><div class="left" style="height: 80px"></div></div>${block(40)}${block(20)}`,
+ "descendant box past the end of its fixed-height parent": lead =>
+ `${block(lead)}${block(30)}<div style="height: 20px"><div style="height: 90px"></div></div>${block(40)}${block(20)}`,
+ "lines past the end of their fixed-height parent": lead =>
+ `${block(lead)}${block(30)}<div style="height: 20px">${words(60)}</div>${block(40)}${block(20)}`,
+ "orphans and widows at a moving boundary": lead =>
+ `${block(lead)}<p style="orphans: 3; widows: 3">${words(50)}</p><p style="orphans: 3; widows: 3">${words(40)}</p><p style="orphans: 3; widows: 3">${words(50)}</p>`,
+ "early break before a descendant of a kept box": lead =>
+ `${block(lead)}${block(20)}<div>${block(20)}<div style="break-after: avoid; height: 20px"></div><div style="break-inside: avoid; height: 50px"></div>${block(20)}</div>${block(30)}`,
+ "column spanner between rows": lead =>
+ `${block(lead)}${lines(3)}${lines(2)}<div style="column-span: all; height: 15px"></div>${lines(2)}${lines(4)}${block(lead)}`,
+ "max-height clamps the columns": lead =>
+ `<div style="columns: 2; column-gap: 10px; max-height: 70px">${block(lead)}${lines(4)}${lines(3)}${lines(5)}${lines(2)}</div>`,
+ "column-fill auto with an indefinite height": lead =>
+ `<div style="column-fill: auto; columns: 2">${block(lead)}${lines(3)}<div style="break-before: column">${lines(2)}</div>${lines(3)}</div>`,
+ "floats beside text across columns": lead =>
+ `${block(lead)}<div class="left" style="height: 35px"></div>${lines(3)}${lines(3)}<div class="left" style="height: 25px"></div>${lines(3)}${lines(4)}`,
+ "collapsing margins at column starts": lead =>
+ `${block(lead)}<div style="margin: 12px 0"><div style="margin: 20px 0; height: 15px"></div></div><div style="margin: 6px 0">${lines(2)}</div><div style="margin: 18px 0"><div style="margin-top: -5px; height: 25px"></div></div><div style="margin: 9px 0; height: 30px"></div>`,
+ "list items with outside markers": lead =>
+ `${block(lead)}<ol style="margin: 0; padding-left: 20px"><li>${words(12)}</li><li>${words(24)}</li><li>${words(6)}</li><li>${words(30)}</li><li>${words(12)}</li></ol>`,
+ "wrappers around boxes crossing every column": lead =>
+ `<div><div>${block(lead)}${lines(2)}${lines(3)}${lines(1)}${lines(4)}${lines(2)}${lines(3)}</div></div>`,
+ "positioned boxes inside kept boxes": lead =>
+ `${block(lead)}${lines(2)}<div style="position: relative; top: -15px">${lines(2)}</div><div style="position: relative">${lines(2)}<div style="position: absolute; top: 0; left: 20px; width: 10px; height: 90px"></div></div><div>${lines(1)}<div style="position: absolute; width: 10px; height: 10px"></div></div>${lines(3)}`,
+ "forced breaks inside and at the start of kept boxes": lead =>
+ `<div>${block(20)}<div style="break-before: column; height: 20px"></div></div>${block(lead)}<div>${block(15)}<div style="break-after: column; height: 15px"></div></div>${lines(2)}${lines(3)}`,
+ "boxes beside a float in the measure pass landing in a column without it": lead =>
+ `<div style="columns: 2; column-gap: 10px; width: 410px; max-height: 70px">${block(lead)}<div class="left" style="height: 80px"></div>${lines(1)}<p>${words(8)}</p><p>${words(8)}</p><p>${words(8)}</p><p>${words(8)}</p><p>${words(8)}</p><p>${words(8)}</p></div>`,
+ "clearance only in the measure pass": lead =>
+ `<div style="columns: 2; column-gap: 10px; width: 410px; max-height: 70px"><div class="left" style="height: ${90 + lead / 5}px"></div>${block(70)}${block(5)}<div style="clear: both"><div class="left" style="height: 20px"></div><div style="margin-top: ${-20 - lead / 5}px; height: 10px"></div></div>${block(20)}</div>`,
+ "percentage block sizes in a wrapper that breaks": lead =>
+ `<div style="height: 240px">${block(lead)}<div style="height: 20%"></div><div style="height: 30%"></div><div style="height: 25%"></div><div style="height: 10%"></div></div>${block(20)}`,
+ "empty boxes and size containment": lead =>
+ `${block(lead)}<div style="margin: 7px 0"></div>${lines(2)}<div style="contain: size; height: 40px">${words(60)}</div><div></div>${lines(3)}<div style="contain: size; height: 15px"></div>${lines(1)}`,
+ };
+
+ promiseTest(async () => {
+ if (document.readyState !== "complete") {
+ await new Promise(resolve => window.addEventListener("load", resolve, { once: true }));
+ }
+ await document.fonts.ready;
+
+ const cases = document.getElementById("cases");
+ const built = [];
+ for (const [name, contents] of Object.entries(scenarios)) {
+ for (const lead of [0, 15, 30, 45, 60, 75]) {
+ const container = document.createElement("div");
+ container.className = "case";
+ container.innerHTML = contents(lead);
+ cases.append(container);
+ built.push({ name, lead, container });
+ }
+ }
+
+ const rectsIn = (element, origin) =>
+ [...element.getClientRects()]
+ .map(rect => `${rect.x - origin.x},${rect.y - origin.y} ${rect.width}x${rect.height}`)
+ .join(" + ");
+ const output = built.map(({ name, lead, container }) => {
+ const origin = container.getBoundingClientRect();
+ const boxes = [...container.querySelectorAll("*")].map(element => rectsIn(element, origin));
+ return `${name}, lead ${lead}: height ${container.offsetHeight}: ${boxes.join(" | ")}`;
+ });
+ cases.remove();
+ output.forEach(line => println(line));
+ });
+</script>