From 976b3ba6e79b4c2682b961a5defe88f5e1195d00 Mon Sep 17 00:00:00 2001 From: Hiroyuki Ikezoe Date: Wed, 24 May 2017 14:00:30 +0900 Subject: [PATCH] Don't process style attribute changes in animation-only restyle. --- components/style/matching.rs | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/components/style/matching.rs b/components/style/matching.rs index 61130b7d609..edb6f923fe3 100644 --- a/components/style/matching.rs +++ b/components/style/matching.rs @@ -983,7 +983,6 @@ pub trait MatchMethods : TElement { let element_styles = &mut data.styles_mut(); let primary_rules = &mut element_styles.primary.rules; - let mut result = false; let replace_rule_node = |level: CascadeLevel, pdb: Option<&Arc>>, @@ -999,6 +998,20 @@ pub trait MatchMethods : TElement { } }; + if !context.shared.traversal_flags.for_animation_only() { + let mut result = false; + if replacements.contains(RESTYLE_STYLE_ATTRIBUTE) { + let style_attribute = self.style_attribute(); + result |= replace_rule_node(CascadeLevel::StyleAttributeNormal, + style_attribute, + primary_rules); + result |= replace_rule_node(CascadeLevel::StyleAttributeImportant, + style_attribute, + primary_rules); + } + return result; + } + // Animation restyle hints are processed prior to other restyle // hints in the animation-only traversal. // @@ -1032,17 +1045,9 @@ pub trait MatchMethods : TElement { replace_rule_node_for_animation(CascadeLevel::Animations, primary_rules); } - } else if replacements.contains(RESTYLE_STYLE_ATTRIBUTE) { - let style_attribute = self.style_attribute(); - result |= replace_rule_node(CascadeLevel::StyleAttributeNormal, - style_attribute, - primary_rules); - result |= replace_rule_node(CascadeLevel::StyleAttributeImportant, - style_attribute, - primary_rules); } - result + false } /// Attempts to share a style with another node. This method is unsafe