Skip to content

Truly independent web browser

LibWeb: Box the absolutely positioned inputs of a fragment link

Andreas Kling758769c1a3b6
diff --git a/Libraries/LibWeb/Rust/src/layout/fragment_tree.rs b/Libraries/LibWeb/Rust/src/layout/fragment_tree.rs
index 327bebf1d9d..64b6cf6ca28 100644
--- a/Libraries/LibWeb/Rust/src/layout/fragment_tree.rs
+++ b/Libraries/LibWeb/Rust/src/layout/fragment_tree.rs
@@ -52,7 +52,8 @@ pub(crate) struct FragmentLink {
pub(crate) inset_top: CssPixels,
pub(crate) inset_bottom: CssPixels,
pub(crate) containing_line_box_index: Option<usize>,
- pub(crate) abspos_layout_inputs: Option<abspos_inputs::AbsposLayoutInputs>,
+ /// Boxed, as few links place an absolutely positioned box and the inputs are larger than the rest of the link.
+ pub(crate) abspos_layout_inputs: Option<Box<abspos_inputs::AbsposLayoutInputs>>,
pub(crate) containing_block: crate::layout::node_data::NodeSlotId,
}
@@ -501,7 +502,7 @@ fn link_fragment(fragment: std::sync::Arc<Fragment>, placement: PlacementData) -
inset_top: placement.inset_top,
inset_bottom: placement.inset_bottom,
containing_line_box_index: placement.containing_line_box_index,
- abspos_layout_inputs: placement.abspos_layout_inputs,
+ abspos_layout_inputs: placement.abspos_layout_inputs.map(Box::new),
containing_block: placement.containing_block,
}
}
diff --git a/Libraries/LibWeb/Rust/src/layout/layout_node_arena.rs b/Libraries/LibWeb/Rust/src/layout/layout_node_arena.rs
index a6dc4ddf0d2..664feafb4a8 100644
--- a/Libraries/LibWeb/Rust/src/layout/layout_node_arena.rs
+++ b/Libraries/LibWeb/Rust/src/layout/layout_node_arena.rs
@@ -4725,7 +4725,7 @@ impl LayoutNodeArena {
let (index, metadata) = self.slot_for_data(data);
self.paintable_rows
.with_committed_fragment_link(index, metadata.generation, |link| {
- link.and_then(|link| link.abspos_layout_inputs)
+ link.and_then(|link| link.abspos_layout_inputs.as_deref().copied())
})
.or_else(|| {
self.confined_abspos_layout_inputs
@@ -6949,7 +6949,7 @@ mod tests {
let allocation = arena.allocate_for_test();
let inputs = test_abspos_layout_inputs();
let mut link = fragment_tree::FragmentLink::for_test(allocation.slot);
- link.abspos_layout_inputs = Some(inputs);
+ link.abspos_layout_inputs = Some(Box::new(inputs));
arena.set_committed_fragment_link(allocation.slot, link, None);
assert!(arena.committed_fragment_link(arena.data(allocation.slot)).is_some());
assert_eq!(
@@ -6978,7 +6978,7 @@ mod tests {
let new = arena.allocate_for_test();
let inputs = test_abspos_layout_inputs();
let mut link = fragment_tree::FragmentLink::for_test(old.slot);
- link.abspos_layout_inputs = Some(inputs);
+ link.abspos_layout_inputs = Some(Box::new(inputs));
let retained_fragment = link.fragment.clone();
arena.set_committed_fragment_link(old.slot, link, None);