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:
Boris Chiou 2017-07-21 13:35:06 +08:00
parent 2ef38ce67a
commit 190cd5b952
8 changed files with 67 additions and 33 deletions

View file

@ -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>> {