mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
stylo: Animate font-size as NonNegativeLength
This commit is contained in:
parent
35aad08619
commit
ce7d82e9c4
3 changed files with 30 additions and 2 deletions
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue