mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 18:17:44 +00:00
LibWeb: Use parse_length() for rect() parsing
This commit is contained in:
parent
8200fdeddc
commit
2f5379bc9b
1 changed files with 5 additions and 4 deletions
|
@ -2378,14 +2378,15 @@ RefPtr<StyleValue> Parser::parse_rect_value(ComponentValue const& component_valu
|
||||||
|
|
||||||
// <top>, <right>, <bottom>, and <left> may either have a <length> value or 'auto'.
|
// <top>, <right>, <bottom>, and <left> may either have a <length> value or 'auto'.
|
||||||
// Negative lengths are permitted.
|
// Negative lengths are permitted.
|
||||||
auto& current_token = tokens.next_token();
|
if (tokens.peek_token().is_ident("auto"sv)) {
|
||||||
if (current_token.is_ident("auto"sv)) {
|
(void)tokens.next_token(); // `auto`
|
||||||
params.append(Length::make_auto());
|
params.append(Length::make_auto());
|
||||||
} else {
|
} else {
|
||||||
auto maybe_length = parse_length(current_token);
|
auto maybe_length = parse_length(tokens);
|
||||||
if (!maybe_length.has_value())
|
if (!maybe_length.has_value())
|
||||||
return nullptr;
|
return nullptr;
|
||||||
params.append(maybe_length.value());
|
// FIXME: Support calculated lengths
|
||||||
|
params.append(maybe_length.value().value());
|
||||||
}
|
}
|
||||||
tokens.skip_whitespace();
|
tokens.skip_whitespace();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue