<!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>[235630] 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/235630">235630</a></dd>
<dt>Author</dt> <dd>simon.fraser@apple.com</dd>
<dt>Date</dt> <dd>2018-09-04 13:27:09 -0700 (Tue, 04 Sep 2018)</dd>
</dl>

<h3>Log Message</h3>
<pre>Simplify RenderLayer filter code
https://bugs.webkit.org/show_bug.cgi?id=189248

Reviewed by Dean Jackson.

Painting filters in RenderLayer involved the confusingly named RenderLayer::FilterInfo,
and FilterEffectRenderer/FilterEffectRendererHelper. Reduce confusion by just collapsing
these together into RenderLayerFilters. RenderLayerFilters stores a reference to the
CSSFilter, and knows how to set it up, and vend a GraphicsContext* for painting the content
to be filtered.

It's also simpler to just give RenderLayer a member variable for RenderLayerFilters, rather
than using a side hash (we can recoup the space in other ways layer).

* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* css/CSSFilterImageValue.cpp:
* rendering/CSSFilter.h:
* rendering/FilterEffectRenderer.cpp: Removed.
* rendering/FilterEffectRenderer.h: Removed.
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::RenderLayer):
(WebCore::RenderLayer::~RenderLayer):
(WebCore::RenderLayer::paintsWithFilters const):
(WebCore::RenderLayer::requiresFullLayerImageForFilters const):
(WebCore::RenderLayer::setFilterBackendNeedsRepaintingInRect):
(WebCore::RenderLayer::filtersForPainting const):
(WebCore::RenderLayer::setupFilters):
(WebCore::RenderLayer::applyFilters):
(WebCore::RenderLayer::paintLayerContents):
(WebCore::RenderLayer::calculateClipRects const):
(WebCore::RenderLayer::filter const): Deleted.
(WebCore::RenderLayer::filterPainter const): Deleted.
(WebCore::RenderLayer::hasFilterThatIsPainting const): Deleted.
* rendering/RenderLayer.h:
* rendering/RenderLayerFilterInfo.cpp: Removed.
* rendering/RenderLayerFilters.cpp: Added.
(WebCore::RenderLayerFilters::RenderLayerFilters):
(WebCore::RenderLayerFilters::~RenderLayerFilters):
(WebCore::RenderLayerFilters::setFilter):
(WebCore::RenderLayerFilters::hasFilterThatMovesPixels const):
(WebCore::RenderLayerFilters::hasFilterThatShouldBeRestrictedBySecurityOrigin const):
(WebCore::RenderLayerFilters::notifyFinished):
(WebCore::RenderLayerFilters::updateReferenceFilterClients):
(WebCore::RenderLayerFilters::removeReferenceFilterClients):
(WebCore::RenderLayerFilters::buildFilter):
(WebCore::RenderLayerFilters::beginFilterEffect):
(WebCore::RenderLayerFilters::applyFilterEffect):
* rendering/RenderLayerFilters.h: Renamed from Source/WebCore/rendering/RenderLayerFilterInfo.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="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCorecssCSSFilterImageValuecpp">trunk/Source/WebCore/css/CSSFilterImageValue.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingCSSFilterh">trunk/Source/WebCore/rendering/CSSFilter.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderLayercpp">trunk/Source/WebCore/rendering/RenderLayer.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderLayerh">trunk/Source/WebCore/rendering/RenderLayer.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCorerenderingRenderLayerFilterscpp">trunk/Source/WebCore/rendering/RenderLayerFilters.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderLayerFiltersh">trunk/Source/WebCore/rendering/RenderLayerFilters.h</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceWebCorerenderingFilterEffectRenderercpp">trunk/Source/WebCore/rendering/FilterEffectRenderer.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingFilterEffectRendererh">trunk/Source/WebCore/rendering/FilterEffectRenderer.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderLayerFilterInfocpp">trunk/Source/WebCore/rendering/RenderLayerFilterInfo.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderLayerFilterInfoh">trunk/Source/WebCore/rendering/RenderLayerFilterInfo.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (235629 => 235630)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog   2018-09-04 20:26:27 UTC (rev 235629)
+++ trunk/Source/WebCore/ChangeLog      2018-09-04 20:27:09 UTC (rev 235630)
</span><span class="lines">@@ -1,3 +1,55 @@
</span><ins>+2018-09-04  Simon Fraser  <simon.fraser@apple.com>
+
+        Simplify RenderLayer filter code
+        https://bugs.webkit.org/show_bug.cgi?id=189248
+
+        Reviewed by Dean Jackson.
+        
+        Painting filters in RenderLayer involved the confusingly named RenderLayer::FilterInfo,
+        and FilterEffectRenderer/FilterEffectRendererHelper. Reduce confusion by just collapsing
+        these together into RenderLayerFilters. RenderLayerFilters stores a reference to the
+        CSSFilter, and knows how to set it up, and vend a GraphicsContext* for painting the content
+        to be filtered.
+        
+        It's also simpler to just give RenderLayer a member variable for RenderLayerFilters, rather
+        than using a side hash (we can recoup the space in other ways layer).
+
+        * Sources.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * css/CSSFilterImageValue.cpp:
+        * rendering/CSSFilter.h:
+        * rendering/FilterEffectRenderer.cpp: Removed.
+        * rendering/FilterEffectRenderer.h: Removed.
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::RenderLayer):
+        (WebCore::RenderLayer::~RenderLayer):
+        (WebCore::RenderLayer::paintsWithFilters const):
+        (WebCore::RenderLayer::requiresFullLayerImageForFilters const):
+        (WebCore::RenderLayer::setFilterBackendNeedsRepaintingInRect):
+        (WebCore::RenderLayer::filtersForPainting const):
+        (WebCore::RenderLayer::setupFilters):
+        (WebCore::RenderLayer::applyFilters):
+        (WebCore::RenderLayer::paintLayerContents):
+        (WebCore::RenderLayer::calculateClipRects const):
+        (WebCore::RenderLayer::filter const): Deleted.
+        (WebCore::RenderLayer::filterPainter const): Deleted.
+        (WebCore::RenderLayer::hasFilterThatIsPainting const): Deleted.
+        * rendering/RenderLayer.h:
+        * rendering/RenderLayerFilterInfo.cpp: Removed.
+        * rendering/RenderLayerFilters.cpp: Added.
+        (WebCore::RenderLayerFilters::RenderLayerFilters):
+        (WebCore::RenderLayerFilters::~RenderLayerFilters):
+        (WebCore::RenderLayerFilters::setFilter):
+        (WebCore::RenderLayerFilters::hasFilterThatMovesPixels const):
+        (WebCore::RenderLayerFilters::hasFilterThatShouldBeRestrictedBySecurityOrigin const):
+        (WebCore::RenderLayerFilters::notifyFinished):
+        (WebCore::RenderLayerFilters::updateReferenceFilterClients):
+        (WebCore::RenderLayerFilters::removeReferenceFilterClients):
+        (WebCore::RenderLayerFilters::buildFilter):
+        (WebCore::RenderLayerFilters::beginFilterEffect):
+        (WebCore::RenderLayerFilters::applyFilterEffect):
+        * rendering/RenderLayerFilters.h: Renamed from Source/WebCore/rendering/RenderLayerFilterInfo.h.
+
</ins><span class="cx"> 2018-09-04  Dean Jackson  <dino@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Build fix.
</span></span></pre></div>
<a id="trunkSourceWebCoreSourcestxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Sources.txt (235629 => 235630)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Sources.txt 2018-09-04 20:26:27 UTC (rev 235629)
+++ trunk/Source/WebCore/Sources.txt    2018-09-04 20:27:09 UTC (rev 235630)
</span><span class="lines">@@ -1841,7 +1841,6 @@
</span><span class="cx"> rendering/ClipRect.cpp
</span><span class="cx"> rendering/CounterNode.cpp
</span><span class="cx"> rendering/EllipsisBox.cpp
</span><del>-rendering/FilterEffectRenderer.cpp
</del><span class="cx"> rendering/FlexibleBoxAlgorithm.cpp
</span><span class="cx"> rendering/FixedTableLayout.cpp
</span><span class="cx"> rendering/FloatingObjects.cpp
</span><span class="lines">@@ -1896,7 +1895,7 @@
</span><span class="cx"> rendering/RenderLayer.cpp
</span><span class="cx"> rendering/RenderLayerBacking.cpp
</span><span class="cx"> rendering/RenderLayerCompositor.cpp
</span><del>-rendering/RenderLayerFilterInfo.cpp
</del><ins>+rendering/RenderLayerFilters.cpp
</ins><span class="cx"> rendering/RenderLayerModelObject.cpp
</span><span class="cx"> rendering/RenderLineBoxList.cpp
</span><span class="cx"> rendering/RenderLineBreak.cpp
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (235629 => 235630)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj   2018-09-04 20:26:27 UTC (rev 235629)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj      2018-09-04 20:27:09 UTC (rev 235630)
</span><span class="lines">@@ -886,7 +886,6 @@
</span><span class="cx">          31288E750E3005D6003619AE /* CSSKeyframesRule.h in Headers */ = {isa = PBXBuildFile; fileRef = 31288E710E3005D6003619AE /* CSSKeyframesRule.h */; };
</span><span class="cx">          3128CA6B147331630074C72A /* NotificationController.h in Headers */ = {isa = PBXBuildFile; fileRef = 3128CA6A147331630074C72A /* NotificationController.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">          312C0C41146DC6CC0016C911 /* Notification.h in Headers */ = {isa = PBXBuildFile; fileRef = 333F704F0FB49CA2008E12A6 /* Notification.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><del>-               31313F661443B35F006E2A90 /* FilterEffectRenderer.h in Headers */ = {isa = PBXBuildFile; fileRef = 31313F641443B35E006E2A90 /* FilterEffectRenderer.h */; };
</del><span class="cx">           313171561FB079E5008D91FC /* CanvasBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 313171541FB079D1008D91FC /* CanvasBase.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">          313591061E7DDC7300F30630 /* RTCIceConnectionState.h in Headers */ = {isa = PBXBuildFile; fileRef = 313591001E7DDC6000F30630 /* RTCIceConnectionState.h */; };
</span><span class="cx">          313591071E7DDC7300F30630 /* RTCIceGatheringState.h in Headers */ = {isa = PBXBuildFile; fileRef = 313591011E7DDC6000F30630 /* RTCIceGatheringState.h */; };
</span><span class="lines">@@ -1353,7 +1352,6 @@
</span><span class="cx">          504AACCE1834455900E3D9BC /* InspectorNodeFinder.h in Headers */ = {isa = PBXBuildFile; fileRef = 504AACCC1834455900E3D9BC /* InspectorNodeFinder.h */; };
</span><span class="cx">          5081E3E03CFF80C16EF8B48B /* CachedResourceRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 5081E3E13D0280C16EF8B48B /* CachedResourceRequest.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">          508CCA4F13CF106B003151F3 /* RenderFragmentedFlow.h in Headers */ = {isa = PBXBuildFile; fileRef = 508CCA4D13CF106B003151F3 /* RenderFragmentedFlow.h */; };
</span><del>-               50D10D9A1545F5760096D288 /* RenderLayerFilterInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 50D10D981545F5760096D288 /* RenderLayerFilterInfo.h */; settings = {ATTRIBUTES = (Private, ); }; };
</del><span class="cx">           510184690B08602A004A825F /* CachedPage.h in Headers */ = {isa = PBXBuildFile; fileRef = 510184670B08602A004A825F /* CachedPage.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">          510192D218B6B9AB007FC7A1 /* ImageControlsRootElementMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 510192D018B6B9AB007FC7A1 /* ImageControlsRootElementMac.h */; };
</span><span class="cx">          510192D618B6B9B7007FC7A1 /* ImageControlsRootElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 510192D418B6B9B7007FC7A1 /* ImageControlsRootElement.h */; };
</span><span class="lines">@@ -5622,6 +5620,8 @@
</span><span class="cx">          0F4966A91DB40C4300A274BB /* JSDOMPointReadOnly.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDOMPointReadOnly.h; sourceTree = "<group>"; };
</span><span class="cx">          0F53FB81213B1BB800C40D34 /* CSSFilter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSFilter.cpp; sourceTree = "<group>"; };
</span><span class="cx">          0F53FB83213B1BB800C40D34 /* CSSFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSFilter.h; sourceTree = "<group>"; };
</span><ins>+               0F53FB89213B768400C40D34 /* RenderLayerFilters.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RenderLayerFilters.h; sourceTree = "<group>"; };
+               0F53FB8B213B768400C40D34 /* RenderLayerFilters.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = RenderLayerFilters.cpp; sourceTree = "<group>"; };
</ins><span class="cx">           0F54DCE31881051D003EEDBB /* TextAutoSizing.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextAutoSizing.cpp; sourceTree = "<group>"; };
</span><span class="cx">          0F54DCE41881051D003EEDBB /* TextAutoSizing.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextAutoSizing.h; sourceTree = "<group>"; };
</span><span class="cx">          0F54DD051881D5F5003EEDBB /* Touch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Touch.h; sourceTree = "<group>"; };
</span><span class="lines">@@ -6760,8 +6760,6 @@
</span><span class="cx">          31288E710E3005D6003619AE /* CSSKeyframesRule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSKeyframesRule.h; sourceTree = "<group>"; };
</span><span class="cx">          3128CA67147331520074C72A /* NotificationController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NotificationController.cpp; sourceTree = "<group>"; };
</span><span class="cx">          3128CA6A147331630074C72A /* NotificationController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NotificationController.h; sourceTree = "<group>"; };
</span><del>-               31313F631443B35E006E2A90 /* FilterEffectRenderer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FilterEffectRenderer.cpp; sourceTree = "<group>"; };
-               31313F641443B35E006E2A90 /* FilterEffectRenderer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FilterEffectRenderer.h; sourceTree = "<group>"; };
</del><span class="cx">           313171541FB079D1008D91FC /* CanvasBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CanvasBase.h; sourceTree = "<group>"; };
</span><span class="cx">          313171571FB0969E008D91FC /* CanvasBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CanvasBase.cpp; sourceTree = "<group>"; };
</span><span class="cx">          313591001E7DDC6000F30630 /* RTCIceConnectionState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RTCIceConnectionState.h; sourceTree = "<group>"; };
</span><span class="lines">@@ -7818,8 +7816,6 @@
</span><span class="cx">          5081E3E13D0280C16EF8B48B /* CachedResourceRequest.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CachedResourceRequest.h; sourceTree = "<group>"; };
</span><span class="cx">          508CCA4D13CF106B003151F3 /* RenderFragmentedFlow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderFragmentedFlow.h; sourceTree = "<group>"; };
</span><span class="cx">          508CCA4E13CF106B003151F3 /* RenderFragmentedFlow.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderFragmentedFlow.cpp; sourceTree = "<group>"; };
</span><del>-               50D10D971545F5760096D288 /* RenderLayerFilterInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderLayerFilterInfo.cpp; sourceTree = "<group>"; };
-               50D10D981545F5760096D288 /* RenderLayerFilterInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderLayerFilterInfo.h; sourceTree = "<group>"; };
</del><span class="cx">           510184670B08602A004A825F /* CachedPage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CachedPage.h; sourceTree = "<group>"; };
</span><span class="cx">          510184680B08602A004A825F /* CachedPage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CachedPage.cpp; sourceTree = "<group>"; };
</span><span class="cx">          510192CF18B6B9AB007FC7A1 /* ImageControlsRootElementMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ImageControlsRootElementMac.cpp; sourceTree = "<group>"; };
</span><span class="lines">@@ -25802,8 +25798,6 @@
</span><span class="cx">                          0F53FB83213B1BB800C40D34 /* CSSFilter.h */,
</span><span class="cx">                          A8CFF6CA0A1561CD000A4234 /* EllipsisBox.cpp */,
</span><span class="cx">                          A8CFF6BD0A156118000A4234 /* EllipsisBox.h */,
</span><del>-                               31313F631443B35E006E2A90 /* FilterEffectRenderer.cpp */,
-                               31313F641443B35E006E2A90 /* FilterEffectRenderer.h */,
</del><span class="cx">                           A8CFF0480A154F09000A4234 /* FixedTableLayout.cpp */,
</span><span class="cx">                          A8CFF04A0A154F09000A4234 /* FixedTableLayout.h */,
</span><span class="cx">                          94DD79721E54E3A20058FB80 /* FlexibleBoxAlgorithm.cpp */,
</span><span class="lines">@@ -25924,8 +25918,8 @@
</span><span class="cx">                          0F580CFB0F12DE9B0051D689 /* RenderLayerBacking.h */,
</span><span class="cx">                          0F580CFA0F12DE9B0051D689 /* RenderLayerCompositor.cpp */,
</span><span class="cx">                          0F580CF90F12DE9B0051D689 /* RenderLayerCompositor.h */,
</span><del>-                               50D10D971545F5760096D288 /* RenderLayerFilterInfo.cpp */,
-                               50D10D981545F5760096D288 /* RenderLayerFilterInfo.h */,
</del><ins>+                                0F53FB8B213B768400C40D34 /* RenderLayerFilters.cpp */,
+                               0F53FB89213B768400C40D34 /* RenderLayerFilters.h */,
</ins><span class="cx">                           3C244FE5A375AC633F88BE6F /* RenderLayerModelObject.cpp */,
</span><span class="cx">                          3C244FE4A375AC633F88BE6F /* RenderLayerModelObject.h */,
</span><span class="cx">                          BC33FB1A0F30EE85002CDD7C /* RenderLineBoxList.cpp */,
</span><span class="lines">@@ -27921,7 +27915,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>-                               31313F661443B35F006E2A90 /* FilterEffectRenderer.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 class="lines">@@ -29864,7 +29857,6 @@
</span><span class="cx">                          BCEA487A097D93020094C9E4 /* RenderLayer.h in Headers */,
</span><span class="cx">                          0F580CFF0F12DE9B0051D689 /* RenderLayerBacking.h in Headers */,
</span><span class="cx">                          0F580CFD0F12DE9B0051D689 /* RenderLayerCompositor.h in Headers */,
</span><del>-                               50D10D9A1545F5760096D288 /* RenderLayerFilterInfo.h in Headers */,
</del><span class="cx">                           3C244FEAA375AC633F88BE6F /* RenderLayerModelObject.h in Headers */,
</span><span class="cx">                          0BE030A20F3112FB003C1A46 /* RenderLineBoxList.h in Headers */,
</span><span class="cx">                          BCEA4864097D93020094C9E4 /* RenderLineBreak.h in Headers */,
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSFilterImageValuecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSFilterImageValue.cpp (235629 => 235630)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSFilterImageValue.cpp 2018-09-04 20:26:27 UTC (rev 235629)
+++ trunk/Source/WebCore/css/CSSFilterImageValue.cpp    2018-09-04 20:27:09 UTC (rev 235630)
</span><span class="lines">@@ -30,7 +30,6 @@
</span><span class="cx"> #include "CSSFilter.h"
</span><span class="cx"> #include "CachedImage.h"
</span><span class="cx"> #include "CachedResourceLoader.h"
</span><del>-#include "FilterEffectRenderer.h"
</del><span class="cx"> #include "GraphicsContext.h"
</span><span class="cx"> #include "ImageBuffer.h"
</span><span class="cx"> #include "RenderElement.h"
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingCSSFilterh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/CSSFilter.h (235629 => 235630)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/CSSFilter.h       2018-09-04 20:26:27 UTC (rev 235629)
+++ trunk/Source/WebCore/rendering/CSSFilter.h  2018-09-04 20:27:09 UTC (rev 235630)
</span><span class="lines">@@ -43,9 +43,8 @@
</span><span class="cx"> 
</span><span class="cx"> class CSSFilter final : public Filter {
</span><span class="cx">     WTF_MAKE_FAST_ALLOCATED;
</span><ins>+    friend class RenderLayerFilters;
</ins><span class="cx"> public:
</span><del>-    friend class FilterEffectRendererHelper;
-
</del><span class="cx">     static Ref<CSSFilter> create();
</span><span class="cx"> 
</span><span class="cx">     void setSourceImageRect(const FloatRect&);
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingFilterEffectRenderercpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/rendering/FilterEffectRenderer.cpp (235629 => 235630)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/FilterEffectRenderer.cpp  2018-09-04 20:26:27 UTC (rev 235629)
+++ trunk/Source/WebCore/rendering/FilterEffectRenderer.cpp     2018-09-04 20:27:09 UTC (rev 235630)
</span><span class="lines">@@ -1,145 +0,0 @@
</span><del>-/*
- * Copyright (C) 2011-2017 Apple Inc. All rights reserved.
- * Copyright (C) 2013 Google 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"
-
-#include "CSSFilter.h"
-#include "CachedSVGDocument.h"
-#include "CachedSVGDocumentReference.h"
-#include "ElementIterator.h"
-#include "FEColorMatrix.h"
-#include "FEComponentTransfer.h"
-#include "FEDropShadow.h"
-#include "FEGaussianBlur.h"
-#include "FEMerge.h"
-#include "Logging.h"
-#include "RenderLayer.h"
-#include "SVGElement.h"
-#include "SVGFilterBuilder.h"
-#include "SVGFilterPrimitiveStandardAttributes.h"
-#include "SourceGraphic.h"
-#include <algorithm>
-#include <wtf/MathExtras.h>
-
-#if USE(DIRECT2D)
-#include <d2d1.h>
-#endif
-
-namespace WebCore {
-
-bool FilterEffectRendererHelper::prepareFilterEffect(RenderLayer& layer, const LayoutRect& filterBoxRect, const LayoutRect& dirtyRect, const LayoutRect& layerRepaintRect)
-{
-    ASSERT(m_haveFilterEffect);
-    ASSERT(layer.filter());
-
-    auto& filter = *layer.filter();
-    auto filterSourceRect = filter.computeSourceImageRectForDirtyRect(filterBoxRect, dirtyRect);
-
-    if (filterSourceRect.isEmpty()) {
-        // The dirty rect is not in view, just bail out.
-        m_haveFilterEffect = false;
-        return false;
-    }
-
-    bool hasUpdatedBackingStore = filter.updateBackingStoreRect(filterSourceRect);
-
-    m_renderLayer = &layer;
-    if (!filter.hasFilterThatMovesPixels())
-        m_repaintRect = dirtyRect;
-    else {
-        if (hasUpdatedBackingStore)
-            m_repaintRect = filterSourceRect;
-        else {
-            m_repaintRect = dirtyRect;
-            m_repaintRect.unite(layerRepaintRect);
-            m_repaintRect.intersect(filterSourceRect);
-        }
-    }
-    m_paintOffset = filterSourceRect.location();
-
-    return true;
-}
-
-GraphicsContext* FilterEffectRendererHelper::filterContext() const
-{
-    if (!m_haveFilterEffect)
-        return nullptr;
-    return m_renderLayer->filter()->inputContext();
-}
-
-bool FilterEffectRendererHelper::beginFilterEffect()
-{
-    ASSERT(m_renderLayer);
-    ASSERT(m_renderLayer->filter());
-
-    auto& filter = *m_renderLayer->filter();
-    filter.allocateBackingStoreIfNeeded(m_targetContext);
-    // Paint into the context that represents the SourceGraphic of the filter.
-    auto* sourceGraphicsContext = filter.inputContext();
-    if (!sourceGraphicsContext || filter.filterRegion().isEmpty() || ImageBuffer::sizeNeedsClamping(filter.filterRegion().size())) {
-        // Disable the filters and continue.
-        m_haveFilterEffect = false;
-        return false;
-    }
-
-    // Translate the context so that the contents of the layer is captured in the offscreen memory buffer.
-    sourceGraphicsContext->save();
-    sourceGraphicsContext->translate(-m_paintOffset);
-    sourceGraphicsContext->clearRect(m_repaintRect);
-    sourceGraphicsContext->clip(m_repaintRect);
-
-    m_startedFilterEffect = true;
-    return true;
-}
-
-void FilterEffectRendererHelper::applyFilterEffect(GraphicsContext& destinationContext)
-{
-    ASSERT(m_haveFilterEffect);
-    ASSERT(m_renderLayer);
-    ASSERT(m_renderLayer->filter());
-    ASSERT(m_renderLayer->filter()->inputContext());
-
-    LOG_WITH_STREAM(Filters, stream << "\nFilterEffectRendererHelper " << this << " applyFilterEffect");
-
-    auto& filter = *m_renderLayer->filter();
-    filter.inputContext()->restore();
-
-    filter.apply();
-
-    // Get the filtered output and draw it in place.
-    LayoutRect destRect = filter.outputRect();
-    destRect.move(m_paintOffset.x(), m_paintOffset.y());
-
-    if (auto* outputBuffer = filter.output())
-        destinationContext.drawImageBuffer(*outputBuffer, snapRectToDevicePixels(destRect, m_renderLayer->renderer().document().deviceScaleFactor()));
-
-    filter.clearIntermediateResults();
-
-    LOG_WITH_STREAM(Filters, stream << "FilterEffectRendererHelper " << this << " applyFilterEffect done\n");
-}
-
-} // namespace WebCore
</del></span></pre></div>
<a id="trunkSourceWebCorerenderingFilterEffectRendererh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/rendering/FilterEffectRenderer.h (235629 => 235630)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/FilterEffectRenderer.h    2018-09-04 20:26:27 UTC (rev 235629)
+++ trunk/Source/WebCore/rendering/FilterEffectRenderer.h       2018-09-04 20:27:09 UTC (rev 235630)
</span><span class="lines">@@ -1,65 +0,0 @@
</span><del>-/*
- * Copyright (C) 2011-2017 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 "LayoutRect.h"
-
-namespace WebCore {
-
-class Document;
-class GraphicsContext;
-class RenderLayer;
-
-class FilterEffectRendererHelper {
-    WTF_MAKE_FAST_ALLOCATED;
-public:
-    FilterEffectRendererHelper(bool haveFilterEffect, GraphicsContext& targetContext)
-        : m_targetContext(targetContext)
-        , m_haveFilterEffect(haveFilterEffect)
-    {
-    }
-
-    bool haveFilterEffect() const { return m_haveFilterEffect; }
-    bool hasStartedFilterEffect() const { return m_startedFilterEffect; }
-
-    bool prepareFilterEffect(RenderLayer&, const LayoutRect& filterBoxRect, const LayoutRect& dirtyRect, const LayoutRect& layerRepaintRect);
-    bool beginFilterEffect();
-    void applyFilterEffect(GraphicsContext& destinationContext);
-    
-    GraphicsContext* filterContext() const;
-
-    const LayoutRect& repaintRect() const { return m_repaintRect; }
-
-private:
-    RenderLayer* m_renderLayer { nullptr }; // FIXME: this is mainly used to get the CSSFilter. FilterEffectRendererHelper should be weaned off it.
-    LayoutPoint m_paintOffset;
-    LayoutRect m_repaintRect;
-    const GraphicsContext& m_targetContext;
-    bool m_haveFilterEffect { false };
-    bool m_startedFilterEffect { false };
-};
-
-} // namespace WebCore
</del></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderLayercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (235629 => 235630)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderLayer.cpp   2018-09-04 20:26:27 UTC (rev 235629)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp      2018-09-04 20:27:09 UTC (rev 235630)
</span><span class="lines">@@ -59,7 +59,6 @@
</span><span class="cx"> #include "EventHandler.h"
</span><span class="cx"> #include "FEColorMatrix.h"
</span><span class="cx"> #include "FEMerge.h"
</span><del>-#include "FilterEffectRenderer.h"
</del><span class="cx"> #include "FloatConversion.h"
</span><span class="cx"> #include "FloatPoint3D.h"
</span><span class="cx"> #include "FloatRect.h"
</span><span class="lines">@@ -96,7 +95,7 @@
</span><span class="cx"> #include "RenderIterator.h"
</span><span class="cx"> #include "RenderLayerBacking.h"
</span><span class="cx"> #include "RenderLayerCompositor.h"
</span><del>-#include "RenderLayerFilterInfo.h"
</del><ins>+#include "RenderLayerFilters.h"
</ins><span class="cx"> #include "RenderMarquee.h"
</span><span class="cx"> #include "RenderMultiColumnFlow.h"
</span><span class="cx"> #include "RenderReplica.h"
</span><span class="lines">@@ -312,7 +311,6 @@
</span><span class="cx"> #if !ASSERT_DISABLED
</span><span class="cx">     , m_layerListMutationAllowed(true)
</span><span class="cx"> #endif
</span><del>-    , m_hasFilterInfo(false)
</del><span class="cx"> #if ENABLE(CSS_COMPOSITING)
</span><span class="cx">     , m_blendMode(static_cast<unsigned>(BlendMode::Normal))
</span><span class="cx">     , m_hasNotIsolatedCompositedBlendingDescendants(false)
</span><span class="lines">@@ -370,7 +368,7 @@
</span><span class="cx">     clearScrollCorner();
</span><span class="cx">     clearResizer();
</span><span class="cx"> 
</span><del>-    FilterInfo::remove(*this);
</del><ins>+    clearLayerFilters();
</ins><span class="cx"> 
</span><span class="cx">     // Child layers will be deleted by their corresponding render objects, so
</span><span class="cx">     // we don't need to delete them ourselves.
</span><span class="lines">@@ -452,10 +450,7 @@
</span><span class="cx">     if (!isComposited())
</span><span class="cx">         return true;
</span><span class="cx"> 
</span><del>-    if (!m_backing || !m_backing->canCompositeFilters())
-        return true;
-
-    return false;
</del><ins>+    return !m_backing->canCompositeFilters();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool RenderLayer::requiresFullLayerImageForFilters() const 
</span><span class="lines">@@ -462,14 +457,8 @@
</span><span class="cx"> {
</span><span class="cx">     if (!paintsWithFilters())
</span><span class="cx">         return false;
</span><del>-    auto* cssFilter = filter();
-    return cssFilter && cssFilter->hasFilterThatMovesPixels();
-}
</del><span class="cx"> 
</span><del>-CSSFilter* RenderLayer::filter() const
-{
-    auto* filterInfo = FilterInfo::getIfExists(*this);
-    return filterInfo ? filterInfo->filter() : nullptr;
</del><ins>+    return m_filters && m_filters->hasFilterThatMovesPixels();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void RenderLayer::updateLayerPositionsAfterLayout(const RenderLayer* rootLayer, OptionSet<UpdateLayerPositionsFlag> flags)
</span><span class="lines">@@ -1608,8 +1597,12 @@
</span><span class="cx">     return nullptr;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+// FIXME: This neeeds a better name.
</ins><span class="cx"> void RenderLayer::setFilterBackendNeedsRepaintingInRect(const LayoutRect& rect)
</span><span class="cx"> {
</span><ins>+    ASSERT(requiresFullLayerImageForFilters());
+    ASSERT(m_filters);
+
</ins><span class="cx">     if (rect.isEmpty())
</span><span class="cx">         return;
</span><span class="cx">     
</span><span class="lines">@@ -1616,8 +1609,7 @@
</span><span class="cx">     LayoutRect rectForRepaint = rect;
</span><span class="cx">     renderer().style().filterOutsets().expandRect(rectForRepaint);
</span><span class="cx"> 
</span><del>-    FilterInfo& filterInfo = FilterInfo::get(*this);
-    filterInfo.expandDirtySourceRect(rectForRepaint);
</del><ins>+    m_filters->expandDirtySourceRect(rectForRepaint);
</ins><span class="cx">     
</span><span class="cx">     RenderLayer* parentLayer = enclosingFilterRepaintLayer();
</span><span class="cx">     ASSERT(parentLayer);
</span><span class="lines">@@ -4196,43 +4188,30 @@
</span><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-std::pair<RenderLayer::FilterInfo*, std::unique_ptr<FilterEffectRendererHelper>> RenderLayer::filterPainter(GraphicsContext& context, OptionSet<PaintLayerFlag> paintFlags) const
</del><ins>+RenderLayerFilters* RenderLayer::filtersForPainting(GraphicsContext& context, OptionSet<PaintLayerFlag> paintFlags) const
</ins><span class="cx"> {
</span><span class="cx">     if (context.paintingDisabled())
</span><del>-        return { };
</del><ins>+        return nullptr;
</ins><span class="cx"> 
</span><span class="cx">     if (paintFlags & PaintLayerPaintingOverlayScrollbars)
</span><del>-        return { };
</del><ins>+        return nullptr;
</ins><span class="cx"> 
</span><span class="cx">     if (!paintsWithFilters())
</span><del>-        return { };
</del><ins>+        return nullptr;
</ins><span class="cx"> 
</span><del>-    auto* info = FilterInfo::getIfExists(*this);
-    if (!info || !info->filter())
-        return { };
</del><ins>+    if (m_filters && m_filters->filter())
+        return m_filters.get();
</ins><span class="cx"> 
</span><del>-    auto helper = std::make_unique<FilterEffectRendererHelper>(true, context);
-    if (!helper->haveFilterEffect())
-        return { };
-
-    return { info, WTFMove(helper) };
</del><ins>+    return nullptr;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool RenderLayer::hasFilterThatIsPainting(GraphicsContext& context, OptionSet<PaintLayerFlag> paintFlags) const
</del><ins>+GraphicsContext* RenderLayer::setupFilters(GraphicsContext& destinationContext, LayerPaintingInfo& paintingInfo, OptionSet<PaintLayerFlag> paintFlags, const LayoutSize& offsetFromRoot, LayoutRect& rootRelativeBounds, bool& rootRelativeBoundsComputed)
</ins><span class="cx"> {
</span><del>-    return !!filterPainter(context, paintFlags).first;
-}
-
-std::unique_ptr<FilterEffectRendererHelper> RenderLayer::setupFilters(GraphicsContext& context, LayerPaintingInfo& paintingInfo, OptionSet<PaintLayerFlag> paintFlags, const LayoutSize& offsetFromRoot, LayoutRect& rootRelativeBounds, bool& rootRelativeBoundsComputed)
-{
-    auto painter = filterPainter(context, paintFlags);
-    if (!painter.first)
</del><ins>+    auto* paintingFilters = filtersForPainting(destinationContext, paintFlags);
+    if (!paintingFilters)
</ins><span class="cx">         return nullptr;
</span><span class="cx"> 
</span><del>-    auto& filterInfo = *painter.first;
-    auto& filterPainter = *painter.second;
-
-    LayoutRect filterRepaintRect = filterInfo.dirtySourceRect();
</del><ins>+    LayoutRect filterRepaintRect = paintingFilters->dirtySourceRect();
</ins><span class="cx">     filterRepaintRect.move(offsetFromRoot);
</span><span class="cx"> 
</span><span class="cx">     if (!rootRelativeBoundsComputed) {
</span><span class="lines">@@ -4240,35 +4219,28 @@
</span><span class="cx">         rootRelativeBoundsComputed = true;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (!filterPainter.prepareFilterEffect(*this, enclosingIntRect(rootRelativeBounds), enclosingIntRect(paintingInfo.paintDirtyRect), enclosingIntRect(filterRepaintRect)))
</del><ins>+    GraphicsContext* filterContext = paintingFilters->beginFilterEffect(destinationContext, enclosingIntRect(rootRelativeBounds), enclosingIntRect(paintingInfo.paintDirtyRect), enclosingIntRect(filterRepaintRect));
+    if (!filterContext)
</ins><span class="cx">         return nullptr;
</span><span class="cx"> 
</span><del>-    // Now we know for sure that the source image will be updated, so we can revert our tracking repaint rect back to zero.
-    filterInfo.resetDirtySourceRect();
</del><ins>+    paintingInfo.paintDirtyRect = paintingFilters->repaintRect();
</ins><span class="cx"> 
</span><del>-    if (!filterPainter.beginFilterEffect())
-        return nullptr;
-
-    paintingInfo.paintDirtyRect = filterPainter.repaintRect();
-
</del><span class="cx">     // If the filter needs the full source image, we need to avoid using the clip rectangles.
</span><span class="cx">     // Otherwise, if for example this layer has overflow:hidden, a drop shadow will not compute correctly.
</span><span class="cx">     // Note that we will still apply the clipping on the final rendering of the filter.
</span><del>-    paintingInfo.clipToDirtyRect = !filterInfo.filter()->hasFilterThatMovesPixels();
</del><ins>+    paintingInfo.clipToDirtyRect = !paintingFilters->hasFilterThatMovesPixels();
</ins><span class="cx"> 
</span><del>-    paintingInfo.requireSecurityOriginAccessForWidgets = filterInfo.filter()->hasFilterThatShouldBeRestrictedBySecurityOrigin();
</del><ins>+    paintingInfo.requireSecurityOriginAccessForWidgets = paintingFilters->hasFilterThatShouldBeRestrictedBySecurityOrigin();
</ins><span class="cx"> 
</span><del>-    return WTFMove(painter.second);
</del><ins>+    return filterContext;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void RenderLayer::applyFilters(FilterEffectRendererHelper* filterPainter, GraphicsContext& originalContext, const LayerPaintingInfo& paintingInfo, const LayerFragments& layerFragments)
</del><ins>+void RenderLayer::applyFilters(GraphicsContext& originalContext, const LayerPaintingInfo& paintingInfo, const LayerFragments& layerFragments)
</ins><span class="cx"> {
</span><del>-    ASSERT(filterPainter->hasStartedFilterEffect());
-
</del><span class="cx">     // FIXME: Handle more than one fragment.
</span><span class="cx">     ClipRect backgroundRect = layerFragments.isEmpty() ? ClipRect() : layerFragments[0].backgroundRect;
</span><span class="cx">     clipToRect(originalContext, paintingInfo, backgroundRect);
</span><del>-    filterPainter->applyFilterEffect(originalContext);
</del><ins>+    m_filters->applyFilterEffect(originalContext);
</ins><span class="cx">     restoreClip(originalContext, paintingInfo, backgroundRect);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -4318,7 +4290,7 @@
</span><span class="cx"> 
</span><span class="cx">     // Apply clip-path to context.
</span><span class="cx">     LayoutSize columnAwareOffsetFromRoot = offsetFromRoot;
</span><del>-    if (renderer().enclosingFragmentedFlow() && (renderer().hasClipPath() || hasFilterThatIsPainting(context, paintFlags)))
</del><ins>+    if (renderer().enclosingFragmentedFlow() && (renderer().hasClipPath() || filtersForPainting(context, paintFlags)))
</ins><span class="cx">         columnAwareOffsetFromRoot = toLayoutSize(convertToLayerCoords(paintingInfo.rootLayer, LayoutPoint(), AdjustForColumns));
</span><span class="cx"> 
</span><span class="cx">     bool hasClipPath = false;
</span><span class="lines">@@ -4335,9 +4307,7 @@
</span><span class="cx"> 
</span><span class="cx">     { // Scope for filter-related state changes.
</span><span class="cx">         LayerPaintingInfo localPaintingInfo(paintingInfo);
</span><del>-        std::unique_ptr<FilterEffectRendererHelper> filterPainter = setupFilters(context, localPaintingInfo, paintFlags, columnAwareOffsetFromRoot, rootRelativeBounds, rootRelativeBoundsComputed);
-
-        GraphicsContext* filterContext = filterPainter ? filterPainter->filterContext() : nullptr;
</del><ins>+        GraphicsContext* filterContext = setupFilters(context, localPaintingInfo, paintFlags, columnAwareOffsetFromRoot, rootRelativeBounds, rootRelativeBoundsComputed);
</ins><span class="cx">         if (filterContext && haveTransparency) {
</span><span class="cx">             // If we have a filter and transparency, we have to eagerly start a transparency layer here, rather than risk a child layer lazily starts one with the wrong context.
</span><span class="cx">             beginTransparencyLayers(context, localPaintingInfo, paintingInfo.paintDirtyRect);
</span><span class="lines">@@ -4431,8 +4401,7 @@
</span><span class="cx">                 (isPaintingOverflowContents) ? IgnoreOverflowClip : RespectOverflowClip, offsetFromRoot);
</span><span class="cx">             updatePaintingInfoForFragments(layerFragments, paintingInfo, localPaintFlags, shouldPaintContent, offsetFromRoot);
</span><span class="cx"> 
</span><del>-            applyFilters(filterPainter.get(), context, paintingInfo, layerFragments);
-            filterPainter = nullptr;
</del><ins>+            applyFilters(context, paintingInfo, layerFragments);
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx">     
</span><span class="lines">@@ -5966,7 +5935,7 @@
</span><span class="cx">         m_backing = std::make_unique<RenderLayerBacking>(*this);
</span><span class="cx">         compositor().layerBecameComposited(*this);
</span><span class="cx"> 
</span><del>-        updateOrRemoveFilterEffectRenderer();
</del><ins>+        updateFilterPaintingStrategy();
</ins><span class="cx">     }
</span><span class="cx">     return m_backing.get();
</span><span class="cx"> }
</span><span class="lines">@@ -5978,7 +5947,7 @@
</span><span class="cx">     m_backing = nullptr;
</span><span class="cx"> 
</span><span class="cx">     if (!layerBeingDestroyed)
</span><del>-        updateOrRemoveFilterEffectRenderer();
</del><ins>+        updateFilterPaintingStrategy();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool RenderLayer::hasCompositedMask() const
</span><span class="lines">@@ -6688,13 +6657,13 @@
</span><span class="cx"> #if ENABLE(CSS_COMPOSITING)
</span><span class="cx">     updateBlendMode();
</span><span class="cx"> #endif
</span><del>-    updateOrRemoveFilterClients();
</del><ins>+    updateFiltersAfterStyleChange();
</ins><span class="cx"> 
</span><span class="cx">     updateNeedsCompositedScrolling();
</span><span class="cx"> 
</span><span class="cx">     compositor().layerStyleChanged(diff, *this, oldStyle);
</span><span class="cx"> 
</span><del>-    updateOrRemoveFilterEffectRenderer();
</del><ins>+    updateFilterPaintingStrategy();
</ins><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS) && ENABLE(TOUCH_EVENTS)
</span><span class="cx">     if (diff == StyleDifference::RecompositeLayer || diff >= StyleDifference::LayoutPositionedMovementOnly)
</span><span class="lines">@@ -6860,30 +6829,45 @@
</span><span class="cx">     return newStyle;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void RenderLayer::updateOrRemoveFilterClients()
</del><ins>+void RenderLayer::ensureLayerFilters()
</ins><span class="cx"> {
</span><ins>+    if (m_filters)
+        return;
+    
+    m_filters = std::make_unique<RenderLayerFilters>(*this);
+}
+
+void RenderLayer::clearLayerFilters()
+{
+    m_filters = nullptr;
+}
+
+void RenderLayer::updateFiltersAfterStyleChange()
+{
</ins><span class="cx">     if (!hasFilter()) {
</span><del>-        FilterInfo::remove(*this);
</del><ins>+        clearLayerFilters();
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     // Add the filter as a client to this renderer, unless we are a RenderLayer accommodating
</span><span class="cx">     // an SVG. In that case it takes care of its own resource management for filters.
</span><del>-    if (renderer().style().filter().hasReferenceFilter() && !renderer().isSVGRoot())
-        FilterInfo::get(*this).updateReferenceFilterClients(renderer().style().filter());
-    else if (FilterInfo* filterInfo = FilterInfo::getIfExists(*this))
-        filterInfo->removeReferenceFilterClients();
</del><ins>+    if (renderer().style().filter().hasReferenceFilter() && !renderer().isSVGRoot()) {
+        ensureLayerFilters();
+        m_filters->updateReferenceFilterClients(renderer().style().filter());
+    } else if (m_filters)
+        m_filters->removeReferenceFilterClients();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void RenderLayer::updateOrRemoveFilterEffectRenderer()
</del><ins>+void RenderLayer::updateFilterPaintingStrategy()
</ins><span class="cx"> {
</span><del>-    // FilterEffectRenderer is only used to render the filters in software mode,
-    // so we always need to run updateOrRemoveFilterEffectRenderer after the composited
</del><ins>+    // RenderLayerFilters is only used to render the filters in software mode,
+    // so we always need to run updateFilterPaintingStrategy() after the composited
</ins><span class="cx">     // mode might have changed for this layer.
</span><span class="cx">     if (!paintsWithFilters()) {
</span><span class="cx">         // Don't delete the whole filter info here, because we might use it
</span><span class="cx">         // for loading SVG reference filter files.
</span><del>-        if (FilterInfo* filterInfo = FilterInfo::getIfExists(*this))
-            filterInfo->setFilter(nullptr);
</del><ins>+        if (m_filters)
+            m_filters->setFilter(nullptr);
</ins><span class="cx"> 
</span><span class="cx">         // Early-return only if we *don't* have reference filters.
</span><span class="cx">         // For reference filters, we still want the FilterEffect graph built
</span><span class="lines">@@ -6892,24 +6876,8 @@
</span><span class="cx">             return;
</span><span class="cx">     }
</span><span class="cx">     
</span><del>-    FilterInfo& filterInfo = FilterInfo::get(*this);
-    if (!filterInfo.filter()) {
-        auto cssFilter = CSSFilter::create();
-        cssFilter->setFilterScale(page().deviceScaleFactor());
-        cssFilter->setRenderingMode(renderer().settings().acceleratedFiltersEnabled() ? Accelerated : Unaccelerated);
-        filterInfo.setFilter(WTFMove(cssFilter));
-        
-        // We can optimize away code paths in other places if we know that there are no software filters.
-        renderer().view().setHasSoftwareFilters(true);
-    } else if (filterInfo.filter()->filterScale() != page().deviceScaleFactor()) {
-        filterInfo.filter()->setFilterScale(page().deviceScaleFactor());
-        filterInfo.filter()->clearIntermediateResults();
-    }
-
-    // If the filter fails to build, remove it from the layer. It will still attempt to
-    // go through regular processing (e.g. compositing), but never apply anything.
-    if (!filterInfo.filter()->build(renderer(), renderer().style().filter(), FilterConsumer::FilterProperty))
-        filterInfo.setFilter(nullptr);
</del><ins>+    ensureLayerFilters();
+    m_filters->buildFilter(renderer(), page().deviceScaleFactor(), renderer().settings().acceleratedFiltersEnabled() ? Accelerated : Unaccelerated);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void RenderLayer::filterNeedsRepaint()
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderLayerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderLayer.h (235629 => 235630)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderLayer.h     2018-09-04 20:26:27 UTC (rev 235629)
+++ trunk/Source/WebCore/rendering/RenderLayer.h        2018-09-04 20:27:09 UTC (rev 235630)
</span><span class="lines">@@ -63,8 +63,6 @@
</span><span class="cx"> class CSSFilter;
</span><span class="cx"> class ClipRects;
</span><span class="cx"> class ClipRectsCache;
</span><del>-class FilterEffectRendererHelper;
-class FilterOperations;
</del><span class="cx"> class HitTestRequest;
</span><span class="cx"> class HitTestResult;
</span><span class="cx"> class HitTestingTransformState;
</span><span class="lines">@@ -72,6 +70,7 @@
</span><span class="cx"> class RenderGeometryMap;
</span><span class="cx"> class RenderLayerBacking;
</span><span class="cx"> class RenderLayerCompositor;
</span><ins>+class RenderLayerFilters;
</ins><span class="cx"> class RenderMarquee;
</span><span class="cx"> class RenderReplica;
</span><span class="cx"> class RenderScrollbarPart;
</span><span class="lines">@@ -125,6 +124,7 @@
</span><span class="cx">     WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> public:
</span><span class="cx">     friend class RenderReplica;
</span><ins>+    friend class RenderLayerFilters;
</ins><span class="cx"> 
</span><span class="cx">     explicit RenderLayer(RenderLayerModelObject&);
</span><span class="cx">     virtual ~RenderLayer();
</span><span class="lines">@@ -645,7 +645,7 @@
</span><span class="cx">     bool hasNotIsolatedBlendingDescendantsStatusDirty() const { return false; }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    bool isComposited() const { return m_backing != 0; }
</del><ins>+    bool isComposited() const { return m_backing != nullptr; }
</ins><span class="cx">     bool hasCompositingDescendant() const { return m_hasCompositingDescendant; }
</span><span class="cx">     bool hasCompositedMask() const;
</span><span class="cx">     RenderLayerBacking* backing() const { return m_backing.get(); }
</span><span class="lines">@@ -679,7 +679,6 @@
</span><span class="cx"> 
</span><span class="cx">     bool paintsWithFilters() const;
</span><span class="cx">     bool requiresFullLayerImageForFilters() const;
</span><del>-    CSSFilter* filter() const;
</del><span class="cx"> 
</span><span class="cx"> #if !ASSERT_DISABLED
</span><span class="cx">     bool layerListMutationAllowed() const { return m_layerListMutationAllowed; }
</span><span class="lines">@@ -823,12 +822,13 @@
</span><span class="cx"> 
</span><span class="cx">     bool setupClipPath(GraphicsContext&, const LayerPaintingInfo&, const LayoutSize& offsetFromRoot, LayoutRect& rootRelativeBounds, bool& rootRelativeBoundsComputed);
</span><span class="cx"> 
</span><del>-    class FilterInfo;
-    std::pair<FilterInfo*, std::unique_ptr<FilterEffectRendererHelper>> filterPainter(GraphicsContext&, OptionSet<PaintLayerFlag>) const;
-    bool hasFilterThatIsPainting(GraphicsContext&, OptionSet<PaintLayerFlag>) const;
-    std::unique_ptr<FilterEffectRendererHelper> setupFilters(GraphicsContext&, LayerPaintingInfo&, OptionSet<PaintLayerFlag>, const LayoutSize& offsetFromRoot, LayoutRect& rootRelativeBounds, bool& rootRelativeBoundsComputed);
-    void applyFilters(FilterEffectRendererHelper*, GraphicsContext& originalContext, const LayerPaintingInfo&, const LayerFragments&);
</del><ins>+    void ensureLayerFilters();
+    void clearLayerFilters();
</ins><span class="cx"> 
</span><ins>+    RenderLayerFilters* filtersForPainting(GraphicsContext&, OptionSet<PaintLayerFlag>) const;
+    GraphicsContext* setupFilters(GraphicsContext& destinationContext, LayerPaintingInfo&, OptionSet<PaintLayerFlag>, const LayoutSize& offsetFromRoot, LayoutRect& rootRelativeBounds, bool& rootRelativeBoundsComputed);
+    void applyFilters(GraphicsContext& originalContext, const LayerPaintingInfo&, const LayerFragments&);
+
</ins><span class="cx">     void paintLayer(GraphicsContext&, const LayerPaintingInfo&, OptionSet<PaintLayerFlag>);
</span><span class="cx">     void paintLayerContentsAndReflection(GraphicsContext&, const LayerPaintingInfo&, OptionSet<PaintLayerFlag>);
</span><span class="cx">     void paintLayerByApplyingTransform(GraphicsContext&, const LayerPaintingInfo&, OptionSet<PaintLayerFlag>, const LayoutSize& translationOffset = LayoutSize());
</span><span class="lines">@@ -955,8 +955,8 @@
</span><span class="cx">     bool paintingInsideReflection() const { return m_paintingInsideReflection; }
</span><span class="cx">     void setPaintingInsideReflection(bool b) { m_paintingInsideReflection = b; }
</span><span class="cx"> 
</span><del>-    void updateOrRemoveFilterClients();
-    void updateOrRemoveFilterEffectRenderer();
</del><ins>+    void updateFiltersAfterStyleChange();
+    void updateFilterPaintingStrategy();
</ins><span class="cx"> 
</span><span class="cx"> #if ENABLE(CSS_COMPOSITING)
</span><span class="cx">     void updateAncestorChainHasBlendingDescendants();
</span><span class="lines">@@ -1092,8 +1092,6 @@
</span><span class="cx">     bool m_layerListMutationAllowed : 1;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    bool m_hasFilterInfo : 1;
-
</del><span class="cx"> #if ENABLE(CSS_COMPOSITING)
</span><span class="cx">     unsigned m_blendMode : 5;
</span><span class="cx">     bool m_hasNotIsolatedCompositedBlendingDescendants : 1;
</span><span class="lines">@@ -1163,6 +1161,7 @@
</span><span class="cx"> 
</span><span class="cx">     IntRect m_blockSelectionGapsBounds;
</span><span class="cx"> 
</span><ins>+    std::unique_ptr<RenderLayerFilters> m_filters;
</ins><span class="cx">     std::unique_ptr<RenderLayerBacking> m_backing;
</span><span class="cx">     
</span><span class="cx">     PaintFrequencyTracker m_paintFrequencyTracker;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderLayerFilterInfocpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/rendering/RenderLayerFilterInfo.cpp (235629 => 235630)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderLayerFilterInfo.cpp 2018-09-04 20:26:27 UTC (rev 235629)
+++ trunk/Source/WebCore/rendering/RenderLayerFilterInfo.cpp    2018-09-04 20:27:09 UTC (rev 235630)
</span><span class="lines">@@ -1,137 +0,0 @@
</span><del>-/*
- * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved.
- * Copyright (C) 2013 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 THE COPYRIGHT HOLDER "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 THE COPYRIGHT HOLDER 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 "RenderLayerFilterInfo.h"
-
-#include "CachedSVGDocument.h"
-#include "CachedSVGDocumentReference.h"
-#include "FilterEffectRenderer.h"
-#include "RenderSVGResourceFilter.h"
-#include <wtf/NeverDestroyed.h>
-
-namespace WebCore {
-
-HashMap<const RenderLayer*, std::unique_ptr<RenderLayer::FilterInfo>>& RenderLayer::FilterInfo::map()
-{
-    static NeverDestroyed<HashMap<const RenderLayer*, std::unique_ptr<FilterInfo>>> map;
-    return map;
-}
-
-RenderLayer::FilterInfo* RenderLayer::FilterInfo::getIfExists(const RenderLayer& layer)
-{
-    ASSERT(layer.m_hasFilterInfo == map().contains(&layer));
-
-    return layer.m_hasFilterInfo ? map().get(&layer) : nullptr;
-}
-
-RenderLayer::FilterInfo& RenderLayer::FilterInfo::get(RenderLayer& layer)
-{
-    ASSERT(layer.m_hasFilterInfo == map().contains(&layer));
-
-    auto& info = map().add(&layer, nullptr).iterator->value;
-    if (!info) {
-        info = std::make_unique<FilterInfo>(layer);
-        layer.m_hasFilterInfo = true;
-    }
-    return *info;
-}
-
-void RenderLayer::FilterInfo::remove(RenderLayer& layer)
-{
-    ASSERT(layer.m_hasFilterInfo == map().contains(&layer));
-    if (!layer.m_hasFilterInfo)
-        return;
-
-    map().remove(&layer);
-    layer.m_hasFilterInfo = false;
-}
-
-RenderLayer::FilterInfo::FilterInfo(RenderLayer& layer)
-    : m_layer(layer)
-{
-}
-
-RenderLayer::FilterInfo::~FilterInfo()
-{
-    removeReferenceFilterClients();
-}
-
-void RenderLayer::FilterInfo::setFilter(RefPtr<CSSFilter>&& filter)
-{
-    m_filter = filter;
-}
-
-void RenderLayer::FilterInfo::notifyFinished(CachedResource&)
-{
-    m_layer.filterNeedsRepaint();
-}
-
-void RenderLayer::FilterInfo::updateReferenceFilterClients(const FilterOperations& operations)
-{
-    removeReferenceFilterClients();
-    for (auto& operation : operations.operations()) {
-        if (!is<ReferenceFilterOperation>(*operation))
-            continue;
-        auto& referenceOperation = downcast<ReferenceFilterOperation>(*operation);
-        auto* documentReference = referenceOperation.cachedSVGDocumentReference();
-        if (auto* cachedSVGDocument = documentReference ? documentReference->document() : nullptr) {
-            // Reference is external; wait for notifyFinished().
-            cachedSVGDocument->addClient(*this);
-            m_externalSVGReferences.append(cachedSVGDocument);
-        } else {
-            // Reference is internal; add layer as a client so we can trigger filter repaint on SVG attribute change.
-            auto* filterElement = m_layer.renderer().document().getElementById(referenceOperation.fragment());
-            if (!filterElement)
-                continue;
-            auto* renderer = filterElement->renderer();
-            if (!is<RenderSVGResourceFilter>(renderer))
-                continue;
-            downcast<RenderSVGResourceFilter>(*renderer).addClientRenderLayer(&m_layer);
-            m_internalSVGReferences.append(filterElement);
-        }
-    }
-}
-
-void RenderLayer::FilterInfo::removeReferenceFilterClients()
-{
-    for (auto& resourceHandle : m_externalSVGReferences)
-        resourceHandle->removeClient(*this);
-
-    m_externalSVGReferences.clear();
-
-    for (auto& filterElement : m_internalSVGReferences) {
-        if (auto* renderer = filterElement->renderer())
-            downcast<RenderSVGResourceContainer>(*renderer).removeClientRenderLayer(&m_layer);
-    }
-    m_internalSVGReferences.clear();
-}
-
-} // namespace WebCore
</del></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderLayerFilterInfoh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/rendering/RenderLayerFilterInfo.h (235629 => 235630)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderLayerFilterInfo.h   2018-09-04 20:26:27 UTC (rev 235629)
+++ trunk/Source/WebCore/rendering/RenderLayerFilterInfo.h      2018-09-04 20:27:09 UTC (rev 235630)
</span><span class="lines">@@ -1,78 +0,0 @@
</span><del>-/*
- * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved.
- * Copyright (C) 2013 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 THE COPYRIGHT HOLDER "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 THE COPYRIGHT HOLDER 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 "CachedResourceHandle.h"
-#include "CachedSVGDocumentClient.h"
-#include "RenderLayer.h"
-
-namespace WebCore {
-
-class CachedSVGDocument;
-class Element;
-
-class RenderLayer::FilterInfo final : private CachedSVGDocumentClient {
-#if !COMPILER(MSVC)
-    WTF_MAKE_FAST_ALLOCATED;
-#endif
-public:
-    static FilterInfo& get(RenderLayer&);
-    static FilterInfo* getIfExists(const RenderLayer&);
-    static void remove(RenderLayer&);
-
-    explicit FilterInfo(RenderLayer&);
-    virtual ~FilterInfo();
-
-    const LayoutRect& dirtySourceRect() const { return m_dirtySourceRect; }
-    void expandDirtySourceRect(const LayoutRect& rect) { m_dirtySourceRect.unite(rect); }
-    void resetDirtySourceRect() { m_dirtySourceRect = LayoutRect(); }
-
-    CSSFilter* filter() const { return m_filter.get(); }
-    void setFilter(RefPtr<CSSFilter>&&);
-
-    void updateReferenceFilterClients(const FilterOperations&);
-    void removeReferenceFilterClients();
-
-private:
-    void notifyFinished(CachedResource&) final;
-
-    static HashMap<const RenderLayer*, std::unique_ptr<FilterInfo>>& map();
-
-    RenderLayer& m_layer;
-
-    RefPtr<CSSFilter> m_filter;
-    LayoutRect m_dirtySourceRect;
-
-    Vector<RefPtr<Element>> m_internalSVGReferences;
-    Vector<CachedResourceHandle<CachedSVGDocument>> m_externalSVGReferences;
-};
-
-} // namespace WebCore
</del></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderLayerFilterscpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/rendering/RenderLayerFilters.cpp (0 => 235630)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderLayerFilters.cpp                            (rev 0)
+++ trunk/Source/WebCore/rendering/RenderLayerFilters.cpp       2018-09-04 20:27:09 UTC (rev 235630)
</span><span class="lines">@@ -0,0 +1,195 @@
</span><ins>+/*
+ * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved.
+ * Copyright (C) 2013 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 THE COPYRIGHT HOLDER "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 THE COPYRIGHT HOLDER 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 "RenderLayerFilters.h"
+
+#include "CachedSVGDocument.h"
+#include "CachedSVGDocumentReference.h"
+#include "RenderSVGResourceFilter.h"
+#include <wtf/NeverDestroyed.h>
+
+namespace WebCore {
+
+RenderLayerFilters::RenderLayerFilters(RenderLayer& layer)
+    : m_layer(layer)
+{
+    WTFLogAlways("RenderLayerFilters %p ctor", this);
+}
+
+RenderLayerFilters::~RenderLayerFilters()
+{
+    WTFLogAlways("RenderLayerFilters %p dtor", this);
+    removeReferenceFilterClients();
+}
+
+void RenderLayerFilters::setFilter(RefPtr<CSSFilter>&& filter)
+{
+    m_filter = WTFMove(filter);
+}
+
+bool RenderLayerFilters::hasFilterThatMovesPixels() const
+{
+    return m_filter && m_filter->hasFilterThatMovesPixels();
+}
+
+bool RenderLayerFilters::hasFilterThatShouldBeRestrictedBySecurityOrigin() const
+{
+    return m_filter && m_filter->hasFilterThatShouldBeRestrictedBySecurityOrigin();
+}
+
+void RenderLayerFilters::notifyFinished(CachedResource&)
+{
+    m_layer.filterNeedsRepaint();
+}
+
+void RenderLayerFilters::updateReferenceFilterClients(const FilterOperations& operations)
+{
+    removeReferenceFilterClients();
+
+    for (auto& operation : operations.operations()) {
+        if (!is<ReferenceFilterOperation>(*operation))
+            continue;
+
+        auto& referenceOperation = downcast<ReferenceFilterOperation>(*operation);
+        auto* documentReference = referenceOperation.cachedSVGDocumentReference();
+        if (auto* cachedSVGDocument = documentReference ? documentReference->document() : nullptr) {
+            // Reference is external; wait for notifyFinished().
+            cachedSVGDocument->addClient(*this);
+            m_externalSVGReferences.append(cachedSVGDocument);
+        } else {
+            // Reference is internal; add layer as a client so we can trigger filter repaint on SVG attribute change.
+            auto* filterElement = m_layer.renderer().document().getElementById(referenceOperation.fragment());
+            if (!filterElement)
+                continue;
+            auto* renderer = filterElement->renderer();
+            if (!is<RenderSVGResourceFilter>(renderer))
+                continue;
+            downcast<RenderSVGResourceFilter>(*renderer).addClientRenderLayer(&m_layer);
+            m_internalSVGReferences.append(filterElement);
+        }
+    }
+}
+
+void RenderLayerFilters::removeReferenceFilterClients()
+{
+    for (auto& resourceHandle : m_externalSVGReferences)
+        resourceHandle->removeClient(*this);
+
+    m_externalSVGReferences.clear();
+
+    for (auto& filterElement : m_internalSVGReferences) {
+        if (auto* renderer = filterElement->renderer())
+            downcast<RenderSVGResourceContainer>(*renderer).removeClientRenderLayer(&m_layer);
+    }
+    m_internalSVGReferences.clear();
+}
+
+void RenderLayerFilters::buildFilter(RenderElement& renderer, float scaleFactor, RenderingMode renderingMode)
+{
+    if (!m_filter) {
+        m_filter = CSSFilter::create();
+        m_filter->setFilterScale(scaleFactor);
+        m_filter->setRenderingMode(renderingMode);
+    } else if (m_filter->filterScale() != scaleFactor) {
+        m_filter->setFilterScale(scaleFactor);
+        m_filter->clearIntermediateResults();
+    }
+
+    // If the filter fails to build, remove it from the layer. It will still attempt to
+    // go through regular processing (e.g. compositing), but never apply anything.
+    // FIXME: this rebuilds the entire effects chain even if the filter style didn't change.
+    if (!m_filter->build(renderer, renderer.style().filter(), FilterConsumer::FilterProperty))
+        m_filter = nullptr;
+}
+
+GraphicsContext* RenderLayerFilters::beginFilterEffect(GraphicsContext& destinationContext, const LayoutRect& filterBoxRect, const LayoutRect& dirtyRect, const LayoutRect& layerRepaintRect)
+{
+    if (!m_filter)
+        return nullptr;
+
+    auto& filter = *m_filter;
+    auto filterSourceRect = filter.computeSourceImageRectForDirtyRect(filterBoxRect, dirtyRect);
+    if (filterSourceRect.isEmpty())
+        return nullptr;
+
+    bool hasUpdatedBackingStore = filter.updateBackingStoreRect(filterSourceRect);
+    if (!filter.hasFilterThatMovesPixels())
+        m_repaintRect = dirtyRect;
+    else {
+        if (hasUpdatedBackingStore)
+            m_repaintRect = filterSourceRect;
+        else {
+            m_repaintRect = dirtyRect;
+            m_repaintRect.unite(layerRepaintRect);
+            m_repaintRect.intersect(filterSourceRect);
+        }
+    }
+    m_paintOffset = filterSourceRect.location();
+    resetDirtySourceRect();
+
+    filter.allocateBackingStoreIfNeeded(destinationContext);
+    auto* sourceGraphicsContext = filter.inputContext();
+    if (!sourceGraphicsContext || filter.filterRegion().isEmpty() || ImageBuffer::sizeNeedsClamping(filter.filterRegion().size()))
+        return nullptr;
+
+    // Translate the context so that the contents of the layer is captured in the offscreen memory buffer.
+    sourceGraphicsContext->save();
+    sourceGraphicsContext->translate(-m_paintOffset);
+    sourceGraphicsContext->clearRect(m_repaintRect);
+    sourceGraphicsContext->clip(m_repaintRect);
+
+    return sourceGraphicsContext;
+}
+
+void RenderLayerFilters::applyFilterEffect(GraphicsContext& destinationContext)
+{
+    ASSERT(m_filter->inputContext());
+
+    LOG_WITH_STREAM(Filters, stream << "\nRenderLayerFilters " << this << " applyFilterEffect");
+
+    auto& filter = *m_filter;
+    filter.inputContext()->restore();
+
+    filter.apply();
+
+    // Get the filtered output and draw it in place.
+    LayoutRect destRect = filter.outputRect();
+    destRect.move(m_paintOffset.x(), m_paintOffset.y());
+
+    if (auto* outputBuffer = filter.output())
+        destinationContext.drawImageBuffer(*outputBuffer, snapRectToDevicePixels(destRect, m_layer.renderer().document().deviceScaleFactor()));
+
+    filter.clearIntermediateResults();
+
+    LOG_WITH_STREAM(Filters, stream << "RenderLayerFilters " << this << " applyFilterEffect done\n");
+}
+
+} // namespace WebCore
</ins></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderLayerFiltershfromrev235629trunkSourceWebCorerenderingRenderLayerFilterInfoh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/rendering/RenderLayerFilters.h (from rev 235629, trunk/Source/WebCore/rendering/RenderLayerFilterInfo.h) (0 => 235630)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderLayerFilters.h                              (rev 0)
+++ trunk/Source/WebCore/rendering/RenderLayerFilters.h 2018-09-04 20:27:09 UTC (rev 235630)
</span><span class="lines">@@ -0,0 +1,86 @@
</span><ins>+/*
+ * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved.
+ * Copyright (C) 2013 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 THE COPYRIGHT HOLDER "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 THE COPYRIGHT HOLDER 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 "CachedResourceHandle.h"
+#include "CachedSVGDocumentClient.h"
+#include "RenderLayer.h"
+
+namespace WebCore {
+
+class CachedSVGDocument;
+class Element;
+class FilterOperations;
+
+class RenderLayerFilters final : private CachedSVGDocumentClient {
+    WTF_MAKE_FAST_ALLOCATED;
+public:
+    explicit RenderLayerFilters(RenderLayer&);
+    virtual ~RenderLayerFilters();
+
+    const LayoutRect& dirtySourceRect() const { return m_dirtySourceRect; }
+    void expandDirtySourceRect(const LayoutRect& rect) { m_dirtySourceRect.unite(rect); }
+
+    CSSFilter* filter() const { return m_filter.get(); }
+    void setFilter(RefPtr<CSSFilter>&&);
+    
+    bool hasFilterThatMovesPixels() const;
+    bool hasFilterThatShouldBeRestrictedBySecurityOrigin() const;
+
+    void updateReferenceFilterClients(const FilterOperations&);
+    void removeReferenceFilterClients();
+
+    void buildFilter(RenderElement&, float scaleFactor, RenderingMode);
+
+    // Per render
+    LayoutRect repaintRect() const { return m_repaintRect; }
+
+    GraphicsContext* beginFilterEffect(GraphicsContext& destinationContext, const LayoutRect& filterBoxRect, const LayoutRect& dirtyRect, const LayoutRect& layerRepaintRect);
+    void applyFilterEffect(GraphicsContext& destinationContext);
+
+private:
+    void notifyFinished(CachedResource&) final;
+    void resetDirtySourceRect() { m_dirtySourceRect = LayoutRect(); }
+
+    RenderLayer& m_layer;
+
+    Vector<RefPtr<Element>> m_internalSVGReferences;
+    Vector<CachedResourceHandle<CachedSVGDocument>> m_externalSVGReferences;
+
+    RefPtr<CSSFilter> m_filter;
+    LayoutRect m_dirtySourceRect;
+    
+    // Data used per paint
+    LayoutPoint m_paintOffset;
+    LayoutRect m_repaintRect;
+};
+
+} // namespace WebCore
</ins></span></pre>
</div>
</div>

</body>
</html>