diff options
author | Martin Robinson <mrobinson@igalia.com> | 2020-04-30 10:59:56 +0200 |
---|---|---|
committer | Martin Robinson <mrobinson@igalia.com> | 2020-04-30 15:45:07 +0200 |
commit | 0ab4260d6b81a7d2aba80bf8959d16d422423e03 (patch) | |
tree | 293015e207434dd9bc5a7428c53842cffa4c881a /components/layout/animation.rs | |
parent | 3bedd440265864bc713b4f3d620b65cfc58b7381 (diff) | |
download | servo-0ab4260d6b81a7d2aba80bf8959d16d422423e03.tar.gz servo-0ab4260d6b81a7d2aba80bf8959d16d422423e03.zip |
Split animation cancellation from update_style_for_animation
`update_style_for_animation` previously handled both canceling defunct
animations and also updating style to reflect current animation state.
This change splits those two concerns because we want to start handling
replaced or canceled animations and finished animations in two different
places.
This is a refactor, so ideally it shouldn't change any behavior.
Diffstat (limited to 'components/layout/animation.rs')
-rw-r--r-- | components/layout/animation.rs | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/components/layout/animation.rs b/components/layout/animation.rs index 79a90f397a7..00fbf4bc1d6 100644 --- a/components/layout/animation.rs +++ b/components/layout/animation.rs @@ -128,17 +128,16 @@ pub fn handle_running_animations( let mut running_animations = std::mem::replace(&mut animation_state.running_animations, Vec::new()); for mut running_animation in running_animations.drain(..) { - let still_running = !running_animation.is_expired() && - match running_animation { - Animation::Transition(_, started_at, ref property_animation) => { - now < started_at + (property_animation.duration) - }, - Animation::Keyframes(_, _, _, ref mut state) => { - // This animation is still running, or we need to keep - // iterating. - now < state.started_at + state.duration || state.tick() - }, - }; + let still_running = match running_animation { + Animation::Transition(_, started_at, ref property_animation) => { + now < started_at + (property_animation.duration) + }, + Animation::Keyframes(_, _, _, ref mut state) => { + // This animation is still running, or we need to keep + // iterating. + now < state.started_at + state.duration || state.tick() + }, + }; // If the animation is still running, add it back to the list of running animations. if still_running { @@ -165,9 +164,8 @@ pub fn handle_cancelled_animations( Animation::Transition(_, _, ref property_animation) => { send_transition_event(property_animation, TransitionEventType::TransitionCancel) }, - Animation::Keyframes(..) => { - warn!("Got unexpected animation in finished transitions list.") - }, + // TODO(mrobinson): We should send animationcancel events. + Animation::Keyframes(..) => {}, } } } |