Bug 1374233 - Part 6: Add PositiveInteger and PositiveIntegerOrAuto for column-count.

column-count should be a positive integer or auto.

MozReview-Commit-ID: 9LFvrYo8De5
This commit is contained in:
Boris Chiou 2017-07-20 17:32:56 +08:00
parent 190cd5b952
commit 9d69cb2866
7 changed files with 49 additions and 9 deletions

View file

@ -511,6 +511,19 @@ impl IntegerOrAuto {
}
}
/// A wrapper of Integer, but only accept a value >= 1.
pub type PositiveInteger = GreaterThanOrEqualToOne<CSSInteger>;
impl From<CSSInteger> for PositiveInteger {
#[inline]
fn from(int: CSSInteger) -> PositiveInteger {
GreaterThanOrEqualToOne::<CSSInteger>(int)
}
}
/// PositiveInteger | auto
pub type PositiveIntegerOrAuto = Either<PositiveInteger, Auto>;
/// <length> | <percentage> | <number>
pub type LengthOrPercentageOrNumber = Either<Number, LengthOrPercentage>;