mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-08 06:09:58 +00:00
LibWeb/CSS: Implement and use ValueType::DashedIdent
Reduces the repeated code for parsing these, and makes them available to the generic value parser.
This commit is contained in:
parent
6671cbef41
commit
9c06d58b2e
Notes:
github-actions[bot]
2025-10-30 11:34:42 +00:00
Author: https://github.com/AtkinsSJ
Commit: 9c06d58b2e
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6614
6 changed files with 38 additions and 23 deletions
|
|
@ -3593,6 +3593,17 @@ Optional<FlyString> Parser::parse_dashed_ident(TokenStream<ComponentValue>& toke
|
|||
return custom_ident;
|
||||
}
|
||||
|
||||
RefPtr<CustomIdentStyleValue const> Parser::parse_dashed_ident_value(TokenStream<ComponentValue>& tokens)
|
||||
{
|
||||
auto transaction = tokens.begin_transaction();
|
||||
tokens.discard_whitespace();
|
||||
if (auto dashed_ident = parse_dashed_ident(tokens); dashed_ident.has_value()) {
|
||||
transaction.commit();
|
||||
return CustomIdentStyleValue::create(*dashed_ident);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// https://www.w3.org/TR/css-grid-2/#typedef-track-breadth
|
||||
Optional<GridSize> Parser::parse_grid_track_breadth(TokenStream<ComponentValue>& tokens)
|
||||
{
|
||||
|
|
@ -4908,6 +4919,8 @@ RefPtr<StyleValue const> Parser::parse_value(ValueType value_type, TokenStream<C
|
|||
case ValueType::CustomIdent:
|
||||
// FIXME: Figure out how to pass the blacklist here
|
||||
return parse_custom_ident_value(tokens, {});
|
||||
case ValueType::DashedIdent:
|
||||
return parse_dashed_ident_value(tokens);
|
||||
case ValueType::EasingFunction:
|
||||
return parse_easing_value(tokens);
|
||||
case ValueType::FilterValueList:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue