Skip to content

Truly independent web browser

LibWeb: Finish a run root's box at the end of its run

Aliaksandr Kalenikf6e99c67486c
diff --git a/Libraries/LibWeb/Rust/src/layout/fc_run_cache.rs b/Libraries/LibWeb/Rust/src/layout/fc_run_cache.rs
index ac7c3221586..b3165176fb3 100644
--- a/Libraries/LibWeb/Rust/src/layout/fc_run_cache.rs
+++ b/Libraries/LibWeb/Rust/src/layout/fc_run_cache.rs
@@ -27,6 +27,8 @@ pub(crate) struct RunInputsTheStoredRunNeverObserved {
pub(super) percentage_inline_basis: bool,
pub(super) own_block_size: formatting_context::OwnBlockSizeObservation,
pub(super) inline_space_around_root: bool,
+ /// The block size an item's root adopts at the end of a run whose contents never read it.
+ pub(super) content_block_size_adopted_after_run: bool,
}
impl RunInputsTheStoredRunNeverObserved {
@@ -47,12 +49,14 @@ impl RunInputsTheStoredRunNeverObserved {
percentage_inline_basis,
own_block_size,
inline_space_around_root,
+ content_block_size_adopted_after_run,
} = self;
percentage_block_basis_and_block_size_definiteness
|| definite_available_inline_sizes_at_or_above.is_some()
|| percentage_inline_basis
|| own_block_size != formatting_context::OwnBlockSizeObservation::Observed
|| inline_space_around_root
+ || content_block_size_adopted_after_run
}
fn available_block_size_definiteness(self) -> bool {
@@ -101,10 +105,6 @@ impl FcRunCacheKey {
mut input: LayoutInput,
root_cells: used_values::RootInputCells,
) -> Self {
- if !formatting_context::run_reads_content_block_size_adopted_after_it(fc_type, &input) {
- input.sizing.adopt_automatic_content_block_size = false;
- input.sizing.content_block_size_after_inside_layout = None;
- }
// NB: The parent block formatting context sizes a float against its containing block position before the
// run and places it after. The run lays the float out from its own origin.
if let ParticipationInParentFormattingContext::Float {
@@ -215,6 +215,7 @@ fn layout_inputs_match_ignoring_unobserved(
&b.sizing,
unobserved.available_block_size_definiteness(),
unobserved.inline_space_around_root,
+ unobserved.content_block_size_adopted_after_run,
)
}
@@ -223,6 +224,7 @@ fn sizing_directives_match_ignoring_unobserved(
b: &RootSizingDirectives,
block_size_definiteness_unobserved: bool,
float_avoidance_inline_size_unobserved: bool,
+ content_block_size_adopted_after_run_unobserved: bool,
) -> bool {
let RootSizingDirectives {
forced_content_inline_size,
@@ -249,9 +251,10 @@ fn sizing_directives_match_ignoring_unobserved(
&& block_parent_resolved_content_inline_size == b.block_parent_resolved_content_inline_size
&& table_cell_intrinsic_block_padding == b.table_cell_intrinsic_block_padding
&& table_box_content_block_offset_in_wrapper == b.table_box_content_block_offset_in_wrapper
- && adopt_automatic_content_block_size == b.adopt_automatic_content_block_size
+ && ((adopt_automatic_content_block_size == b.adopt_automatic_content_block_size
+ && content_block_size_after_inside_layout == b.content_block_size_after_inside_layout)
+ || content_block_size_adopted_after_run_unobserved)
&& finds_automatic_line_clamp_lines == b.finds_automatic_line_clamp_lines
- && content_block_size_after_inside_layout == b.content_block_size_after_inside_layout
&& (float_avoidance_inline_size == b.float_avoidance_inline_size || float_avoidance_inline_size_unobserved)
&& outer_float_intrusion_before_list_item_children == b.outer_float_intrusion_before_list_item_children
&& treat_block_axis_percentage_insets_as_auto_beyond_root
@@ -296,7 +299,6 @@ pub(super) struct FcRunCacheEntry {
/// Whether the run is a table cell's that did not observe the intrinsic block padding its table hands it (see
/// run_observes_root_block_padding), so that it stands for runs with any such padding.
table_cell_intrinsic_block_padding_unobserved: bool,
- root_content_block_size_adopted_after_run: Option<CssPixels>,
/// How many layouts the arena had committed when the run was stored. The subtrees the run took from the cache as
/// they were committed are only known to be so while no layout was committed since.
layout_commits_when_stored: u64,
@@ -352,8 +354,13 @@ impl FcRunCacheEntry {
Some(cells) => (cells.content_inline_size, cells.content_block_size),
None => (
self.key.root_cells.content_inline_size,
- self.root_content_block_size_adopted_after_run
- .unwrap_or(self.key.root_cells.content_block_size),
+ formatting_context::content_block_size_adopted_after_run(
+ &self.key.input,
+ self.outputs.result.automatic_content_block_size,
+ )
+ .map_or(self.key.root_cells.content_block_size, |block_size| {
+ clamp_to_max_dimension_value(block_size.max(CssPixels::default()))
+ }),
),
}
}
@@ -376,7 +383,6 @@ impl FcRunCacheEntry {
validity: self.validity,
outputs: outputs_without_descendant_fragments(&self.outputs),
table_cell_intrinsic_block_padding_unobserved: self.table_cell_intrinsic_block_padding_unobserved,
- root_content_block_size_adopted_after_run: self.root_content_block_size_adopted_after_run,
layout_commits_when_stored: self.layout_commits_when_stored,
committed_subtree_token_when_descendants_dropped: Some(token),
last_used_at_layout_commit: std::sync::atomic::AtomicU64::new(self.last_used_at_layout_commit()),
@@ -391,6 +397,7 @@ impl FcRunCacheEntry {
root_outcome: self.outputs.root_outcome.clone(),
inputs_never_observed: self.outputs.inputs_never_observed,
host_findings: self.outputs.host_findings.clone(),
+ laid_out_abspos_contained_by_root: self.outputs.laid_out_abspos_contained_by_root,
}
}
@@ -487,6 +494,7 @@ fn outputs_without_descendant_fragments(outputs: &formatting_context::RunOutputs
root_outcome: outputs.root_outcome.clone(),
inputs_never_observed: outputs.inputs_never_observed,
host_findings: outputs.host_findings.clone(),
+ laid_out_abspos_contained_by_root: outputs.laid_out_abspos_contained_by_root,
}
}
@@ -905,14 +913,8 @@ impl FcRunCacheAttempt {
callbacks: &LayoutPass<'_>,
box_: Node,
key: FcRunCacheKey,
- input: &LayoutInput,
outputs: &formatting_context::RunOutputs,
) {
- let root_content_block_size_adopted_after_run = formatting_context::content_block_size_adopted_after_run(
- input,
- outputs.result.automatic_content_block_size,
- )
- .map(|block_size| clamp_to_max_dimension_value(block_size.max(CssPixels::default())));
let store = callbacks.fc_run_cache_store();
let (validity, structurally_damaged_entry) = match self {
Self::Bypass => return,
@@ -925,7 +927,6 @@ impl FcRunCacheAttempt {
validity,
outputs: outputs.clone(),
table_cell_intrinsic_block_padding_unobserved: false,
- root_content_block_size_adopted_after_run,
layout_commits_when_stored: callbacks.arena().layout_commit_count(),
committed_subtree_token_when_descendants_dropped: None,
last_used_at_layout_commit: std::sync::atomic::AtomicU64::new(
@@ -963,7 +964,6 @@ impl FcRunCacheAttempt {
.is_some()
&& outputs.root_outcome.parent_owns_root_input_cells()
&& !run_observes_root_block_padding(callbacks, box_, outputs),
- root_content_block_size_adopted_after_run,
layout_commits_when_stored: callbacks.arena().layout_commit_count(),
committed_subtree_token_when_descendants_dropped: None,
last_used_at_layout_commit: std::sync::atomic::AtomicU64::new(callbacks.arena().layout_commit_count()),
@@ -1016,9 +1016,10 @@ pub(super) fn can_describe_run(
/// Whether a run's outputs may depend on its root's block paddings. They hold the content in content box coordinates,
/// so they stand for the same run at other block paddings unless the root is a scroll container, whose scrollable
-/// overflow area is bounded by its padding box, places a rendered legend on its border box, or passes payloads on to
-/// its ancestors (out-of-flow descendants, their containing block rects, anchors), which are placed against its
-/// padding box. Outputs without a root fragment cannot show those payloads.
+/// overflow area is bounded by its padding box, places a rendered legend on its border box, lays out absolutely
+/// positioned boxes against its padding box, or passes payloads on to its ancestors (out-of-flow descendants, their
+/// containing block rects, anchors), which are placed against its padding box. Outputs without a root fragment cannot
+/// show those payloads.
pub(super) fn run_observes_root_block_padding(
callbacks: &LayoutPass<'_>,
box_: Node,
@@ -1028,6 +1029,7 @@ pub(super) fn run_observes_root_block_padding(
let places_rendered_legend_on_its_border_box = facts.is_fieldset_box() && !facts.rendered_legend().is_invalid();
facts.is_scroll_container()
|| places_rendered_legend_on_its_border_box
+ || outputs.laid_out_abspos_contained_by_root
|| outputs.root.as_ref().is_none_or(|root| !root.propagates_nothing())
}
@@ -1107,9 +1109,9 @@ mod tests {
..RunInputsTheStoredRunNeverObserved::default()
},
host_findings: None,
+ laid_out_abspos_contained_by_root: false,
},
table_cell_intrinsic_block_padding_unobserved: false,
- root_content_block_size_adopted_after_run: None,
layout_commits_when_stored: layout_commit_count,
committed_subtree_token_when_descendants_dropped: None,
last_used_at_layout_commit: std::sync::atomic::AtomicU64::new(layout_commit_count),
@@ -1386,7 +1388,7 @@ mod tests {
}
#[test]
- fn item_keys_leave_out_the_block_size_adopted_after_the_run_unless_the_run_reads_it() {
+ fn an_item_run_that_never_read_the_block_size_its_root_adopts_matches_at_another() {
let root_cells = used_values::RootInputCells::default();
let item_input = LayoutInput::new(
AvailableSpace {
@@ -1396,22 +1398,21 @@ mod tests {
ContainingBlockConstraints::default(),
ParticipationInParentFormattingContext::Item,
);
- let key_of = |fc_type, input| FcRunCacheKey::new(fc_type, input, root_cells);
- let stored_block_key = key_of(formatting_context::FormattingContextType::Block, item_input);
- let stored_flex_key = key_of(formatting_context::FormattingContextType::Flex, item_input);
+ let key_of = |input| FcRunCacheKey::new(formatting_context::FormattingContextType::Block, input, root_cells);
+ let stored = key_of(item_input);
let mut adopting_input = item_input;
adopting_input.sizing.adopt_automatic_content_block_size = true;
adopting_input.sizing.content_block_size_after_inside_layout = Some(px(40));
+ let probe = key_of(adopting_input);
- let exact = RunInputsTheStoredRunNeverObserved::default();
- assert!(stored_block_key.matches(
- &key_of(formatting_context::FormattingContextType::Block, adopting_input),
- exact
- ));
- assert!(!stored_flex_key.matches(
- &key_of(formatting_context::FormattingContextType::Flex, adopting_input),
- exact
+ assert!(!stored.matches(&probe, RunInputsTheStoredRunNeverObserved::default()));
+ assert!(stored.matches(
+ &probe,
+ RunInputsTheStoredRunNeverObserved {
+ content_block_size_adopted_after_run: true,
+ ..RunInputsTheStoredRunNeverObserved::default()
+ }
));
}
diff --git a/Libraries/LibWeb/Rust/src/layout/formatting_context.rs b/Libraries/LibWeb/Rust/src/layout/formatting_context.rs
index 7e2ccf97f69..2742b19bc49 100644
--- a/Libraries/LibWeb/Rust/src/layout/formatting_context.rs
+++ b/Libraries/LibWeb/Rust/src/layout/formatting_context.rs
@@ -1091,6 +1091,9 @@ pub(crate) struct RunOutputs {
pub(crate) inputs_never_observed: fc_run_cache::RunInputsTheStoredRunNeverObserved,
/// Boxed, as most runs find out nothing for the host.
pub(crate) host_findings: Option<Box<super::run_state::HostFindings>>,
+ /// Whether the run laid out absolutely positioned boxes against the final sizes and box sides of its root, which
+ /// its outputs then depend on.
+ pub(crate) laid_out_abspos_contained_by_root: bool,
}
pub(crate) enum ChildLayoutOutcome {
@@ -1361,6 +1364,7 @@ impl<'pass> FormattingContextRun<'pass> {
root_outcome,
inputs_never_observed,
host_findings: self.state.take_host_findings(),
+ laid_out_abspos_contained_by_root: false,
}
}
}
@@ -2134,7 +2138,7 @@ pub(super) fn run_formatting_context(
},
);
}
- cache_attempt.conclude(&callbacks, box_, cache_key, &input, &outputs);
+ cache_attempt.conclude(&callbacks, box_, cache_key, &outputs);
child_run_outcome_from_outputs(
&callbacks,
parent_fragments,
@@ -2297,9 +2301,7 @@ fn execute_formatting_context_run(
root_input_cells_the_run_must_leave.has_definite_inline_size = true;
root_input_cells_the_run_must_leave.has_definite_block_size = true;
}
- if run_reads_content_block_size_adopted_after_it(fc_type, &input)
- && content_block_size_adopted_after_run(&input, outputs.result.automatic_content_block_size).is_some()
- {
+ if content_block_size_adopted_after_run(&input, outputs.result.automatic_content_block_size).is_some() {
root_input_cells_the_run_must_leave.content_block_size = root_cells_left_by_run.content_block_size;
}
assert_eq!(
@@ -2577,9 +2579,7 @@ fn lay_out_run_root_and_contents<'pass>(
result.out_of_flow_root_used_insets = Some(root_used_insets.get());
}
ParticipationInParentFormattingContext::Item => {
- if run_reads_content_block_size_adopted_after_it(fc_type, &input)
- && let Some(block_size) =
- content_block_size_adopted_after_run(&input, result.automatic_content_block_size)
+ if let Some(block_size) = content_block_size_adopted_after_run(&input, result.automatic_content_block_size)
{
sized_root.cells.set_content_block_size(block_size);
}
@@ -2628,6 +2628,8 @@ fn lay_out_run_root_and_contents<'pass>(
OwnBlockSizeObservation::Observed
},
inline_space_around_root: table_wrapper_sized_by_its_parent,
+ content_block_size_adopted_after_run: input.participation == ParticipationInParentFormattingContext::Item
+ && !fc_type.registers_abspos_children_against_its_final_block_size(),
};
// NB: The root's descendants are laid out in the frame the root establishes.
@@ -2678,17 +2680,57 @@ fn lay_out_run_root_and_contents<'pass>(
}
}
}
- let outputs = run.outputs(
- result,
- take_run_fragments(),
- root_cells_left_by_run,
- root_line_data,
- inputs_never_observed,
- parent_owns_root_input_cells,
- );
+ // NB: The absolutely positioned boxes whose containing block is the root are laid out against its final sizes and
+ // box sides, in the frame its contents are laid out in, so that the root's fragment holds them. The columns of
+ // a fragmentainer run leave them to the run of the box they belong to.
+ let laid_out_abspos_contained_by_root = run.fragmentainer.is_none()
+ && lay_out_abspos_contained_by_run_root(body_run, root_in_own_frame_left_by_run, own_frame);
+ let inputs_never_observed = if laid_out_abspos_contained_by_root {
+ fc_run_cache::RunInputsTheStoredRunNeverObserved::default()
+ } else {
+ inputs_never_observed
+ };
+ let outputs = RunOutputs {
+ laid_out_abspos_contained_by_root,
+ ..run.outputs(
+ result,
+ take_run_fragments(),
+ root_cells_left_by_run,
+ root_line_data,
+ inputs_never_observed,
+ parent_owns_root_input_cells,
+ )
+ };
(outputs, root_cells_left_by_run)
}
+/// Lays out the absolutely positioned boxes whose containing block is the root of `body_run`, against the root's
+/// final sizes and box sides `root_in_own_frame`. Returns whether there were any.
+fn lay_out_abspos_contained_by_run_root(
+ body_run: &FormattingContextRun,
+ root_in_own_frame: used_values::RootInputCells,
+ own_frame: geometry::Frame,
+) -> bool {
+ let Some(fragments) = body_run.fragments.as_deref() else {
+ return false;
+ };
+ let mut batch = fragments.take_abspos_contained_by_root(&body_run.callbacks);
+ if batch.is_empty() {
+ return false;
+ }
+ fragments.keep_root_cells_for_contained_abspos(fragment_tree::CellsInFrame {
+ cells: root_in_own_frame,
+ frame: own_frame,
+ });
+ // NB: Laying out an absolutely positioned box can hand the root more, such as a fixed-position descendant of one
+ // whose containing block is the root.
+ while !batch.is_empty() {
+ lay_out_pending_abspos_children(body_run, batch);
+ batch = fragments.take_abspos_contained_by_root(&body_run.callbacks);
+ }
+ true
+}
+
/// The frame in which `node` lays out its contents: that of its writing mode.
pub(crate) fn frame_established_by(callbacks: &LayoutPass<'_>, node: Node) -> geometry::Frame {
callbacks
@@ -3269,7 +3311,7 @@ pub(crate) fn lay_out_shape_for_its_result(callbacks: LayoutPass<'_>, shape: Chi
|callbacks, other_root_cells, other_input| lay_out(callbacks, other_root_cells, other_input, None),
);
}
- cache_attempt.conclude(&callbacks, node, cache_key, &input, &outputs);
+ cache_attempt.conclude(&callbacks, node, cache_key, &outputs);
result_with_host_findings(&outputs)
}
@@ -3379,6 +3421,7 @@ fn item_run_never_observes_percentage_inline_basis(
&& !run.sizing().measurement_root_observes_percentage_inline_basis(run.box_)
}
+/// The content block size an item takes once its contents are laid out, which its run gives its root at its end.
pub(super) fn content_block_size_adopted_after_run(
input: &LayoutInput,
automatic_content_block_size: CssPixels,
@@ -3392,14 +3435,6 @@ pub(super) fn content_block_size_adopted_after_run(
.then_some(automatic_content_block_size))
}
-pub(super) fn run_reads_content_block_size_adopted_after_it(
- fc_type: FormattingContextType,
- input: &LayoutInput,
-) -> bool {
- input.participation == ParticipationInParentFormattingContext::Item
- && fc_type.registers_abspos_children_against_its_final_block_size()
-}
-
#[expect(clippy::too_many_arguments)]
fn child_run_outcome_from_outputs(
callbacks: &LayoutPass<'_>,
@@ -3417,6 +3452,7 @@ fn child_run_outcome_from_outputs(
root_outcome,
inputs_never_observed,
host_findings,
+ laid_out_abspos_contained_by_root: _,
} = outputs;
callbacks.receive_host_findings(host_findings);
let content_block_size_adopted_after_run =
diff --git a/Libraries/LibWeb/Rust/src/layout/fragment_tree.rs b/Libraries/LibWeb/Rust/src/layout/fragment_tree.rs
index 2d3e1b5a6e2..cf24493d981 100644
--- a/Libraries/LibWeb/Rust/src/layout/fragment_tree.rs
+++ b/Libraries/LibWeb/Rust/src/layout/fragment_tree.rs
@@ -411,6 +411,18 @@ fn propagate_payload_toward_run_root_space<Payload: PropagatedPayload>(
}
}
+fn sort_in_tree_order(entries: &mut [abspos_inputs::PendingAbsposChild], callbacks: &LayoutPass<'_>) {
+ entries.sort_by(|left, right| {
+ if left.child_box == right.child_box {
+ std::cmp::Ordering::Equal
+ } else if callbacks.is_before(left.child_box, right.child_box) {
+ std::cmp::Ordering::Less
+ } else {
+ std::cmp::Ordering::Greater
+ }
+ });
+}
+
/// The sizes and box sides of a box, in the frame `frame`.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub(crate) struct CellsInFrame {
@@ -1274,15 +1286,38 @@ impl RunFragmentBuilder {
.extract_if(.., |entry| containing_block_is_owned_and_placed(entry)),
);
}
- taken.sort_by(|left, right| {
- if left.child_box == right.child_box {
- std::cmp::Ordering::Equal
- } else if callbacks.is_before(left.child_box, right.child_box) {
- std::cmp::Ordering::Less
- } else {
- std::cmp::Ordering::Greater
- }
- });
+ sort_in_tree_order(&mut taken, callbacks);
+ taken
+ }
+
+ /// Keeps the sizes and box sides of the run's root, in the frame its contents are laid out in, for the absolutely
+ /// positioned boxes the run lays out against the root at its end.
+ pub(crate) fn keep_root_cells_for_contained_abspos(&self, cells: CellsInFrame) {
+ debug_assert!(
+ !self.is_entry_accumulator,
+ "an entry accumulator has no root of its own"
+ );
+ self.inner
+ .borrow_mut()
+ .placed_boxes
+ .cells_of_abspos_containing_blocks
+ .insert(self.root_node.slot_index(), cells);
+ }
+
+ /// Takes the absolutely positioned boxes whose containing block is the run's root and whose positions the run
+ /// knows, in tree order. Those inside a child the run left unplaced stay for the run's parent.
+ pub(crate) fn take_abspos_contained_by_root(
+ &self,
+ callbacks: &LayoutPass<'_>,
+ ) -> Vec<abspos_inputs::PendingAbsposChild> {
+ let root = self.root_node;
+ let mut taken: Vec<abspos_inputs::PendingAbsposChild> = self
+ .inner
+ .borrow_mut()
+ .pending_abspos_at_root
+ .extract_if(.., |entry| entry.containing_block() == root)
+ .collect();
+ sort_in_tree_order(&mut taken, callbacks);
taken
}
diff --git a/Tests/LibWeb/Text/input/display_list/paint-damage-containing-block-change.html b/Tests/LibWeb/Text/input/display_list/paint-damage-containing-block-change.html
index c1fe98679d0..2a17810034c 100644
--- a/Tests/LibWeb/Text/input/display_list/paint-damage-containing-block-change.html
+++ b/Tests/LibWeb/Text/input/display_list/paint-damage-containing-block-change.html
@@ -20,9 +20,9 @@ displayListTest({
mutate: () => { document.getElementById("parent").style.position = "relative"; },
check: equal => { equal(document.elementFromPoint(20, 20).id, "child", "hit target"); },
expect: `
- damage: rows=5 moved=2 order=4 eligibility=0 all=false
+ damage: rows=5 moved=2 order=5 eligibility=0 all=false
@canvas RECORD (empty)
- @viewport ASSEMBLE
+ @viewport REPLAN
@viewport/preamble COPY
@viewport/background/hit-test COPY
@viewport/scroll-metadata COPY
diff --git a/Tests/LibWeb/Text/input/layout-in-flow-reuse.html b/Tests/LibWeb/Text/input/layout-in-flow-reuse.html
index 5ae0cf85c8a..bb98586c205 100644
--- a/Tests/LibWeb/Text/input/layout-in-flow-reuse.html
+++ b/Tests/LibWeb/Text/input/layout-in-flow-reuse.html
@@ -32,8 +32,7 @@
ListItemBox<LI>#li4 REUSE IN-FLOW SUBTREE
BlockContainer<DIV>#text.scenario/block REUSE SUBTREE
BlockContainer<DIV>#margins.scenario/block REUSE SUBTREE
- BlockContainer<DIV>#abspos-scenario.scenario/block REPLAY FRAGMENTS
- BlockContainer<DIV>#escaping.escaping/block REUSE SUBTREE
+ BlockContainer<DIV>#abspos-scenario.scenario/block REUSE SUBTREE
`,
check: equal => {
equal(li4.getBoundingClientRect().top, 50, "last item top");
@@ -56,8 +55,7 @@
BlockContainer<P>#p2 REUSE IN-FLOW SUBTREE
BlockContainer<P>#p4 REUSE IN-FLOW SUBTREE
BlockContainer<DIV>#margins.scenario/block REUSE SUBTREE
- BlockContainer<DIV>#abspos-scenario.scenario/block REPLAY FRAGMENTS
- BlockContainer<DIV>#escaping.escaping/block REUSE SUBTREE
+ BlockContainer<DIV>#abspos-scenario.scenario/block REUSE SUBTREE
`,
check: equal => {
equal(p4.getBoundingClientRect().top - text.getBoundingClientRect().top, 66, "last paragraph top");
@@ -76,8 +74,7 @@
BlockContainer<DIV>#text.scenario/block REUSE SUBTREE
BlockContainer<DIV>#margins.scenario/block RUN (cache=miss)
BlockContainer<DIV>#m3 REUSE IN-FLOW SUBTREE
- BlockContainer<DIV>#abspos-scenario.scenario/block REPLAY FRAGMENTS
- BlockContainer<DIV>#escaping.escaping/block REUSE SUBTREE
+ BlockContainer<DIV>#abspos-scenario.scenario/block REUSE SUBTREE
`,
check: equal => {
equal(m3.getBoundingClientRect().top - margins.getBoundingClientRect().top, 27, "last box top");
@@ -98,8 +95,7 @@
BlockContainer<DIV>#text.scenario/block REUSE SUBTREE
BlockContainer<DIV>#margins.scenario/block RUN (cache=miss)
BlockContainer<DIV>.float/block RUN (cache=miss)
- BlockContainer<DIV>#abspos-scenario.scenario/block REPLAY FRAGMENTS
- BlockContainer<DIV>#escaping.escaping/block REUSE SUBTREE
+ BlockContainer<DIV>#abspos-scenario.scenario/block REUSE SUBTREE
`,
},
{
@@ -116,7 +112,7 @@
BlockContainer<DIV>#margins.scenario/block REUSE SUBTREE
BlockContainer<DIV>#abspos-scenario.scenario/block RUN (cache=miss)
BlockContainer<DIV>#e3 REUSE IN-FLOW SUBTREE
- BlockContainer<DIV>#escaping.escaping/block RUN (cache=miss)
+ BlockContainer<DIV>#escaping.escaping/block RUN (cache=miss)
`,
check: equal => {
equal(escaping.getBoundingClientRect().top - document.getElementById("abspos-scenario").getBoundingClientRect().top, 0, "escaping abspos top");
diff --git a/Tests/LibWeb/Text/input/layout-run-cache-optimization-scenarios.html b/Tests/LibWeb/Text/input/layout-run-cache-optimization-scenarios.html
index 285fd86d126..7dc76d7f8f6 100644
--- a/Tests/LibWeb/Text/input/layout-run-cache-optimization-scenarios.html
+++ b/Tests/LibWeb/Text/input/layout-run-cache-optimization-scenarios.html
@@ -58,14 +58,10 @@
}
function movementWork(testCase) {
- // The single-level run exports the out-of-flow child to its caller.
- // Deeper chains can retain the committed subtree including that child.
+ // The chain lays out its out-of-flow child itself, so it retains the committed subtree including that child.
// An inline-block chain sits in an anonymous block, whose subtree is reused as it is.
- const replay = testCase.depth === 1 && testCase.descendant !== "inFlow";
const work = testCase.format === "inlineBlock"
? "BlockContainer(anonymous) REUSE IN-FLOW SUBTREE"
- : replay
- ? `${chainRun(testCase.format)} REPLAY FRAGMENTS\n BlockContainer<DIV>#target/block REUSE SUBTREE`
: `${chainRun(testCase.format)} REUSE SUBTREE`;
return `layout FULL
@viewport/block RUN (cache=bypass)
diff --git a/Tests/LibWeb/Text/input/layout-run-cache-viewport-resize-scenarios.html b/Tests/LibWeb/Text/input/layout-run-cache-viewport-resize-scenarios.html
index a14d850f20d..1d62c5ee390 100644
--- a/Tests/LibWeb/Text/input/layout-run-cache-viewport-resize-scenarios.html
+++ b/Tests/LibWeb/Text/input/layout-run-cache-viewport-resize-scenarios.html
@@ -54,7 +54,7 @@
const kind = context === "block" ? "BlockContainer" : "Box";
const escaped = testCase.dependency === "absolute" || testCase.dependency === "fixed";
const work = escaped
- ? "REPLAY FRAGMENTS\n BlockContainer<DIV>#target/block RUN (cache=miss)"
+ ? "REPLAY FRAGMENTS\n BlockContainer<DIV>#target/block RUN (cache=miss)"
: "REUSE SUBTREE";
return `layout FULL
@viewport/block RUN (cache=bypass)
diff --git a/Tests/LibWeb/Text/input/layout-trace.html b/Tests/LibWeb/Text/input/layout-trace.html
index 5165382f0da..4b6c7f54033 100644
--- a/Tests/LibWeb/Text/input/layout-trace.html
+++ b/Tests/LibWeb/Text/input/layout-trace.html
@@ -45,17 +45,17 @@ layoutTest({
@viewport/block RUN (cache=bypass)
BlockContainer<HTML>/block RUN (cache=miss)
BlockContainer<DIV>#target/block REUSE SUBTREE
- BlockContainer<DIV>#boundary/block REUSE SUBTREE
+ BlockContainer<DIV>#boundary/block REUSE SUBTREE
layout FULL
@viewport/block RUN (cache=bypass)
BlockContainer<HTML>/block RUN (cache=miss)
BlockContainer<DIV>#target/block REUSE SUBTREE
- BlockContainer<DIV>#boundary/block REUSE SUBTREE
+ BlockContainer<DIV>#boundary/block REUSE SUBTREE
layout FULL
@viewport/block RUN (cache=bypass)
BlockContainer<HTML>/block RUN (cache=miss)
BlockContainer<DIV>#target/block REUSE SUBTREE
- BlockContainer<DIV>#boundary/block REUSE SUBTREE
+ BlockContainer<DIV>#boundary/block REUSE SUBTREE
`,
check: equal => {
equal(target.getBoundingClientRect().top, 30, "top after flush");
@@ -77,11 +77,11 @@ layoutTest({
BlockContainer<HTML>/block RUN (cache=miss)
BlockContainer<DIV>#spacer REUSE IN-FLOW SUBTREE
BlockContainer<DIV>#target/block RUN (cache=miss)
- BlockContainer<DIV>#boundary/block REUSE SUBTREE
+ BlockContainer<DIV>#boundary/block REUSE SUBTREE
layout FULL
@viewport/block RUN (cache=bypass)
BlockContainer<HTML>/block RUN (cache=miss)
- BlockContainer<DIV>#boundary/block RUN (cache=miss)
+ BlockContainer<DIV>#boundary/block RUN (cache=miss)
`,
},
],
diff --git a/Tests/LibWeb/Text/input/table-measurement-reuse-work.html b/Tests/LibWeb/Text/input/table-measurement-reuse-work.html
index 1946890a8e5..aad44aab128 100644
--- a/Tests/LibWeb/Text/input/table-measurement-reuse-work.html
+++ b/Tests/LibWeb/Text/input/table-measurement-reuse-work.html
@@ -39,11 +39,10 @@
Box<TABLE>#table/table RUN (cache=miss)
BlockContainer<TD>#cell/block RUN AHEAD OF INTRINSIC BLOCK PADDING
BlockContainer<DIV> REUSE IN-FLOW SUBTREE
+ BlockContainer<SPAN>.control/block RUN (cache=miss)
BlockContainer<TD>/block READ RESULT AHEAD OF INTRINSIC BLOCK PADDING
- BlockContainer<TD>#cell/block RUN (cache=miss)
- BlockContainer<DIV> REUSE IN-FLOW SUBTREE
+ BlockContainer<TD>#cell/block REPLAY FRAGMENTS
BlockContainer<TD>/block REUSE SUBTREE
- BlockContainer<SPAN>.control/block RUN (cache=miss)
TableWrapper(anonymous) MEASURE max-content block (cache=hit)
TableWrapper(anonymous) MEASURE max-content block (cache=hit)
TableWrapper(anonymous) MEASURE max-content block (cache=hit)