Skip to content

Truly independent web browser

LibWeb: Reuse in-flow block layouts whatever margins collapse into them

Aliaksandr Kalenikc03d820cb45a
diff --git a/Libraries/LibWeb/Rust/src/layout/block_formatting_context.rs b/Libraries/LibWeb/Rust/src/layout/block_formatting_context.rs
index ad2d0062f2b..f1120b1960c 100644
--- a/Libraries/LibWeb/Rust/src/layout/block_formatting_context.rs
+++ b/Libraries/LibWeb/Rust/src/layout/block_formatting_context.rs
@@ -557,6 +557,40 @@ impl BlockMarginState {
self.continues_enclosing_margins = false;
}
}
+
+ /// The block-start margin of a block container in this margin state, whose contents collapsed `group` into it.
+ fn block_start_margin_collapsing(&self, group: TopMarginGroup) -> CssPixels {
+ self.margins_since_reset
+ .collapsed_with(group.margins)
+ .collapsed_margin()
+ }
+
+ fn take_own_top_margin_group(&mut self) -> TopMarginGroup {
+ let group = self
+ .top_margin_group
+ .take()
+ .expect("the contents of a box collapse into its own top margin group");
+ debug_assert!(!group.joins_enclosing_group);
+ group
+ }
+
+ /// Makes the margins these contents collapsed into their own block-start margin join the open top margin group of
+ /// the enclosing margin state instead.
+ fn join_enclosing_top_margin_group(&mut self) {
+ self.top_margin_group
+ .as_mut()
+ .expect("the contents of a box collapse into a top margin group")
+ .joins_enclosing_group = true;
+ }
+
+ /// These contents with `own_top_margin_group`, the group they collapsed into their own block-start margin once it
+ /// was resolved, where they have one.
+ fn with_own_top_margin_group(self, own_top_margin_group: Option<TopMarginGroup>) -> Self {
+ Self {
+ top_margin_group: own_top_margin_group.or(self.top_margin_group),
+ ..self
+ }
+ }
}
/// What the probe for a stored in-flow layout found, and what storing the fresh layout needs.
@@ -569,7 +603,6 @@ enum InFlowReuse {
Store {
key: in_flow_block_cache::InFlowBlockKey,
validity: fc_run_cache::FcRunCacheValidity,
- flow_position: CssPixels,
abspos_containing_block_info_contributions_received: u64,
host_findings_noted_so_far: u64,
},
@@ -1053,21 +1086,14 @@ impl<'pass> BlockFormattingContext<'pass> {
}
/// Takes out the top margin group of the innermost margin state, whose margins collapse into the block-start margin
- /// of its block container, and returns that margin, collapsed with the margins before the container.
- fn resolve_own_top_margin_group(&self) -> CssPixels {
+ /// of its block container, and returns it with that margin, collapsed with the margins before the container.
+ fn resolve_own_top_margin_group(&self) -> (TopMarginGroup, CssPixels) {
let mut states = self.margin_states.borrow_mut();
let [.., enclosing, contents] = states.as_mut_slice() else {
panic!("a block container's contents have a margin state of their own");
};
- let group = contents
- .top_margin_group
- .take()
- .expect("the contents of a box collapse into its own top margin group");
- debug_assert!(!group.joins_enclosing_group);
- enclosing
- .margins_since_reset
- .collapsed_with(group.margins)
- .collapsed_margin()
+ let group = contents.take_own_top_margin_group();
+ (group, enclosing.block_start_margin_collapsing(group))
}
#[inline]
@@ -3233,6 +3259,7 @@ impl<'pass> BlockFormattingContext<'pass> {
// NB: A child its own run laid out is placed as that run handed it back, and any other with its cells here.
let mut child_handed_back_by_its_run = None;
let mut laid_out_box_handed_back_by_its_run = None;
+ let mut own_top_margin_group_of_contents = None;
if has_independent_formatting_context {
// Margins of elements that establish new formatting contexts do not collapse with their in-flow children
self.margin_state_mut().reset();
@@ -3366,7 +3393,8 @@ impl<'pass> BlockFormattingContext<'pass> {
self.discard_block_start_margin_of_next_child.set(false);
}
if box_opens_top_margin_group {
- let resolved_margin_top = self.resolve_own_top_margin_group();
+ let (own_top_margin_group, resolved_margin_top) = self.resolve_own_top_margin_group();
+ own_top_margin_group_of_contents = Some(own_top_margin_group);
let final_content_block_offset = if introduced_clearance {
content_block_offset
} else {
@@ -3636,6 +3664,7 @@ impl<'pass> BlockFormattingContext<'pass> {
baselines_of_contents_laid_out_in_this_flow.unwrap_or_default(),
placed.map(|placed| (content_offset, placed)),
depends_on_percentage_block_size,
+ margins_left_by_contents.map(|margins| margins.with_own_top_margin_group(own_top_margin_group_of_contents)),
);
let broken_inside = broken_token_of_box.map(|token| BrokenInside {
token,
@@ -3715,12 +3744,17 @@ impl<'pass> BlockFormattingContext<'pass> {
return InFlowReuse::Ineligible;
}
let callbacks = &self.run.callbacks;
+ let stretch_fit_block_margins = sizing_context::stretch_fit_block_margins(
+ callbacks,
+ node,
+ input.containing_block_constraints.inline_basis(),
+ );
let key = in_flow_block_cache::InFlowBlockKey::new(
&self.run,
input,
block_container_inline_size,
self.style(block_container).direction() == direction::RTL,
- self.margin_state().clone(),
+ stretch_fit_block_margins,
self.outside_marker_line.get(),
);
let validity = fc_run_cache::run_root_validity(callbacks, node);
@@ -3743,7 +3777,6 @@ impl<'pass> BlockFormattingContext<'pass> {
InFlowReuse::Store {
key,
validity,
- flow_position: self.flow_position(),
abspos_containing_block_info_contributions_received: self
.abspos_containing_block_info_contributions_received(),
host_findings_noted_so_far: callbacks.host_findings_noted_so_far(),
@@ -3772,8 +3805,29 @@ impl<'pass> BlockFormattingContext<'pass> {
let node = sized_child.node;
self.run.callbacks.layout_trace().reused_in_flow_subtree(node);
self.cells_laid_out_here(sized_child).set(entry.cells);
- let flow_position = self.flow_position();
- *self.margin_state_mut() = entry.outgoing_margins.clone();
+ let metrics = self.metrics_of(sized_child);
+ // NB: This collapses the margins before the child with those its contents left as laying the child out does,
+ // where the child is not floated, has no clearance and margins do not collapse through it.
+ let mut margins_left_by_contents = entry.margins_left_by_contents.clone();
+ let block_start_margin = {
+ let mut margin_state = self.margin_state_mut();
+ margin_state.add_margin(metrics.margin_top());
+ margin_state.update_open_top_margin_group();
+ if metrics.border_top() > CssPixels::default() || metrics.padding_top() > CssPixels::default() {
+ let margin = margin_state.pending_margin_for_next_box();
+ margin_state.reset();
+ margin
+ } else if margin_state.has_open_top_margin_group() {
+ margins_left_by_contents.join_enclosing_top_margin_group();
+ CssPixels::default()
+ } else {
+ let group = margins_left_by_contents
+ .top_margin_group
+ .take()
+ .expect("the contents of a box collapse into a top margin group");
+ margin_state.block_start_margin_collapsing(group)
+ }
+ };
self.outside_marker_line.set(entry.outgoing_outside_marker_line);
formatting_context::propagate_percentage_block_size_dependency_to_containing_block(
self.run.state,
@@ -3783,8 +3837,8 @@ impl<'pass> BlockFormattingContext<'pass> {
);
let insets = self.compute_inset(&self.run, node, block_container);
let content_offset = FfiCssPixelPoint {
- x: entry.offset_from_flow_position.x,
- y: entry.offset_from_flow_position.y + flow_position,
+ x: entry.content_inline_offset,
+ y: self.flow_position() + block_start_margin + metrics.border_box_top(false),
};
formatting_context::place_child(
&self.run,
@@ -3798,11 +3852,22 @@ impl<'pass> BlockFormattingContext<'pass> {
None,
Some(fragment_tree::RunRootFragment::propagating_nothing(fragment)),
);
- self.block_offset_of_current_block_container
- .set(Some(flow_position + entry.flow_position_advance));
+ self.block_offset_of_current_block_container.set(Some(
+ content_offset.y
+ + metrics.content_block_size()
+ + metrics.border_box_bottom(metrics.uses_collapsing_borders_model()),
+ ));
+ self.collapse_margins_after_block_level_box(
+ Some(&margins_left_by_contents),
+ false,
+ false,
+ metrics.margin_bottom(),
+ );
(
content_offset,
- flow_position + entry.margin_box_bottom_from_flow_position,
+ content_offset.y
+ + metrics.content_block_size()
+ + metrics.margin_box_bottom(metrics.uses_collapsing_borders_model()),
)
}
@@ -3813,12 +3878,12 @@ impl<'pass> BlockFormattingContext<'pass> {
baselines: DerivedBaselines,
placed: Option<(FfiCssPixelPoint, fragment_tree::PlacedFragment)>,
depends_on_percentage_block_size: bool,
+ margins_left_by_contents: Option<BlockMarginState>,
) {
let node = sized_child.node;
let InFlowReuse::Store {
key,
validity,
- flow_position,
abspos_containing_block_info_contributions_received,
host_findings_noted_so_far,
} = attempt
@@ -3846,17 +3911,10 @@ impl<'pass> BlockFormattingContext<'pass> {
validity,
cells: self.metrics_of(sized_child),
baselines,
- offset_from_flow_position: FfiCssPixelPoint {
- x: content_offset.x,
- y: content_offset.y - flow_position,
- },
- flow_position_advance: self.flow_position() - flow_position,
- outgoing_margins: self.margin_state().clone(),
+ content_inline_offset: content_offset.x,
+ margins_left_by_contents: margins_left_by_contents
+ .expect("the contents of an in-flow child collapse their margins in a margin state of their own"),
outgoing_outside_marker_line: self.outside_marker_line.get(),
- margin_box_bottom_from_flow_position: content_offset.y
- + used.content_block_size()
- + used.margin_box_bottom(used.uses_collapsing_borders_model())
- - flow_position,
depends_on_percentage_block_size,
fragment_identity: placed.fragment.identity,
};
diff --git a/Libraries/LibWeb/Rust/src/layout/in_flow_block_cache.rs b/Libraries/LibWeb/Rust/src/layout/in_flow_block_cache.rs
index 9c09ce48b2d..83e5c9d5140 100644
--- a/Libraries/LibWeb/Rust/src/layout/in_flow_block_cache.rs
+++ b/Libraries/LibWeb/Rust/src/layout/in_flow_block_cache.rs
@@ -6,13 +6,15 @@
//! Reuse of an in-flow block-level child of a block formatting context whose subtree did not change, moved to where
//! the flow now puts it. A block container that does not establish a formatting context is laid out inside its
-//! parent's run, so the formatting context run cache cannot see it: besides its layout input, it reads the margins
-//! its preceding siblings left open and the flow position, and it leaves margins and a flow position behind.
+//! parent's run, so the formatting context run cache cannot see it. Its contents collapse their margins in a margin
+//! state of their own, so reuse collapses what they left there with the margins before the box again, as the flow does
+//! after laying them out.
use super::*;
/// Everything the layout of an in-flow block container and its subtree reads from outside that subtree, apart from
-/// the flow position it starts at. Reuse moves the stored layout by the difference in flow position.
+/// the flow position it starts at and the margins before it. Reuse moves the stored layout by the difference in flow
+/// position, and collapses the margins its contents left with those now before it.
///
/// NB: Reuse is exact only while this key covers every such read. A new read of block formatting context or
/// containing block state inside the in-flow child path must be added here. Floats and line clamping read the
@@ -22,7 +24,9 @@ pub(super) struct InFlowBlockKey {
pub(super) input: LayoutInput,
pub(super) containing_block_inline_size: CssPixels,
pub(super) containing_block_is_right_to_left: bool,
- pub(super) incoming_margins: block_formatting_context::BlockMarginState,
+ /// The block margins of the child that stretch-fit sizing subtracts, which it treats as zero on a side where the
+ /// containing block has no border or padding.
+ pub(super) stretch_fit_block_margins: (CssPixels, CssPixels),
pub(super) incoming_outside_marker_line: Option<block_formatting_context::OutsideMarkerLine>,
pub(super) run_root: Node,
pub(super) treat_block_axis_percentage_insets_as_auto_beyond_root: bool,
@@ -36,14 +40,14 @@ impl InFlowBlockKey {
input: LayoutInput,
containing_block_inline_size: CssPixels,
containing_block_is_right_to_left: bool,
- incoming_margins: block_formatting_context::BlockMarginState,
+ stretch_fit_block_margins: (CssPixels, CssPixels),
incoming_outside_marker_line: Option<block_formatting_context::OutsideMarkerLine>,
) -> Self {
Self {
input,
containing_block_inline_size,
containing_block_is_right_to_left,
- incoming_margins,
+ stretch_fit_block_margins,
incoming_outside_marker_line,
run_root: run.box_,
treat_block_axis_percentage_insets_as_auto_beyond_root: run
@@ -57,8 +61,8 @@ impl InFlowBlockKey {
}
}
-/// What the layout of an in-flow block container leaves behind for its parent, relative to the flow position it
-/// started at.
+/// What the layout of an in-flow block container leaves behind for its parent, apart from the flow position it started
+/// at and the margins before it.
#[derive(Clone)]
pub(super) struct InFlowBlockEntry {
pub(super) key: InFlowBlockKey,
@@ -67,11 +71,11 @@ pub(super) struct InFlowBlockEntry {
pub(super) cells: used_values::RootInputCells,
/// The baselines of the child's contents as its layout left them.
pub(super) baselines: formatting_context::DerivedBaselines,
- pub(super) offset_from_flow_position: FfiCssPixelPoint,
- pub(super) flow_position_advance: CssPixels,
- pub(super) outgoing_margins: block_formatting_context::BlockMarginState,
+ /// The inline offset of the child's content box in its containing block.
+ pub(super) content_inline_offset: CssPixels,
+ /// What the child's contents left in their margin state, with the top margin group they collapsed into.
+ pub(super) margins_left_by_contents: block_formatting_context::BlockMarginState,
pub(super) outgoing_outside_marker_line: Option<block_formatting_context::OutsideMarkerLine>,
- pub(super) margin_box_bottom_from_flow_position: CssPixels,
pub(super) depends_on_percentage_block_size: bool,
/// The fragment the stored layout placed. The committed subtree is reused only while it is still that fragment.
pub(super) fragment_identity: u64,
diff --git a/Tests/LibWeb/Text/expected/layout-in-flow-reuse-collapsed-margins.txt b/Tests/LibWeb/Text/expected/layout-in-flow-reuse-collapsed-margins.txt
new file mode 100644
index 00000000000..f653c147539
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/layout-in-flow-reuse-collapsed-margins.txt
@@ -0,0 +1,7 @@
+PASS: a changed margin before a box collapses with the margin of its first child (work + checks)
+PASS: a negative margin before a box collapses with the positive margin of its first child (work + checks)
+PASS: a changed margin of a parent collapses with the margin of its first child (work + checks)
+PASS: a box whose margins start collapsing into its parent's keeps its layout (work + checks)
+PASS: a box whose margins stop collapsing into its parent's keeps its layout (work + checks)
+PASS: a block-start border of its parent makes a stretched box keep its block-start margin (work + checks)
+PASS: a block-end border of its parent makes a stretched box keep its block-end margin (work + checks)
diff --git a/Tests/LibWeb/Text/expected/layout-in-flow-reuse.txt b/Tests/LibWeb/Text/expected/layout-in-flow-reuse.txt
index e6457f4dcac..5096f39cce6 100644
--- a/Tests/LibWeb/Text/expected/layout-in-flow-reuse.txt
+++ b/Tests/LibWeb/Text/expected/layout-in-flow-reuse.txt
@@ -1,5 +1,5 @@
PASS: removing the first list item moves the rest (work + checks)
PASS: editing one paragraph moves the following ones (work + checks)
-PASS: a changed margin before a box makes it lay out again (work + checks)
+PASS: a changed margin before a box moves it without laying it out again (work + checks)
PASS: a float before boxes makes them lay out again (work)
PASS: a box with an abspos descendant positioned by an ancestor is laid out again (work + checks)
diff --git a/Tests/LibWeb/Text/input/layout-in-flow-reuse-collapsed-margins.html b/Tests/LibWeb/Text/input/layout-in-flow-reuse-collapsed-margins.html
new file mode 100644
index 00000000000..413c8862459
--- /dev/null
+++ b/Tests/LibWeb/Text/input/layout-in-flow-reuse-collapsed-margins.html
@@ -0,0 +1,164 @@
+<!DOCTYPE html>
+<script src="include.js"></script>
+<script src="layout-test.js"></script>
+<style>
+ body { margin: 0; font: 10px/10px SerenitySans; }
+ .scenario { display: flow-root; width: 200px; }
+ p { margin: 12px 0; }
+</style>
+<div class="scenario" id="own"><div id="o1">first</div><div id="o2"><p id="o2p">second</p></div><div id="o3">third</div></div>
+<div class="scenario" id="joined"><div id="wrapper"><div id="j1"><p id="j1p">first</p></div><div id="j2">second</div></div></div>
+<div class="scenario" id="switch"><div id="sw"><div id="s0" style="height: 10px"></div><div id="s1"><p id="s1p">first</p></div></div></div>
+<div class="scenario" id="stretch"><div id="stretch-parent" style="height: 100px"><div id="stretched" style="margin: 25px 0; height: stretch"></div></div></div>
+<script>
+ const topIn = (box, scenario) => box.getBoundingClientRect().top - scenario.getBoundingClientRect().top;
+ layoutTest({
+ steps: [
+ {
+ name: "a changed margin before a box collapses with the margin of its first child",
+ mutate: () => {
+ o1.style.marginBottom = "20px";
+ },
+ expect: `
+ layout FULL
+ @viewport/block RUN (cache=bypass)
+ BlockContainer<HTML>/block RUN (cache=miss)
+ BlockContainer<DIV>#own.scenario/block RUN (cache=miss)
+ BlockContainer<DIV>#o2 REUSE IN-FLOW SUBTREE
+ BlockContainer<DIV>#o3 REUSE IN-FLOW SUBTREE
+ BlockContainer<DIV>#joined.scenario/block REUSE SUBTREE
+ BlockContainer<DIV>#switch.scenario/block REUSE SUBTREE
+ BlockContainer<DIV>#stretch.scenario/block REUSE SUBTREE
+ `,
+ check: equal => {
+ equal(topIn(o2, own), 30, "box top");
+ equal(topIn(o2p, own), 30, "first child top");
+ equal(topIn(o3, own), 52, "next box top");
+ },
+ },
+ {
+ name: "a negative margin before a box collapses with the positive margin of its first child",
+ mutate: () => {
+ o1.style.marginBottom = "-5px";
+ },
+ expect: `
+ layout FULL
+ @viewport/block RUN (cache=bypass)
+ BlockContainer<HTML>/block RUN (cache=miss)
+ BlockContainer<DIV>#own.scenario/block RUN (cache=miss)
+ BlockContainer<DIV>#o2 REUSE IN-FLOW SUBTREE
+ BlockContainer<DIV>#o3 REUSE IN-FLOW SUBTREE
+ BlockContainer<DIV>#joined.scenario/block REUSE SUBTREE
+ BlockContainer<DIV>#switch.scenario/block REUSE SUBTREE
+ BlockContainer<DIV>#stretch.scenario/block REUSE SUBTREE
+ `,
+ check: equal => {
+ equal(topIn(o2, own), 17, "box top");
+ equal(topIn(o3, own), 39, "next box top");
+ },
+ },
+ {
+ name: "a changed margin of a parent collapses with the margin of its first child",
+ mutate: () => {
+ wrapper.style.marginTop = "20px";
+ },
+ expect: `
+ layout FULL
+ @viewport/block RUN (cache=bypass)
+ BlockContainer<HTML>/block RUN (cache=miss)
+ BlockContainer<DIV>#own.scenario/block REUSE SUBTREE
+ BlockContainer<DIV>#joined.scenario/block RUN (cache=miss)
+ BlockContainer<DIV>#j1 REUSE IN-FLOW SUBTREE
+ BlockContainer<DIV>#j2 REUSE IN-FLOW SUBTREE
+ BlockContainer<DIV>#switch.scenario/block REUSE SUBTREE
+ BlockContainer<DIV>#stretch.scenario/block REUSE SUBTREE
+ `,
+ check: equal => {
+ equal(topIn(wrapper, joined), 20, "parent top");
+ equal(topIn(j1p, joined), 20, "first child top");
+ equal(topIn(j2, joined), 42, "second child top");
+ },
+ },
+ {
+ name: "a box whose margins start collapsing into its parent's keeps its layout",
+ mutate: () => {
+ s0.style.height = "";
+ },
+ expect: `
+ layout FULL
+ @viewport/block RUN (cache=bypass)
+ BlockContainer<HTML>/block RUN (cache=miss)
+ BlockContainer<DIV>#own.scenario/block REUSE SUBTREE
+ BlockContainer<DIV>#joined.scenario/block REUSE SUBTREE
+ BlockContainer<DIV>#switch.scenario/block RUN (cache=miss)
+ BlockContainer<DIV>#s1 REUSE IN-FLOW SUBTREE
+ BlockContainer<DIV>#stretch.scenario/block REUSE SUBTREE
+ `,
+ check: equal => {
+ equal(topIn(sw, switchScenario()), 12, "parent top");
+ equal(topIn(s1p, switchScenario()), 12, "first child top");
+ },
+ },
+ {
+ name: "a box whose margins stop collapsing into its parent's keeps its layout",
+ mutate: () => {
+ s0.style.height = "10px";
+ },
+ expect: `
+ layout FULL
+ @viewport/block RUN (cache=bypass)
+ BlockContainer<HTML>/block RUN (cache=miss)
+ BlockContainer<DIV>#own.scenario/block REUSE SUBTREE
+ BlockContainer<DIV>#joined.scenario/block REUSE SUBTREE
+ BlockContainer<DIV>#switch.scenario/block RUN (cache=miss)
+ BlockContainer<DIV>#s1 REUSE IN-FLOW SUBTREE
+ BlockContainer<DIV>#stretch.scenario/block REUSE SUBTREE
+ `,
+ check: equal => {
+ equal(topIn(sw, switchScenario()), 0, "parent top");
+ equal(topIn(s1p, switchScenario()), 22, "first child top");
+ },
+ },
+ {
+ name: "a block-start border of its parent makes a stretched box keep its block-start margin",
+ mutate: () => {
+ document.getElementById("stretch-parent").style.borderTop = "5px solid";
+ },
+ expect: `
+ layout FULL
+ @viewport/block RUN (cache=bypass)
+ BlockContainer<HTML>/block RUN (cache=miss)
+ BlockContainer<DIV>#own.scenario/block REUSE SUBTREE
+ BlockContainer<DIV>#joined.scenario/block REUSE SUBTREE
+ BlockContainer<DIV>#switch.scenario/block REUSE SUBTREE
+ BlockContainer<DIV>#stretch.scenario/block RUN (cache=miss)
+ `,
+ check: equal => {
+ equal(stretched.getBoundingClientRect().height, 75, "stretched height");
+ },
+ },
+ {
+ name: "a block-end border of its parent makes a stretched box keep its block-end margin",
+ mutate: () => {
+ document.getElementById("stretch-parent").style.borderBottom = "5px solid";
+ },
+ expect: `
+ layout FULL
+ @viewport/block RUN (cache=bypass)
+ BlockContainer<HTML>/block RUN (cache=miss)
+ BlockContainer<DIV>#own.scenario/block REUSE SUBTREE
+ BlockContainer<DIV>#joined.scenario/block REUSE SUBTREE
+ BlockContainer<DIV>#switch.scenario/block REUSE SUBTREE
+ BlockContainer<DIV>#stretch.scenario/block RUN (cache=miss)
+ `,
+ check: equal => {
+ equal(stretched.getBoundingClientRect().height, 50, "stretched height");
+ },
+ },
+ ],
+ });
+
+ function switchScenario() {
+ return document.getElementById("switch");
+ }
+</script>
diff --git a/Tests/LibWeb/Text/input/layout-in-flow-reuse.html b/Tests/LibWeb/Text/input/layout-in-flow-reuse.html
index bb98586c205..0a7ad624c58 100644
--- a/Tests/LibWeb/Text/input/layout-in-flow-reuse.html
+++ b/Tests/LibWeb/Text/input/layout-in-flow-reuse.html
@@ -27,7 +27,7 @@
@viewport/block RUN (cache=bypass)
BlockContainer<HTML>/block RUN (cache=miss)
BlockContainer<DIV>#list.scenario/block RUN (cache=miss)
- BlockContainer<DIV>.toggle/block REUSE SUBTREE
+ ListItemBox<LI>#li2 REUSE IN-FLOW SUBTREE
ListItemBox<LI>#li3 REUSE IN-FLOW SUBTREE
ListItemBox<LI>#li4 REUSE IN-FLOW SUBTREE
BlockContainer<DIV>#text.scenario/block REUSE SUBTREE
@@ -62,7 +62,7 @@
},
},
{
- name: "a changed margin before a box makes it lay out again",
+ name: "a changed margin before a box moves it without laying it out again",
mutate: () => {
m1.style.marginBottom = "7px";
},
@@ -73,10 +73,12 @@
BlockContainer<DIV>#list.scenario/block REUSE SUBTREE
BlockContainer<DIV>#text.scenario/block REUSE SUBTREE
BlockContainer<DIV>#margins.scenario/block RUN (cache=miss)
+ BlockContainer<DIV>#m2 REUSE IN-FLOW SUBTREE
BlockContainer<DIV>#m3 REUSE IN-FLOW SUBTREE
BlockContainer<DIV>#abspos-scenario.scenario/block REUSE SUBTREE
`,
check: equal => {
+ equal(m2.getBoundingClientRect().top - margins.getBoundingClientRect().top, 17, "box after the margin top");
equal(m3.getBoundingClientRect().top - margins.getBoundingClientRect().top, 27, "last box top");
},
},