mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
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:
parent
359ef7b7c3
commit
293274fa5e
1 changed files with 12 additions and 10 deletions
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue