From 293274fa5ef6e1104e97b7db788a2846b01e2e11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Sun, 20 Aug 2017 23:37:38 +0200 Subject: [PATCH] style: Make sure to set the initial value of the transition even if we don't start it. Otherwise we may get to the end of it directly, which is far from what we want. --- components/style/animation.rs | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/components/style/animation.rs b/components/style/animation.rs index c1a49fca7a1..6736d39269f 100644 --- a/components/style/animation.rs +++ b/components/style/animation.rs @@ -437,21 +437,23 @@ pub fn start_transitions_if_applicable(new_animations_sender: &Sender old_style, Arc::make_mut(new_style)); for property_animation in property_animations { - // Per [1], don't trigger a new transition if the end state for that transition is - // the same as that of a transition that's already running on the same node. - // - // [1]: https://drafts.csswg.org/css-transitions/#starting - if possibly_expired_animations.iter().any(|animation| { - animation.has_the_same_end_value_as(&property_animation) - }) { - continue - } - // Set the property to the initial value. + // // NB: get_mut is guaranteed to succeed since we called make_mut() // above. property_animation.update(Arc::get_mut(new_style).unwrap(), 0.0); + // Per [1], don't trigger a new transition if the end state for that + // transition is the same as that of a transition that's already + // running on the same node. + // + // [1]: https://drafts.csswg.org/css-transitions/#starting + if possibly_expired_animations.iter().any(|animation| { + animation.has_the_same_end_value_as(&property_animation) + }) { + continue + } + // Kick off the animation. let box_style = new_style.get_box(); let now = timer.seconds();