mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-25 17:25:08 +02:00
LibWeb: Parse @counter-style pad descriptor
This commit is contained in:
Notes:
github-actions[bot]
2026-02-06 10:37:44 +00:00
Author: https://github.com/Calme1709 Commit: https://github.com/LadybirdBrowser/ladybird/commit/9b376240f9e Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/7708 Reviewed-by: https://github.com/AtkinsSJ ✅
@@ -2733,6 +2733,48 @@ RefPtr<StyleValue const> Parser::parse_symbol_value(TokenStream<ComponentValue>&
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RefPtr<StyleValue const> Parser::parse_nonnegative_integer_symbol_pair_value(TokenStream<ComponentValue>& tokens)
|
||||
{
|
||||
auto transaction = tokens.begin_transaction();
|
||||
tokens.discard_whitespace();
|
||||
|
||||
RefPtr<StyleValue const> integer;
|
||||
RefPtr<StyleValue const> symbol;
|
||||
|
||||
while (tokens.has_next_token()) {
|
||||
if (auto integer_value = parse_integer_value(tokens)) {
|
||||
if (integer)
|
||||
return nullptr;
|
||||
|
||||
// FIXME: Do we need to support CalculatedStyleValue here?
|
||||
if (!integer_value->is_integer() || integer_value->as_integer().integer() < 0)
|
||||
return nullptr;
|
||||
|
||||
integer = integer_value;
|
||||
tokens.discard_whitespace();
|
||||
continue;
|
||||
}
|
||||
|
||||
if (auto symbol_value = parse_symbol_value(tokens)) {
|
||||
if (symbol)
|
||||
return nullptr;
|
||||
|
||||
symbol = symbol_value;
|
||||
tokens.discard_whitespace();
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (!integer || !symbol)
|
||||
return nullptr;
|
||||
|
||||
transaction.commit();
|
||||
|
||||
return StyleValueList::create({ integer.release_nonnull(), symbol.release_nonnull() }, StyleValueList::Separator::Space);
|
||||
}
|
||||
|
||||
RefPtr<StyleValue const> Parser::parse_ratio_value(TokenStream<ComponentValue>& tokens)
|
||||
{
|
||||
if (auto ratio = parse_ratio(tokens); ratio.has_value())
|
||||
|
||||
Reference in New Issue
Block a user