mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 15:57:35 +00:00
LibWeb: Disallow trailing commas in transform function arguments
This commit is contained in:
parent
b3a6044fd8
commit
00782d9a59
1 changed files with 15 additions and 13 deletions
|
@ -4796,19 +4796,11 @@ RefPtr<StyleValue> Parser::parse_transform_value(Vector<ComponentValue> const& c
|
||||||
auto function = maybe_function.release_value();
|
auto function = maybe_function.release_value();
|
||||||
auto function_metadata = transform_function_metadata(function);
|
auto function_metadata = transform_function_metadata(function);
|
||||||
|
|
||||||
bool expect_comma = false;
|
|
||||||
NonnullRefPtrVector<StyleValue> values;
|
NonnullRefPtrVector<StyleValue> values;
|
||||||
for (auto& value : part.function().values()) {
|
auto argument_tokens = TokenStream { part.function().values() };
|
||||||
if (value.is(Token::Type::Whitespace))
|
argument_tokens.skip_whitespace();
|
||||||
continue;
|
while (argument_tokens.has_next_token()) {
|
||||||
|
auto& value = argument_tokens.next_token();
|
||||||
if (value.is(Token::Type::Comma)) {
|
|
||||||
if (!expect_comma)
|
|
||||||
return nullptr;
|
|
||||||
expect_comma = false;
|
|
||||||
continue;
|
|
||||||
} else if (expect_comma)
|
|
||||||
return nullptr;
|
|
||||||
|
|
||||||
// FIXME: Allow calc() parameters.
|
// FIXME: Allow calc() parameters.
|
||||||
|
|
||||||
|
@ -4846,7 +4838,17 @@ RefPtr<StyleValue> Parser::parse_transform_value(Vector<ComponentValue> const& c
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
expect_comma = true;
|
argument_tokens.skip_whitespace();
|
||||||
|
if (argument_tokens.has_next_token()) {
|
||||||
|
// Arguments must be separated by commas.
|
||||||
|
if (!argument_tokens.next_token().is(Token::Type::Comma))
|
||||||
|
return nullptr;
|
||||||
|
argument_tokens.skip_whitespace();
|
||||||
|
|
||||||
|
// If there are no more parameters after the comma, this is invalid.
|
||||||
|
if (!argument_tokens.has_next_token())
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (values.size() < function_metadata.min_parameters) {
|
if (values.size() < function_metadata.min_parameters) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue