1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-29 07:05:06 +00:00

LibWeb: Don't assume rect() contents are Tokens

This stops `clip: rect({});` from crashing.
This commit is contained in:
Sam Atkins 2023-11-21 11:39:06 +00:00 committed by Andreas Kling
parent aba2946b1e
commit 5e54ff1858
3 changed files with 15 additions and 2 deletions

View file

@ -2122,8 +2122,8 @@ RefPtr<StyleValue> Parser::parse_rect_value(ComponentValue const& component_valu
// <top>, <right>, <bottom>, and <left> may either have a <length> value or 'auto'.
// Negative lengths are permitted.
auto current_token = tokens.next_token().token();
if (current_token.is(Token::Type::Ident) && current_token.ident().equals_ignoring_ascii_case("auto"sv)) {
auto& current_token = tokens.next_token();
if (current_token.is_ident("auto"sv)) {
params.append(Length::make_auto());
} else {
auto maybe_length = parse_length(current_token);