mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-21 20:15:17 +00:00
LibWeb/CSS: Stop using parse_color()
Parsing a `Gfx::Color` no longer makes sense, as CSS has many ways of defining a color, often in a dynamic way where the color value isn't known until later. This is a small preparatory change before a much larger color rewrite.
This commit is contained in:
parent
37ea4e3b5f
commit
9bc71ab1fe
Notes:
github-actions[bot]
2024-08-21 09:53:00 +00:00
Author: https://github.com/AtkinsSJ Commit: https://github.com/LadybirdBrowser/ladybird/commit/9bc71ab1fe6 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1091
1 changed files with 5 additions and 6 deletions
|
@ -4695,7 +4695,7 @@ RefPtr<CSSStyleValue> Parser::parse_filter_value_list_value(TokenStream<Componen
|
|||
// drop-shadow( [ <color>? && <length>{2,3} ] )
|
||||
// Note: The following code is a little awkward to allow the color to be before or after the lengths.
|
||||
Optional<LengthOrCalculated> maybe_radius = {};
|
||||
auto maybe_color = parse_color(tokens);
|
||||
auto maybe_color = parse_color_value(tokens);
|
||||
auto x_offset = parse_length(tokens);
|
||||
tokens.skip_whitespace();
|
||||
if (!x_offset.has_value() || !tokens.has_next_token()) {
|
||||
|
@ -4707,18 +4707,17 @@ RefPtr<CSSStyleValue> Parser::parse_filter_value_list_value(TokenStream<Componen
|
|||
}
|
||||
if (tokens.has_next_token()) {
|
||||
maybe_radius = parse_length(tokens);
|
||||
if (!maybe_color.has_value() && (!maybe_radius.has_value() || tokens.has_next_token())) {
|
||||
maybe_color = parse_color(tokens);
|
||||
if (!maybe_color && (!maybe_radius.has_value() || tokens.has_next_token())) {
|
||||
maybe_color = parse_color_value(tokens);
|
||||
tokens.skip_whitespace();
|
||||
if (!maybe_color.has_value()) {
|
||||
if (!maybe_color)
|
||||
return {};
|
||||
}
|
||||
} else if (!maybe_radius.has_value()) {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
// FIXME: Support calculated offsets and radius
|
||||
return if_no_more_tokens_return(Filter::DropShadow { x_offset->value(), y_offset->value(), maybe_radius.map([](auto& it) { return it.value(); }), maybe_color });
|
||||
return if_no_more_tokens_return(Filter::DropShadow { x_offset->value(), y_offset->value(), maybe_radius.map([](auto& it) { return it.value(); }), maybe_color->to_color({}) });
|
||||
} else if (filter_token == FilterToken::HueRotate) {
|
||||
// hue-rotate( [ <angle> | <zero> ]? )
|
||||
if (!tokens.has_next_token())
|
||||
|
|
Loading…
Add table
Reference in a new issue