Bug 1374233 - Part 11: Implement ToAnimatedValue for background-size.

MozReview-Commit-ID: DMcvpaqHdy9
This commit is contained in:
Boris Chiou 2017-07-24 15:00:53 +08:00
parent 1e79e5fe1b
commit ebedea5860
6 changed files with 78 additions and 6 deletions

View file

@ -9,6 +9,7 @@
//! module's raison d'être is to ultimately contain all these types.
use app_units::Au;
use smallvec::SmallVec;
use std::cmp::max;
use values::computed::Angle as ComputedAngle;
use values::computed::BorderCornerRadius as ComputedBorderCornerRadius;
@ -71,6 +72,23 @@ where
}
}
impl<T> ToAnimatedValue for SmallVec<[T; 1]>
where
T: ToAnimatedValue,
{
type AnimatedValue = SmallVec<[T::AnimatedValue; 1]>;
#[inline]
fn to_animated_value(self) -> Self::AnimatedValue {
self.into_iter().map(T::to_animated_value).collect()
}
#[inline]
fn from_animated_value(animated: Self::AnimatedValue) -> Self {
animated.into_iter().map(T::from_animated_value).collect()
}
}
/// Marker trait for computed values with the same representation during animations.
pub trait AnimatedValueAsComputed {}