LibWeb: Return correct computed value for lab-like and lch-like colors

This commit is contained in:
Tim Ledbetter 2025-04-19 14:02:10 +01:00 committed by Andreas Kling
parent e860dd4f65
commit 4283c73d02
Notes: github-actions[bot] 2025-04-20 16:44:55 +00:00
3 changed files with 312 additions and 0 deletions

View file

@ -595,6 +595,11 @@ static RefPtr<CSSStyleValue const> resolve_color_style_value(CSSStyleValue const
{
if (style_value.is_color_function())
return style_value;
if (style_value.is_color()) {
auto& color_style_value = static_cast<CSSColorValue const&>(style_value);
if (first_is_one_of(color_style_value.color_type(), CSSColorValue::ColorType::Lab, CSSColorValue::ColorType::OKLab, CSSColorValue::ColorType::LCH, CSSColorValue::ColorType::OKLCH))
return style_value;
}
return CSSColorValue::create_from_color(computed_color, ColorSyntax::Modern);
}