Truly independent web browser
LibWeb: Hand a root laid out without parent fragments its cells as value
Aliaksandr Kalenik297106b80115
diff --git a/Libraries/LibWeb/Rust/src/layout/abspos_engine.rs b/Libraries/LibWeb/Rust/src/layout/abspos_engine.rsindex 2557527e5ef..18a2a9003ad 100644--- a/Libraries/LibWeb/Rust/src/layout/abspos_engine.rs+++ b/Libraries/LibWeb/Rust/src/layout/abspos_engine.rs@@ -3444,18 +3444,23 @@ impl<'pass> AbsposEngine<'pass> {inputs.position_option = Some(choice);// 3. Let el rect be the size and position of abspos's margin box, and cb rect be the size and position of// abspos's inset-modified containing block, when laid out with adjusted styles.- let used = used_values::create_used_values(&self.callbacks, node, ContainingBlockConstraints::default());let (available_space, constraints) = out_of_flow_root_space(inputs);- formatting_context::run_root_without_parent_fragments(+ let used = formatting_context::run_root_without_parent_fragments(self.callbacks,node,- &used,+ used_values::RootInputCells::capture(&used_values::create_used_values(+ &self.callbacks,+ node,+ ContainingBlockConstraints::default(),+ )),LayoutInput::new(available_space,constraints,ParticipationInParentFormattingContext::AbsolutelyPositioned(inputs),),- );+ )+ .root_cells_left_by_run+ .materialize_record();let style = self.style(node).with_resolved_insets(inputs.resolved_anchor_insets.as_ref());diff --git a/Libraries/LibWeb/Rust/src/layout/formatting_context.rs b/Libraries/LibWeb/Rust/src/layout/formatting_context.rsindex ce3b71cd67b..9039c65fd8f 100644--- a/Libraries/LibWeb/Rust/src/layout/formatting_context.rs+++ b/Libraries/LibWeb/Rust/src/layout/formatting_context.rs@@ -105,17 +105,28 @@ pub(crate) fn run_builds_fragments(input: &LayoutInput, parent_collects_fragmentparent_collects_fragments || input.participation != ParticipationInParentFormattingContext::Root}+pub(crate) struct RootLaidOutWithoutParentFragments {+ pub(crate) result: ChildLayoutResult,+ pub(crate) root_cells_left_by_run: used_values::RootInputCells,+}+pub(crate) fn run_root_without_parent_fragments(callbacks: LayoutPass<'_>,node: Node,- root_used: &UsedValues,+ root_cells: used_values::RootInputCells,input: LayoutInput,-) -> ChildLayoutResult {+) -> RootLaidOutWithoutParentFragments {+ debug_assert_ne!(+ input.participation,+ ParticipationInParentFormattingContext::Item,+ "an item run leaves its root's input cells to its parent, so they would come back unchanged"+ );let fc_type = independent_formatting_context_type(node, &callbacks);let root_containing_block = callbacks.containing_block_for_child_run(node, &input.participation);- run_formatting_context(+ let root_used = root_cells.materialize_record();+ let result = run_formatting_context(None,- root_used,+ &root_used,node,root_containing_block,None,@@ -124,7 +135,11 @@ pub(crate) fn run_root_without_parent_fragments(callbacks,input,None,- )+ );+ RootLaidOutWithoutParentFragments {+ result,+ root_cells_left_by_run: used_values::RootInputCells::capture(&root_used),+ }}pub(crate) fn run_fragmentainer(diff --git a/Libraries/LibWeb/Rust/src/layout/intrinsic_sizing.rs b/Libraries/LibWeb/Rust/src/layout/intrinsic_sizing.rsindex 45488159a33..602a1d99fdb 100644--- a/Libraries/LibWeb/Rust/src/layout/intrinsic_sizing.rs+++ b/Libraries/LibWeb/Rust/src/layout/intrinsic_sizing.rs@@ -702,8 +702,13 @@ pub(super) fn content_sizes_of_math(constraints,ParticipationInParentFormattingContext::Root,);- let result = formatting_context::run_root_without_parent_fragments(callbacks, node, scope.root(), input);- let size = scope.root().content_inline_size.get();+ let laid_out = formatting_context::run_root_without_parent_fragments(+ callbacks,+ node,+ used_values::RootInputCells::capture(scope.root()),+ input,+ );+ let size = laid_out.root_cells_left_by_run.content_inline_size;let observes_percentage_inline_basis = scope.enter(callbacks, |run| {run.sizing().measurement_root_observes_percentage_inline_basis(node)});@@ -711,7 +716,7 @@ pub(super) fn content_sizes_of_math(sizes: sizing_context::ContentSizes { min: size, max: size },first_line_max_content: FirstLineMaxContent::without_floats(size),dependencies: IntrinsicMeasurementDependencies {- percentage_block_size: result.depends_on_percentage_block_size,+ percentage_block_size: laid_out.result.depends_on_percentage_block_size,percentage_inline_basis: observes_percentage_inline_basis,block_size: true,},