summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb
diff options
context:
space:
mode:
authorSam Atkins <atkinssj@serenityos.org>2022-04-17 19:33:09 +0100
committerAndreas Kling <kling@serenityos.org>2022-04-18 14:16:28 +0200
commitb3a6044fd8214aa13630486e16b46256648aa478 (patch)
tree952d7238cb09f228f9232904c8576d2c3d67524d /Userland/Libraries/LibWeb
parenta52f6fb5b030583fe541f8f6c36b685bb3da2700 (diff)
downloadserenity-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')
-rw-r--r--Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp12
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);
}