mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-11 01:06:01 +03:00
LibWeb: Parse FilterValueListStyleValue using TokenStream
This commit is contained in:
parent
2efaadd63c
commit
64a44b719e
Notes:
sideshowbarker
2024-07-17 07:08:37 +09:00
Author: https://github.com/AtkinsSJ Commit: https://github.com/SerenityOS/serenity/commit/64a44b719e Pull-request: https://github.com/SerenityOS/serenity/pull/22200
@ -3635,12 +3635,14 @@ RefPtr<StyleValue> Parser::parse_display_value(TokenStream<ComponentValue>& toke
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RefPtr<StyleValue> Parser::parse_filter_value_list_value(Vector<ComponentValue> const& component_values)
|
||||
RefPtr<StyleValue> Parser::parse_filter_value_list_value(TokenStream<ComponentValue>& tokens)
|
||||
{
|
||||
TokenStream tokens { component_values };
|
||||
auto transaction = tokens.begin_transaction();
|
||||
|
||||
if (contains_single_none_ident(tokens))
|
||||
if (contains_single_none_ident(tokens)) {
|
||||
transaction.commit();
|
||||
return parse_identifier_value(tokens.next_token());
|
||||
}
|
||||
|
||||
// FIXME: <url>s are ignored for now
|
||||
// <filter-value-list> = [ <filter-function> | <url> ]+
|
||||
@ -3810,6 +3812,7 @@ RefPtr<StyleValue> Parser::parse_filter_value_list_value(Vector<ComponentValue>
|
||||
if (filter_value_list.is_empty())
|
||||
return nullptr;
|
||||
|
||||
transaction.commit();
|
||||
return FilterValueListStyleValue::create(move(filter_value_list));
|
||||
}
|
||||
|
||||
@ -5737,7 +5740,7 @@ Parser::ParseErrorOr<NonnullRefPtr<StyleValue>> Parser::parse_css_value(Property
|
||||
return parsed_value.release_nonnull();
|
||||
return ParseError::SyntaxError;
|
||||
case PropertyID::BackdropFilter:
|
||||
if (auto parsed_value = parse_filter_value_list_value(component_values))
|
||||
if (auto parsed_value = parse_filter_value_list_value(tokens); parsed_value && !tokens.has_next_token())
|
||||
return parsed_value.release_nonnull();
|
||||
return ParseError::SyntaxError;
|
||||
case PropertyID::Background:
|
||||
|
@ -220,11 +220,12 @@ private:
|
||||
BackgroundPosition,
|
||||
};
|
||||
RefPtr<PositionStyleValue> parse_position_value(TokenStream<ComponentValue>&, PositionParsingMode = PositionParsingMode::Normal);
|
||||
RefPtr<StyleValue> parse_filter_value_list_value(TokenStream<ComponentValue>&);
|
||||
|
||||
template<typename ParseFunction>
|
||||
RefPtr<StyleValue> parse_comma_separated_value_list(TokenStream<ComponentValue>&, ParseFunction);
|
||||
RefPtr<StyleValue> parse_simple_comma_separated_value_list(PropertyID, TokenStream<ComponentValue>&);
|
||||
|
||||
RefPtr<StyleValue> parse_filter_value_list_value(Vector<ComponentValue> const&);
|
||||
RefPtr<StyleValue> parse_aspect_ratio_value(TokenStream<ComponentValue>&);
|
||||
RefPtr<StyleValue> parse_background_value(Vector<ComponentValue> const&);
|
||||
RefPtr<StyleValue> parse_single_background_position_x_or_y_value(TokenStream<ComponentValue>&, PropertyID);
|
||||
|
Loading…
Reference in New Issue
Block a user