diff options
author | Emilio Cobos Álvarez <me@emiliocobos.me> | 2016-06-22 19:24:25 +0200 |
---|---|---|
committer | Emilio Cobos Álvarez <me@emiliocobos.me> | 2016-06-28 15:09:53 +0000 |
commit | 33f581883b65e24f01c97189a059da991a699d32 (patch) | |
tree | ee96cec4d229fc624a6f3bf76f09a34039814c1b /components/layout/animation.rs | |
parent | 9cf2e52d3604384e93a861ee218591a2c80c1816 (diff) | |
download | servo-33f581883b65e24f01c97189a059da991a699d32.tar.gz servo-33f581883b65e24f01c97189a059da991a699d32.zip |
style: Support animation-direction.
Diffstat (limited to 'components/layout/animation.rs')
-rw-r--r-- | components/layout/animation.rs | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/components/layout/animation.rs b/components/layout/animation.rs index 337855599e6..fecc4762d67 100644 --- a/components/layout/animation.rs +++ b/components/layout/animation.rs @@ -13,7 +13,7 @@ use script_layout_interface::restyle_damage::RestyleDamage; use script_traits::{AnimationState, LayoutMsg as ConstellationMsg}; use std::collections::HashMap; use std::sync::mpsc::Receiver; -use style::animation::{Animation, KeyframesIterationState, update_style_for_animation}; +use style::animation::{Animation, update_style_for_animation}; use time; /// Processes any new animations that were discovered after style recalculation. @@ -42,11 +42,11 @@ pub fn update_animation_state(constellation_chan: &IpcSender<ConstellationMsg>, match *anim { Animation::Keyframes(_, _, ref mut anim_state) => { // NB: The important part is not touching - // the started_at field. - anim_state.duration = state.duration; - anim_state.iteration_state = state.iteration_state.clone(); - anim_state.paused = state.paused; - anim_state.delay = state.delay; + // the started_at field, since we don't want + // to restart the animation. + let old_started_at = anim_state.started_at; + *anim_state = state.clone(); + anim_state.started_at = old_started_at; false } _ => unreachable!(), @@ -84,18 +84,7 @@ pub fn update_animation_state(constellation_chan: &IpcSender<ConstellationMsg>, Animation::Keyframes(_, _, ref mut state) => { // This animation is still running, or we need to keep // iterating. - now < state.started_at + state.duration || - match state.iteration_state { - KeyframesIterationState::Finite(ref mut current, ref max) => { - *current += 1; - *current < *max - } - // Just tick it again. - KeyframesIterationState::Infinite => { - state.started_at += state.duration + state.delay; - true - } - } + now < state.started_at + state.duration || state.tick() } }; |