mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-16 13:09:41 +00:00
LibWeb: Parse the anchor-name
property
This commit is contained in:
parent
846f1626dd
commit
7374a07fbc
Notes:
github-actions[bot]
2025-10-07 10:32:02 +00:00
Author: https://github.com/tcl3
Commit: 7374a07fbc
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6363
Reviewed-by: https://github.com/AtkinsSJ ✅
10 changed files with 768 additions and 2 deletions
|
@ -440,6 +440,10 @@ Parser::ParseErrorOr<NonnullRefPtr<StyleValue const>> Parser::parse_css_value(Pr
|
|||
// values, only the CSS-wide keywords - this is handled above, and thus, if we have gotten to here, there
|
||||
// is an invalid value which is a syntax error.
|
||||
return ParseError::SyntaxError;
|
||||
case PropertyID::AnchorName:
|
||||
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::AspectRatio:
|
||||
if (auto parsed_value = parse_aspect_ratio_value(tokens); parsed_value && !tokens.has_next_token())
|
||||
return parsed_value.release_nonnull();
|
||||
|
@ -1186,6 +1190,21 @@ RefPtr<StyleValue const> Parser::parse_cursor_value(TokenStream<ComponentValue>&
|
|||
return StyleValueList::create(move(cursors), StyleValueList::Separator::Comma);
|
||||
}
|
||||
|
||||
// https://drafts.csswg.org/css-anchor-position/#name
|
||||
RefPtr<StyleValue const> Parser::parse_anchor_name_value(TokenStream<ComponentValue>& tokens)
|
||||
{
|
||||
// none | <dashed-ident>#
|
||||
if (auto none = parse_all_as_single_keyword_value(tokens, Keyword::None))
|
||||
return none;
|
||||
|
||||
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 nullptr;
|
||||
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