mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Parse perspective property as non negative and add tests
This commit is contained in:
parent
c5c4354f84
commit
20c07332a1
4 changed files with 50 additions and 0 deletions
|
@ -458,6 +458,17 @@ impl Parse for Length {
|
|||
}
|
||||
}
|
||||
|
||||
impl Either<Length, None_> {
|
||||
/// Parse a non-negative length or none
|
||||
#[inline]
|
||||
pub fn parse_non_negative_length(context: &ParserContext, input: &mut Parser) -> Result<Self, ()> {
|
||||
if input.try(|input| None_::parse(context, input)).is_ok() {
|
||||
return Ok(Either::Second(None_));
|
||||
}
|
||||
Length::parse_non_negative(input).map(Either::First)
|
||||
}
|
||||
}
|
||||
|
||||
impl Either<Length, Normal> {
|
||||
#[inline]
|
||||
#[allow(missing_docs)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue