diff options
author | Emilio Cobos Álvarez <emilio@crisal.io> | 2017-12-05 22:13:50 +0100 |
---|---|---|
committer | Emilio Cobos Álvarez <emilio@crisal.io> | 2017-12-06 02:35:10 +0100 |
commit | af879523eabbdb72b672aab50da1f83bb782ed1e (patch) | |
tree | 4071fb814c411a6c2fd52192d0994bd4861af94d /components/style/animation.rs | |
parent | 37cd870a9e41fe6e6ba12e0622f2e2a935fda89a (diff) | |
download | servo-af879523eabbdb72b672aab50da1f83bb782ed1e.tar.gz servo-af879523eabbdb72b672aab50da1f83bb782ed1e.zip |
style: Make all keywords CamelCase for consistency.
This prevents confusion and paves the ground for derive(Parse) of them.
Diffstat (limited to 'components/style/animation.rs')
-rw-r--r-- | components/style/animation.rs | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/components/style/animation.rs b/components/style/animation.rs index 9f5c19fab8f..a324fa99ea9 100644 --- a/components/style/animation.rs +++ b/components/style/animation.rs @@ -103,11 +103,11 @@ impl KeyframesAnimationState { // Update the next iteration direction if applicable. match self.direction { - AnimationDirection::alternate | - AnimationDirection::alternate_reverse => { + AnimationDirection::Alternate | + AnimationDirection::AlternateReverse => { self.current_direction = match self.current_direction { - AnimationDirection::normal => AnimationDirection::reverse, - AnimationDirection::reverse => AnimationDirection::normal, + AnimationDirection::Normal => AnimationDirection::Reverse, + AnimationDirection::Reverse => AnimationDirection::Normal, _ => unreachable!(), }; } @@ -551,15 +551,15 @@ pub fn maybe_start_animations(context: &SharedStyleContext, let animation_direction = box_style.animation_direction_mod(i); let initial_direction = match animation_direction { - AnimationDirection::normal | - AnimationDirection::alternate => AnimationDirection::normal, - AnimationDirection::reverse | - AnimationDirection::alternate_reverse => AnimationDirection::reverse, + AnimationDirection::Normal | + AnimationDirection::Alternate => AnimationDirection::Normal, + AnimationDirection::Reverse | + AnimationDirection::AlternateReverse => AnimationDirection::Reverse, }; let running_state = match box_style.animation_play_state_mod(i) { - AnimationPlayState::paused => KeyframesRunningState::Paused(0.), - AnimationPlayState::running => KeyframesRunningState::Running, + AnimationPlayState::Paused => KeyframesRunningState::Paused(0.), + AnimationPlayState::Running => KeyframesRunningState::Running, }; @@ -677,7 +677,7 @@ pub fn update_style_for_animation(context: &SharedStyleContext, let last_keyframe_position; let target_keyframe_position; match state.current_direction { - AnimationDirection::normal => { + AnimationDirection::Normal => { target_keyframe_position = animation.steps.iter().position(|step| { total_progress as f32 <= step.start_percentage.0 @@ -687,7 +687,7 @@ pub fn update_style_for_animation(context: &SharedStyleContext, if pos != 0 { Some(pos - 1) } else { None } }).unwrap_or(0); } - AnimationDirection::reverse => { + AnimationDirection::Reverse => { target_keyframe_position = animation.steps.iter().rev().position(|step| { total_progress as f32 <= 1. - step.start_percentage.0 @@ -717,10 +717,10 @@ pub fn update_style_for_animation(context: &SharedStyleContext, let relative_timespan = (target_keyframe.start_percentage.0 - last_keyframe.start_percentage.0).abs(); let relative_duration = relative_timespan as f64 * duration; let last_keyframe_ended_at = match state.current_direction { - AnimationDirection::normal => { + AnimationDirection::Normal => { state.started_at + (total_duration * last_keyframe.start_percentage.0 as f64) } - AnimationDirection::reverse => { + AnimationDirection::Reverse => { state.started_at + (total_duration * (1. - last_keyframe.start_percentage.0 as f64)) } _ => unreachable!(), |