diff options
Diffstat (limited to 'components/style/values/generics/rect.rs')
-rw-r--r-- | components/style/values/generics/rect.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/components/style/values/generics/rect.rs b/components/style/values/generics/rect.rs index 1ac00766f88..3dc9e095890 100644 --- a/components/style/values/generics/rect.rs +++ b/components/style/values/generics/rect.rs @@ -6,6 +6,7 @@ use cssparser::Parser; use parser::{Parse, ParserContext}; +use properties::animated_properties::Animatable; use std::fmt; use style_traits::{ToCss, ParseError}; @@ -51,6 +52,24 @@ impl<T> Rect<T> } } +impl<L> Animatable for Rect<L> +where + L: Animatable, +{ + fn add_weighted( + &self, + other: &Self, + self_portion: f64, + other_portion: f64, + ) -> Result<Self, ()> { + let first = self.0.add_weighted(&other.0, self_portion, other_portion)?; + let second = self.1.add_weighted(&other.1, self_portion, other_portion)?; + let third = self.2.add_weighted(&other.2, self_portion, other_portion)?; + let fourth = self.3.add_weighted(&other.3, self_portion, other_portion)?; + Ok(Rect(first, second, third, fourth)) + } +} + impl<T> From<T> for Rect<T> where T: Clone { |