mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
Only allow border-image-outset to use non-negative values.
This commit is contained in:
parent
72e4c6dc21
commit
46c4c9ce66
3 changed files with 34 additions and 6 deletions
|
@ -242,7 +242,7 @@ ${helpers.single_keyword("-moz-float-edge", "content-box margin-box",
|
|||
pub fn parse(_context: &ParserContext, input: &mut Parser) -> Result<SpecifiedValue, ()> {
|
||||
let mut values = vec![];
|
||||
for _ in 0..4 {
|
||||
let value = input.try(|input| LengthOrNumber::parse(input));
|
||||
let value = input.try(|input| LengthOrNumber::parse_non_negative(input));
|
||||
match value {
|
||||
Ok(val) => values.push(val),
|
||||
Err(_) => break,
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue