LibWeb: Canonicalize color space when parsing color-mix() function

This amounts to replacing the "xyz" color space with "xyz-d65".
This commit is contained in:
Tim Ledbetter 2025-04-22 15:44:10 +01:00 committed by Jelle Raaijmakers
parent 7b8af4d84c
commit 8a20899382
Notes: github-actions[bot] 2025-04-23 10:38:25 +00:00
2 changed files with 37 additions and 31 deletions

View file

@ -1732,10 +1732,17 @@ RefPtr<CSSStyleValue const> Parser::parse_color_mix_function(TokenStream<Compone
return {};
color_space = color_space_token.token().ident().to_string();
}
function_tokens.discard_whitespace();
auto canonical_color_space_name = [](String const& color_space_name) {
if (color_space_name == "xyz"sv)
return "xyz-d65"_string;
return color_space_name;
};
return ColorMixStyleValue::ColorInterpolationMethod {
.color_space = color_space,
.color_space = canonical_color_space_name(color_space),
.hue_interpolation_method = hue_interpolation_method,
};
};