<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[286193] trunk/Source/WebCore</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/286193">286193</a></dd>
<dt>Author</dt> <dd>said@apple.com</dd>
<dt>Date</dt> <dd>2021-11-27 20:28:11 -0800 (Sat, 27 Nov 2021)</dd>
</dl>

<h3>Log Message</h3>
<pre>[GPU Process] Implement FilterEffect CoreImage appliers
https://bugs.webkit.org/show_bug.cgi?id=232831

Reviewed by Cameron McCormack.

This will allow applying the CoreImage filters through FilterEffect::apply().
It will also allow passing FilterImages to the FilterEffect CoreImage
appliers. This will require adding a CIImage as a possible result to
FilterImage.

If the CoreImage filters are enabled, the Filter will check if all the
FilterEffects supports CoreImage rendering. And if one if them does not
support it, the renderingMode will be switched to Unaccelerated.

* Sources.txt:
* SourcesCocoa.txt:
* WebCore.xcodeproj/project.pbxproj:
* platform/graphics/coreimage/FEColorMatrixCoreImageApplier.h: Copied from Source/WebCore/platform/graphics/filters/FilterEffectRenderer.cpp.
* platform/graphics/coreimage/FEColorMatrixCoreImageApplier.mm: Added.
(WebCore::FEColorMatrixCoreImageApplier::FEColorMatrixCoreImageApplier):
(WebCore::FEColorMatrixCoreImageApplier::supportsCoreImageRendering):
(WebCore::FEColorMatrixCoreImageApplier::apply const):
* platform/graphics/coreimage/FEComponentTransferCoreImageApplier.h: Renamed from Source/WebCore/platform/graphics/filters/FilterEffectRenderer.h.
* platform/graphics/coreimage/FEComponentTransferCoreImageApplier.mm: Added.
(WebCore::FEComponentTransferCoreImageApplier::FEComponentTransferCoreImageApplier):
(WebCore::FEComponentTransferCoreImageApplier::supportsCoreImageRendering):
(WebCore::FEComponentTransferCoreImageApplier::apply const):
* platform/graphics/coreimage/FilterEffectRendererCoreImage.h: Removed.
* platform/graphics/coreimage/FilterEffectRendererCoreImage.mm: Removed.
* platform/graphics/coreimage/FilterImageCoreImage.mm: Added.
(WebCore::sharedCIContext):
(WebCore::FilterImage::setCIImage):
(WebCore::FilterImage::imageBufferFromCIImage):
* platform/graphics/coreimage/SourceGraphicCoreImageApplier.h: Copied from Source/WebCore/platform/graphics/filters/FilterEffectRenderer.cpp.
* platform/graphics/coreimage/SourceGraphicCoreImageApplier.mm: Renamed from Source/WebCore/platform/graphics/filters/FilterEffectRenderer.cpp.
(WebCore::SourceGraphicCoreImageApplier::apply const):
* platform/graphics/cv/CVUtilities.mm:
* platform/graphics/filters/FEColorMatrix.cpp:
(WebCore::FEColorMatrix::supportsCoreImageRendering const):
(WebCore::FEColorMatrix::createApplier const):
* platform/graphics/filters/FEColorMatrix.h:
* platform/graphics/filters/FEComponentTransfer.cpp:
(WebCore::FEComponentTransfer::supportsCoreImageRendering const):
(WebCore::FEComponentTransfer::createApplier const):
* platform/graphics/filters/FEComponentTransfer.h:
* platform/graphics/filters/Filter.h:
(WebCore::Filter::Filter):
(): Deleted.
* platform/graphics/filters/FilterFunction.h:
(WebCore::FilterFunction::supportsCoreImageRendering const):
* platform/graphics/filters/FilterImage.cpp:
(WebCore::FilterImage::imageBuffer):
(WebCore::FilterImage::imageBufferFromPixelBuffer):
* platform/graphics/filters/FilterImage.h:
(WebCore::FilterImage::ciImage const):
* platform/graphics/filters/SourceGraphic.cpp:
(WebCore::SourceGraphic::createApplier const):
* platform/graphics/filters/SourceGraphic.h:
* platform/mac/ScrollingEffectsController.mm:
* rendering/CSSFilter.cpp:
(WebCore::CSSFilter::create):
(WebCore::CSSFilter::CSSFilter):
(WebCore::createSVGFilter):
(WebCore::CSSFilter::buildFilterFunctions):
(WebCore::CSSFilter::allocateBackingStoreIfNeeded):
(WebCore::CSSFilter::supportsCoreImageRendering const):
(WebCore::CSSFilter::apply):
(WebCore::CSSFilter::output):
(WebCore::CSSFilter::outputRect):
* rendering/CSSFilter.h:
* rendering/svg/RenderSVGResourceFilter.cpp:
(WebCore::RenderSVGResourceFilter::applyResource):
* rendering/svg/SVGRenderTreeAsText.cpp:
(WebCore::writeSVGResourceContainer):
* svg/graphics/filters/SVGFilter.cpp:
(WebCore::SVGFilter::create):
(WebCore::SVGFilter::SVGFilter):
(WebCore::SVGFilter::supportsCoreImageRendering const):
* svg/graphics/filters/SVGFilter.h:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreSourcestxt">trunk/Source/WebCore/Sources.txt</a></li>
<li><a href="#trunkSourceWebCoreSourcesCocoatxt">trunk/Source/WebCore/SourcesCocoa.txt</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscvCVUtilitiesmm">trunk/Source/WebCore/platform/graphics/cv/CVUtilities.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsfiltersFEColorMatrixcpp">trunk/Source/WebCore/platform/graphics/filters/FEColorMatrix.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsfiltersFEColorMatrixh">trunk/Source/WebCore/platform/graphics/filters/FEColorMatrix.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsfiltersFEComponentTransfercpp">trunk/Source/WebCore/platform/graphics/filters/FEComponentTransfer.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsfiltersFEComponentTransferh">trunk/Source/WebCore/platform/graphics/filters/FEComponentTransfer.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsfiltersFilterh">trunk/Source/WebCore/platform/graphics/filters/Filter.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsfiltersFilterFunctionh">trunk/Source/WebCore/platform/graphics/filters/FilterFunction.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsfiltersFilterImagecpp">trunk/Source/WebCore/platform/graphics/filters/FilterImage.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsfiltersFilterImageh">trunk/Source/WebCore/platform/graphics/filters/FilterImage.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsfiltersSourceGraphiccpp">trunk/Source/WebCore/platform/graphics/filters/SourceGraphic.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsfiltersSourceGraphich">trunk/Source/WebCore/platform/graphics/filters/SourceGraphic.h</a></li>
<li><a href="#trunkSourceWebCoreplatformmacScrollingEffectsControllermm">trunk/Source/WebCore/platform/mac/ScrollingEffectsController.mm</a></li>
<li><a href="#trunkSourceWebCorerenderingCSSFiltercpp">trunk/Source/WebCore/rendering/CSSFilter.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingCSSFilterh">trunk/Source/WebCore/rendering/CSSFilter.h</a></li>
<li><a href="#trunkSourceWebCorerenderingsvgRenderSVGResourceFiltercpp">trunk/Source/WebCore/rendering/svg/RenderSVGResourceFilter.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingsvgSVGRenderTreeAsTextcpp">trunk/Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp</a></li>
<li><a href="#trunkSourceWebCoresvggraphicsfiltersSVGFiltercpp">trunk/Source/WebCore/svg/graphics/filters/SVGFilter.cpp</a></li>
<li><a href="#trunkSourceWebCoresvggraphicsfiltersSVGFilterh">trunk/Source/WebCore/svg/graphics/filters/SVGFilter.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreplatformgraphicscoreimageFEColorMatrixCoreImageApplierh">trunk/Source/WebCore/platform/graphics/coreimage/FEColorMatrixCoreImageApplier.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscoreimageFEColorMatrixCoreImageAppliermm">trunk/Source/WebCore/platform/graphics/coreimage/FEColorMatrixCoreImageApplier.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscoreimageFEComponentTransferCoreImageApplierh">trunk/Source/WebCore/platform/graphics/coreimage/FEComponentTransferCoreImageApplier.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscoreimageFEComponentTransferCoreImageAppliermm">trunk/Source/WebCore/platform/graphics/coreimage/FEComponentTransferCoreImageApplier.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscoreimageFilterImageCoreImagemm">trunk/Source/WebCore/platform/graphics/coreimage/FilterImageCoreImage.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscoreimageSourceGraphicCoreImageApplierh">trunk/Source/WebCore/platform/graphics/coreimage/SourceGraphicCoreImageApplier.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscoreimageSourceGraphicCoreImageAppliermm">trunk/Source/WebCore/platform/graphics/coreimage/SourceGraphicCoreImageApplier.mm</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreplatformgraphicscoreimageFilterEffectRendererCoreImageh">trunk/Source/WebCore/platform/graphics/coreimage/FilterEffectRendererCoreImage.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscoreimageFilterEffectRendererCoreImagemm">trunk/Source/WebCore/platform/graphics/coreimage/FilterEffectRendererCoreImage.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsfiltersFilterEffectRenderercpp">trunk/Source/WebCore/platform/graphics/filters/FilterEffectRenderer.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsfiltersFilterEffectRendererh">trunk/Source/WebCore/platform/graphics/filters/FilterEffectRenderer.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (286192 => 286193)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog   2021-11-28 03:43:46 UTC (rev 286192)
+++ trunk/Source/WebCore/ChangeLog      2021-11-28 04:28:11 UTC (rev 286193)
</span><span class="lines">@@ -1,3 +1,85 @@
</span><ins>+2021-11-27  Said Abou-Hallawa  <said@apple.com>
+
+        [GPU Process] Implement FilterEffect CoreImage appliers
+        https://bugs.webkit.org/show_bug.cgi?id=232831
+
+        Reviewed by Cameron McCormack.
+
+        This will allow applying the CoreImage filters through FilterEffect::apply().
+        It will also allow passing FilterImages to the FilterEffect CoreImage
+        appliers. This will require adding a CIImage as a possible result to
+        FilterImage.
+
+        If the CoreImage filters are enabled, the Filter will check if all the 
+        FilterEffects supports CoreImage rendering. And if one if them does not
+        support it, the renderingMode will be switched to Unaccelerated.
+
+        * Sources.txt:
+        * SourcesCocoa.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * platform/graphics/coreimage/FEColorMatrixCoreImageApplier.h: Copied from Source/WebCore/platform/graphics/filters/FilterEffectRenderer.cpp.
+        * platform/graphics/coreimage/FEColorMatrixCoreImageApplier.mm: Added.
+        (WebCore::FEColorMatrixCoreImageApplier::FEColorMatrixCoreImageApplier):
+        (WebCore::FEColorMatrixCoreImageApplier::supportsCoreImageRendering):
+        (WebCore::FEColorMatrixCoreImageApplier::apply const):
+        * platform/graphics/coreimage/FEComponentTransferCoreImageApplier.h: Renamed from Source/WebCore/platform/graphics/filters/FilterEffectRenderer.h.
+        * platform/graphics/coreimage/FEComponentTransferCoreImageApplier.mm: Added.
+        (WebCore::FEComponentTransferCoreImageApplier::FEComponentTransferCoreImageApplier):
+        (WebCore::FEComponentTransferCoreImageApplier::supportsCoreImageRendering):
+        (WebCore::FEComponentTransferCoreImageApplier::apply const):
+        * platform/graphics/coreimage/FilterEffectRendererCoreImage.h: Removed.
+        * platform/graphics/coreimage/FilterEffectRendererCoreImage.mm: Removed.
+        * platform/graphics/coreimage/FilterImageCoreImage.mm: Added.
+        (WebCore::sharedCIContext):
+        (WebCore::FilterImage::setCIImage):
+        (WebCore::FilterImage::imageBufferFromCIImage):
+        * platform/graphics/coreimage/SourceGraphicCoreImageApplier.h: Copied from Source/WebCore/platform/graphics/filters/FilterEffectRenderer.cpp.
+        * platform/graphics/coreimage/SourceGraphicCoreImageApplier.mm: Renamed from Source/WebCore/platform/graphics/filters/FilterEffectRenderer.cpp.
+        (WebCore::SourceGraphicCoreImageApplier::apply const):
+        * platform/graphics/cv/CVUtilities.mm:
+        * platform/graphics/filters/FEColorMatrix.cpp:
+        (WebCore::FEColorMatrix::supportsCoreImageRendering const):
+        (WebCore::FEColorMatrix::createApplier const):
+        * platform/graphics/filters/FEColorMatrix.h:
+        * platform/graphics/filters/FEComponentTransfer.cpp:
+        (WebCore::FEComponentTransfer::supportsCoreImageRendering const):
+        (WebCore::FEComponentTransfer::createApplier const):
+        * platform/graphics/filters/FEComponentTransfer.h:
+        * platform/graphics/filters/Filter.h:
+        (WebCore::Filter::Filter):
+        (): Deleted.
+        * platform/graphics/filters/FilterFunction.h:
+        (WebCore::FilterFunction::supportsCoreImageRendering const):
+        * platform/graphics/filters/FilterImage.cpp:
+        (WebCore::FilterImage::imageBuffer):
+        (WebCore::FilterImage::imageBufferFromPixelBuffer):
+        * platform/graphics/filters/FilterImage.h:
+        (WebCore::FilterImage::ciImage const):
+        * platform/graphics/filters/SourceGraphic.cpp:
+        (WebCore::SourceGraphic::createApplier const):
+        * platform/graphics/filters/SourceGraphic.h:
+        * platform/mac/ScrollingEffectsController.mm:
+        * rendering/CSSFilter.cpp:
+        (WebCore::CSSFilter::create):
+        (WebCore::CSSFilter::CSSFilter):
+        (WebCore::createSVGFilter):
+        (WebCore::CSSFilter::buildFilterFunctions):
+        (WebCore::CSSFilter::allocateBackingStoreIfNeeded):
+        (WebCore::CSSFilter::supportsCoreImageRendering const):
+        (WebCore::CSSFilter::apply):
+        (WebCore::CSSFilter::output):
+        (WebCore::CSSFilter::outputRect):
+        * rendering/CSSFilter.h:
+        * rendering/svg/RenderSVGResourceFilter.cpp:
+        (WebCore::RenderSVGResourceFilter::applyResource):
+        * rendering/svg/SVGRenderTreeAsText.cpp:
+        (WebCore::writeSVGResourceContainer):
+        * svg/graphics/filters/SVGFilter.cpp:
+        (WebCore::SVGFilter::create):
+        (WebCore::SVGFilter::SVGFilter):
+        (WebCore::SVGFilter::supportsCoreImageRendering const):
+        * svg/graphics/filters/SVGFilter.h:
+
</ins><span class="cx"> 2021-11-27  Sam Weinig  <weinig@apple.com>
</span><span class="cx"> 
</span><span class="cx">         [CSS Color 4] Add support for oklab() and oklch() colors
</span></span></pre></div>
<a id="trunkSourceWebCoreSourcestxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Sources.txt (286192 => 286193)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Sources.txt 2021-11-28 03:43:46 UTC (rev 286192)
+++ trunk/Source/WebCore/Sources.txt    2021-11-28 04:28:11 UTC (rev 286193)
</span><span class="lines">@@ -2101,7 +2101,6 @@
</span><span class="cx"> platform/graphics/filters/FETile.cpp
</span><span class="cx"> platform/graphics/filters/FETurbulence.cpp
</span><span class="cx"> platform/graphics/filters/FilterEffect.cpp
</span><del>-platform/graphics/filters/FilterEffectRenderer.cpp
</del><span class="cx"> platform/graphics/filters/FilterFunction.cpp
</span><span class="cx"> platform/graphics/filters/FilterImage.cpp
</span><span class="cx"> platform/graphics/filters/FilterOperation.cpp
</span></span></pre></div>
<a id="trunkSourceWebCoreSourcesCocoatxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/SourcesCocoa.txt (286192 => 286193)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/SourcesCocoa.txt    2021-11-28 03:43:46 UTC (rev 286192)
+++ trunk/Source/WebCore/SourcesCocoa.txt       2021-11-28 04:28:11 UTC (rev 286193)
</span><span class="lines">@@ -402,7 +402,10 @@
</span><span class="cx"> platform/graphics/cv/ImageTransferSessionVT.mm
</span><span class="cx"> platform/graphics/cv/PixelBufferConformerCV.cpp
</span><span class="cx"> platform/graphics/cv/GraphicsContextGLCVANGLE.cpp
</span><del>-platform/graphics/coreimage/FilterEffectRendererCoreImage.mm
</del><ins>+platform/graphics/coreimage/FEColorMatrixCoreImageApplier.mm
+platform/graphics/coreimage/FEComponentTransferCoreImageApplier.mm
+platform/graphics/coreimage/FilterImageCoreImage.mm
+platform/graphics/coreimage/SourceGraphicCoreImageApplier.mm
</ins><span class="cx"> platform/graphics/gpu/cocoa/GPUPrewarmingMetal.mm
</span><span class="cx"> platform/graphics/ios/DisplayRefreshMonitorIOS.mm
</span><span class="cx"> platform/graphics/ios/IconIOS.mm
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (286192 => 286193)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj   2021-11-28 03:43:46 UTC (rev 286192)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj      2021-11-28 04:28:11 UTC (rev 286193)
</span><span class="lines">@@ -488,7 +488,6 @@
</span><span class="cx">          1A494EDF0A123F4C00FDAFC1 /* JSDocumentFragment.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A494EDD0A123F4C00FDAFC1 /* JSDocumentFragment.h */; };
</span><span class="cx">          1A4A2DF00A1B852A00C807F8 /* JSHTMLAnchorElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A4A2DEC0A1B852A00C807F8 /* JSHTMLAnchorElement.h */; };
</span><span class="cx">          1A4A954E0B4EDCCB002D8C3C /* SharedBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A4A954C0B4EDCCB002D8C3C /* SharedBuffer.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><del>-               51FA2EDF27506FDE0011C15D /* SharedBufferChunkReader.h in Headers */ = {isa = PBXBuildFile; fileRef = 51FA2ED6274F78370011C15D /* SharedBufferChunkReader.h */; settings = {ATTRIBUTES = (Private, ); }; };
</del><span class="cx">           1A4DA4221CDD3A8300F4473C /* LinkIconCollector.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A4DA4201CDD3A8300F4473C /* LinkIconCollector.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">          1A569D120D7E2B82007C3983 /* objc_class.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A569CE30D7E2B82007C3983 /* objc_class.h */; };
</span><span class="cx">          1A569D130D7E2B82007C3983 /* objc_class.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A569CE40D7E2B82007C3983 /* objc_class.mm */; };
</span><span class="lines">@@ -769,8 +768,6 @@
</span><span class="cx">          2AEF6FDD26E7ECCF00326D02 /* CSSNumericType.h in Headers */ = {isa = PBXBuildFile; fileRef = 2AEF6FCE26E71F2D00326D02 /* CSSNumericType.h */; };
</span><span class="cx">          2B365C841525119E0091D27B /* RenderSVGEllipse.h in Headers */ = {isa = PBXBuildFile; fileRef = 2B4235A015250F6000DBBCD8 /* RenderSVGEllipse.h */; };
</span><span class="cx">          2BE8E2C712A589EC00FAD550 /* HTMLMetaCharsetParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 2BE8E2C612A589EC00FAD550 /* HTMLMetaCharsetParser.h */; };
</span><del>-               2C85653424C0F73C00A37673 /* FilterEffectRenderer.h in Headers */ = {isa = PBXBuildFile; fileRef = 2C85653324C0F73C00A37673 /* FilterEffectRenderer.h */; };
-               2CAA4A3A24BE18B7009DEE70 /* FilterEffectRendererCoreImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 2CAA4A3924BE18B7009DEE70 /* FilterEffectRendererCoreImage.h */; };
</del><span class="cx">           2D0621441DA639B600A7FB26 /* WebKitMediaKeyMessageEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D0621421DA6398800A7FB26 /* WebKitMediaKeyMessageEvent.cpp */; };
</span><span class="cx">          2D0621451DA639BA00A7FB26 /* WebKitMediaKeyMessageEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D0621431DA6398800A7FB26 /* WebKitMediaKeyMessageEvent.h */; };
</span><span class="cx">          2D06214D1DA63A8B00A7FB26 /* WebKitMediaKeys.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D0621491DA63A7900A7FB26 /* WebKitMediaKeys.cpp */; };
</span><span class="lines">@@ -1689,6 +1686,7 @@
</span><span class="cx">          51F798F01BE880E7008AE491 /* IDBIndexInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 51F798EC1BE880D3008AE491 /* IDBIndexInfo.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">          51F886C01F32923100C193EF /* JSNavigatorServiceWorker.h in Headers */ = {isa = PBXBuildFile; fileRef = 51F886BF1F32920700C193EF /* JSNavigatorServiceWorker.h */; };
</span><span class="cx">          51FA2D78152132B300C1BA0B /* DOMWindowExtension.h in Headers */ = {isa = PBXBuildFile; fileRef = 517FBA18151AA71B00B57959 /* DOMWindowExtension.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><ins>+               51FA2EDF27506FDE0011C15D /* SharedBufferChunkReader.h in Headers */ = {isa = PBXBuildFile; fileRef = 51FA2ED6274F78370011C15D /* SharedBufferChunkReader.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">           51FB5504113E3E9100821176 /* JSCloseEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 51FB5502113E3E9100821176 /* JSCloseEvent.h */; };
</span><span class="cx">          51FB67DC1AE6B82F00D06C5A /* ContentExtensionStyleSheet.h in Headers */ = {isa = PBXBuildFile; fileRef = 51FB67DA1AE6B5E400D06C5A /* ContentExtensionStyleSheet.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">          5273CC77256103CF00850007 /* PlatformXRCocoa.h in Headers */ = {isa = PBXBuildFile; fileRef = 5273CC75256103CF00850007 /* PlatformXRCocoa.h */; };
</span><span class="lines">@@ -7659,10 +7657,6 @@
</span><span class="cx">          2B4235A015250F6000DBBCD8 /* RenderSVGEllipse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderSVGEllipse.h; sourceTree = "<group>"; };
</span><span class="cx">          2BE8E2C612A589EC00FAD550 /* HTMLMetaCharsetParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLMetaCharsetParser.h; sourceTree = "<group>"; };
</span><span class="cx">          2BE8E2C812A58A0100FAD550 /* HTMLMetaCharsetParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLMetaCharsetParser.cpp; sourceTree = "<group>"; };
</span><del>-               2C85653324C0F73C00A37673 /* FilterEffectRenderer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FilterEffectRenderer.h; sourceTree = "<group>"; };
-               2C85653824C10B0B00A37673 /* FilterEffectRenderer.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = FilterEffectRenderer.cpp; sourceTree = "<group>"; };
-               2CAA4A3724BE18A1009DEE70 /* FilterEffectRendererCoreImage.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = FilterEffectRendererCoreImage.mm; sourceTree = "<group>"; };
-               2CAA4A3924BE18B7009DEE70 /* FilterEffectRendererCoreImage.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FilterEffectRendererCoreImage.h; sourceTree = "<group>"; };
</del><span class="cx">           2D0621421DA6398800A7FB26 /* WebKitMediaKeyMessageEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebKitMediaKeyMessageEvent.cpp; sourceTree = "<group>"; };
</span><span class="cx">          2D0621431DA6398800A7FB26 /* WebKitMediaKeyMessageEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKitMediaKeyMessageEvent.h; sourceTree = "<group>"; };
</span><span class="cx">          2D0621471DA63A7900A7FB26 /* WebKitMediaKeyNeededEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebKitMediaKeyNeededEvent.cpp; sourceTree = "<group>"; };
</span><span class="lines">@@ -10935,6 +10929,13 @@
</span><span class="cx">          72B4EF74274E233300293C2F /* FEBlendSoftwareApplier.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FEBlendSoftwareApplier.h; sourceTree = "<group>"; };
</span><span class="cx">          72B4EF75274E233400293C2F /* FEBlendSoftwareApplier.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = FEBlendSoftwareApplier.cpp; sourceTree = "<group>"; };
</span><span class="cx">          72B4EF7C274EE37F00293C2F /* FilterImageVector.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FilterImageVector.h; sourceTree = "<group>"; };
</span><ins>+               72B8B0142751084D00F752AA /* SourceGraphicCoreImageApplier.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SourceGraphicCoreImageApplier.mm; sourceTree = "<group>"; };
+               72B8B0162751086A00F752AA /* SourceGraphicCoreImageApplier.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SourceGraphicCoreImageApplier.h; sourceTree = "<group>"; };
+               72B8B01B2751B6BC00F752AA /* FEComponentTransferCoreImageApplier.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = FEComponentTransferCoreImageApplier.mm; sourceTree = "<group>"; };
+               72B8B01D2751B82B00F752AA /* FEComponentTransferCoreImageApplier.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FEComponentTransferCoreImageApplier.h; sourceTree = "<group>"; };
+               72B8B01E2751B91000F752AA /* FEColorMatrixCoreImageApplier.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = FEColorMatrixCoreImageApplier.mm; sourceTree = "<group>"; };
+               72B8B01F2751B92800F752AA /* FEColorMatrixCoreImageApplier.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FEColorMatrixCoreImageApplier.h; sourceTree = "<group>"; };
+               72B8B0202751C4B700F752AA /* FilterImageCoreImage.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = FilterImageCoreImage.mm; sourceTree = "<group>"; };
</ins><span class="cx">           72BAC3A423E17327008D741C /* ImageBufferBackend.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ImageBufferBackend.cpp; sourceTree = "<group>"; };
</span><span class="cx">          72BAC3A523E17328008D741C /* ImageBufferBackend.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageBufferBackend.h; sourceTree = "<group>"; };
</span><span class="cx">          72BAC3A623E17328008D741C /* PlatformImageBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformImageBuffer.h; sourceTree = "<group>"; };
</span><span class="lines">@@ -20214,8 +20215,13 @@
</span><span class="cx">          2CE1189824C2402C003770E9 /* coreimage */ = {
</span><span class="cx">                  isa = PBXGroup;
</span><span class="cx">                  children = (
</span><del>-                               2CAA4A3924BE18B7009DEE70 /* FilterEffectRendererCoreImage.h */,
-                               2CAA4A3724BE18A1009DEE70 /* FilterEffectRendererCoreImage.mm */,
</del><ins>+                                72B8B01F2751B92800F752AA /* FEColorMatrixCoreImageApplier.h */,
+                               72B8B01E2751B91000F752AA /* FEColorMatrixCoreImageApplier.mm */,
+                               72B8B01D2751B82B00F752AA /* FEComponentTransferCoreImageApplier.h */,
+                               72B8B01B2751B6BC00F752AA /* FEComponentTransferCoreImageApplier.mm */,
+                               72B8B0202751C4B700F752AA /* FilterImageCoreImage.mm */,
+                               72B8B0162751086A00F752AA /* SourceGraphicCoreImageApplier.h */,
+                               72B8B0142751084D00F752AA /* SourceGraphicCoreImageApplier.mm */,
</ins><span class="cx">                   );
</span><span class="cx">                  path = coreimage;
</span><span class="cx">                  sourceTree = "<group>";
</span><span class="lines">@@ -26026,8 +26032,6 @@
</span><span class="cx">                          08C925170FCC7C4A00480DEC /* FilterEffect.cpp */,
</span><span class="cx">                          08C925180FCC7C4A00480DEC /* FilterEffect.h */,
</span><span class="cx">                          72A13A9F274C5CC700E2A88E /* FilterEffectApplier.h */,
</span><del>-                               2C85653824C10B0B00A37673 /* FilterEffectRenderer.cpp */,
-                               2C85653324C0F73C00A37673 /* FilterEffectRenderer.h */,
</del><span class="cx">                           7214B9B7274458FA003BE6DF /* FilterEffectVector.h */,
</span><span class="cx">                          7262D757272A174100C56A09 /* FilterFunction.cpp */,
</span><span class="cx">                          7262D756272A174100C56A09 /* FilterFunction.h */,
</span><span class="lines">@@ -33566,8 +33570,6 @@
</span><span class="cx">                          712BE4831FE865DD002031CC /* FillMode.h in Headers */,
</span><span class="cx">                          845E72F80FD261EE00A87D79 /* Filter.h in Headers */,
</span><span class="cx">                          08C9251A0FCC7C4A00480DEC /* FilterEffect.h in Headers */,
</span><del>-                               2C85653424C0F73C00A37673 /* FilterEffectRenderer.h in Headers */,
-                               2CAA4A3A24BE18B7009DEE70 /* FilterEffectRendererCoreImage.h in Headers */,
</del><span class="cx">                           49ECEB6E1499790D00CDD3A4 /* FilterOperation.h in Headers */,
</span><span class="cx">                          49ECEB701499790D00CDD3A4 /* FilterOperations.h in Headers */,
</span><span class="cx">                          372C00D9129619F8005C9575 /* FindOptions.h in Headers */,
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscoreimageFEColorMatrixCoreImageApplierh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/platform/graphics/coreimage/FEColorMatrixCoreImageApplier.h (0 => 286193)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/coreimage/FEColorMatrixCoreImageApplier.h                         (rev 0)
+++ trunk/Source/WebCore/platform/graphics/coreimage/FEColorMatrixCoreImageApplier.h    2021-11-28 04:28:11 UTC (rev 286193)
</span><span class="lines">@@ -0,0 +1,46 @@
</span><ins>+/*
+ * Copyright (C) 2020-2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#import "FilterEffectApplier.h"
+
+namespace WebCore {
+
+class FEColorMatrix;
+
+class FEColorMatrixCoreImageApplier : public FilterEffectConcreteApplier<FEColorMatrix> {
+    WTF_MAKE_FAST_ALLOCATED;
+    using Base = FilterEffectConcreteApplier<FEColorMatrix>;
+
+public:
+    FEColorMatrixCoreImageApplier(const FEColorMatrix&);
+
+    static bool supportsCoreImageRendering(const FEColorMatrix&);
+
+    bool apply(const Filter&, const FilterImageVector& inputs, FilterImage& result) const override;
+};
+
+} // namespace WebCore
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscoreimageFEColorMatrixCoreImageAppliermm"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/platform/graphics/coreimage/FEColorMatrixCoreImageApplier.mm (0 => 286193)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/coreimage/FEColorMatrixCoreImageApplier.mm                                (rev 0)
+++ trunk/Source/WebCore/platform/graphics/coreimage/FEColorMatrixCoreImageApplier.mm   2021-11-28 04:28:11 UTC (rev 286193)
</span><span class="lines">@@ -0,0 +1,114 @@
</span><ins>+/*
+ * Copyright (C) 2020-2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+#import "FEColorMatrixCoreImageApplier.h"
+
+#if USE(CORE_IMAGE)
+
+#import "FEColorMatrix.h"
+#import "FilterImage.h"
+#import <CoreImage/CIContext.h>
+#import <CoreImage/CIFilter.h>
+#import <CoreImage/CoreImage.h>
+
+namespace WebCore {
+
+FEColorMatrixCoreImageApplier::FEColorMatrixCoreImageApplier(const FEColorMatrix& effect)
+    : Base(effect)
+{
+    // FIXME: Implement the rest of FEColorMatrix types
+    ASSERT(supportsCoreImageRendering(effect));
+}
+
+bool FEColorMatrixCoreImageApplier::supportsCoreImageRendering(const FEColorMatrix& effect)
+{
+    return effect.type() == FECOLORMATRIX_TYPE_SATURATE
+        || effect.type() == FECOLORMATRIX_TYPE_HUEROTATE
+        || effect.type() == FECOLORMATRIX_TYPE_MATRIX;
+}
+
+bool FEColorMatrixCoreImageApplier::apply(const Filter&, const FilterImageVector& inputs, FilterImage& result) const
+{
+    ASSERT(inputs.size() == 1);
+    auto& input = inputs[0].get();
+
+    auto inputImage = input.ciImage();
+    if (!inputImage)
+        return false;
+
+    auto values = FEColorMatrix::normalizedFloats(m_effect.values());
+    float components[9];
+
+    switch (m_effect.type()) {
+    case FECOLORMATRIX_TYPE_SATURATE:
+        FEColorMatrix::calculateSaturateComponents(components, values[0]);
+        break;
+
+    case FECOLORMATRIX_TYPE_HUEROTATE:
+        FEColorMatrix::calculateHueRotateComponents(components, values[0]);
+        break;
+
+    case FECOLORMATRIX_TYPE_MATRIX:
+        break;
+
+    case FECOLORMATRIX_TYPE_UNKNOWN:
+    case FECOLORMATRIX_TYPE_LUMINANCETOALPHA: // FIXME: Add Luminance to Alpha Implementation
+        return nullptr;
+    }
+
+    auto *colorMatrixFilter = [CIFilter filterWithName:@"CIColorMatrix"];
+    [colorMatrixFilter setValue:inputImage.get() forKey:kCIInputImageKey];
+
+    switch (m_effect.type()) {
+    case FECOLORMATRIX_TYPE_SATURATE:
+    case FECOLORMATRIX_TYPE_HUEROTATE:
+        [colorMatrixFilter setValue:[CIVector vectorWithX:components[0] Y:components[1] Z:components[2] W:0] forKey:@"inputRVector"];
+        [colorMatrixFilter setValue:[CIVector vectorWithX:components[3] Y:components[4] Z:components[5] W:0] forKey:@"inputGVector"];
+        [colorMatrixFilter setValue:[CIVector vectorWithX:components[6] Y:components[7] Z:components[8] W:0] forKey:@"inputBVector"];
+        [colorMatrixFilter setValue:[CIVector vectorWithX:0             Y:0             Z:0             W:1] forKey:@"inputAVector"];
+        [colorMatrixFilter setValue:[CIVector vectorWithX:0             Y:0             Z:0             W:0] forKey:@"inputBiasVector"];
+        break;
+
+    case FECOLORMATRIX_TYPE_MATRIX:
+        [colorMatrixFilter setValue:[CIVector vectorWithX:values[0]  Y:values[1]  Z:values[2]  W:values[3]]  forKey:@"inputRVector"];
+        [colorMatrixFilter setValue:[CIVector vectorWithX:values[5]  Y:values[6]  Z:values[7]  W:values[8]]  forKey:@"inputGVector"];
+        [colorMatrixFilter setValue:[CIVector vectorWithX:values[10] Y:values[11] Z:values[12] W:values[13]] forKey:@"inputBVector"];
+        [colorMatrixFilter setValue:[CIVector vectorWithX:values[15] Y:values[16] Z:values[17] W:values[18]] forKey:@"inputAVector"];
+        [colorMatrixFilter setValue:[CIVector vectorWithX:values[4]  Y:values[9]  Z:values[14] W:values[19]] forKey:@"inputBiasVector"];
+        break;
+
+    case FECOLORMATRIX_TYPE_LUMINANCETOALPHA:
+    case FECOLORMATRIX_TYPE_UNKNOWN:
+        return nullptr;
+    }
+
+    result.setCIImage(colorMatrixFilter.outputImage);
+    return true;
+}
+
+} // namespace WebCore
+
+#endif // USE(CORE_IMAGE)
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscoreimageFEComponentTransferCoreImageApplierh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/platform/graphics/coreimage/FEComponentTransferCoreImageApplier.h (0 => 286193)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/coreimage/FEComponentTransferCoreImageApplier.h                           (rev 0)
+++ trunk/Source/WebCore/platform/graphics/coreimage/FEComponentTransferCoreImageApplier.h      2021-11-28 04:28:11 UTC (rev 286193)
</span><span class="lines">@@ -0,0 +1,46 @@
</span><ins>+/*
+ * Copyright (C) 2020-2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#import "FilterEffectApplier.h"
+
+namespace WebCore {
+
+class FEComponentTransfer;
+
+class FEComponentTransferCoreImageApplier : public FilterEffectConcreteApplier<FEComponentTransfer> {
+    WTF_MAKE_FAST_ALLOCATED;
+    using Base = FilterEffectConcreteApplier<FEComponentTransfer>;
+
+public:
+    FEComponentTransferCoreImageApplier(const FEComponentTransfer&);
+
+    static bool supportsCoreImageRendering(const FEComponentTransfer&);
+
+    bool apply(const Filter&, const FilterImageVector& inputs, FilterImage& result) const override;
+};
+
+} // namespace WebCore
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscoreimageFEComponentTransferCoreImageAppliermm"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/platform/graphics/coreimage/FEComponentTransferCoreImageApplier.mm (0 => 286193)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/coreimage/FEComponentTransferCoreImageApplier.mm                          (rev 0)
+++ trunk/Source/WebCore/platform/graphics/coreimage/FEComponentTransferCoreImageApplier.mm     2021-11-28 04:28:11 UTC (rev 286193)
</span><span class="lines">@@ -0,0 +1,83 @@
</span><ins>+/*
+ * Copyright (C) 2020-2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+#import "FEComponentTransferCoreImageApplier.h"
+
+#if USE(CORE_IMAGE)
+
+#import "FEComponentTransfer.h"
+
+namespace WebCore {
+
+FEComponentTransferCoreImageApplier::FEComponentTransferCoreImageApplier(const FEComponentTransfer& effect)
+    : Base(effect)
+{
+    // FIXME: Implement the rest of FEComponentTransfer functions
+    ASSERT(supportsCoreImageRendering(effect));
+}
+
+bool FEComponentTransferCoreImageApplier::supportsCoreImageRendering(const FEComponentTransfer& effect)
+{
+    auto isNullOrLinear = [] (const ComponentTransferFunction& function) {
+        return function.type == FECOMPONENTTRANSFER_TYPE_UNKNOWN
+            || function.type == FECOMPONENTTRANSFER_TYPE_LINEAR;
+    };
+
+    return isNullOrLinear(effect.redFunction())
+        && isNullOrLinear(effect.greenFunction())
+        && isNullOrLinear(effect.blueFunction())
+        && isNullOrLinear(effect.alphaFunction());
+}
+
+bool FEComponentTransferCoreImageApplier::apply(const Filter&, const FilterImageVector& inputs, FilterImage& result) const
+{
+    ASSERT(inputs.size() == 1);
+    auto& input = inputs[0].get();
+
+    auto inputImage = input.ciImage();
+    if (!inputImage)
+        return false;
+
+    auto componentTransferFilter = [CIFilter filterWithName:@"CIColorPolynomial"];
+    [componentTransferFilter setValue:inputImage.get() forKey:kCIInputImageKey];
+
+    auto setCoefficients = [&] (NSString *key, const ComponentTransferFunction& function) {
+        if (function.type == FECOMPONENTTRANSFER_TYPE_LINEAR)
+            [componentTransferFilter setValue:[CIVector vectorWithX:function.intercept Y:function.slope Z:0 W:0] forKey:key];
+    };
+
+    setCoefficients(@"inputRedCoefficients", m_effect.redFunction());
+    setCoefficients(@"inputGreenCoefficients", m_effect.greenFunction());
+    setCoefficients(@"inputBlueCoefficients", m_effect.blueFunction());
+    setCoefficients(@"inputAlphaCoefficients", m_effect.alphaFunction());
+
+    result.setCIImage(componentTransferFilter.outputImage);
+    return true;
+}
+
+} // namespace WebCore
+
+#endif // USE(CORE_IMAGE)
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscoreimageFilterEffectRendererCoreImageh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/platform/graphics/coreimage/FilterEffectRendererCoreImage.h (286192 => 286193)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/coreimage/FilterEffectRendererCoreImage.h 2021-11-28 03:43:46 UTC (rev 286192)
+++ trunk/Source/WebCore/platform/graphics/coreimage/FilterEffectRendererCoreImage.h    2021-11-28 04:28:11 UTC (rev 286193)
</span><span class="lines">@@ -1,73 +0,0 @@
</span><del>-/*
-* Copyright (C) 2020 Apple Inc. All rights reserved.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions
-* are met:
-* 1. Redistributions of source code must retain the above copyright
-*    notice, this list of conditions and the following disclaimer.
-* 2. Redistributions in binary form must reproduce the above copyright
-*    notice, this list of conditions and the following disclaimer in the
-*    documentation and/or other materials provided with the distribution.
-*
-* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
-* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-* PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
-* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
-* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#pragma once
-
-#if USE(CORE_IMAGE)
-
-#import "FilterEffectRenderer.h"
-#import "PlatformImageBuffer.h"
-#import <wtf/Vector.h>
-
-OBJC_CLASS CIImage;
-OBJC_CLASS CIFilter;
-OBJC_CLASS CIContext;
-
-namespace WebCore {
-
-class FEColorMatrix;
-class FEComponentTransfer;
-class SourceGraphic;
-
-class FilterEffectRendererCoreImage : public FilterEffectRenderer {
-    WTF_MAKE_FAST_ALLOCATED;
-    
-public:
-    static std::unique_ptr<FilterEffectRendererCoreImage> tryCreate(FilterEffect&);
-    RetainPtr<CIContext> sharedCIContext();
-    void applyEffects(const Filter&, FilterEffect&) final;
-    bool hasResult() const final { return m_outputImage; }
-    ImageBuffer* output() const final;
-    FloatRect destRect(const FilterEffect&) const final;
-    void clearResult() final;
-    FilterEffectRendererCoreImage();
-    
-private:
-    RetainPtr<CIImage> connectCIFilters(const Filter&, FilterEffect&);
-    void renderToImageBuffer(FilterEffect&) final;
-    static bool supportsCoreImageRendering(FilterEffect&);
-    static bool canRenderUsingCIFilters(FilterEffect&);
-    
-    RetainPtr<CIImage> imageForSourceGraphic(const Filter&);
-    RetainPtr<CIImage> imageForFEColorMatrix(const FEColorMatrix&, const Vector<RetainPtr<CIImage>>&);
-    RetainPtr<CIImage> imageForFEComponentTransfer(const FEComponentTransfer&, Vector<RetainPtr<CIImage>>&);
-    
-    RefPtr<IOSurfaceImageBuffer> m_outputImageBuffer;
-    RetainPtr<CIImage> m_outputImage;
-};
-
-} // namespace WebCore
-
-#endif
</del></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscoreimageFilterEffectRendererCoreImagemm"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/platform/graphics/coreimage/FilterEffectRendererCoreImage.mm (286192 => 286193)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/coreimage/FilterEffectRendererCoreImage.mm        2021-11-28 03:43:46 UTC (rev 286192)
+++ trunk/Source/WebCore/platform/graphics/coreimage/FilterEffectRendererCoreImage.mm   2021-11-28 04:28:11 UTC (rev 286193)
</span><span class="lines">@@ -1,273 +0,0 @@
</span><del>-/*
-* Copyright (C) 2020-2021 Apple Inc. All rights reserved.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions
-* are met:
-* 1. Redistributions of source code must retain the above copyright
-*    notice, this list of conditions and the following disclaimer.
-* 2. Redistributions in binary form must reproduce the above copyright
-*    notice, this list of conditions and the following disclaimer in the
-*    documentation and/or other materials provided with the distribution.
-*
-* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
-* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-* PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
-* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
-* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#import "config.h"
-#import "FilterEffectRendererCoreImage.h"
-
-#if USE(CORE_IMAGE)
-
-#import "FEColorMatrix.h"
-#import "FEComponentTransfer.h"
-#import "Filter.h"
-#import "FilterEffect.h"
-#import "FilterOperation.h"
-#import "FloatConversion.h"
-#import "GraphicsContextCG.h"
-#import "ImageBuffer.h"
-#import "Logging.h"
-#import "SourceGraphic.h"
-#import <CoreImage/CIContext.h>
-#import <CoreImage/CIFilter.h>
-#import <CoreImage/CoreImage.h>
-#import <wtf/NeverDestroyed.h>
-#import <wtf/cocoa/TypeCastsCocoa.h>
-
-namespace WebCore {
-
-std::unique_ptr<FilterEffectRendererCoreImage> FilterEffectRendererCoreImage::tryCreate(FilterEffect& lastEffect)
-{
-    if (canRenderUsingCIFilters(lastEffect))
-        return makeUnique<FilterEffectRendererCoreImage>();
-    return nullptr;
-}
-
-RetainPtr<CIContext> FilterEffectRendererCoreImage::sharedCIContext()
-{
-    static NeverDestroyed<RetainPtr<CIContext>> ciContext = [CIContext contextWithOptions:@{ kCIContextWorkingColorSpace: bridge_id_cast(adoptCF(CGColorSpaceCreateWithName(kCGColorSpaceSRGB))).get() }];
-    return ciContext;
-}
-
-static bool isNullOrLinearComponentTransferFunction(const FEComponentTransfer& effect)
-{
-    auto isNullOrLinear = [] (const ComponentTransferFunction& function) {
-        return function.type == FECOMPONENTTRANSFER_TYPE_UNKNOWN
-            || function.type == FECOMPONENTTRANSFER_TYPE_LINEAR;
-    };
-    return isNullOrLinear(effect.redFunction()) && isNullOrLinear(effect.greenFunction())
-        && isNullOrLinear(effect.blueFunction()) && isNullOrLinear(effect.alphaFunction());
-}
-
-bool FilterEffectRendererCoreImage::supportsCoreImageRendering(FilterEffect& effect)
-{
-    // FIXME: change return value to true once they are implemented
-    switch (effect.filterType()) {
-    case FilterEffect::Type::SourceGraphic:
-        return true;
-            
-    case FilterEffect::Type::FEColorMatrix: {
-        switch (downcast<FEColorMatrix>(effect).type()) {
-        case FECOLORMATRIX_TYPE_UNKNOWN:
-        case FECOLORMATRIX_TYPE_LUMINANCETOALPHA:
-            return false;
-        case FECOLORMATRIX_TYPE_MATRIX:
-        case FECOLORMATRIX_TYPE_SATURATE:
-        case FECOLORMATRIX_TYPE_HUEROTATE:
-            return true;
-        }
-    }
-
-    case FilterEffect::Type::FEComponentTransfer:
-        return isNullOrLinearComponentTransferFunction(downcast<FEComponentTransfer>(effect));
-
-    default:
-        return false;
-    }
-    return false;
-}
-
-void FilterEffectRendererCoreImage::applyEffects(const Filter& filter, FilterEffect& lastEffect)
-{
-    m_outputImage = connectCIFilters(filter, lastEffect);
-    if (!m_outputImage)
-        return;
-    renderToImageBuffer(lastEffect);
-}
-
-RetainPtr<CIImage> FilterEffectRendererCoreImage::connectCIFilters(const Filter& filter, FilterEffect& effect)
-{
-    Vector<RetainPtr<CIImage>> inputImages;
-    
-    for (auto in : effect.inputEffects()) {
-        auto inputImage = connectCIFilters(filter, *in);
-        if (!inputImage)
-            return nullptr;
-        inputImages.append(inputImage);
-    }
-    effect.determineAbsolutePaintRect(filter);
-    
-    if (effect.absolutePaintRect().isEmpty() || ImageBuffer::sizeNeedsClamping(effect.absolutePaintRect().size()))
-        return nullptr;
-    
-    switch (effect.filterType()) {
-    case FilterEffect::Type::SourceGraphic:
-        return imageForSourceGraphic(filter);
-    case FilterEffect::Type::FEColorMatrix:
-        return imageForFEColorMatrix(downcast<FEColorMatrix>(effect), inputImages);
-    case FilterEffect::Type::FEComponentTransfer:
-        return imageForFEComponentTransfer(downcast<FEComponentTransfer>(effect), inputImages);
-
-    default:
-        return nullptr;
-    }
-    return nullptr;
-}
-
-RetainPtr<CIImage> FilterEffectRendererCoreImage::imageForSourceGraphic(const Filter& filter)
-{
-    ImageBuffer* sourceImage = filter.sourceImage();
-    if (!sourceImage)
-        return nullptr;
-    
-    if (is<IOSurfaceImageBuffer>(*sourceImage))
-        return [CIImage imageWithIOSurface:downcast<IOSurfaceImageBuffer>(*sourceImage).surface().surface()];
-    
-    return [CIImage imageWithCGImage:sourceImage->copyNativeImage()->platformImage().get()];
-}
-
-RetainPtr<CIImage> FilterEffectRendererCoreImage::imageForFEColorMatrix(const FEColorMatrix& effect, const Vector<RetainPtr<CIImage>>& inputImages)
-{
-    auto inputImage = inputImages.at(0);
-
-    auto values = FEColorMatrix::normalizedFloats(effect.values());
-    float components[9];
-    
-    switch (effect.type()) {
-    case FECOLORMATRIX_TYPE_SATURATE:
-        FEColorMatrix::calculateSaturateComponents(components, values[0]);
-        break;
-    
-    case FECOLORMATRIX_TYPE_HUEROTATE:
-        FEColorMatrix::calculateHueRotateComponents(components, values[0]);
-        break;
-    
-    case FECOLORMATRIX_TYPE_MATRIX:
-        break;
-        
-    case FECOLORMATRIX_TYPE_UNKNOWN:
-    case FECOLORMATRIX_TYPE_LUMINANCETOALPHA: // FIXME: Add Luminance to Alpha Implementation
-        return nullptr;
-    }
-    
-    auto *colorMatrixFilter = [CIFilter filterWithName:@"CIColorMatrix"];
-    [colorMatrixFilter setValue:inputImage.get() forKey:kCIInputImageKey];
-    
-    switch (effect.type()) {
-    case FECOLORMATRIX_TYPE_SATURATE:
-    case FECOLORMATRIX_TYPE_HUEROTATE: {
-        [colorMatrixFilter setValue:[CIVector vectorWithX:components[0] Y:components[1] Z:components[2] W:0] forKey:@"inputRVector"];
-        [colorMatrixFilter setValue:[CIVector vectorWithX:components[3] Y:components[4] Z:components[5] W:0] forKey:@"inputGVector"];
-        [colorMatrixFilter setValue:[CIVector vectorWithX:components[6] Y:components[7] Z:components[8] W:0] forKey:@"inputBVector"];
-        [colorMatrixFilter setValue:[CIVector vectorWithX:0             Y:0             Z:0             W:1] forKey:@"inputAVector"];
-        [colorMatrixFilter setValue:[CIVector vectorWithX:0             Y:0             Z:0             W:0] forKey:@"inputBiasVector"];
-        break;
-    }
-    case FECOLORMATRIX_TYPE_MATRIX: {
-        [colorMatrixFilter setValue:[CIVector vectorWithX:values[0]  Y:values[1]  Z:values[2]  W:values[3]]  forKey:@"inputRVector"];
-        [colorMatrixFilter setValue:[CIVector vectorWithX:values[5]  Y:values[6]  Z:values[7]  W:values[8]]  forKey:@"inputGVector"];
-        [colorMatrixFilter setValue:[CIVector vectorWithX:values[10] Y:values[11] Z:values[12] W:values[13]] forKey:@"inputBVector"];
-        [colorMatrixFilter setValue:[CIVector vectorWithX:values[15] Y:values[16] Z:values[17] W:values[18]] forKey:@"inputAVector"];
-        [colorMatrixFilter setValue:[CIVector vectorWithX:values[4]  Y:values[9]  Z:values[14] W:values[19]] forKey:@"inputBiasVector"];
-        break;
-    }
-    case FECOLORMATRIX_TYPE_LUMINANCETOALPHA:
-    case FECOLORMATRIX_TYPE_UNKNOWN:
-        return nullptr;
-    }
-    return colorMatrixFilter.outputImage;
-}
-
-RetainPtr<CIImage> FilterEffectRendererCoreImage::imageForFEComponentTransfer(const FEComponentTransfer& effect, Vector<RetainPtr<CIImage>>& inputImages)
-{
-    // FIXME: Implement the rest of FEComponentTransfer functions
-    ASSERT(isNullOrLinearComponentTransferFunction(effect));
-
-    auto inputImage = inputImages.at(0);
-    auto filter = [CIFilter filterWithName:@"CIColorPolynomial"];
-    
-    [filter setValue:inputImage.get() forKey:kCIInputImageKey];
-    
-    auto setCoefficients = [&] (NSString *key, const ComponentTransferFunction& function) {
-        if (function.type == FECOMPONENTTRANSFER_TYPE_LINEAR)
-            [filter setValue:[CIVector vectorWithX:function.intercept Y:function.slope Z:0 W:0] forKey:key];
-    };
-    setCoefficients(@"inputRedCoefficients", effect.redFunction());
-    setCoefficients(@"inputGreenCoefficients", effect.greenFunction());
-    setCoefficients(@"inputBlueCoefficients", effect.blueFunction());
-    setCoefficients(@"inputAlphaCoefficients", effect.alphaFunction());
-    
-    return filter.outputImage;
-}
-
-bool FilterEffectRendererCoreImage::canRenderUsingCIFilters(FilterEffect& effect)
-{
-    if (!supportsCoreImageRendering(effect))
-        return false;
-    
-    for (auto in : effect.inputEffects()) {
-        if (!supportsCoreImageRendering(*in) || !canRenderUsingCIFilters(*in))
-            return false;
-    }
-    return true;
-}
-
-ImageBuffer* FilterEffectRendererCoreImage::output() const
-{
-    LOG_WITH_STREAM(Filters, stream << "Rendering " << this << " using CoreImage\n");
-    return m_outputImageBuffer.get();
-}
-    
-void FilterEffectRendererCoreImage::renderToImageBuffer(FilterEffect& lastEffect)
-{
-    FloatSize clampedSize = ImageBuffer::clampedSize(lastEffect.absolutePaintRect().size());
-    m_outputImageBuffer = IOSurfaceImageBuffer::create(clampedSize, 1, lastEffect.resultColorSpace(), PixelFormat::BGRA8);
-    if (!m_outputImageBuffer) {
-        clearResult();
-        return;
-    }
-
-    [sharedCIContext().get() render: m_outputImage.get() toIOSurface: m_outputImageBuffer->surface().surface() bounds:destRect(lastEffect) colorSpace:lastEffect.resultColorSpace().platformColorSpace()];
-}
-    
-FloatRect FilterEffectRendererCoreImage::destRect(const FilterEffect& lastEffect) const
-{
-    IntSize destSize = lastEffect.absolutePaintRect().size();
-    FloatRect destRect = FloatRect(FloatPoint(), destSize);
-    return destRect;
-}
-
-void FilterEffectRendererCoreImage::clearResult()
-{
-    m_outputImageBuffer = nullptr;
-    m_outputImage = nullptr;
-}
-
-FilterEffectRendererCoreImage::FilterEffectRendererCoreImage()
-    : FilterEffectRenderer()
-{
-}
-    
-} // namespace WebCore
-
-#endif
</del></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscoreimageFilterImageCoreImagemm"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/platform/graphics/coreimage/FilterImageCoreImage.mm (0 => 286193)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/coreimage/FilterImageCoreImage.mm                         (rev 0)
+++ trunk/Source/WebCore/platform/graphics/coreimage/FilterImageCoreImage.mm    2021-11-28 04:28:11 UTC (rev 286193)
</span><span class="lines">@@ -0,0 +1,70 @@
</span><ins>+/*
+ * Copyright (C) 2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+#import "FilterImage.h"
+
+#if USE(CORE_IMAGE)
+
+#import "PlatformImageBuffer.h"
+#import <CoreImage/CIContext.h>
+#import <CoreImage/CoreImage.h>
+#import <wtf/NeverDestroyed.h>
+#import <wtf/cocoa/TypeCastsCocoa.h>
+
+namespace WebCore {
+
+static RetainPtr<CIContext> sharedCIContext()
+{
+    static NeverDestroyed<RetainPtr<CIContext>> ciContext = [CIContext contextWithOptions:@{ kCIContextWorkingColorSpace: bridge_id_cast(adoptCF(CGColorSpaceCreateWithName(kCGColorSpaceSRGB))).get() }];
+    return ciContext;
+}
+
+void FilterImage::setCIImage(RetainPtr<CIImage>&& ciImage)
+{
+    ASSERT(ciImage);
+    m_ciImage = WTFMove(ciImage);
+}
+
+ImageBuffer* FilterImage::imageBufferFromCIImage()
+{
+    ASSERT(m_ciImage);
+
+    if (m_imageBuffer)
+        return m_imageBuffer.get();
+
+    m_imageBuffer = IOSurfaceImageBuffer::create(m_absoluteImageRect.size(), 1, m_colorSpace, PixelFormat::BGRA8);
+    if (!m_imageBuffer)
+        return nullptr;
+
+    auto destRect = FloatRect { FloatPoint(), m_absoluteImageRect.size() };
+    [sharedCIContext().get() render: m_ciImage.get() toIOSurface: downcast<IOSurfaceImageBuffer>(*m_imageBuffer).surface().surface() bounds:destRect colorSpace:m_colorSpace.platformColorSpace()];
+
+    return m_imageBuffer.get();
+}
+
+} // namespace WebCore
+
+#endif // USE(CORE_IMAGE)
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscoreimageSourceGraphicCoreImageApplierh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/platform/graphics/coreimage/SourceGraphicCoreImageApplier.h (0 => 286193)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/coreimage/SourceGraphicCoreImageApplier.h                         (rev 0)
+++ trunk/Source/WebCore/platform/graphics/coreimage/SourceGraphicCoreImageApplier.h    2021-11-28 04:28:11 UTC (rev 286193)
</span><span class="lines">@@ -0,0 +1,44 @@
</span><ins>+/*
+ * Copyright (C) 2020-2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#import "FilterEffectApplier.h"
+
+namespace WebCore {
+
+class SourceGraphic;
+
+class SourceGraphicCoreImageApplier : public FilterEffectConcreteApplier<SourceGraphic> {
+    WTF_MAKE_FAST_ALLOCATED;
+    using Base = FilterEffectConcreteApplier<SourceGraphic>;
+
+public:
+    using Base::Base;
+
+    bool apply(const Filter&, const FilterImageVector& inputs, FilterImage& result) const override;
+};
+
+} // namespace WebCore
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscoreimageSourceGraphicCoreImageAppliermm"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/platform/graphics/coreimage/SourceGraphicCoreImageApplier.mm (0 => 286193)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/coreimage/SourceGraphicCoreImageApplier.mm                                (rev 0)
+++ trunk/Source/WebCore/platform/graphics/coreimage/SourceGraphicCoreImageApplier.mm   2021-11-28 04:28:11 UTC (rev 286193)
</span><span class="lines">@@ -0,0 +1,58 @@
</span><ins>+/*
+ * Copyright (C) 2020-2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+#import "SourceGraphicCoreImageApplier.h"
+
+#if USE(CORE_IMAGE)
+
+#import "Filter.h"
+#import "FilterImage.h"
+#import "PlatformImageBuffer.h"
+
+namespace WebCore {
+
+bool SourceGraphicCoreImageApplier::apply(const Filter& filter, const FilterImageVector&, FilterImage& result) const
+{
+    auto sourceImage = filter.sourceImage();
+    if (!sourceImage)
+        return false;
+
+    RetainPtr<CIImage> image;
+    if (is<IOSurfaceImageBuffer>(*sourceImage))
+        image = [CIImage imageWithIOSurface:downcast<IOSurfaceImageBuffer>(*sourceImage).surface().surface()];
+    else
+        image = [CIImage imageWithCGImage:sourceImage->copyNativeImage()->platformImage().get()];
+
+    if (!image)
+        return false;
+
+    result.setCIImage(WTFMove(image));
+    return true;
+}
+
+} // namespace WebCore
+
+#endif // USE(CORE_IMAGE)
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscvCVUtilitiesmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/cv/CVUtilities.mm (286192 => 286193)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/cv/CVUtilities.mm 2021-11-28 03:43:46 UTC (rev 286192)
+++ trunk/Source/WebCore/platform/graphics/cv/CVUtilities.mm    2021-11-28 04:28:11 UTC (rev 286193)
</span><span class="lines">@@ -26,6 +26,7 @@
</span><span class="cx"> #import "config.h"
</span><span class="cx"> #import "CVUtilities.h"
</span><span class="cx"> 
</span><ins>+#import "ColorSpaceCG.h"
</ins><span class="cx"> #import <wtf/StdLibExtras.h>
</span><span class="cx"> #import "CoreVideoSoftLink.h"
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsfiltersFEColorMatrixcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/filters/FEColorMatrix.cpp (286192 => 286193)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/filters/FEColorMatrix.cpp 2021-11-28 03:43:46 UTC (rev 286192)
+++ trunk/Source/WebCore/platform/graphics/filters/FEColorMatrix.cpp    2021-11-28 04:28:11 UTC (rev 286193)
</span><span class="lines">@@ -28,6 +28,10 @@
</span><span class="cx"> #include "Filter.h"
</span><span class="cx"> #include <wtf/text/TextStream.h>
</span><span class="cx"> 
</span><ins>+#if USE(CORE_IMAGE)
+#include "FEColorMatrixCoreImageApplier.h"
+#endif
+
</ins><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> Ref<FEColorMatrix> FEColorMatrix::create(ColorMatrixType type, Vector<float>&& values)
</span><span class="lines">@@ -94,6 +98,13 @@
</span><span class="cx">     return normalizedValues;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if USE(CORE_IMAGE)
+bool FEColorMatrix::supportsCoreImageRendering() const
+{
+    return FEColorMatrixCoreImageApplier::supportsCoreImageRendering(*this);
+}
+#endif
+
</ins><span class="cx"> bool FEColorMatrix::resultIsAlphaImage() const
</span><span class="cx"> {
</span><span class="cx">     return m_type == FECOLORMATRIX_TYPE_LUMINANCETOALPHA;
</span><span class="lines">@@ -102,9 +113,8 @@
</span><span class="cx"> std::unique_ptr<FilterEffectApplier> FEColorMatrix::createApplier(const Filter& filter) const
</span><span class="cx"> {
</span><span class="cx"> #if USE(CORE_IMAGE)
</span><del>-    // FIXME: return FEColorMatrixCoreImageApplier.
</del><span class="cx">     if (filter.renderingMode() == RenderingMode::Accelerated)
</span><del>-        return nullptr;
</del><ins>+        return FilterEffectApplier::create<FEColorMatrixCoreImageApplier>(*this);
</ins><span class="cx"> #endif
</span><span class="cx">     return FilterEffectApplier::create<FEColorMatrixSoftwareApplier>(*this);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsfiltersFEColorMatrixh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/filters/FEColorMatrix.h (286192 => 286193)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/filters/FEColorMatrix.h   2021-11-28 03:43:46 UTC (rev 286192)
+++ trunk/Source/WebCore/platform/graphics/filters/FEColorMatrix.h      2021-11-28 04:28:11 UTC (rev 286193)
</span><span class="lines">@@ -52,6 +52,10 @@
</span><span class="cx"> private:
</span><span class="cx">     FEColorMatrix(ColorMatrixType, Vector<float>&&);
</span><span class="cx"> 
</span><ins>+#if USE(CORE_IMAGE)
+    bool supportsCoreImageRendering() const override;
+#endif
+    
</ins><span class="cx">     bool resultIsAlphaImage() const override;
</span><span class="cx"> 
</span><span class="cx">     std::unique_ptr<FilterEffectApplier> createApplier(const Filter&) const override;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsfiltersFEComponentTransfercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/filters/FEComponentTransfer.cpp (286192 => 286193)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/filters/FEComponentTransfer.cpp   2021-11-28 03:43:46 UTC (rev 286192)
+++ trunk/Source/WebCore/platform/graphics/filters/FEComponentTransfer.cpp      2021-11-28 04:28:11 UTC (rev 286193)
</span><span class="lines">@@ -29,6 +29,10 @@
</span><span class="cx"> #include "Filter.h"
</span><span class="cx"> #include <wtf/text/TextStream.h>
</span><span class="cx"> 
</span><ins>+#if USE(CORE_IMAGE)
+#include "FEComponentTransferCoreImageApplier.h"
+#endif
+
</ins><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> Ref<FEComponentTransfer> FEComponentTransfer::create(const ComponentTransferFunction& redFunction, const ComponentTransferFunction& greenFunction, const ComponentTransferFunction& blueFunction, const ComponentTransferFunction& alphaFunction)
</span><span class="lines">@@ -45,12 +49,18 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if USE(CORE_IMAGE)
+bool FEComponentTransfer::supportsCoreImageRendering() const
+{
+    return FEComponentTransferCoreImageApplier::supportsCoreImageRendering(*this);
+}
+#endif
+
</ins><span class="cx"> std::unique_ptr<FilterEffectApplier> FEComponentTransfer::createApplier(const Filter& filter) const
</span><span class="cx"> {
</span><span class="cx"> #if USE(CORE_IMAGE)
</span><del>-    // FIXME: return FEComponentTransferCoreImageApplier.
</del><span class="cx">     if (filter.renderingMode() == RenderingMode::Accelerated)
</span><del>-        return nullptr;
</del><ins>+        return FilterEffectApplier::create<FEComponentTransferCoreImageApplier>(*this);
</ins><span class="cx"> #endif
</span><span class="cx">     return FilterEffectApplier::create<FEComponentTransferSoftwareApplier>(*this);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsfiltersFEComponentTransferh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/filters/FEComponentTransfer.h (286192 => 286193)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/filters/FEComponentTransfer.h     2021-11-28 03:43:46 UTC (rev 286192)
+++ trunk/Source/WebCore/platform/graphics/filters/FEComponentTransfer.h        2021-11-28 04:28:11 UTC (rev 286193)
</span><span class="lines">@@ -62,6 +62,10 @@
</span><span class="cx"> private:
</span><span class="cx">     FEComponentTransfer(const ComponentTransferFunction& redFunc, const ComponentTransferFunction& greenFunc, const ComponentTransferFunction& blueFunc, const ComponentTransferFunction& alphaFunc);
</span><span class="cx"> 
</span><ins>+#if USE(CORE_IMAGE)
+    bool supportsCoreImageRendering() const override;
+#endif
+
</ins><span class="cx">     std::unique_ptr<FilterEffectApplier> createApplier(const Filter&) const override;
</span><span class="cx"> 
</span><span class="cx">     WTF::TextStream& externalRepresentation(WTF::TextStream&, RepresentationType) const override;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsfiltersFilterh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/filters/Filter.h (286192 => 286193)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/filters/Filter.h  2021-11-28 03:43:46 UTC (rev 286192)
+++ trunk/Source/WebCore/platform/graphics/filters/Filter.h     2021-11-28 04:28:11 UTC (rev 286193)
</span><span class="lines">@@ -54,14 +54,16 @@
</span><span class="cx">     void setRenderingMode(RenderingMode renderingMode) { m_renderingMode = renderingMode; }
</span><span class="cx"> 
</span><span class="cx"> protected:
</span><del>-    Filter(Filter::Type filterType, const FloatSize& filterScale)
</del><ins>+    Filter(Filter::Type filterType, RenderingMode renderingMode, const FloatSize& filterScale)
</ins><span class="cx">         : FilterFunction(filterType)
</span><ins>+        , m_renderingMode(renderingMode)
</ins><span class="cx">         , m_filterScale(filterScale)
</span><span class="cx">     {
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    Filter(Filter::Type filterType, const FloatSize& filterScale, const FloatRect& sourceImageRect, const FloatRect& filterRegion)
</del><ins>+    Filter(Filter::Type filterType, RenderingMode renderingMode, const FloatSize& filterScale, const FloatRect& sourceImageRect, const FloatRect& filterRegion)
</ins><span class="cx">         : FilterFunction(filterType)
</span><ins>+        , m_renderingMode(renderingMode)
</ins><span class="cx">         , m_filterScale(filterScale)
</span><span class="cx">         , m_sourceImageRect(sourceImageRect)
</span><span class="cx">         , m_filterRegion(filterRegion)
</span><span class="lines">@@ -69,12 +71,13 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx"> private:
</span><ins>+    RenderingMode m_renderingMode;
+
</ins><span class="cx">     FloatSize m_filterScale;
</span><span class="cx">     FloatRect m_sourceImageRect;
</span><span class="cx">     FloatRect m_filterRegion;
</span><span class="cx"> 
</span><span class="cx">     RefPtr<ImageBuffer> m_sourceImage;
</span><del>-    RenderingMode m_renderingMode { RenderingMode::Unaccelerated };
</del><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsfiltersFilterEffectRenderercpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/platform/graphics/filters/FilterEffectRenderer.cpp (286192 => 286193)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/filters/FilterEffectRenderer.cpp  2021-11-28 03:43:46 UTC (rev 286192)
+++ trunk/Source/WebCore/platform/graphics/filters/FilterEffectRenderer.cpp     2021-11-28 04:28:11 UTC (rev 286193)
</span><span class="lines">@@ -1,48 +0,0 @@
</span><del>-/*
-* Copyright (C) 2020 Apple Inc. All rights reserved.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions
-* are met:
-* 1. Redistributions of source code must retain the above copyright
-*    notice, this list of conditions and the following disclaimer.
-* 2. Redistributions in binary form must reproduce the above copyright
-*    notice, this list of conditions and the following disclaimer in the
-*    documentation and/or other materials provided with the distribution.
-*
-* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
-* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-* PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
-* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
-* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#include "config.h"
-#include "FilterEffectRenderer.h"
-
-#if USE(CORE_IMAGE)
-#include "FilterEffectRendererCoreImage.h"
-#endif
-
-namespace WebCore {
-
-std::unique_ptr<FilterEffectRenderer> FilterEffectRenderer::tryCreate(bool acceleratedFilterRenderingEnabled, FilterEffect& lastEffect)
-{
-#if USE(CORE_IMAGE)
-    if (acceleratedFilterRenderingEnabled)
-        return FilterEffectRendererCoreImage::tryCreate(lastEffect);
-#else
-    UNUSED_PARAM(acceleratedFilterRenderingEnabled);
-    UNUSED_PARAM(lastEffect);
-#endif
-    return nullptr;
-}
-
-
-} // namspace WebCore
</del></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsfiltersFilterEffectRendererh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/platform/graphics/filters/FilterEffectRenderer.h (286192 => 286193)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/filters/FilterEffectRenderer.h    2021-11-28 03:43:46 UTC (rev 286192)
+++ trunk/Source/WebCore/platform/graphics/filters/FilterEffectRenderer.h       2021-11-28 04:28:11 UTC (rev 286193)
</span><span class="lines">@@ -1,52 +0,0 @@
</span><del>-/*
-* Copyright (C) 2020 Apple Inc. All rights reserved.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions
-* are met:
-* 1. Redistributions of source code must retain the above copyright
-*    notice, this list of conditions and the following disclaimer.
-* 2. Redistributions in binary form must reproduce the above copyright
-*    notice, this list of conditions and the following disclaimer in the
-*    documentation and/or other materials provided with the distribution.
-*
-* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
-* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-* PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
-* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
-* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#pragma once
-
-#include "FilterEffect.h"
-#include "ImageBuffer.h"
-#include "Settings.h"
-
-namespace WebCore {
-
-class FilterEffectRenderer {
-    WTF_MAKE_FAST_ALLOCATED;
-    
-public:
-    static std::unique_ptr<FilterEffectRenderer> tryCreate(bool, FilterEffect&);
-    virtual void applyEffects(const Filter&, FilterEffect&) = 0;
-    virtual bool hasResult() const = 0;
-    virtual ImageBuffer* output() const = 0;
-    virtual FloatRect destRect(const FilterEffect&) const = 0;
-    virtual void clearResult() = 0;
-    
-    virtual ~FilterEffectRenderer() = default;
-    
-protected:
-    FilterEffectRenderer() = default;
-    virtual void renderToImageBuffer(FilterEffect&) = 0;
-};
-
-} // namespace WebCore
</del></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsfiltersFilterFunctionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/filters/FilterFunction.h (286192 => 286193)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/filters/FilterFunction.h  2021-11-28 03:43:46 UTC (rev 286192)
+++ trunk/Source/WebCore/platform/graphics/filters/FilterFunction.h     2021-11-28 04:28:11 UTC (rev 286193)
</span><span class="lines">@@ -84,6 +84,10 @@
</span><span class="cx">     static AtomString sourceGraphicName() { return filterName(Type::SourceGraphic); }
</span><span class="cx">     AtomString filterName() const { return filterName(m_filterType); }
</span><span class="cx"> 
</span><ins>+#if USE(CORE_IMAGE)
+    virtual bool supportsCoreImageRendering() const { return false; }
+#endif
+
</ins><span class="cx">     virtual bool apply(const Filter&) { return false; }
</span><span class="cx">     virtual IntOutsets outsets() const { return { }; }
</span><span class="cx">     virtual void clearResult() { }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsfiltersFilterImagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/filters/FilterImage.cpp (286192 => 286193)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/filters/FilterImage.cpp   2021-11-28 03:43:46 UTC (rev 286192)
+++ trunk/Source/WebCore/platform/graphics/filters/FilterImage.cpp      2021-11-28 04:28:11 UTC (rev 286193)
</span><span class="lines">@@ -65,6 +65,15 @@
</span><span class="cx"> 
</span><span class="cx"> ImageBuffer* FilterImage::imageBuffer()
</span><span class="cx"> {
</span><ins>+#if USE(CORE_IMAGE)
+    if (m_ciImage)
+        return imageBufferFromCIImage();
+#endif
+    return imageBufferFromPixelBuffer();
+}
+
+ImageBuffer* FilterImage::imageBufferFromPixelBuffer()
+{
</ins><span class="cx">     if (m_imageBuffer)
</span><span class="cx">         return m_imageBuffer.get();
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsfiltersFilterImageh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/filters/FilterImage.h (286192 => 286193)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/filters/FilterImage.h     2021-11-28 03:43:46 UTC (rev 286192)
+++ trunk/Source/WebCore/platform/graphics/filters/FilterImage.h        2021-11-28 04:28:11 UTC (rev 286193)
</span><span class="lines">@@ -31,6 +31,10 @@
</span><span class="cx"> #include <wtf/RefCounted.h>
</span><span class="cx"> #include <wtf/Vector.h>
</span><span class="cx"> 
</span><ins>+#if USE(CORE_IMAGE)
+OBJC_CLASS CIImage;
+#endif
+
</ins><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> class Filter;
</span><span class="lines">@@ -61,11 +65,22 @@
</span><span class="cx">     void correctPremultipliedPixelBuffer();
</span><span class="cx">     void transformToColorSpace(const DestinationColorSpace&);
</span><span class="cx"> 
</span><ins>+#if USE(CORE_IMAGE)
+    RetainPtr<CIImage> ciImage() const { return m_ciImage; }
+    void setCIImage(RetainPtr<CIImage>&&);
+#endif
+
</ins><span class="cx"> private:
</span><span class="cx">     FilterImage(const FloatRect& primitiveSubregion, const IntRect& absoluteImageRect, bool isAlphaImage, RenderingMode, const DestinationColorSpace&);
</span><span class="cx"> 
</span><span class="cx">     std::optional<PixelBuffer>& pixelBufferSlot(AlphaPremultiplication);
</span><span class="cx"> 
</span><ins>+    ImageBuffer* imageBufferFromPixelBuffer();
+
+#if USE(CORE_IMAGE)
+    ImageBuffer* imageBufferFromCIImage();
+#endif
+
</ins><span class="cx">     bool requiresPixelBufferColorSpaceConversion(std::optional<DestinationColorSpace>) const;
</span><span class="cx"> 
</span><span class="cx">     FloatRect m_primitiveSubregion;
</span><span class="lines">@@ -78,6 +93,10 @@
</span><span class="cx">     RefPtr<ImageBuffer> m_imageBuffer;
</span><span class="cx">     std::optional<PixelBuffer> m_unpremultipliedPixelBuffer;
</span><span class="cx">     std::optional<PixelBuffer> m_premultipliedPixelBuffer;
</span><ins>+
+#if USE(CORE_IMAGE)
+    RetainPtr<CIImage> m_ciImage;
+#endif
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsfiltersSourceGraphiccpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/filters/SourceGraphic.cpp (286192 => 286193)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/filters/SourceGraphic.cpp 2021-11-28 03:43:46 UTC (rev 286192)
+++ trunk/Source/WebCore/platform/graphics/filters/SourceGraphic.cpp    2021-11-28 04:28:11 UTC (rev 286193)
</span><span class="lines">@@ -25,6 +25,10 @@
</span><span class="cx"> #include "SourceGraphicSoftwareApplier.h"
</span><span class="cx"> #include <wtf/text/TextStream.h>
</span><span class="cx"> 
</span><ins>+#if USE(CORE_IMAGE)
+#include "SourceGraphicCoreImageApplier.h"
+#endif
+
</ins><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> Ref<SourceGraphic> SourceGraphic::create()
</span><span class="lines">@@ -48,7 +52,7 @@
</span><span class="cx"> #if USE(CORE_IMAGE)
</span><span class="cx">     // FIXME: return SourceGraphicCoreImageApplier.
</span><span class="cx">     if (filter.renderingMode() == RenderingMode::Accelerated)
</span><del>-        return nullptr;
</del><ins>+        return FilterEffectApplier::create<SourceGraphicCoreImageApplier>(*this);
</ins><span class="cx"> #endif
</span><span class="cx">     return FilterEffectApplier::create<SourceGraphicSoftwareApplier>(*this);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsfiltersSourceGraphich"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/filters/SourceGraphic.h (286192 => 286193)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/filters/SourceGraphic.h   2021-11-28 03:43:46 UTC (rev 286192)
+++ trunk/Source/WebCore/platform/graphics/filters/SourceGraphic.h      2021-11-28 04:28:11 UTC (rev 286193)
</span><span class="lines">@@ -34,6 +34,10 @@
</span><span class="cx"> private:
</span><span class="cx">     SourceGraphic();
</span><span class="cx"> 
</span><ins>+#if USE(CORE_IMAGE)
+    bool supportsCoreImageRendering() const override { return true; }
+#endif
+
</ins><span class="cx">     void determineAbsolutePaintRect(const Filter&) override;
</span><span class="cx"> 
</span><span class="cx">     std::unique_ptr<FilterEffectApplier> createApplier(const Filter&) const override;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmacScrollingEffectsControllermm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mac/ScrollingEffectsController.mm (286192 => 286193)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mac/ScrollingEffectsController.mm  2021-11-28 03:43:46 UTC (rev 286192)
+++ trunk/Source/WebCore/platform/mac/ScrollingEffectsController.mm     2021-11-28 04:28:11 UTC (rev 286193)
</span><span class="lines">@@ -30,6 +30,7 @@
</span><span class="cx"> #import "PlatformWheelEvent.h"
</span><span class="cx"> #import "ScrollAnimationRubberBand.h"
</span><span class="cx"> #import "ScrollExtents.h"
</span><ins>+#import "ScrollableArea.h"
</ins><span class="cx"> #import "WheelEventDeltaFilter.h"
</span><span class="cx"> #import <pal/spi/mac/NSScrollViewSPI.h>
</span><span class="cx"> #import <sys/sysctl.h>
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingCSSFiltercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/CSSFilter.cpp (286192 => 286193)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/CSSFilter.cpp     2021-11-28 03:43:46 UTC (rev 286192)
+++ trunk/Source/WebCore/rendering/CSSFilter.cpp        2021-11-28 04:28:11 UTC (rev 286193)
</span><span class="lines">@@ -32,7 +32,6 @@
</span><span class="cx"> #include "FEDropShadow.h"
</span><span class="cx"> #include "FEGaussianBlur.h"
</span><span class="cx"> #include "FEMerge.h"
</span><del>-#include "FilterEffectRenderer.h"
</del><span class="cx"> #include "FilterOperations.h"
</span><span class="cx"> #include "GraphicsContext.h"
</span><span class="cx"> #include "LengthFunctions.h"
</span><span class="lines">@@ -55,14 +54,11 @@
</span><span class="cx">     bool hasFilterThatMovesPixels = operations.hasFilterThatMovesPixels();
</span><span class="cx">     bool hasFilterThatShouldBeRestrictedBySecurityOrigin = operations.hasFilterThatShouldBeRestrictedBySecurityOrigin();
</span><span class="cx"> 
</span><del>-    auto filter = adoptRef(*new CSSFilter(hasFilterThatMovesPixels, hasFilterThatShouldBeRestrictedBySecurityOrigin, scaleFactor));
-
-    filter->setRenderingMode(renderingMode);
-    return filter;
</del><ins>+    return adoptRef(*new CSSFilter(renderingMode, scaleFactor, hasFilterThatMovesPixels, hasFilterThatShouldBeRestrictedBySecurityOrigin));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-CSSFilter::CSSFilter(bool hasFilterThatMovesPixels, bool hasFilterThatShouldBeRestrictedBySecurityOrigin, float scaleFactor)
-    : Filter(Filter::Type::CSSFilter, FloatSize { scaleFactor, scaleFactor })
</del><ins>+CSSFilter::CSSFilter(RenderingMode renderingMode, float scaleFactor, bool hasFilterThatMovesPixels, bool hasFilterThatShouldBeRestrictedBySecurityOrigin)
+    : Filter(Filter::Type::CSSFilter, renderingMode, FloatSize { scaleFactor, scaleFactor })
</ins><span class="cx">     , m_hasFilterThatMovesPixels(hasFilterThatMovesPixels)
</span><span class="cx">     , m_hasFilterThatShouldBeRestrictedBySecurityOrigin(hasFilterThatShouldBeRestrictedBySecurityOrigin)
</span><span class="cx"> {
</span><span class="lines">@@ -225,7 +221,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     SVGFilterBuilder builder;
</span><del>-    return SVGFilter::create(*filterElement, builder, filter.filterScale(), filter.sourceImageRect(), filter.filterRegion(), previousEffect);
</del><ins>+    return SVGFilter::create(*filterElement, builder, filter.renderingMode(), filter.filterScale(), filter.sourceImageRect(), filter.filterRegion(), previousEffect);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static void setupLastEffectProperties(FilterEffect& effect, FilterConsumer consumer)
</span><span class="lines">@@ -329,9 +325,10 @@
</span><span class="cx">     m_functions.shrinkToFit();
</span><span class="cx"> 
</span><span class="cx"> #if USE(CORE_IMAGE)
</span><del>-    if (!m_filterRenderer)
-        m_filterRenderer = FilterEffectRenderer::tryCreate(renderer.settings().coreImageAcceleratedFilterRenderEnabled(), *lastEffect());
</del><ins>+    if (!supportsCoreImageRendering())
+        setRenderingMode(RenderingMode::Unaccelerated);
</ins><span class="cx"> #endif
</span><ins>+
</ins><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -367,8 +364,7 @@
</span><span class="cx">         setSourceImage(ImageBuffer::create(logicalSize, renderingMode(), &targetContext, 1, DestinationColorSpace::SRGB(), PixelFormat::BGRA8));
</span><span class="cx"> #else
</span><span class="cx">         UNUSED_PARAM(targetContext);
</span><del>-        RenderingMode mode = m_filterRenderer ? RenderingMode::Accelerated : renderingMode();
-        setSourceImage(ImageBuffer::create(logicalSize, mode, 1, DestinationColorSpace::SRGB(), PixelFormat::BGRA8));
</del><ins>+        setSourceImage(ImageBuffer::create(logicalSize, renderingMode(), 1, DestinationColorSpace::SRGB(), PixelFormat::BGRA8));
</ins><span class="cx"> #endif
</span><span class="cx">         if (auto context = inputContext())
</span><span class="cx">             context->scale(filterScale());
</span><span class="lines">@@ -389,6 +385,21 @@
</span><span class="cx">     return downcast<FilterEffect>(function.ptr());
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if USE(CORE_IMAGE)
+bool CSSFilter::supportsCoreImageRendering() const
+{
+    if (renderingMode() == RenderingMode::Unaccelerated)
+        return false;
+
+    for (auto& function : m_functions) {
+        if (!function->supportsCoreImageRendering())
+            return false;
+    }
+
+    return true;
+}
+#endif
+
</ins><span class="cx"> void CSSFilter::determineFilterPrimitiveSubregion()
</span><span class="cx"> {
</span><span class="cx">     auto effect = lastEffect();
</span><span class="lines">@@ -410,21 +421,12 @@
</span><span class="cx"> 
</span><span class="cx"> bool CSSFilter::apply()
</span><span class="cx"> {
</span><del>-    auto effect = lastEffect();
-    if (m_filterRenderer) {
-        m_filterRenderer->applyEffects(*this, *effect);
-        if (m_filterRenderer->hasResult()) {
-            effect->transformResultColorSpace(DestinationColorSpace::SRGB());
-            return true;
-        }
-    }
-
</del><span class="cx">     for (auto& function : m_functions) {
</span><span class="cx">         if (!function->apply(*this))
</span><span class="cx">             return false;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    effect->transformResultColorSpace(DestinationColorSpace::SRGB());
</del><ins>+    lastEffect()->transformResultColorSpace(DestinationColorSpace::SRGB());
</ins><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -440,9 +442,6 @@
</span><span class="cx"> 
</span><span class="cx"> ImageBuffer* CSSFilter::output()
</span><span class="cx"> {
</span><del>-    if (m_filterRenderer && m_filterRenderer->hasResult())
-        return m_filterRenderer->output();
-
</del><span class="cx">     if (auto result = lastEffect()->filterImage())
</span><span class="cx">         return result->imageBuffer();
</span><span class="cx"> 
</span><span class="lines">@@ -471,8 +470,8 @@
</span><span class="cx"> {
</span><span class="cx">     auto effect = lastEffect();
</span><span class="cx"> 
</span><del>-    if (effect->hasResult() || (m_filterRenderer && m_filterRenderer->hasResult()))
-        return effect->absolutePaintRect() - IntPoint(filterRegion().location());
</del><ins>+    if (auto result = effect->filterImage())
+        return result->absoluteImageRect() - IntPoint(filterRegion().location());
</ins><span class="cx"> 
</span><span class="cx">     return { };
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingCSSFilterh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/CSSFilter.h (286192 => 286193)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/CSSFilter.h       2021-11-28 03:43:46 UTC (rev 286192)
+++ trunk/Source/WebCore/rendering/CSSFilter.h  2021-11-28 04:28:11 UTC (rev 286193)
</span><span class="lines">@@ -33,7 +33,6 @@
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> class FilterEffect;
</span><del>-class FilterEffectRenderer;
</del><span class="cx"> class FilterOperations;
</span><span class="cx"> class GraphicsContext;
</span><span class="cx"> class ReferenceFilterOperation;
</span><span class="lines">@@ -71,8 +70,12 @@
</span><span class="cx">     LayoutRect computeSourceImageRectForDirtyRect(const LayoutRect& filterBoxRect, const LayoutRect& dirtyRect);
</span><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    CSSFilter(bool hasFilterThatMovesPixels, bool hasFilterThatShouldBeRestrictedBySecurityOrigin, float scaleFactor);
</del><ins>+    CSSFilter(RenderingMode, float scaleFactor, bool hasFilterThatMovesPixels, bool hasFilterThatShouldBeRestrictedBySecurityOrigin);
</ins><span class="cx"> 
</span><ins>+#if USE(CORE_IMAGE)
+    bool supportsCoreImageRendering() const override;
+#endif
+
</ins><span class="cx">     bool m_graphicsBufferAttached { false };
</span><span class="cx">     bool m_hasFilterThatMovesPixels { false };
</span><span class="cx">     bool m_hasFilterThatShouldBeRestrictedBySecurityOrigin { false };
</span><span class="lines">@@ -80,8 +83,6 @@
</span><span class="cx">     Vector<Ref<FilterFunction>> m_functions;
</span><span class="cx"> 
</span><span class="cx">     mutable IntOutsets m_outsets;
</span><del>-
-    std::unique_ptr<FilterEffectRenderer> m_filterRenderer;
</del><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingsvgRenderSVGResourceFiltercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/svg/RenderSVGResourceFilter.cpp (286192 => 286193)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/svg/RenderSVGResourceFilter.cpp   2021-11-28 03:43:46 UTC (rev 286192)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGResourceFilter.cpp      2021-11-28 04:28:11 UTC (rev 286193)
</span><span class="lines">@@ -126,9 +126,12 @@
</span><span class="cx">     absoluteDrawingRegion.scale(filterScale);
</span><span class="cx">     ImageBuffer::sizeNeedsClamping(absoluteDrawingRegion.size(), filterScale);
</span><span class="cx"> 
</span><ins>+    // Set the rendering mode from the page's settings.
+    auto renderingMode = renderer.settings().acceleratedFiltersEnabled() ? RenderingMode::Accelerated : RenderingMode::Unaccelerated;
+
</ins><span class="cx">     // Create the SVGFilter object.
</span><span class="cx">     filterData->builder = makeUnique<SVGFilterBuilder>();
</span><del>-    filterData->filter = SVGFilter::create(filterElement(), *filterData->builder, filterScale, absoluteDrawingRegion, filterData->boundaries, targetBoundingBox);
</del><ins>+    filterData->filter = SVGFilter::create(filterElement(), *filterData->builder, renderingMode, filterScale, absoluteDrawingRegion, filterData->boundaries, targetBoundingBox);
</ins><span class="cx">     if (!filterData->filter) {
</span><span class="cx">         m_rendererFilterDataMap.remove(&renderer);
</span><span class="cx">         return false;
</span><span class="lines">@@ -160,13 +163,12 @@
</span><span class="cx">     // Change the coordinate transformation applied to the filtered element to reflect the resolution of the filter.
</span><span class="cx">     AffineTransform effectiveTransform = AffineTransform(filterScale.width(), 0, 0, filterScale.height(), 0, 0);
</span><span class="cx"> 
</span><del>-    auto renderingMode = renderer.settings().acceleratedFiltersEnabled() ? RenderingMode::Accelerated : RenderingMode::Unaccelerated;
</del><span class="cx"> #if ENABLE(DESTINATION_COLOR_SPACE_LINEAR_SRGB)
</span><span class="cx">     auto colorSpace = DestinationColorSpace::LinearSRGB();
</span><span class="cx"> #else
</span><span class="cx">     auto colorSpace = DestinationColorSpace::SRGB();
</span><span class="cx"> #endif
</span><del>-    auto sourceGraphic = SVGRenderingContext::createImageBuffer(filterData->drawingRegion, effectiveTransform, colorSpace, renderingMode, context);
</del><ins>+    auto sourceGraphic = SVGRenderingContext::createImageBuffer(filterData->drawingRegion, effectiveTransform, colorSpace, filterData->filter->renderingMode(), context);
</ins><span class="cx">     if (!sourceGraphic) {
</span><span class="cx">         ASSERT(m_rendererFilterDataMap.contains(&renderer));
</span><span class="cx">         filterData->savedContext = context;
</span><span class="lines">@@ -173,9 +175,6 @@
</span><span class="cx">         return false;
</span><span class="cx">     }
</span><span class="cx">     
</span><del>-    // Set the rendering mode from the page's settings.
-    filterData->filter->setRenderingMode(renderingMode);
-
</del><span class="cx">     GraphicsContext& sourceGraphicContext = sourceGraphic->context();
</span><span class="cx">   
</span><span class="cx">     filterData->sourceGraphicBuffer = WTFMove(sourceGraphic);
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingsvgSVGRenderTreeAsTextcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp (286192 => 286193)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp       2021-11-28 03:43:46 UTC (rev 286192)
+++ trunk/Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp  2021-11-28 04:28:11 UTC (rev 286193)
</span><span class="lines">@@ -431,7 +431,7 @@
</span><span class="cx">         FloatRect dummyRect;
</span><span class="cx">         FloatSize dummyScale(1, 1);
</span><span class="cx">         SVGFilterBuilder builder;
</span><del>-        auto dummyFilter = SVGFilter::create(filter.filterElement(), builder, dummyScale, dummyRect, dummyRect, dummyRect);
</del><ins>+        auto dummyFilter = SVGFilter::create(filter.filterElement(), builder, RenderingMode::Unaccelerated, dummyScale, dummyRect, dummyRect, dummyRect);
</ins><span class="cx">         if (dummyFilter) {
</span><span class="cx">             TextStream::IndentScope indentScope(ts);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoresvggraphicsfiltersSVGFiltercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/graphics/filters/SVGFilter.cpp (286192 => 286193)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/graphics/filters/SVGFilter.cpp  2021-11-28 03:43:46 UTC (rev 286192)
+++ trunk/Source/WebCore/svg/graphics/filters/SVGFilter.cpp     2021-11-28 04:28:11 UTC (rev 286193)
</span><span class="lines">@@ -28,21 +28,21 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-RefPtr<SVGFilter> SVGFilter::create(SVGFilterElement& filterElement, SVGFilterBuilder& builder, const FloatSize& filterScale, const FloatRect& sourceImageRect, const FloatRect& filterRegion, FilterEffect& previousEffect)
</del><ins>+RefPtr<SVGFilter> SVGFilter::create(SVGFilterElement& filterElement, SVGFilterBuilder& builder, RenderingMode renderingMode, const FloatSize& filterScale, const FloatRect& sourceImageRect, const FloatRect& filterRegion, FilterEffect& previousEffect)
</ins><span class="cx"> {
</span><del>-    return create(filterElement, builder, filterScale, sourceImageRect, filterRegion, filterRegion, &previousEffect);
</del><ins>+    return create(filterElement, builder, renderingMode, filterScale, sourceImageRect, filterRegion, filterRegion, &previousEffect);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-RefPtr<SVGFilter> SVGFilter::create(SVGFilterElement& filterElement, SVGFilterBuilder& builder, const FloatSize& filterScale, const FloatRect& sourceImageRect, const FloatRect& filterRegion, const FloatRect& targetBoundingBox)
</del><ins>+RefPtr<SVGFilter> SVGFilter::create(SVGFilterElement& filterElement, SVGFilterBuilder& builder, RenderingMode renderingMode, const FloatSize& filterScale, const FloatRect& sourceImageRect, const FloatRect& filterRegion, const FloatRect& targetBoundingBox)
</ins><span class="cx"> {
</span><del>-    return create(filterElement, builder, filterScale, sourceImageRect, filterRegion, targetBoundingBox, nullptr);
</del><ins>+    return create(filterElement, builder, renderingMode, filterScale, sourceImageRect, filterRegion, targetBoundingBox, nullptr);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-RefPtr<SVGFilter> SVGFilter::create(SVGFilterElement& filterElement, SVGFilterBuilder& builder, const FloatSize& filterScale, const FloatRect& sourceImageRect, const FloatRect& filterRegion, const FloatRect& targetBoundingBox, FilterEffect* previousEffect)
</del><ins>+RefPtr<SVGFilter> SVGFilter::create(SVGFilterElement& filterElement, SVGFilterBuilder& builder, RenderingMode renderingMode, const FloatSize& filterScale, const FloatRect& sourceImageRect, const FloatRect& filterRegion, const FloatRect& targetBoundingBox, FilterEffect* previousEffect)
</ins><span class="cx"> {
</span><span class="cx">     bool primitiveBoundingBoxMode = filterElement.primitiveUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX;
</span><span class="cx"> 
</span><del>-    auto filter = adoptRef(*new SVGFilter(filterScale, sourceImageRect, filterRegion, targetBoundingBox, primitiveBoundingBoxMode));
</del><ins>+    auto filter = adoptRef(*new SVGFilter(renderingMode, filterScale, sourceImageRect, filterRegion, targetBoundingBox, primitiveBoundingBoxMode));
</ins><span class="cx"> 
</span><span class="cx">     if (!previousEffect)
</span><span class="cx">         builder.setupBuiltinEffects(SourceGraphic::create());
</span><span class="lines">@@ -62,11 +62,17 @@
</span><span class="cx"> 
</span><span class="cx">     ASSERT(!expression.isEmpty());
</span><span class="cx">     filter->setExpression(WTFMove(expression));
</span><ins>+    
+#if USE(CORE_IMAGE)
+    if (!filter->supportsCoreImageRendering())
+        filter->setRenderingMode(RenderingMode::Unaccelerated);
+#endif
+
</ins><span class="cx">     return filter;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-SVGFilter::SVGFilter(const FloatSize& filterScale, const FloatRect& sourceImageRect, const FloatRect& filterRegion, const FloatRect& targetBoundingBox, bool effectBBoxMode)
-    : Filter(Filter::Type::SVGFilter, filterScale, sourceImageRect, filterRegion)
</del><ins>+SVGFilter::SVGFilter(RenderingMode renderingMode, const FloatSize& filterScale, const FloatRect& sourceImageRect, const FloatRect& filterRegion, const FloatRect& targetBoundingBox, bool effectBBoxMode)
+    : Filter(Filter::Type::SVGFilter, renderingMode, filterScale, sourceImageRect, filterRegion)
</ins><span class="cx">     , m_targetBoundingBox(targetBoundingBox)
</span><span class="cx">     , m_effectBBoxMode(effectBBoxMode)
</span><span class="cx"> {
</span><span class="lines">@@ -80,6 +86,22 @@
</span><span class="cx">     return Filter::scaledByFilterScale(size);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if USE(CORE_IMAGE)
+bool SVGFilter::supportsCoreImageRendering() const
+{
+    if (renderingMode() == RenderingMode::Unaccelerated)
+        return false;
+
+    ASSERT(!m_expression.isEmpty());
+    for (auto& effect : m_expression) {
+        if (!effect->supportsCoreImageRendering())
+            return false;
+    }
+
+    return true;
+}
+#endif
+
</ins><span class="cx"> bool SVGFilter::apply(const Filter& filter)
</span><span class="cx"> {
</span><span class="cx">     setSourceImage({ filter.sourceImage() });
</span></span></pre></div>
<a id="trunkSourceWebCoresvggraphicsfiltersSVGFilterh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/graphics/filters/SVGFilter.h (286192 => 286193)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/graphics/filters/SVGFilter.h    2021-11-28 03:43:46 UTC (rev 286192)
+++ trunk/Source/WebCore/svg/graphics/filters/SVGFilter.h       2021-11-28 04:28:11 UTC (rev 286193)
</span><span class="lines">@@ -33,9 +33,9 @@
</span><span class="cx"> 
</span><span class="cx"> class SVGFilter final : public Filter {
</span><span class="cx"> public:
</span><del>-    static RefPtr<SVGFilter> create(SVGFilterElement&, SVGFilterBuilder&, const FloatSize& filterScale, const FloatRect& sourceImageRect, const FloatRect& filterRegion, FilterEffect& previousEffect);
-    static RefPtr<SVGFilter> create(SVGFilterElement&, SVGFilterBuilder&, const FloatSize& filterScale, const FloatRect& sourceImageRect, const FloatRect& filterRegion, const FloatRect& targetBoundingBox);
-    static RefPtr<SVGFilter> create(SVGFilterElement&, SVGFilterBuilder&, const FloatSize& filterScale, const FloatRect& sourceImageRect, const FloatRect& filterRegion, const FloatRect& targetBoundingBox, FilterEffect* previousEffect);
</del><ins>+    static RefPtr<SVGFilter> create(SVGFilterElement&, SVGFilterBuilder&, RenderingMode, const FloatSize& filterScale, const FloatRect& sourceImageRect, const FloatRect& filterRegion, FilterEffect& previousEffect);
+    static RefPtr<SVGFilter> create(SVGFilterElement&, SVGFilterBuilder&, RenderingMode, const FloatSize& filterScale, const FloatRect& sourceImageRect, const FloatRect& filterRegion, const FloatRect& targetBoundingBox);
+    static RefPtr<SVGFilter> create(SVGFilterElement&, SVGFilterBuilder&, RenderingMode, const FloatSize& filterScale, const FloatRect& sourceImageRect, const FloatRect& filterRegion, const FloatRect& targetBoundingBox, FilterEffect* previousEffect);
</ins><span class="cx"> 
</span><span class="cx">     FloatSize scaledByFilterScale(FloatSize) const final;
</span><span class="cx"> 
</span><span class="lines">@@ -46,8 +46,12 @@
</span><span class="cx">     RefPtr<FilterEffect> lastEffect() const { return !m_expression.isEmpty() ? m_expression.last() : nullptr; }
</span><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    SVGFilter(const FloatSize& filterScale, const FloatRect& sourceImageRect, const FloatRect& targetBoundingBox, const FloatRect& filterRegion, bool effectBBoxMode);
</del><ins>+    SVGFilter(RenderingMode, const FloatSize& filterScale, const FloatRect& sourceImageRect, const FloatRect& targetBoundingBox, const FloatRect& filterRegion, bool effectBBoxMode);
</ins><span class="cx"> 
</span><ins>+#if USE(CORE_IMAGE)
+    bool supportsCoreImageRendering() const override;
+#endif
+
</ins><span class="cx">     bool apply(const Filter&) override;
</span><span class="cx">     IntOutsets outsets() const override;
</span><span class="cx">     void clearResult() override;
</span></span></pre>
</div>
</div>

</body>
</html>