aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/style/properties/helpers/animated_properties.mako.rs21
-rw-r--r--components/style/values/computed/mod.rs2
2 files changed, 22 insertions, 1 deletions
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<FontStretch> for f64 {
impl<H, V> RepeatableListAnimatable for generic_position::Position<H, V>
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<Self, ()> {
+ let animate_component = |this: &Option<Au>, other: &Option<Au>| {
+ 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<Self, ()> { 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<NonNegativeNumber, NonNe
#[allow(missing_docs)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
-#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, Eq, PartialEq)]
+#[derive(Clone, ComputeSquaredDistance, Copy, Debug, Eq, PartialEq)]
/// A computed cliprect for clip and image-region
pub struct ClipRect {
pub top: Option<Au>,