mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Fix parsing methods of column-{gap,width}
This commit is contained in:
parent
d2ae3d8bed
commit
19978f2087
5 changed files with 76 additions and 15 deletions
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue