1
Fork 0
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:
Sam Atkins 2022-04-17 19:33:09 +01:00 committed by Andreas Kling
parent a52f6fb5b0
commit b3a6044fd8

View file

@ -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);
}