mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 09:28:11 +00:00
LibWeb: Disallow non-whitespace tokens after "none" in transform
Before this, a declaration like `transform: none yellow 20;` would be parsed as `transform: none;`. Now it's correctly rejected as invalid.
This commit is contained in:
parent
a52f6fb5b0
commit
b3a6044fd8
1 changed files with 9 additions and 3 deletions
|
@ -4772,13 +4772,19 @@ RefPtr<StyleValue> Parser::parse_text_decoration_line_value(TokenStream<Componen
|
|||
RefPtr<StyleValue> Parser::parse_transform_value(Vector<ComponentValue> const& component_values)
|
||||
{
|
||||
NonnullRefPtrVector<StyleValue> transformations;
|
||||
auto tokens = TokenStream { component_values };
|
||||
tokens.skip_whitespace();
|
||||
|
||||
while (tokens.has_next_token()) {
|
||||
tokens.skip_whitespace();
|
||||
auto& part = tokens.next_token();
|
||||
|
||||
for (auto& part : component_values) {
|
||||
if (part.is(Token::Type::Whitespace))
|
||||
continue;
|
||||
if (part.is(Token::Type::Ident) && part.token().ident().equals_ignoring_case("none")) {
|
||||
if (!transformations.is_empty())
|
||||
return nullptr;
|
||||
tokens.skip_whitespace();
|
||||
if (tokens.has_next_token())
|
||||
return nullptr;
|
||||
return IdentifierStyleValue::create(ValueID::None);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue