mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-03 14:50:18 +00:00
LibWeb/CSS: Flatten parse_basic_shape_function() into only caller
This commit is contained in:
parent
e5553d6d2f
commit
98963e0c9a
Notes:
github-actions[bot]
2024-08-10 08:39:25 +00:00
Author: https://github.com/AtkinsSJ
Commit: 98963e0c9a
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1018
Reviewed-by: https://github.com/awesomekling
2 changed files with 4 additions and 11 deletions
|
@ -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()) {
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue