From 0c8bb8287acd31487c0e43dd593993d6bd14d729 Mon Sep 17 00:00:00 2001 From: Martin Robinson Date: Fri, 11 Apr 2025 18:37:11 +0200 Subject: [PATCH] layout: Eliminate extra stored style on outside markers (#36471) This is a duplicate of the style stored on the marker's `LayoutBoxBase`. Testing: This is covered by existings WPT tests. Signed-off-by: Martin Robinson Co-authored-by: Oriol Brufau --- components/layout_2020/flow/construct.rs | 1 - components/layout_2020/flow/mod.rs | 7 +++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/components/layout_2020/flow/construct.rs b/components/layout_2020/flow/construct.rs index c7667231260..07b2bbb5e0a 100644 --- a/components/layout_2020/flow/construct.rs +++ b/components/layout_2020/flow/construct.rs @@ -705,7 +705,6 @@ where false, /* is_list_item */ ); ArcRefCell::new(BlockLevelBox::OutsideMarker(OutsideMarker { - marker_style: info.style.clone(), base: LayoutBoxBase::new(info.into(), info.style.clone()), block_container, list_item_style, diff --git a/components/layout_2020/flow/mod.rs b/components/layout_2020/flow/mod.rs index aa4bf8dd36f..a9710ff7963 100644 --- a/components/layout_2020/flow/mod.rs +++ b/components/layout_2020/flow/mod.rs @@ -246,7 +246,6 @@ pub(crate) struct CollapsibleWithParentStartMargin(bool); /// for a list that has `list-style-position: outside`. #[derive(Debug)] pub(crate) struct OutsideMarker { - pub marker_style: Arc, pub list_item_style: Arc, pub base: LayoutBoxBase, pub block_container: BlockContainer, @@ -271,7 +270,7 @@ impl OutsideMarker { collapsible_with_parent_start_margin: Option, ) -> Fragment { let constraint_space = ConstraintSpace::new_for_style_and_ratio( - &self.marker_style, + &self.base.style, None, /* TODO: support preferred aspect ratios on non-replaced boxes */ ); let content_sizes = self.inline_content_sizes(layout_context, &constraint_space); @@ -280,7 +279,7 @@ impl OutsideMarker { inline: content_sizes.sizes.max_content, block: SizeConstraint::default(), }, - style: &self.marker_style, + style: &self.base.style, }; // A ::marker can't have a stretch size (must be auto), so this doesn't matter. @@ -349,7 +348,7 @@ impl OutsideMarker { Fragment::Box(ArcRefCell::new(BoxFragment::new( base_fragment_info, - self.marker_style.clone(), + self.base.style.clone(), flow_layout.fragments, content_rect.as_physical(Some(containing_block)), PhysicalSides::zero(),