diff --git a/components/style/properties/helpers/animated_properties.mako.rs b/components/style/properties/helpers/animated_properties.mako.rs index 2f7aaafc63d..68c90d0ce20 100644 --- a/components/style/properties/helpers/animated_properties.mako.rs +++ b/components/style/properties/helpers/animated_properties.mako.rs @@ -1072,6 +1072,27 @@ impl Into for f64 { impl RepeatableListAnimatable for generic_position::Position where H: RepeatableListAnimatable, V: RepeatableListAnimatable {} +/// https://drafts.csswg.org/css-transitions/#animtype-rect +impl Animate for ClipRect { + #[inline] + fn animate(&self, other: &Self, procedure: Procedure) -> Result { + let animate_component = |this: &Option, other: &Option| { + match (this.animate(other, procedure)?, procedure) { + (None, Procedure::Interpolate { .. }) => Ok(None), + (None, _) => Err(()), + (result, _) => Ok(result), + } + }; + + Ok(ClipRect { + top: animate_component(&self.top, &other.top)?, + right: animate_component(&self.right, &other.right)?, + bottom: animate_component(&self.bottom, &other.bottom)?, + left: animate_component(&self.left, &other.left)?, + }) + } +} + impl ToAnimatedZero for ClipRect { #[inline] fn to_animated_zero(&self) -> Result { Err(()) } diff --git a/components/style/values/computed/mod.rs b/components/style/values/computed/mod.rs index 22d958f90a6..ef2234863bc 100644 --- a/components/style/values/computed/mod.rs +++ b/components/style/values/computed/mod.rs @@ -439,7 +439,7 @@ pub type NonNegativeLengthOrPercentageOrNumber = Either,