mirror of
https://github.com/servo/servo.git
synced 2025-08-10 16:05:43 +01:00
Bug 1374233 - Part 11: Implement ToAnimatedValue for background-size.
MozReview-Commit-ID: DMcvpaqHdy9
This commit is contained in:
parent
1e79e5fe1b
commit
ebedea5860
6 changed files with 78 additions and 6 deletions
|
@ -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 {}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue