Incorrect color space conversion for FEImage
https://bugs.webkit.org/show_bug.cgi?id=105437

Reviewed by Dirk Schulze.

Source/WebCore:

When no color-interpolation-filters property is specified, SVG filters are assumed to
operate in LinearRGB color space (http://www.w3.org/TR/SVG/filters.html#FilterPrimitivesOverviewIntro).
Currently, FilterEffect relies on filters generating results in the same color space they
are requested to use (LinearRGB by default) - but this is not true for FEImage as its
result is always a DeviceRGB image buffer. Hence, in FEImage's case, the filter chain
performs an invalid LinearRGB->DeviceRGB conversion at the end (for an image buffer already
encoded in DeviceRGB).

This patch introduces a mechanism for filters to override the requested result color space
and updates FEImage to always mark its result as DeviceRGB. If a dependent filter requires
input in a different color space, FilterEffect::apply() already handles the conversion.

No new tests - existing tests cover this extensively, after rebaseline.

* platform/graphics/filters/FilterEffect.cpp:
(WebCore::FilterEffect::transformResultColorSpace):
Minor cleanup: asImageBuffer() already handles this logic.

* platform/graphics/filters/FilterEffect.h:
(WebCore::FilterEffect::setResultColorSpace):
(FilterEffect):
New method for overriding the result color space.

* rendering/FilterEffectRenderer.cpp:
(WebCore::FilterEffectRenderer::apply):
* rendering/svg/RenderSVGResourceFilter.cpp:
(WebCore::RenderSVGResourceFilter::postApplyResource):
Do not perform an explicit conversion in these places, as the result color space may be
different from the requested color space. Let FilterEffect::transformResultColorSpace()
figure it out.

* svg/graphics/filters/SVGFEImage.cpp:
(WebCore::FEImage::platformApplySoftware):
FEImage results are always ColorSpaceDeviceRGB.

LayoutTests:

Rebaselined Chromium(Linux) results, updated Chromium/EFL/Gtk/Qt expectations.

* platform/chromium-linux/svg/W3C-SVG-1.1-SE/filters-image-03-f-expected.png:
* platform/chromium-linux/svg/W3C-SVG-1.1-SE/filters-image-05-f-expected.png:
* platform/chromium-linux/svg/W3C-SVG-1.1/filters-displace-01-f-expected.png:
* platform/chromium-linux/svg/W3C-SVG-1.1/filters-image-01-b-expected.png:
* platform/chromium-linux/svg/dynamic-updates/SVGFEDisplacementMapElement-dom-in-attr-expected.png:
* platform/chromium-linux/svg/dynamic-updates/SVGFEDisplacementMapElement-dom-in2-attr-expected.png:
* platform/chromium-linux/svg/dynamic-updates/SVGFEDisplacementMapElement-dom-scale-attr-expected.png:
* platform/chromium-linux/svg/dynamic-updates/SVGFEDisplacementMapElement-dom-xChannelSelector-attr-expected.png:
* platform/chromium-linux/svg/dynamic-updates/SVGFEDisplacementMapElement-dom-yChannelSelector-attr-expected.png:
* platform/chromium-linux/svg/dynamic-updates/SVGFEDisplacementMapElement-svgdom-in-prop-expected.png:
* platform/chromium-linux/svg/dynamic-updates/SVGFEDisplacementMapElement-svgdom-in2-prop-expected.png:
* platform/chromium-linux/svg/dynamic-updates/SVGFEDisplacementMapElement-svgdom-scale-prop-expected.png:
* platform/chromium-linux/svg/dynamic-updates/SVGFEDisplacementMapElement-svgdom-xChannelSelector-prop-expected.png:
* platform/chromium-linux/svg/dynamic-updates/SVGFEDisplacementMapElement-svgdom-yChannelSelector-prop-expected.png:
* platform/chromium-linux/svg/dynamic-updates/SVGFEImageElement-dom-preserveAspectRatio-attr-expected.png:
* platform/chromium-linux/svg/dynamic-updates/SVGFEImageElement-svgdom-preserveAspectRatio-prop-expected.png:
* platform/chromium-linux/svg/filters/feImage-filterUnits-objectBoundingBox-primitiveUnits-objectBoundingBox-expected.png:
* platform/chromium-linux/svg/filters/feImage-filterUnits-objectBoundingBox-primitiveUnits-userSpaceOnUse-expected.png:
* platform/chromium-linux/svg/filters/feImage-filterUnits-userSpaceOnUse-primitiveUnits-objectBoundingBox-expected.png:
* platform/chromium-linux/svg/filters/feImage-filterUnits-userSpaceOnUse-primitiveUnits-userSpaceOnUse-expected.png:
* platform/chromium-linux/svg/filters/feImage-late-indirect-update-expected.png:
* platform/chromium-win/svg/custom/feDisplacementMap-01-expected.png:
* platform/chromium-win/svg/filters/feImage-animated-transform-on-target-rect-expected.png:
* platform/chromium-win/svg/filters/feImage-multiple-targets-id-change-expected.png:
* platform/chromium-win/svg/filters/feImage-position-expected.png:
* platform/chromium-win/svg/filters/feImage-preserveAspectratio-expected.png:
* platform/chromium-win/svg/filters/feImage-reference-invalidation-expected.png:
* platform/chromium-win/svg/filters/feImage-subregions-expected.png:
* platform/chromium-win/svg/filters/feImage-subregions-preseveAspectRatio-none-expected.png:
* platform/chromium-win/svg/filters/feImage-subregions-preseveAspectRatio-none-with-viewBox-expected.png:
* platform/chromium-win/svg/filters/feImage-target-add-to-document-expected.png:
* platform/chromium-win/svg/filters/feImage-target-attribute-change-expected.png:
* platform/chromium-win/svg/filters/feImage-target-attribute-change-with-use-indirection-2-expected.png:
* platform/chromium-win/svg/filters/feImage-target-attribute-change-with-use-indirection-expected.png:
* platform/chromium-win/svg/filters/feImage-target-changes-id-expected.png:
* platform/chromium-win/svg/filters/feImage-target-id-change-expected.png:
* platform/chromium-win/svg/filters/feImage-target-inline-style-change-expected.png:
* platform/chromium-win/svg/filters/feImage-target-property-change-expected.png:
* platform/chromium-win/svg/filters/feImage-target-reappend-to-document-expected.png:
* platform/chromium-win/svg/filters/feImage-target-remove-from-document-expected.png:
* platform/chromium-win/svg/filters/feImage-target-style-change-expected.png:
* platform/chromium/TestExpectations:
* platform/efl/TestExpectations:
* platform/gtk/TestExpectations:
* platform/qt/TestExpectations:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@138250 268f45cc-cd09-0410-ab3c-d52691b4dbfc