diff --git a/components/style/data.rs b/components/style/data.rs index a34ce78c2e8..7e42511b559 100644 --- a/components/style/data.rs +++ b/components/style/data.rs @@ -19,6 +19,7 @@ use std::ops::Deref; use std::sync::Arc; use stylist::Stylist; use thread_state; +use traversal::TraversalFlags; /// The structure that represents the result of style computation. This is /// effectively a tuple of rules and computed values, that is, the rule node, @@ -192,17 +193,22 @@ pub struct StoredRestyleHint(RestyleHint); impl StoredRestyleHint { /// Propagates this restyle hint to a child element. - pub fn propagate(&mut self) -> Self { + pub fn propagate(&mut self, traversal_flags: &TraversalFlags) -> Self { use std::mem; - // If we have RESTYLE_CSS_ANIMATIONS restyle hint, it means we are in - // the middle of an animation only restyle. In that case, we don't need - // to propagate any restyle hints, and we need to remove ourselves. - if self.0.contains(RESTYLE_CSS_ANIMATIONS) { - self.0.remove(RESTYLE_CSS_ANIMATIONS); + // In the middle of an animation only restyle, we don't need to + // propagate any restyle hints, and we need to remove ourselves. + if traversal_flags.for_animation_only() { + if self.0.contains(RESTYLE_CSS_ANIMATIONS) { + self.0.remove(RESTYLE_CSS_ANIMATIONS); + } return Self::empty(); } + debug_assert!(!self.0.contains(RESTYLE_CSS_ANIMATIONS), + "There should not be any animation restyle hints \ + during normal traversal"); + // Else we should clear ourselves, and return the propagated hint. let hint = mem::replace(&mut self.0, RestyleHint::empty()); StoredRestyleHint(if hint.contains(RESTYLE_DESCENDANTS) { diff --git a/components/style/traversal.rs b/components/style/traversal.rs index d0910de2c6d..f15c45b6d7a 100644 --- a/components/style/traversal.rs +++ b/components/style/traversal.rs @@ -601,7 +601,7 @@ pub fn recalc_style_at(traversal: &D, "animation restyle hint should be handled during \ animation-only restyles"); r.recascade = false; - r.hint.propagate() + r.hint.propagate(&context.shared.traversal_flags) }, }; debug_assert!(data.has_current_styles() ||