LibWeb: Implement the color-interpolation property for SVG gradients

This changes the operating color space for gradient `<linearGradient>`
and `<radialGradient>` elements.
This commit is contained in:
Tim Ledbetter 2025-08-15 23:53:15 +01:00 committed by Jelle Raaijmakers
commit ad06ac0d58
Notes: github-actions[bot] 2025-08-17 08:52:13 +00:00
29 changed files with 192 additions and 13 deletions

View file

@ -66,6 +66,19 @@ SpreadMethod SVGGradientElement::spread_method_impl(HashTable<SVGGradientElement
return SpreadMethod::Pad;
}
Gfx::InterpolationColorSpace SVGGradientElement::color_space() const
{
switch (computed_properties()->color_interpolation()) {
case CSS::ColorInterpolation::Linearrgb:
return Gfx::InterpolationColorSpace::LinearRGB;
case CSS::ColorInterpolation::Auto:
case CSS::ColorInterpolation::Srgb:
return Gfx::InterpolationColorSpace::SRGB;
}
VERIFY_NOT_REACHED();
}
Optional<Gfx::AffineTransform> SVGGradientElement::gradient_transform() const
{
HashTable<SVGGradientElement const*> seen_gradients;