LibWeb: Allow passing a resolution context to CSSStyleValue::to_color

This will be used for resolving any calculated style values within the
various `CSSColorValue` sub-classes.

No functionality changes.
This commit is contained in:
Callum Law 2025-06-29 12:56:28 +12:00 committed by Sam Atkins
commit 62d138ebf7
Notes: github-actions[bot] 2025-07-04 12:20:15 +00:00
33 changed files with 105 additions and 105 deletions

View file

@ -37,7 +37,7 @@ public:
// https://drafts.csswg.org/css-color/#parse-a-css-color-value
auto style_value = parse_css_value(CSS::Parser::ParsingParams(), string, CSS::PropertyID::Color);
if (style_value && style_value->has_color()) {
auto parsedValue = style_value->to_color(OptionalNone());
auto parsedValue = style_value->to_color(OptionalNone(), {});
// 4. Set this's fill style to parsedValue.
my_drawing_state().fill_style = parsedValue;
@ -76,7 +76,7 @@ public:
// https://drafts.csswg.org/css-color/#parse-a-css-color-value
auto style_value = parse_css_value(CSS::Parser::ParsingParams(), string, CSS::PropertyID::Color);
if (style_value && style_value->has_color()) {
auto parsedValue = style_value->to_color(OptionalNone());
auto parsedValue = style_value->to_color(OptionalNone(), {});
// 4. Set this's stroke style to parsedValue.
my_drawing_state().stroke_style = parsedValue;

View file

@ -941,7 +941,7 @@ void CanvasRenderingContext2D::set_shadow_color(String color)
// 2. Let parsedValue be the result of parsing the given value with context if non-null.
auto style_value = parse_css_value(CSS::Parser::ParsingParams(), color, CSS::PropertyID::Color);
if (style_value && style_value->has_color()) {
auto parsedValue = style_value->to_color(OptionalNone());
auto parsedValue = style_value->to_color(OptionalNone(), {});
// 4. Set this's shadow color to parsedValue.
drawing_state().shadow_color = parsedValue;

View file

@ -288,7 +288,7 @@ void OffscreenCanvasRenderingContext2D::set_shadow_color(String color)
// 2. Let parsedValue be the result of parsing the given value with context if non-null.
auto style_value = parse_css_value(CSS::Parser::ParsingParams(), color, CSS::PropertyID::Color);
if (style_value && style_value->has_color()) {
auto parsedValue = style_value->to_color(OptionalNone());
auto parsedValue = style_value->to_color({}, {});
// 4. Set this's shadow color to parsedValue.
drawing_state().shadow_color = parsedValue;