diff options
author | Sam Atkins <atkinssj@serenityos.org> | 2022-04-17 19:33:09 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-04-18 14:16:28 +0200 |
commit | b3a6044fd8214aa13630486e16b46256648aa478 (patch) | |
tree | 952d7238cb09f228f9232904c8576d2c3d67524d /Userland/Libraries/LibWeb/CSS | |
parent | a52f6fb5b030583fe541f8f6c36b685bb3da2700 (diff) | |
download | serenity-b3a6044fd8214aa13630486e16b46256648aa478.zip |
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.
Diffstat (limited to 'Userland/Libraries/LibWeb/CSS')
-rw-r--r-- | Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp index b7a9e95f22..aec3bf250f 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp +++ b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp @@ -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); } |