stylo: Animate font-size as NonNegativeLength

This commit is contained in:
Manish Goregaokar 2017-09-23 16:22:42 -07:00
parent 35aad08619
commit ce7d82e9c4
3 changed files with 30 additions and 2 deletions

View file

@ -791,6 +791,16 @@ impl NonNegativeLength {
self.0.px()
}
#[inline]
/// Ensures it is positive
pub fn clamp(self) -> Self {
if (self.0).0 < 0. {
Self::zero()
} else {
self
}
}
/// Scale this NonNegativeLength.
/// We scale NonNegativeLength by zero if the factor is negative because it doesn't
/// make sense to scale a negative factor on a non-negative length.