diff --git a/components/style/matching.rs b/components/style/matching.rs index 7b13e34c1bc..aed3958a36e 100644 --- a/components/style/matching.rs +++ b/components/style/matching.rs @@ -416,25 +416,26 @@ trait PrivateMatchMethods: TNode } }; - // Trigger transitions if necessary. This will reset `this_style` back to its old value if - // it did trigger a transition. if animate_properties { + let this_opaque = self.opaque(); + // Trigger any present animations if necessary. + let mut animations_started = animation::maybe_start_animations::<::Impl>( + &context, + this_opaque, + &this_style); + + // Trigger transitions if necessary. This will reset `this_style` back + // to its old value if it did trigger a transition. if let Some(ref style) = style { - let mut animations_started = + animations_started |= animation::start_transitions_if_applicable::( &context.new_animations_sender, - self.opaque(), + this_opaque, &**style, &mut this_style); - - // TODO: Take into account animation-play-state - animations_started |= animation::maybe_start_animations::<::Impl>( - &context, - self.opaque(), - &mut this_style); - - cacheable = cacheable && !animations_started } + + cacheable = cacheable && !animations_started } // Calculate style difference.