mirror of
https://github.com/servo/servo.git
synced 2025-07-02 04:53:39 +01:00
Change AnimatedValue for NonNegativeNumber to CSSFloat
This commit is contained in:
parent
da5acc81d2
commit
f89ebf7fe9
5 changed files with 22 additions and 42 deletions
|
@ -429,6 +429,20 @@ pub type Number = CSSFloat;
|
|||
/// A wrapper of Number, but the value >= 0.
|
||||
pub type NonNegativeNumber = NonNegative<CSSFloat>;
|
||||
|
||||
impl ToAnimatedValue for NonNegativeNumber {
|
||||
type AnimatedValue = CSSFloat;
|
||||
|
||||
#[inline]
|
||||
fn to_animated_value(self) -> Self::AnimatedValue {
|
||||
self.0
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn from_animated_value(animated: Self::AnimatedValue) -> Self {
|
||||
animated.max(0.).into()
|
||||
}
|
||||
}
|
||||
|
||||
impl From<CSSFloat> for NonNegativeNumber {
|
||||
#[inline]
|
||||
fn from(number: CSSFloat) -> NonNegativeNumber {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue