mirror of
https://github.com/servo/servo.git
synced 2025-08-08 06:55:31 +01:00
Introduce CSSPixelLength and update NonNegativeLength.
First, we define computed::CSSPixelLength which contains a CSSFloat, a pixel value, and then we replace computed::Length with CSSPixelLength. Therefore, the |ComputedValue| of NoCalcLength, AbsoluteLength, FontRelativeLength, ViewportPercentageLength, CharacterWidth, and PhysicalLength is CSSPixelLength. Besides, we drop NonNegativeAu, and replace computed::NonNegativeLength with NonNegative<computed::Length>. (i.e. NonNegative<CSSPixelLength>)
This commit is contained in:
parent
cad3aff508
commit
a949e2a057
40 changed files with 502 additions and 406 deletions
|
@ -19,7 +19,7 @@ use values::computed::ComputedUrl;
|
|||
use values::computed::GreaterThanOrEqualToOneNumber as ComputedGreaterThanOrEqualToOneNumber;
|
||||
use values::computed::MaxLength as ComputedMaxLength;
|
||||
use values::computed::MozLength as ComputedMozLength;
|
||||
use values::computed::NonNegativeAu;
|
||||
use values::computed::NonNegativeLength as ComputedNonNegativeLength;
|
||||
use values::computed::NonNegativeLengthOrPercentage as ComputedNonNegativeLengthOrPercentage;
|
||||
use values::computed::NonNegativeNumber as ComputedNonNegativeNumber;
|
||||
use values::computed::PositiveInteger as ComputedPositiveInteger;
|
||||
|
@ -296,7 +296,7 @@ impl ToAnimatedValue for ComputedGreaterThanOrEqualToOneNumber {
|
|||
}
|
||||
}
|
||||
|
||||
impl ToAnimatedValue for NonNegativeAu {
|
||||
impl ToAnimatedValue for ComputedNonNegativeLength {
|
||||
type AnimatedValue = Self;
|
||||
|
||||
#[inline]
|
||||
|
@ -306,7 +306,7 @@ impl ToAnimatedValue for NonNegativeAu {
|
|||
|
||||
#[inline]
|
||||
fn from_animated_value(animated: Self::AnimatedValue) -> Self {
|
||||
max(animated.0, Au(0)).into()
|
||||
ComputedNonNegativeLength::new(animated.px().max(0.))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue