mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-04 08:36:12 +00:00
LibWeb/CSS: Add support for the rec2020
color space in color()
This color space is often used as a reference in WPT tests, having support for it makes us pass 15 new tests: - css/css-color/rec2020-001.html - css/css-color/rec2020-002.html - css/css-color/rec2020-003.html - css/css-color/rec2020-004.html - css/css-color/rec2020-005.html - css/css-color/predefined-011.html - css/css-color/predefined-012.html
This commit is contained in:
parent
2173219eac
commit
63873f3809
Notes:
github-actions[bot]
2024-11-16 09:30:38 +00:00
Author: https://github.com/LucasChollet
Commit: 63873f3809
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2374
14 changed files with 170 additions and 1 deletions
|
@ -25,6 +25,8 @@ CSSColorValue::ColorType color_type_from_string_view(StringView color_space)
|
|||
return CSSColorValue::ColorType::sRGBLinear;
|
||||
if (color_space == "prophoto-rgb"sv)
|
||||
return CSSColorValue::ColorType::ProPhotoRGB;
|
||||
if (color_space == "rec2020"sv)
|
||||
return CSSColorValue::ColorType::Rec2020;
|
||||
if (color_space == "xyz-d50"sv)
|
||||
return CSSColorValue::ColorType::XYZD50;
|
||||
if (color_space == "xyz"sv || color_space == "xyz-d65")
|
||||
|
@ -88,6 +90,9 @@ Color CSSColor::to_color(Optional<Layout::NodeWithStyle const&>) const
|
|||
if (color_type() == ColorType::ProPhotoRGB)
|
||||
return Color::from_pro_photo_rgb(c1, c2, c3, alpha_val);
|
||||
|
||||
if (color_type() == ColorType::Rec2020)
|
||||
return Color::from_rec2020(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, "prophoto-rgb"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, "rec2020"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)
|
||||
|
|
|
@ -35,6 +35,7 @@ public:
|
|||
sRGB, // This is used by CSSColor for color(srgb ...).
|
||||
sRGBLinear,
|
||||
ProPhotoRGB,
|
||||
Rec2020,
|
||||
XYZD50,
|
||||
XYZD65,
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue