Skip to content

Truly independent web browser

LibWeb: Capture the root input cells of a box before sizing it

Aliaksandr Kalenik09d2af0b0414
diff --git a/Libraries/LibWeb/Rust/src/layout/abspos_engine.rs b/Libraries/LibWeb/Rust/src/layout/abspos_engine.rs
index 5d280b67632..551f6fa7dea 100644
--- a/Libraries/LibWeb/Rust/src/layout/abspos_engine.rs
+++ b/Libraries/LibWeb/Rust/src/layout/abspos_engine.rs
@@ -3447,11 +3447,11 @@ impl<'pass> AbsposEngine<'pass> {
let laid_out = formatting_context::run_root_without_parent_fragments(
self.callbacks,
node,
- used_values::RootInputCells::capture(&used_values::create_used_values(
+ used_values::RootInputCells::of_box_before_sizing(
&self.callbacks,
node,
ContainingBlockConstraints::default(),
- )),
+ ),
LayoutInput::new(
available_space,
constraints,
diff --git a/Libraries/LibWeb/Rust/src/layout/sizing_context.rs b/Libraries/LibWeb/Rust/src/layout/sizing_context.rs
index 15e67c6b2bc..cc98ddc7680 100644
--- a/Libraries/LibWeb/Rust/src/layout/sizing_context.rs
+++ b/Libraries/LibWeb/Rust/src/layout/sizing_context.rs
@@ -3233,7 +3233,7 @@ impl<'pass, 'container> SizingContext<'pass, 'container> {
formatting_context::lay_out_measurement_root_for_its_result(
self.callbacks,
node,
- used_values::RootInputCells::capture(&used_values::create_used_values(&self.callbacks, node, constraints)),
+ used_values::RootInputCells::of_box_before_sizing(&self.callbacks, node, constraints),
LayoutInput::new(
inner_available_space,
constraints,
diff --git a/Libraries/LibWeb/Rust/src/layout/used_values.rs b/Libraries/LibWeb/Rust/src/layout/used_values.rs
index 301a0c24da8..190305b326f 100644
--- a/Libraries/LibWeb/Rust/src/layout/used_values.rs
+++ b/Libraries/LibWeb/Rust/src/layout/used_values.rs
@@ -636,6 +636,15 @@ used_values_cells! {
}
impl RootInputCells {
+ /// The input cells of `node` as its record starts out, before anything sizes the box.
+ pub(crate) fn of_box_before_sizing(
+ callbacks: &LayoutPass<'_>,
+ node: Node,
+ constraints: ContainingBlockConstraints,
+ ) -> Self {
+ Self::capture(&create_used_values(callbacks, node, constraints))
+ }
+
pub(crate) fn materialize_record(&self) -> UsedValues {
let record = UsedValues::default();
self.apply_to_record(&record);