From 9bc71ab1fe6f5207b858bb3681f48871f3e18673 Mon Sep 17 00:00:00 2001 From: Sam Atkins Date: Thu, 15 Aug 2024 14:33:56 +0100 Subject: [PATCH] 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. --- Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp index 7e776a251fb..26fceca07af 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp +++ b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp @@ -4695,7 +4695,7 @@ RefPtr Parser::parse_filter_value_list_value(TokenStream? && {2,3} ] ) // Note: The following code is a little awkward to allow the color to be before or after the lengths. Optional 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 Parser::parse_filter_value_list_value(TokenStreamvalue(), 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( [ | ]? ) if (!tokens.has_next_token())