diff --git a/components/style/matching.rs b/components/style/matching.rs index e6b1f32941c..46e249863d0 100644 --- a/components/style/matching.rs +++ b/components/style/matching.rs @@ -471,15 +471,15 @@ trait PrivateMatchMethods: TElement { shared_context: &SharedStyleContext, rule_node: &StrongRuleNode, primary_style: &ComputedStyle, - pseudo_style: &Option<(&PseudoElement, &mut ComputedStyle)>, - cascade_flags: CascadeFlags) + cascade_flags: CascadeFlags, + is_pseudo: bool) -> Arc { let mut cascade_info = CascadeInfo::new(); // Grab the inherited values. let parent_el; let parent_data; - let inherited_values_ = if pseudo_style.is_none() { + let inherited_values_ = if !is_pseudo { parent_el = self.parent_element(); parent_data = parent_el.as_ref().and_then(|e| e.borrow_data()); let parent_values = parent_data.as_ref().map(|d| { @@ -516,7 +516,7 @@ trait PrivateMatchMethods: TElement { // // Note that this is not needed for pseudos since we already do that // when we resolve the non-pseudo style. - if pseudo_style.is_none() { + if !is_pseudo { if let Some(ref p) = layout_parent_style { let can_be_fragmented = p.is_multicol() || @@ -556,7 +556,7 @@ trait PrivateMatchMethods: TElement { // Grab the rule node. let rule_node = &pseudo_style.as_ref().map_or(primary_style, |p| &*p.1).rules; - self.cascade_with_rules(context.shared, rule_node, primary_style, pseudo_style, cascade_flags) + self.cascade_with_rules(context.shared, rule_node, primary_style, cascade_flags, pseudo_style.is_some()) } /// Computes values and damage for the primary or pseudo style of an element, @@ -605,7 +605,7 @@ trait PrivateMatchMethods: TElement { fn get_after_change_style(&self, context: &mut StyleContext, primary_style: &ComputedStyle, - pseudo_style: &Option<(&PseudoElement, &mut ComputedStyle)>) + pseudo_style: &Option<(&PseudoElement, &ComputedStyle)>) -> Arc { let style = &pseudo_style.as_ref().map_or(primary_style, |p| &*p.1); let rule_node = &style.rules; @@ -624,8 +624,8 @@ trait PrivateMatchMethods: TElement { self.cascade_with_rules(context.shared, &without_transition_rules, primary_style, - &pseudo_style, - cascade_flags) + cascade_flags, + pseudo_style.is_some()) } #[cfg(feature = "gecko")]