LibWeb/CSS: Flatten parse_basic_shape_function() into only caller

This commit is contained in:
Sam Atkins 2024-08-09 11:30:58 +01:00 committed by Andreas Kling
commit 98963e0c9a
Notes: github-actions[bot] 2024-08-10 08:39:25 +00:00
2 changed files with 4 additions and 11 deletions

View file

@ -1199,8 +1199,10 @@ RefPtr<StyleValue> Parser::parse_url_value(TokenStream<ComponentValue>& tokens)
return URLStyleValue::create(*url);
}
RefPtr<StyleValue> Parser::parse_basic_shape_function(ComponentValue const& component_value)
RefPtr<StyleValue> Parser::parse_basic_shape_value(TokenStream<ComponentValue>& tokens)
{
auto transaction = tokens.begin_transaction();
auto& component_value = tokens.next_token();
if (!component_value.is_function())
return nullptr;
@ -1236,18 +1238,10 @@ RefPtr<StyleValue> Parser::parse_basic_shape_function(ComponentValue const& comp
points.append(Polygon::Point { *x_pos, *y_pos });
}
transaction.commit();
return BasicShapeStyleValue::create(Polygon { FillRule::Nonzero, move(points) });
}
RefPtr<StyleValue> Parser::parse_basic_shape_value(TokenStream<ComponentValue>& tokens)
{
auto basic_shape = parse_basic_shape_function(tokens.peek_token());
if (!basic_shape)
return nullptr;
(void)tokens.next_token();
return basic_shape;
}
CSSRule* Parser::convert_to_rule(NonnullRefPtr<Rule> rule)
{
if (rule->is_at_rule()) {

View file

@ -260,7 +260,6 @@ private:
Optional<URL::URL> parse_url_function(ComponentValue const&);
RefPtr<StyleValue> parse_url_value(TokenStream<ComponentValue>&);
RefPtr<StyleValue> parse_basic_shape_function(ComponentValue const&);
RefPtr<StyleValue> parse_basic_shape_value(TokenStream<ComponentValue>&);
template<typename TElement>