Ignore:
Timestamp:
Dec 12, 2021, 9:31:36 AM (3 years ago)
Author:
[email protected]
Message:

Pipe ColorInterpolationMethod into Gradient
https://bugs.webkit.org/show_bug.cgi?id=234205

Reviewed by Antti Koivisto.

Source/WebCore:

There is no functional change yet, this just adds a required ColorInterpolationMethod parameter to
Gradient, which for the moment has to be SRGB and non-premultiplied alpha. Subsequent changes will
support for specifying an interpolation method via CSS gradients as well as implementing support
for that in the platform gradient backends.

Also moves the ColorInterpolationMethod struct into its own file as it was getting quite long.

  • Headers.cmake:
  • WebCore.xcodeproj/project.pbxproj:
  • css/CSSGradientValue.cpp:

(WebCore::CSSGradientValue::equals const):
(WebCore::CSSLinearGradientValue::createGradient):
(WebCore::CSSRadialGradientValue::createGradient):
(WebCore::CSSConicGradientValue::createGradient):

  • css/CSSGradientValue.h:

(WebCore::CSSGradientValue::CSSGradientValue):
(WebCore::CSSGradientValue::colorInterpolationMethod const):

  • css/parser/CSSPropertyParserHelpers.cpp:

(WebCore::CSSPropertyParserHelpers::consumeDeprecatedGradient):
(WebCore::CSSPropertyParserHelpers::consumeDeprecatedRadialGradient):
(WebCore::CSSPropertyParserHelpers::consumeRadialGradient):
(WebCore::CSSPropertyParserHelpers::consumeLinearGradient):
(WebCore::CSSPropertyParserHelpers::consumeConicGradient):

  • html/HTMLInputElement.cpp:

(WebCore::autoFillStrongPasswordMaskImage):

  • html/canvas/CanvasGradient.cpp:

(WebCore::CanvasGradient::CanvasGradient):

  • platform/graphics/ColorInterpolation.h:

(WebCore::interpolateColorComponents):
(WebCore::ColorInterpolationMethod::encode const): Deleted.
(WebCore::ColorInterpolationMethod::decode): Deleted.

  • platform/graphics/ColorInterpolationMethod.h: Added.

(WebCore::ColorInterpolationMethod::encode const):
(WebCore::ColorInterpolationMethod::decode):
(WebCore::add):
(WebCore::operator==):

  • platform/graphics/Gradient.cpp:

(WebCore::Gradient::create):
(WebCore::Gradient::Gradient):
(WebCore::Gradient::hash const):

  • platform/graphics/Gradient.h:

(WebCore::Gradient::encode const):
(WebCore::Gradient::decode):

  • rendering/RenderThemeIOS.mm:

(WebCore::RenderThemeIOS::paintProgressBar):
(WebCore::RenderThemeIOS::checkboxRadioBackgroundGradient):
(WebCore::RenderThemeIOS::paintColorWellDecorations):

  • rendering/svg/RenderSVGResourceLinearGradient.cpp:

(WebCore::RenderSVGResourceLinearGradient::buildGradient const):

  • rendering/svg/RenderSVGResourceRadialGradient.cpp:

(WebCore::RenderSVGResourceRadialGradient::buildGradient const):

Tools:

Update calls to Gradient::create() to pass the now required ColorInterpolationMethod.

  • TestWebKitAPI/Tests/WebCore/DisplayListTests.cpp:

(TestWebKitAPI::createGradient):

  • TestWebKitAPI/Tests/WebCore/cg/BifurcatedGraphicsContextTestsCG.cpp:

(TestWebKitAPI::TEST):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/css/CSSGradientValue.cpp

    r283561 r286925  
    658658        && m_stops == other.m_stops
    659659        && m_gradientType == other.m_gradientType
    660         && m_repeating == other.m_repeating;
     660        && m_repeating == other.m_repeating
     661        && m_colorInterpolationMethod == other.m_colorInterpolationMethod;
    661662}
    662663
     
    872873    auto stops = computeStops(adapter, conversionData, renderer.style(), 1);
    873874
    874     auto gradient = Gradient::create(WTFMove(data));
     875    auto gradient = Gradient::create(WTFMove(data), colorInterpolationMethod());
    875876    gradient->setSortedColorStops(WTFMove(stops));
    876877    return gradient;
     
    12061207    auto stops = computeStops(adapter, conversionData, renderer.style(), maxExtent);
    12071208
    1208     auto gradient = Gradient::create(WTFMove(data));
     1209    auto gradient = Gradient::create(WTFMove(data), colorInterpolationMethod());
    12091210    gradient->setSortedColorStops(WTFMove(stops));
    12101211    return gradient;
     
    12801281    auto stops = computeStops(adapter, conversionData, renderer.style(), 1);
    12811282
    1282     auto gradient = Gradient::create(WTFMove(data));
     1283    auto gradient = Gradient::create(WTFMove(data), colorInterpolationMethod());
    12831284    gradient->setSortedColorStops(WTFMove(stops));
    12841285    return gradient;
Note: See TracChangeset for help on using the changeset viewer.