Truly independent web browser
LibWeb: Tell a child run only whether its parent collects fragments
Aliaksandr Kalenik261172f5b306
diff --git a/Libraries/LibWeb/Rust/src/layout/formatting_context.rs b/Libraries/LibWeb/Rust/src/layout/formatting_context.rsindex be9fee81e86..5799ae44166 100644--- a/Libraries/LibWeb/Rust/src/layout/formatting_context.rs+++ b/Libraries/LibWeb/Rust/src/layout/formatting_context.rs@@ -128,7 +128,7 @@ pub(crate) fn run_root_without_parent_fragments(laid_out_box,fragment_arrival,} = run_formatting_context(- None,+ false,root_cells,node,root_containing_block,@@ -1992,7 +1992,7 @@ fn body_input_with_inner_available_space(root: &impl BoxMetricCells, input: &Lay#[expect(clippy::too_many_arguments)]/// Runs the formatting context of `box_` with the input cells `root_cells` its parent sized it in.pub(super) fn run_formatting_context(- parent_fragments: Option<&fragment_tree::RunFragmentBuilder>,+ parent_collects_fragments: bool,root_cells: used_values::RootInputCells,box_: Node,root_containing_block: Node,@@ -2003,9 +2003,9 @@ pub(super) fn run_formatting_context(input: LayoutInput,table_inline_layout: Option<table_formatting_context::TableInlineLayout>,) -> ChildLayout {- let builds_fragments = run_builds_fragments(&input, parent_fragments.is_some());+ let builds_fragments = run_builds_fragments(&input, parent_collects_fragments);assert!(- parent_fragments.is_none() || builds_fragments,+ !parent_collects_fragments || builds_fragments,"the run of {box_:?} builds no fragments for its parent to commit");if callbacks.reads_no_memoized_layout() {@@ -2025,7 +2025,7 @@ pub(super) fn run_formatting_context();return child_layout_from_outputs(&callbacks,- parent_fragments,+ parent_collects_fragments,box_,&input,root_cells,@@ -2056,7 +2056,7 @@ pub(super) fn run_formatting_context(});return child_layout_from_outputs(&callbacks,- parent_fragments,+ parent_collects_fragments,box_,&input,root_cells,@@ -2128,7 +2128,15 @@ pub(super) fn run_formatting_context();}let outputs = cache_attempt.conclude(&callbacks, box_, &cache_probe, outputs);- child_layout_from_outputs(&callbacks, parent_fragments, box_, &input, root_cells, outputs, false)+ child_layout_from_outputs(+ &callbacks,+ parent_collects_fragments,+ box_,+ &input,+ root_cells,+ outputs,+ false,+ )}fn keep_inline_margins_resolved_now_where_unobserved(@@ -3066,7 +3074,7 @@ pub(crate) fn layout_inside_child_with_input_cells(percentage_block_insets_of_containing_block_have_definite_basis,);run_formatting_context(- run.fragments,+ run.fragments.is_some(),child_input_cells,child,root_containing_block,@@ -3449,7 +3457,7 @@ pub(super) fn content_block_size_adopted_after_run(fn child_layout_from_outputs(callbacks: &LayoutPass<'_>,- parent_fragments: Option<&fragment_tree::RunFragmentBuilder>,+ parent_collects_fragments: bool,child: Node,input: &LayoutInput,root_cells: used_values::RootInputCells,@@ -3462,7 +3470,7 @@ fn child_layout_from_outputs(root_outcome,inputs_never_observed,host_findings,- } = outputs.into_parts(parent_fragments.is_some());+ } = outputs.into_parts(parent_collects_fragments);callbacks.receive_host_findings(host_findings);let content_block_size_adopted_after_run =content_block_size_adopted_after_run(input, result.automatic_content_block_size);@@ -3735,7 +3743,7 @@ fn compute_root_layout(input: LayoutStageInput<'_>, should_collect_devtools_layo.with_forced_sizes(viewport_inline_size, viewport_block_size);let fc_type = independent_formatting_context_type(root_for_layout, &callbacks);let root_outcome = run_formatting_context(- Some(entry_fragments),+ true,root_cells,root_for_layout,callbacks.in_flow_containing_block(root_for_layout),@@ -3887,7 +3895,7 @@ fn layout_subtree_with_frozen_root_geometry(run: &FormattingContextRun<'_>) {let fc_type = formatting_context_type_created_by_box(facts).expect("partial relayout root must establish an independent formatting context");let root_outcome = run_formatting_context(- Some(fragments),+ true,root_cells,root,callbacks.in_flow_containing_block(root),diff --git a/Libraries/LibWeb/Rust/src/layout/replaced_with_children_formatting_context.rs b/Libraries/LibWeb/Rust/src/layout/replaced_with_children_formatting_context.rsindex 52aa7fdd75d..bc72ca9c9e5 100644--- a/Libraries/LibWeb/Rust/src/layout/replaced_with_children_formatting_context.rs+++ b/Libraries/LibWeb/Rust/src/layout/replaced_with_children_formatting_context.rs@@ -41,7 +41,7 @@ pub(super) fn layout_replaced_with_children(wrapper_cells.set_content_inline_size(content_inline_size);let wrapper_outcome = formatting_context::run_formatting_context(- run.fragments,+ run.fragments.is_some(),wrapper_cells,wrapper,run.callbacks.in_flow_containing_block(wrapper),