Only allow border-image-outset to use non-negative values.

This commit is contained in:
J. Cliff Dyer 2016-11-23 09:19:56 -05:00
parent 72e4c6dc21
commit 46c4c9ce66
3 changed files with 34 additions and 6 deletions

View file

@ -1009,3 +1009,13 @@ impl Parse for LengthOrPercentageOrAutoOrContent {
}
pub type LengthOrNumber = Either<Length, Number>;
impl LengthOrNumber {
pub fn parse_non_negative(input: &mut Parser) -> Result<Self, ()> {
if let Ok(v) = input.try(|i| Length::parse_non_negative(i)) {
Ok(Either::First(v))
} else {
Number::parse_non_negative(input).map(Either::Second)
}
}
}