mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 05:39:11 +00:00
LibWeb/CSS: Parse gradient functions with TokenStream
They already used TokenStream for parsing the function parameters, but this makes the `parse_foo_gradient()` functions themselves take a TokenStream.
This commit is contained in:
parent
29d7aa9fc9
commit
9de73bf89b
Notes:
github-actions[bot]
2024-08-10 08:38:51 +00:00
Author: https://github.com/AtkinsSJ
Commit: 9de73bf89b
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1018
Reviewed-by: https://github.com/awesomekling
3 changed files with 25 additions and 21 deletions
|
@ -3199,26 +3199,18 @@ RefPtr<StyleValue> Parser::parse_string_value(TokenStream<ComponentValue>& token
|
|||
|
||||
RefPtr<StyleValue> Parser::parse_image_value(TokenStream<ComponentValue>& tokens)
|
||||
{
|
||||
auto transaction = tokens.begin_transaction();
|
||||
|
||||
if (auto url = parse_url_function(tokens); url.has_value()) {
|
||||
transaction.commit();
|
||||
if (auto url = parse_url_function(tokens); url.has_value())
|
||||
return ImageStyleValue::create(url.value());
|
||||
}
|
||||
|
||||
auto& token = tokens.next_token();
|
||||
if (auto linear_gradient = parse_linear_gradient_function(token)) {
|
||||
transaction.commit();
|
||||
if (auto linear_gradient = parse_linear_gradient_function(tokens))
|
||||
return linear_gradient;
|
||||
}
|
||||
if (auto conic_gradient = parse_conic_gradient_function(token)) {
|
||||
transaction.commit();
|
||||
|
||||
if (auto conic_gradient = parse_conic_gradient_function(tokens))
|
||||
return conic_gradient;
|
||||
}
|
||||
if (auto radial_gradient = parse_radial_gradient_function(token)) {
|
||||
transaction.commit();
|
||||
|
||||
if (auto radial_gradient = parse_radial_gradient_function(tokens))
|
||||
return radial_gradient;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue