mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-21 18:00:16 +00:00
LibWeb/CSS: Add support for the prophoto-rgb
color space in color()
That makes us pass the following WPT tests: - css/css-color/prophoto-rgb-001.html - css/css-color/prophoto-rgb-002.html - css/css-color/prophoto-rgb-003.html - css/css-color/prophoto-rgb-004.html - css/css-color/prophoto-rgb-005.html - css/css-color/predefined-009.html - css/css-color/predefined-010.html
This commit is contained in:
parent
596a4e55dd
commit
0b9c4b8adc
Notes:
github-actions[bot]
2024-11-16 09:30:50 +00:00
Author: https://github.com/LucasChollet
Commit: 0b9c4b8adc
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2374
15 changed files with 176 additions and 1 deletions
|
@ -23,6 +23,8 @@ CSSColorValue::ColorType color_type_from_string_view(StringView color_space)
|
|||
return CSSColorValue::ColorType::sRGB;
|
||||
if (color_space == "srgb-linear"sv)
|
||||
return CSSColorValue::ColorType::sRGBLinear;
|
||||
if (color_space == "prophoto-rgb"sv)
|
||||
return CSSColorValue::ColorType::ProPhotoRGB;
|
||||
if (color_space == "xyz-d50"sv)
|
||||
return CSSColorValue::ColorType::XYZD50;
|
||||
if (color_space == "xyz"sv || color_space == "xyz-d65")
|
||||
|
@ -83,6 +85,9 @@ Color CSSColor::to_color(Optional<Layout::NodeWithStyle const&>) const
|
|||
if (color_type() == ColorType::sRGBLinear)
|
||||
return Color::from_linear_srgb(c1, c2, c3, alpha_val);
|
||||
|
||||
if (color_type() == ColorType::ProPhotoRGB)
|
||||
return Color::from_pro_photo_rgb(c1, c2, c3, alpha_val);
|
||||
|
||||
if (color_type() == ColorType::XYZD50)
|
||||
return Color::from_xyz50(c1, c2, c3, alpha_val);
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ public:
|
|||
virtual Color to_color(Optional<Layout::NodeWithStyle const&>) const override;
|
||||
virtual String to_string() const override;
|
||||
|
||||
static constexpr Array s_supported_color_space = { "a98-rgb"sv, "display-p3"sv, "srgb"sv, "srgb-linear"sv, "xyz"sv, "xyz-d50"sv, "xyz-d65"sv };
|
||||
static constexpr Array s_supported_color_space = { "a98-rgb"sv, "display-p3"sv, "srgb"sv, "srgb-linear"sv, "prophoto-rgb"sv, "xyz"sv, "xyz-d50"sv, "xyz-d65"sv };
|
||||
|
||||
private:
|
||||
CSSColor(ColorType color_type, ValueComparingNonnullRefPtr<CSSStyleValue> c1, ValueComparingNonnullRefPtr<CSSStyleValue> c2, ValueComparingNonnullRefPtr<CSSStyleValue> c3, ValueComparingNonnullRefPtr<CSSStyleValue> alpha)
|
||||
|
|
|
@ -34,6 +34,7 @@ public:
|
|||
OKLCH,
|
||||
sRGB, // This is used by CSSColor for color(srgb ...).
|
||||
sRGBLinear,
|
||||
ProPhotoRGB,
|
||||
XYZD50,
|
||||
XYZD65,
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue