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

@ -717,6 +717,19 @@ impl IntegerOrAuto {
}
}
/// A wrapper of Integer, with value >= 1.
pub type PositiveInteger = GreaterThanOrEqualToOne<Integer>;
impl Parse for PositiveInteger {
#[inline]
fn parse<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i>> {
Integer::parse_positive(context, input).map(GreaterThanOrEqualToOne::<Integer>)
}
}
/// PositiveInteger | auto
pub type PositiveIntegerOrAuto = Either<PositiveInteger, Auto>;
#[allow(missing_docs)]
pub type UrlOrNone = Either<SpecifiedUrl, None_>;