diff --git a/components/style/animation.rs b/components/style/animation.rs index e6e8a3ac89e..f05a43b3ff2 100644 --- a/components/style/animation.rs +++ b/components/style/animation.rs @@ -51,10 +51,10 @@ impl PropertyAnimation { /// Creates a new property animation for the given transition index and old and new styles. /// Any number of animations may be returned, from zero (if the property did not animate) to /// one (for a single transition property) to arbitrarily many (for `all`). - pub fn from_transition(transition_index: usize, - old_style: &ServoComputedValues, - new_style: &mut ServoComputedValues) - -> Vec { + pub fn from_transition(transition_index: usize, + old_style: &C, + new_style: &mut C) + -> Vec { let mut result = vec![]; let box_style = new_style.as_servo().get_box(); let transition_property = box_style.transition_property.0[transition_index]; @@ -88,12 +88,12 @@ impl PropertyAnimation { result } - fn from_transition_property(transition_property: TransitionProperty, - timing_function: TransitionTimingFunction, - duration: Time, - old_style: &ServoComputedValues, - new_style: &ServoComputedValues) - -> Option { + fn from_transition_property(transition_property: TransitionProperty, + timing_function: TransitionTimingFunction, + duration: Time, + old_style: &C, + new_style: &C) + -> Option { let animated_property = AnimatedProperty::from_transition_property(&transition_property, old_style, new_style); @@ -111,7 +111,7 @@ impl PropertyAnimation { } } - pub fn update(&self, style: &mut ServoComputedValues, time: f64) { + pub fn update(&self, style: &mut C, time: f64) { let progress = match self.timing_function { TransitionTimingFunction::CubicBezier(p1, p2) => { // See `WebCore::AnimationBase::solveEpsilon(double)` in WebKit. @@ -167,7 +167,7 @@ pub fn start_transitions_if_applicable(new_animations_sender: let property_animations = PropertyAnimation::from_transition(i, old_style.as_servo(), new_style.as_servo_mut()); for property_animation in property_animations { // Set the property to the initial value. - property_animation.update(new_style.as_servo_mut(), 0.0); + property_animation.update(new_style, 0.0); // Kick off the animation. let now = time::precise_time_s(); diff --git a/components/style/keyframes.rs b/components/style/keyframes.rs index 8c3e90ef2a4..03682b1e3af 100644 --- a/components/style/keyframes.rs +++ b/components/style/keyframes.rs @@ -121,6 +121,7 @@ pub struct KeyframesStep { } impl KeyframesStep { + #[inline] fn new(percentage: KeyframePercentage, declarations: Arc>) -> Self { KeyframesStep { @@ -156,6 +157,7 @@ fn get_animated_properties(keyframe: &Keyframe) -> Vec { ret.push(property); } } + ret }