mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-16 21:20:18 +00:00
LibWeb: Parse the anchor-scope
property
This commit is contained in:
parent
85a15ea1d4
commit
03fa367d9d
Notes:
github-actions[bot]
2025-10-07 10:31:24 +00:00
Author: https://github.com/tcl3
Commit: 03fa367d9d
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6363
Reviewed-by: https://github.com/AtkinsSJ ✅
10 changed files with 125 additions and 2 deletions
|
@ -444,6 +444,10 @@ Parser::ParseErrorOr<NonnullRefPtr<StyleValue const>> Parser::parse_css_value(Pr
|
|||
if (auto parsed_value = parse_anchor_name_value(tokens); parsed_value && !tokens.has_next_token())
|
||||
return parsed_value.release_nonnull();
|
||||
return ParseError::SyntaxError;
|
||||
case PropertyID::AnchorScope:
|
||||
if (auto parsed_value = parse_anchor_scope_value(tokens); parsed_value && !tokens.has_next_token())
|
||||
return parsed_value.release_nonnull();
|
||||
return ParseError::SyntaxError;
|
||||
case PropertyID::AspectRatio:
|
||||
if (auto parsed_value = parse_aspect_ratio_value(tokens); parsed_value && !tokens.has_next_token())
|
||||
return parsed_value.release_nonnull();
|
||||
|
@ -1216,6 +1220,24 @@ RefPtr<StyleValue const> Parser::parse_anchor_name_value(TokenStream<ComponentVa
|
|||
});
|
||||
}
|
||||
|
||||
// https://drafts.csswg.org/css-anchor-position/#anchor-scope
|
||||
RefPtr<StyleValue const> Parser::parse_anchor_scope_value(TokenStream<ComponentValue>& tokens)
|
||||
{
|
||||
// none | all | <dashed-ident>#
|
||||
if (auto none = parse_all_as_single_keyword_value(tokens, Keyword::None))
|
||||
return none;
|
||||
|
||||
if (auto all = parse_all_as_single_keyword_value(tokens, Keyword::All))
|
||||
return all;
|
||||
|
||||
return parse_comma_separated_value_list(tokens, [this](TokenStream<ComponentValue>& inner_tokens) -> RefPtr<StyleValue const> {
|
||||
auto dashed_ident = parse_dashed_ident(inner_tokens);
|
||||
if (!dashed_ident.has_value())
|
||||
return {};
|
||||
return CustomIdentStyleValue::create(*dashed_ident);
|
||||
});
|
||||
}
|
||||
|
||||
// https://www.w3.org/TR/css-sizing-4/#aspect-ratio
|
||||
RefPtr<StyleValue const> Parser::parse_aspect_ratio_value(TokenStream<ComponentValue>& tokens)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue