Fix parsing methods of column-{gap,width}

This commit is contained in:
Nazım Can Altınova 2017-02-20 19:32:31 +03:00
parent d2ae3d8bed
commit 19978f2087
No known key found for this signature in database
GPG key ID: AF9BCD7CE6449954
5 changed files with 76 additions and 15 deletions

View file

@ -496,10 +496,24 @@ impl Parse for Length {
}
}
impl<T> Either<Length, T> {
impl Either<Length, Normal> {
#[inline]
#[allow(missing_docs)]
pub fn parse_non_negative_length(_context: &ParserContext, input: &mut Parser) -> Result<Self, ()> {
pub fn parse_non_negative_length(context: &ParserContext, input: &mut Parser) -> Result<Self, ()> {
if input.try(|input| Normal::parse(context, input)).is_ok() {
return Ok(Either::Second(Normal));
}
Length::parse_internal(input, AllowedNumericType::NonNegative).map(Either::First)
}
}
impl Either<Length, Auto> {
#[inline]
#[allow(missing_docs)]
pub fn parse_non_negative_length(context: &ParserContext, input: &mut Parser) -> Result<Self, ()> {
if input.try(|input| Auto::parse(context, input)).is_ok() {
return Ok(Either::Second(Auto));
}
Length::parse_internal(input, AllowedNumericType::NonNegative).map(Either::First)
}
}