mirror of
https://github.com/servo/servo.git
synced 2025-08-10 07:55:33 +01:00
Bug 1374233 - Part 5: Use NonNegativeLength and NonNegativeAu for border-spacing.
We already have NonNegativeLength and NonNegativeAu, so we can re-use it to define the specified value and the computed value of border-spacing. And then implement ToAnimatedValue for it. MozReview-Commit-ID: CLckpKMYVXU
This commit is contained in:
parent
2ef38ce67a
commit
190cd5b952
8 changed files with 67 additions and 33 deletions
|
@ -708,6 +708,20 @@ impl<T: Parse> Either<Length, T> {
|
|||
/// A wrapper of Length, whose value must be >= 0.
|
||||
pub type NonNegativeLength = NonNegative<Length>;
|
||||
|
||||
impl From<NoCalcLength> for NonNegativeLength {
|
||||
#[inline]
|
||||
fn from(len: NoCalcLength) -> Self {
|
||||
NonNegative::<Length>(Length::NoCalc(len))
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Length> for NonNegativeLength {
|
||||
#[inline]
|
||||
fn from(len: Length) -> Self {
|
||||
NonNegative::<Length>(len)
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Parse> Parse for Either<NonNegativeLength, T> {
|
||||
#[inline]
|
||||
fn parse<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i>> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue