diff --git a/components/style/properties/helpers/animated_properties.mako.rs b/components/style/properties/helpers/animated_properties.mako.rs index 6422149fb1d..def7bcb9ffe 100644 --- a/components/style/properties/helpers/animated_properties.mako.rs +++ b/components/style/properties/helpers/animated_properties.mako.rs @@ -936,9 +936,20 @@ impl Animatable for i32 { impl Animatable for Angle { #[inline] fn add_weighted(&self, other: &Angle, self_portion: f64, other_portion: f64) -> Result { - self.radians() - .add_weighted(&other.radians(), self_portion, other_portion) - .map(Angle::from_radians) + match (*self, *other) { + % for angle_type in [ 'Degree', 'Gradian', 'Turn' ]: + (Angle::${angle_type}(val1), Angle::${angle_type}(val2)) => { + Ok(Angle::${angle_type}( + try!(val1.add_weighted(&val2, self_portion, other_portion)) + )) + } + % endfor + _ => { + self.radians() + .add_weighted(&other.radians(), self_portion, other_portion) + .map(Angle::from_radians) + } + } } }