mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 16:28:11 +00:00
LibWeb: Don't assume repeat() contents are Tokens
This stops `grid-template-rows: repeat({})` from crashing.
This commit is contained in:
parent
5e54ff1858
commit
1f6e13d8fe
3 changed files with 18 additions and 5 deletions
|
@ -5102,14 +5102,14 @@ Optional<CSS::GridRepeat> Parser::parse_repeat(Vector<ComponentValue> const& com
|
|||
part_one_tokens.skip_whitespace();
|
||||
if (!part_one_tokens.has_next_token())
|
||||
return {};
|
||||
auto current_token = part_one_tokens.next_token().token();
|
||||
auto& current_token = part_one_tokens.next_token();
|
||||
|
||||
auto repeat_count = 0;
|
||||
if (current_token.is(Token::Type::Number) && current_token.number().is_integer() && current_token.number_value() > 0)
|
||||
repeat_count = current_token.number_value();
|
||||
else if (current_token.is(Token::Type::Ident) && current_token.ident().equals_ignoring_ascii_case("auto-fill"sv))
|
||||
if (current_token.is(Token::Type::Number) && current_token.token().number().is_integer() && current_token.token().number_value() > 0)
|
||||
repeat_count = current_token.token().number_value();
|
||||
else if (current_token.is_ident("auto-fill"sv))
|
||||
is_auto_fill = true;
|
||||
else if (current_token.is(Token::Type::Ident) && current_token.ident().equals_ignoring_ascii_case("auto-fit"sv))
|
||||
else if (current_token.is_ident("auto-fit"sv))
|
||||
is_auto_fit = true;
|
||||
|
||||
// The second argument is a track list, which is repeated that number of times.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue