mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-21 03:55:24 +00:00
LibWeb/CSS: Take custom-ident blacklist as a Span
Using std::initializer_list here was a bit of a hack, and makes it awkward to pass those blacklists around.
This commit is contained in:
parent
9585c6c0c7
commit
c6c607884b
Notes:
github-actions[bot]
2025-02-26 11:24:19 +00:00
Author: https://github.com/AtkinsSJ Commit: https://github.com/LadybirdBrowser/ladybird/commit/c6c607884b6 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3684 Reviewed-by: https://github.com/trflynn89
3 changed files with 7 additions and 7 deletions
|
@ -293,7 +293,7 @@ private:
|
|||
Optional<PropertyAndValue> parse_css_value_for_properties(ReadonlySpan<PropertyID>, TokenStream<ComponentValue>&);
|
||||
RefPtr<CSSStyleValue> parse_builtin_value(TokenStream<ComponentValue>&);
|
||||
RefPtr<CSSStyleValue> parse_calculated_value(ComponentValue const&);
|
||||
RefPtr<CustomIdentStyleValue> parse_custom_ident_value(TokenStream<ComponentValue>&, std::initializer_list<StringView> blacklist);
|
||||
RefPtr<CustomIdentStyleValue> parse_custom_ident_value(TokenStream<ComponentValue>&, ReadonlySpan<StringView> blacklist);
|
||||
// NOTE: Implemented in generated code. (GenerateCSSMathFunctions.cpp)
|
||||
RefPtr<CalculationNode> parse_math_function(Function const&, CalculationContext const&);
|
||||
RefPtr<CalculationNode> parse_a_calc_function_node(Function const&, CalculationContext const&);
|
||||
|
|
|
@ -839,7 +839,7 @@ RefPtr<CSSStyleValue> Parser::parse_color_scheme_value(TokenStream<ComponentValu
|
|||
|
||||
// The 'normal', 'light', 'dark', and 'only' keywords are not valid <custom-ident>s in this property.
|
||||
// Note: only 'normal' is blacklisted here because 'light' and 'dark' aren't parsed differently and 'only' is checked for afterwards
|
||||
auto ident = parse_custom_ident_value(tokens, { "normal"sv });
|
||||
auto ident = parse_custom_ident_value(tokens, { { "normal"sv } });
|
||||
if (!ident)
|
||||
return {};
|
||||
|
||||
|
@ -4452,7 +4452,7 @@ RefPtr<CSSStyleValue> Parser::parse_view_transition_name_value(TokenStream<Compo
|
|||
|
||||
// The values 'none' and 'auto' are excluded from <custom-ident> here.
|
||||
// Note: Only auto is excluded here since none isn't parsed differently.
|
||||
auto ident = parse_custom_ident_value(tokens, { "auto"sv });
|
||||
auto ident = parse_custom_ident_value(tokens, { { "auto"sv } });
|
||||
if (!ident)
|
||||
return {};
|
||||
|
||||
|
|
|
@ -1796,7 +1796,7 @@ RefPtr<CSSStyleValue> Parser::parse_counter_value(TokenStream<ComponentValue>& t
|
|||
auto transaction = tokens.begin_transaction();
|
||||
tokens.discard_whitespace();
|
||||
|
||||
auto counter_name = parse_custom_ident_value(tokens, { "none"sv });
|
||||
auto counter_name = parse_custom_ident_value(tokens, { { "none"sv } });
|
||||
if (!counter_name)
|
||||
return {};
|
||||
|
||||
|
@ -1817,7 +1817,7 @@ RefPtr<CSSStyleValue> Parser::parse_counter_value(TokenStream<ComponentValue>& t
|
|||
auto transaction = tokens.begin_transaction();
|
||||
tokens.discard_whitespace();
|
||||
|
||||
auto counter_style_name = parse_custom_ident_value(tokens, { "none"sv });
|
||||
auto counter_style_name = parse_custom_ident_value(tokens, { { "none"sv } });
|
||||
if (!counter_style_name)
|
||||
return {};
|
||||
|
||||
|
@ -2812,7 +2812,7 @@ RefPtr<CSSStyleValue> Parser::parse_builtin_value(TokenStream<ComponentValue>& t
|
|||
}
|
||||
|
||||
// https://www.w3.org/TR/css-values-4/#custom-idents
|
||||
RefPtr<CustomIdentStyleValue> Parser::parse_custom_ident_value(TokenStream<ComponentValue>& tokens, std::initializer_list<StringView> blacklist)
|
||||
RefPtr<CustomIdentStyleValue> Parser::parse_custom_ident_value(TokenStream<ComponentValue>& tokens, ReadonlySpan<StringView> blacklist)
|
||||
{
|
||||
auto transaction = tokens.begin_transaction();
|
||||
tokens.discard_whitespace();
|
||||
|
@ -3096,7 +3096,7 @@ RefPtr<GridTrackPlacementStyleValue> Parser::parse_grid_track_placement(TokenStr
|
|||
};
|
||||
auto parse_custom_ident = [this](auto& tokens) {
|
||||
// The <custom-ident> additionally excludes the keywords span and auto.
|
||||
return parse_custom_ident_value(tokens, { "span"sv, "auto"sv });
|
||||
return parse_custom_ident_value(tokens, { { "span"sv, "auto"sv } });
|
||||
};
|
||||
|
||||
auto transaction = tokens.begin_transaction();
|
||||
|
|
Loading…
Add table
Reference in a new issue