diff --git a/components/layout/construct.rs b/components/layout/construct.rs index 8d6983d5e95..7e53bfee798 100644 --- a/components/layout/construct.rs +++ b/components/layout/construct.rs @@ -1247,9 +1247,9 @@ impl<'a> FlowConstructor<'a> { return false } + let mut style = node.style().clone(); let mut layout_data_ref = node.mutate_layout_data(); let layout_data = layout_data_ref.as_mut().expect("no layout data"); - let mut style = (*node.get_style(&layout_data)).clone(); let damage = layout_data.data.restyle_damage; match node.construction_result_mut(layout_data) { &mut ConstructionResult::None => true, diff --git a/components/layout/wrapper.rs b/components/layout/wrapper.rs index 8309c370e8a..26378daf40c 100644 --- a/components/layout/wrapper.rs +++ b/components/layout/wrapper.rs @@ -743,22 +743,18 @@ impl<'ln> ThreadSafeLayoutNode<'ln> { self.node.mutate_layout_data() } - #[inline] - pub fn get_style<'a>(&self, layout_data_ref: &'a LayoutDataWrapper) -> &'a Arc { - match self.get_pseudo_element_type() { - PseudoElementType::Before(_) => layout_data_ref.data.before_style.as_ref().unwrap(), - PseudoElementType::After(_) => layout_data_ref.data.after_style.as_ref().unwrap(), - PseudoElementType::Normal => layout_data_ref.shared_data.style.as_ref().unwrap(), - } - } - /// Returns the style results for the given node. If CSS selector matching /// has not yet been performed, fails. #[inline] pub fn style<'a>(&'a self) -> Ref<'a, Arc> { Ref::map(self.borrow_layout_data(), |layout_data_ref| { let layout_data = layout_data_ref.as_ref().expect("no layout data"); - self.get_style(layout_data) + let style = match self.get_pseudo_element_type() { + PseudoElementType::Before(_) => &layout_data.data.before_style, + PseudoElementType::After(_) => &layout_data.data.after_style, + PseudoElementType::Normal => &layout_data.shared_data.style, + }; + style.as_ref().unwrap() }) }