mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Don't consume invalid idents when parsing text-decoration.
This commit is contained in:
parent
61fd5e79f7
commit
53a9defa9f
2 changed files with 20 additions and 15 deletions
|
@ -75,19 +75,27 @@ ${helpers.single_keyword("unicode-bidi", "normal embed isolate bidi-override iso
|
|||
}
|
||||
let mut blink = false;
|
||||
let mut empty = true;
|
||||
while let Ok(ident) = input.expect_ident() {
|
||||
match_ignore_ascii_case! { ident,
|
||||
"underline" => if result.underline { return Err(()) }
|
||||
else { empty = false; result.underline = true },
|
||||
"overline" => if result.overline { return Err(()) }
|
||||
else { empty = false; result.overline = true },
|
||||
"line-through" => if result.line_through { return Err(()) }
|
||||
else { empty = false; result.line_through = true },
|
||||
"blink" => if blink { return Err(()) }
|
||||
else { empty = false; blink = true },
|
||||
_ => break
|
||||
}
|
||||
|
||||
while input.try(|input| {
|
||||
if let Ok(ident) = input.expect_ident() {
|
||||
match_ignore_ascii_case! { ident,
|
||||
"underline" => if result.underline { return Err(()) }
|
||||
else { empty = false; result.underline = true },
|
||||
"overline" => if result.overline { return Err(()) }
|
||||
else { empty = false; result.overline = true },
|
||||
"line-through" => if result.line_through { return Err(()) }
|
||||
else { empty = false; result.line_through = true },
|
||||
"blink" => if blink { return Err(()) }
|
||||
else { empty = false; blink = true },
|
||||
_ => return Err(())
|
||||
}
|
||||
} else {
|
||||
return Err(());
|
||||
}
|
||||
Ok(())
|
||||
}).is_ok() {
|
||||
}
|
||||
|
||||
if !empty { Ok(result) } else { Err(()) }
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue