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.
This commit is contained in:
Emilio Cobos Álvarez 2017-08-20 23:37:38 +02:00
parent 359ef7b7c3
commit 293274fa5e
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C

View file

@ -437,21 +437,23 @@ pub fn start_transitions_if_applicable(new_animations_sender: &Sender<Animation>
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();