From f149d4d57748db205772a4873533884cccca4dc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Sat, 25 Jun 2016 15:46:55 +0200 Subject: [PATCH] style: Don't calculate animations just on style changes. Calculate it also on the first restyle. --- components/style/matching.rs | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) 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.