<!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>[210469] 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/210469">210469</a></dd>
<dt>Author</dt> <dd>darin@apple.com</dd>
<dt>Date</dt> <dd>2017-01-06 21:23:54 -0800 (Fri, 06 Jan 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>Remove PassRefPtr use from &quot;rendering&quot; directory, other improvements
https://bugs.webkit.org/show_bug.cgi?id=166717

Reviewed by Sam Weinig.

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::shapePropertyValue): Use auto.
* css/CSSFilterImageValue.cpp:
(WebCore::CSSFilterImageValue::image): Use auto. Pass references.
(WebCore::CSSFilterImageValue::filterImageChanged): Use modern for loop.

* css/StyleBuilderConverter.h:
(WebCore::StyleBuilderConverter::convertShapeValue): Use overloaded
ShapeValue::create function instead of differently named functions.
* page/animation/CSSPropertyAnimation.cpp:
(WebCore::blendFunc): Ditto.

* platform/graphics/filters/Filter.h: Added a protected constructor that takes
a filter resolution.

* rendering/FilterEffectRenderer.cpp:
(WebCore::FilterEffectRenderer::FilterEffectRenderer): Use new constructor so
we don't have to call setFilterResolution and can initialize m_sourceGraphic.
(WebCore::FilterEffectRenderer::create): Moved here from the header.
(WebCore::FilterEffectRenderer::buildReferenceFilter): Take references and not
PssRefPtr. Use auto and references.
(WebCore::FilterEffectRenderer::build): Take a reference. Updated to work with
references rather than pointer. Use auto.
(WebCore::FilterEffectRenderer::allocateBackingStoreIfNeeded): Use early return.
(WebCore::FilterEffectRenderer::clearIntermediateResults): Use modern for loop.
(WebCore::FilterEffectRenderer::apply): Use references.
(WebCore::FilterEffectRenderer::output): Moved here from header.
(WebCore::FilterEffectRenderer::setMaxEffectRects): Moved here from header.
(WebCore::FilterEffectRenderer::outputRect): Moved here from header.
(WebCore::FilterEffectRendererHelper::prepareFilterEffect): Take references.
(WebCore::FilterEffectRendererHelper::beginFilterEffect): Use auto and references.
(WebCore::FilterEffectRendererHelper::applyFilterEffect): Ditto.
* rendering/FilterEffectRenderer.h: Updated for the above changes. Made a lot more
things private.

* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::filterPainter): Added. Helper so setupFilters does not
have to do things twice.
(WebCore::RenderLayer::hasFilterThatIsPainting): Updated to call filterPainter.
(WebCore::RenderLayer::setupFilters): Ditto.
(WebCore::RenderLayer::calculateClipRects): Pass reference.
* rendering/RenderLayer.h: Updated for the above changes.

* rendering/style/ContentData.cpp:
(WebCore::ContentData::clone): Use auto.
(WebCore::ImageContentData::createContentRenderer): Updated for reference.
* rendering/style/ContentData.h: Use Ref&amp;&amp; instead of PassRefPtr. Made more
things private.

* rendering/style/NinePieceImage.cpp:
(WebCore::NinePieceImage::defaultData): Made this a static member so it can
get at the now-private class NinePieceImage::Data.
(WebCore::NinePieceImage::NinePieceImage): Use RefPtr&amp;&amp; instead of PassRefPtr.
Use construction instead of calling m_data.access() over and over again.
(WebCore::NinePieceImage::Data::Data): Renamed from NinePieceImageData.
Moved initialization to class definition. Added a new overload for the normal
creation case.
(WebCore::NinePieceImage::Data::create): Ditto.
(WebCore::NinePieceImage::Data::copy): Ditto.
(WebCore::NinePieceImage::Data::operator==): Ditto.
* rendering/style/NinePieceImage.h: Cut down on includes. Moved the class
named NinePieceImageData in to become the private struct NinePieceImage::Data.

* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::setContent): Pass Ref&amp;&amp; instead of RefPtr&amp;&amp; when
creating ImageContentData.

* rendering/style/ShapeValue.cpp:
(WebCore::ShapeValue::isImageValid): Tighten up by using data member directly
and using a local variabel.
(WebCore::pointersOrValuesEqual): Deleted.
(WebCore::ShapeValue::operator==): Use arePointingToEqualData instead the
above deleted function template. Wrote as a single return statement for clarity.
* rendering/style/ShapeValue.h: Changed all the create function names to just
create, using overloading instead of separate names. Use Ref&amp;&amp; instead of PassRefPtr.
Removed unused constructor that took a type but no data.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorecssCSSComputedStyleDeclarationcpp">trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp</a></li>
<li><a href="#trunkSourceWebCorecssCSSFilterImageValuecpp">trunk/Source/WebCore/css/CSSFilterImageValue.cpp</a></li>
<li><a href="#trunkSourceWebCorecssStyleBuilderConverterh">trunk/Source/WebCore/css/StyleBuilderConverter.h</a></li>
<li><a href="#trunkSourceWebCorepageanimationCSSPropertyAnimationcpp">trunk/Source/WebCore/page/animation/CSSPropertyAnimation.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsfiltersFilterh">trunk/Source/WebCore/platform/graphics/filters/Filter.h</a></li>
<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="#trunkSourceWebCorerenderingRenderLayercpp">trunk/Source/WebCore/rendering/RenderLayer.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderLayerh">trunk/Source/WebCore/rendering/RenderLayer.h</a></li>
<li><a href="#trunkSourceWebCorerenderingstyleContentDatacpp">trunk/Source/WebCore/rendering/style/ContentData.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingstyleContentDatah">trunk/Source/WebCore/rendering/style/ContentData.h</a></li>
<li><a href="#trunkSourceWebCorerenderingstyleNinePieceImagecpp">trunk/Source/WebCore/rendering/style/NinePieceImage.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingstyleNinePieceImageh">trunk/Source/WebCore/rendering/style/NinePieceImage.h</a></li>
<li><a href="#trunkSourceWebCorerenderingstyleRenderStylecpp">trunk/Source/WebCore/rendering/style/RenderStyle.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingstyleShapeValuecpp">trunk/Source/WebCore/rendering/style/ShapeValue.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingstyleShapeValueh">trunk/Source/WebCore/rendering/style/ShapeValue.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (210468 => 210469)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2017-01-07 04:02:06 UTC (rev 210468)
+++ trunk/Source/WebCore/ChangeLog        2017-01-07 05:23:54 UTC (rev 210469)
</span><span class="lines">@@ -1,3 +1,87 @@
</span><ins>+2017-01-05  Darin Adler  &lt;darin@apple.com&gt;
+
+        Remove PassRefPtr use from &quot;rendering&quot; directory, other improvements
+        https://bugs.webkit.org/show_bug.cgi?id=166717
+
+        Reviewed by Sam Weinig.
+
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::shapePropertyValue): Use auto.
+        * css/CSSFilterImageValue.cpp:
+        (WebCore::CSSFilterImageValue::image): Use auto. Pass references.
+        (WebCore::CSSFilterImageValue::filterImageChanged): Use modern for loop.
+
+        * css/StyleBuilderConverter.h:
+        (WebCore::StyleBuilderConverter::convertShapeValue): Use overloaded
+        ShapeValue::create function instead of differently named functions.
+        * page/animation/CSSPropertyAnimation.cpp:
+        (WebCore::blendFunc): Ditto.
+
+        * platform/graphics/filters/Filter.h: Added a protected constructor that takes
+        a filter resolution.
+
+        * rendering/FilterEffectRenderer.cpp:
+        (WebCore::FilterEffectRenderer::FilterEffectRenderer): Use new constructor so
+        we don't have to call setFilterResolution and can initialize m_sourceGraphic.
+        (WebCore::FilterEffectRenderer::create): Moved here from the header.
+        (WebCore::FilterEffectRenderer::buildReferenceFilter): Take references and not
+        PssRefPtr. Use auto and references.
+        (WebCore::FilterEffectRenderer::build): Take a reference. Updated to work with
+        references rather than pointer. Use auto.
+        (WebCore::FilterEffectRenderer::allocateBackingStoreIfNeeded): Use early return.
+        (WebCore::FilterEffectRenderer::clearIntermediateResults): Use modern for loop.
+        (WebCore::FilterEffectRenderer::apply): Use references.
+        (WebCore::FilterEffectRenderer::output): Moved here from header.
+        (WebCore::FilterEffectRenderer::setMaxEffectRects): Moved here from header.
+        (WebCore::FilterEffectRenderer::outputRect): Moved here from header.
+        (WebCore::FilterEffectRendererHelper::prepareFilterEffect): Take references.
+        (WebCore::FilterEffectRendererHelper::beginFilterEffect): Use auto and references.
+        (WebCore::FilterEffectRendererHelper::applyFilterEffect): Ditto.
+        * rendering/FilterEffectRenderer.h: Updated for the above changes. Made a lot more
+        things private.
+
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::filterPainter): Added. Helper so setupFilters does not
+        have to do things twice.
+        (WebCore::RenderLayer::hasFilterThatIsPainting): Updated to call filterPainter.
+        (WebCore::RenderLayer::setupFilters): Ditto.
+        (WebCore::RenderLayer::calculateClipRects): Pass reference.
+        * rendering/RenderLayer.h: Updated for the above changes.
+
+        * rendering/style/ContentData.cpp:
+        (WebCore::ContentData::clone): Use auto.
+        (WebCore::ImageContentData::createContentRenderer): Updated for reference.
+        * rendering/style/ContentData.h: Use Ref&amp;&amp; instead of PassRefPtr. Made more
+        things private.
+
+        * rendering/style/NinePieceImage.cpp:
+        (WebCore::NinePieceImage::defaultData): Made this a static member so it can
+        get at the now-private class NinePieceImage::Data.
+        (WebCore::NinePieceImage::NinePieceImage): Use RefPtr&amp;&amp; instead of PassRefPtr.
+        Use construction instead of calling m_data.access() over and over again.
+        (WebCore::NinePieceImage::Data::Data): Renamed from NinePieceImageData.
+        Moved initialization to class definition. Added a new overload for the normal
+        creation case.
+        (WebCore::NinePieceImage::Data::create): Ditto.
+        (WebCore::NinePieceImage::Data::copy): Ditto.
+        (WebCore::NinePieceImage::Data::operator==): Ditto.
+        * rendering/style/NinePieceImage.h: Cut down on includes. Moved the class
+        named NinePieceImageData in to become the private struct NinePieceImage::Data.
+
+        * rendering/style/RenderStyle.cpp:
+        (WebCore::RenderStyle::setContent): Pass Ref&amp;&amp; instead of RefPtr&amp;&amp; when
+        creating ImageContentData.
+
+        * rendering/style/ShapeValue.cpp:
+        (WebCore::ShapeValue::isImageValid): Tighten up by using data member directly
+        and using a local variabel.
+        (WebCore::pointersOrValuesEqual): Deleted.
+        (WebCore::ShapeValue::operator==): Use arePointingToEqualData instead the
+        above deleted function template. Wrote as a single return statement for clarity.
+        * rendering/style/ShapeValue.h: Changed all the create function names to just
+        create, using overloading instead of separate names. Use Ref&amp;&amp; instead of PassRefPtr.
+        Removed unused constructor that took a type but no data.
+
</ins><span class="cx"> 2017-01-06  Chris Dumez  &lt;cdumez@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Regression(r189230): DOM Callbacks may use wrong global object
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSComputedStyleDeclarationcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (210468 => 210469)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp        2017-01-07 04:02:06 UTC (rev 210468)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp        2017-01-07 05:23:54 UTC (rev 210469)
</span><span class="lines">@@ -2433,11 +2433,11 @@
</span><span class="cx"> 
</span><span class="cx">     ASSERT(shapeValue-&gt;type() == ShapeValue::Type::Shape);
</span><span class="cx"> 
</span><del>-    RefPtr&lt;CSSValueList&gt; list = CSSValueList::createSpaceSeparated();
</del><ins>+    auto list = CSSValueList::createSpaceSeparated();
</ins><span class="cx">     list-&gt;append(valueForBasicShape(style, *shapeValue-&gt;shape()));
</span><span class="cx">     if (shapeValue-&gt;cssBox() != BoxMissing)
</span><span class="cx">         list-&gt;append(CSSValuePool::singleton().createValue(shapeValue-&gt;cssBox()));
</span><del>-    return list.releaseNonNull();
</del><ins>+    return WTFMove(list);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static Ref&lt;CSSValueList&gt; valueForItemPositionWithOverflowAlignment(const StyleSelfAlignmentData&amp; data)
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSFilterImageValuecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSFilterImageValue.cpp (210468 => 210469)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSFilterImageValue.cpp        2017-01-07 04:02:06 UTC (rev 210468)
+++ trunk/Source/WebCore/css/CSSFilterImageValue.cpp        2017-01-07 05:23:54 UTC (rev 210469)
</span><span class="lines">@@ -33,6 +33,7 @@
</span><span class="cx"> #include &quot;CachedSVGDocumentReference.h&quot;
</span><span class="cx"> #include &quot;CrossfadeGeneratedImage.h&quot;
</span><span class="cx"> #include &quot;FilterEffectRenderer.h&quot;
</span><ins>+#include &quot;GraphicsContext.h&quot;
</ins><span class="cx"> #include &quot;ImageBuffer.h&quot;
</span><span class="cx"> #include &quot;RenderElement.h&quot;
</span><span class="cx"> #include &quot;StyleCachedImage.h&quot;
</span><span class="lines">@@ -109,6 +110,8 @@
</span><span class="cx"> 
</span><span class="cx"> RefPtr&lt;Image&gt; CSSFilterImageValue::image(RenderElement* renderer, const FloatSize&amp; size)
</span><span class="cx"> {
</span><ins>+    ASSERT(renderer);
+
</ins><span class="cx">     if (size.isEmpty())
</span><span class="cx">         return nullptr;
</span><span class="cx"> 
</span><span class="lines">@@ -115,32 +118,28 @@
</span><span class="cx">     // FIXME: Skip Content Security Policy check when filter is applied to an element in a user agent shadow tree.
</span><span class="cx">     // See &lt;https://bugs.webkit.org/show_bug.cgi?id=146663&gt;.
</span><span class="cx">     ResourceLoaderOptions options = CachedResourceLoader::defaultCachedResourceOptions();
</span><del>-
-    CachedResourceLoader&amp; cachedResourceLoader = renderer-&gt;document().cachedResourceLoader();
-    CachedImage* cachedImage = cachedImageForCSSValue(m_imageValue, cachedResourceLoader, options);
-
</del><ins>+    auto* cachedImage = cachedImageForCSSValue(m_imageValue, renderer-&gt;document().cachedResourceLoader(), options);
</ins><span class="cx">     if (!cachedImage)
</span><span class="cx">         return Image::nullImage();
</span><span class="cx"> 
</span><del>-    Image* image = cachedImage-&gt;imageForRenderer(renderer);
-
</del><ins>+    auto* image = cachedImage-&gt;imageForRenderer(renderer);
</ins><span class="cx">     if (!image)
</span><span class="cx">         return Image::nullImage();
</span><span class="cx"> 
</span><span class="cx">     // Transform Image into ImageBuffer.
</span><span class="cx">     // FIXME (149424): This buffer should not be unconditionally unaccelerated.
</span><del>-    std::unique_ptr&lt;ImageBuffer&gt; texture = ImageBuffer::create(size, Unaccelerated);
</del><ins>+    auto texture = ImageBuffer::create(size, Unaccelerated);
</ins><span class="cx">     if (!texture)
</span><span class="cx">         return Image::nullImage();
</span><span class="cx"> 
</span><del>-    FloatRect imageRect = FloatRect(FloatPoint(), size);
</del><ins>+    auto imageRect = FloatRect { { }, size };
</ins><span class="cx">     texture-&gt;context().drawImage(*image, imageRect);
</span><span class="cx"> 
</span><del>-    RefPtr&lt;FilterEffectRenderer&gt; filterRenderer = FilterEffectRenderer::create();
</del><ins>+    auto filterRenderer = FilterEffectRenderer::create();
</ins><span class="cx">     filterRenderer-&gt;setSourceImage(WTFMove(texture));
</span><span class="cx">     filterRenderer-&gt;setSourceImageRect(imageRect);
</span><span class="cx">     filterRenderer-&gt;setFilterRegion(imageRect);
</span><del>-    if (!filterRenderer-&gt;build(renderer, m_filterOperations, FilterFunction))
</del><ins>+    if (!filterRenderer-&gt;build(*renderer, m_filterOperations, FilterFunction))
</ins><span class="cx">         return Image::nullImage();
</span><span class="cx">     filterRenderer-&gt;apply();
</span><span class="cx"> 
</span><span class="lines">@@ -149,8 +148,8 @@
</span><span class="cx"> 
</span><span class="cx"> void CSSFilterImageValue::filterImageChanged(const IntRect&amp;)
</span><span class="cx"> {
</span><del>-    for (auto it = clients().begin(), end = clients().end(); it != end; ++it)
-        it-&gt;key-&gt;imageChanged(static_cast&lt;WrappedImagePtr&gt;(this));
</del><ins>+    for (auto&amp; client : clients())
+        client.key-&gt;imageChanged(static_cast&lt;WrappedImagePtr&gt;(this));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void CSSFilterImageValue::createFilterOperations(StyleResolver* resolver)
</span></span></pre></div>
<a id="trunkSourceWebCorecssStyleBuilderConverterh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleBuilderConverter.h (210468 => 210469)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleBuilderConverter.h        2017-01-07 04:02:06 UTC (rev 210468)
+++ trunk/Source/WebCore/css/StyleBuilderConverter.h        2017-01-07 05:23:54 UTC (rev 210469)
</span><span class="lines">@@ -766,7 +766,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (isImageShape(value))
</span><del>-        return ShapeValue::createImageValue(styleResolver.styleImage(value));
</del><ins>+        return ShapeValue::create(styleResolver.styleImage(value));
</ins><span class="cx"> 
</span><span class="cx">     RefPtr&lt;BasicShape&gt; shape;
</span><span class="cx">     CSSBoxType referenceBox = BoxMissing;
</span><span class="lines">@@ -786,10 +786,10 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (shape)
</span><del>-        return ShapeValue::createShapeValue(WTFMove(shape), referenceBox);
</del><ins>+        return ShapeValue::create(WTFMove(shape), referenceBox);
</ins><span class="cx"> 
</span><span class="cx">     if (referenceBox != BoxMissing)
</span><del>-        return ShapeValue::createBoxShapeValue(referenceBox);
</del><ins>+        return ShapeValue::create(referenceBox);
</ins><span class="cx"> 
</span><span class="cx">     ASSERT_NOT_REACHED();
</span><span class="cx">     return nullptr;
</span></span></pre></div>
<a id="trunkSourceWebCorepageanimationCSSPropertyAnimationcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/animation/CSSPropertyAnimation.cpp (210468 => 210469)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/animation/CSSPropertyAnimation.cpp        2017-01-07 04:02:06 UTC (rev 210468)
+++ trunk/Source/WebCore/page/animation/CSSPropertyAnimation.cpp        2017-01-07 05:23:54 UTC (rev 210469)
</span><span class="lines">@@ -161,7 +161,7 @@
</span><span class="cx">     if (!fromShape.canBlend(toShape))
</span><span class="cx">         return to;
</span><span class="cx"> 
</span><del>-    return ShapeValue::createShapeValue(toShape.blend(fromShape, progress), to-&gt;cssBox());
</del><ins>+    return ShapeValue::create(toShape.blend(fromShape, progress), to-&gt;cssBox());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static inline PassRefPtr&lt;FilterOperation&gt; blendFunc(const AnimationBase* animation, FilterOperation* fromOp, FilterOperation* toOp, double progress, bool blendToPassthrough = false)
</span><span class="lines">@@ -365,8 +365,7 @@
</span><span class="cx">     if (from.image()-&gt;imageSize(anim-&gt;renderer(), 1.0) != to.image()-&gt;imageSize(anim-&gt;renderer(), 1.0))
</span><span class="cx">         return to;
</span><span class="cx"> 
</span><del>-    RefPtr&lt;StyleImage&gt; newContentImage = blendFunc(anim, from.image(), to.image(), progress);
-
</del><ins>+    auto newContentImage = blendFunc(anim, from.image(), to.image(), progress);
</ins><span class="cx">     return NinePieceImage(newContentImage, from.imageSlices(), from.fill(), from.borderSlices(), from.outset(), from.horizontalRule(), from.verticalRule());
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsfiltersFilterh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/filters/Filter.h (210468 => 210469)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/filters/Filter.h        2017-01-07 04:02:06 UTC (rev 210468)
+++ trunk/Source/WebCore/platform/graphics/filters/Filter.h        2017-01-07 05:23:54 UTC (rev 210469)
</span><span class="lines">@@ -18,13 +18,10 @@
</span><span class="cx">  * Boston, MA 02110-1301, USA.
</span><span class="cx">  */
</span><span class="cx"> 
</span><del>-#ifndef Filter_h
-#define Filter_h
</del><ins>+#pragma once
</ins><span class="cx"> 
</span><del>-#include &quot;FloatRect.h&quot;
</del><span class="cx"> #include &quot;FloatSize.h&quot;
</span><span class="cx"> #include &quot;ImageBuffer.h&quot;
</span><del>-#include &lt;wtf/RefCounted.h&gt;
</del><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="lines">@@ -32,7 +29,6 @@
</span><span class="cx"> public:
</span><span class="cx">     Filter(const AffineTransform&amp; absoluteTransform, float filterScale = 1)
</span><span class="cx">         : m_absoluteTransform(absoluteTransform)
</span><del>-        , m_renderingMode(Unaccelerated)
</del><span class="cx">         , m_filterScale(filterScale)
</span><span class="cx">     { }
</span><span class="cx">     virtual ~Filter() { }
</span><span class="lines">@@ -60,14 +56,18 @@
</span><span class="cx">     virtual FloatRect sourceImageRect() const = 0;
</span><span class="cx">     virtual FloatRect filterRegion() const = 0;
</span><span class="cx"> 
</span><ins>+protected:
+    explicit Filter(const FloatSize&amp; filterResolution)
+        : m_filterResolution(filterResolution)
+    {
+    }
+
</ins><span class="cx"> private:
</span><span class="cx">     std::unique_ptr&lt;ImageBuffer&gt; m_sourceImage;
</span><span class="cx">     FloatSize m_filterResolution;
</span><span class="cx">     AffineTransform m_absoluteTransform;
</span><del>-    RenderingMode m_renderingMode;
-    float m_filterScale;
</del><ins>+    RenderingMode m_renderingMode { Unaccelerated };
+    float m_filterScale { 1 };
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span><del>-
-#endif // Filter_h
</del></span></pre></div>
<a id="trunkSourceWebCorerenderingFilterEffectRenderercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/FilterEffectRenderer.cpp (210468 => 210469)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/FilterEffectRenderer.cpp        2017-01-07 04:02:06 UTC (rev 210468)
+++ trunk/Source/WebCore/rendering/FilterEffectRenderer.cpp        2017-01-07 05:23:54 UTC (rev 210469)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2011 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2011-2017 Apple Inc. All rights reserved.
</ins><span class="cx">  * Copyright (C) 2013 Google Inc. All rights reserved.
</span><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="lines">@@ -29,8 +29,6 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;CachedSVGDocument.h&quot;
</span><span class="cx"> #include &quot;CachedSVGDocumentReference.h&quot;
</span><del>-#include &quot;ColorSpace.h&quot;
-#include &quot;Document.h&quot;
</del><span class="cx"> #include &quot;ElementIterator.h&quot;
</span><span class="cx"> #include &quot;FEColorMatrix.h&quot;
</span><span class="cx"> #include &quot;FEComponentTransfer.h&quot;
</span><span class="lines">@@ -37,11 +35,11 @@
</span><span class="cx"> #include &quot;FEDropShadow.h&quot;
</span><span class="cx"> #include &quot;FEGaussianBlur.h&quot;
</span><span class="cx"> #include &quot;FEMerge.h&quot;
</span><del>-#include &quot;FloatConversion.h&quot;
-#include &quot;Frame.h&quot;
</del><span class="cx"> #include &quot;RenderLayer.h&quot;
</span><span class="cx"> #include &quot;SVGElement.h&quot;
</span><ins>+#include &quot;SVGFilterBuilder.h&quot;
</ins><span class="cx"> #include &quot;SVGFilterPrimitiveStandardAttributes.h&quot;
</span><ins>+#include &quot;SourceGraphic.h&quot;
</ins><span class="cx"> #include &lt;algorithm&gt;
</span><span class="cx"> #include &lt;wtf/MathExtras.h&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -66,13 +64,17 @@
</span><span class="cx">     parameters.append(0);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-FilterEffectRenderer::FilterEffectRenderer()
-    : Filter(AffineTransform())
</del><ins>+inline FilterEffectRenderer::FilterEffectRenderer()
+    : Filter(FloatSize { 1, 1 })
+    , m_sourceGraphic(SourceGraphic::create(*this))
</ins><span class="cx"> {
</span><del>-    setFilterResolution(FloatSize(1, 1));
-    m_sourceGraphic = SourceGraphic::create(*this);
</del><span class="cx"> }
</span><span class="cx"> 
</span><ins>+Ref&lt;FilterEffectRenderer&gt; FilterEffectRenderer::create()
+{
+    return adoptRef(*new FilterEffectRenderer);
+}
+
</ins><span class="cx"> FilterEffectRenderer::~FilterEffectRenderer()
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="lines">@@ -82,36 +84,34 @@
</span><span class="cx">     return sourceImage() ? &amp;sourceImage()-&gt;context() : nullptr;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-RefPtr&lt;FilterEffect&gt; FilterEffectRenderer::buildReferenceFilter(RenderElement* renderer, PassRefPtr&lt;FilterEffect&gt; previousEffect, ReferenceFilterOperation* filterOperation)
</del><ins>+RefPtr&lt;FilterEffect&gt; FilterEffectRenderer::buildReferenceFilter(RenderElement&amp; renderer, FilterEffect&amp; previousEffect, ReferenceFilterOperation&amp; filterOperation)
</ins><span class="cx"> {
</span><del>-    if (!renderer)
-        return nullptr;
</del><ins>+    auto* cachedSVGDocumentReference = filterOperation.cachedSVGDocumentReference();
+    auto* cachedSVGDocument = cachedSVGDocumentReference ? cachedSVGDocumentReference-&gt;document() : nullptr;
</ins><span class="cx"> 
</span><del>-    Document* document = &amp;renderer-&gt;document();
-
-    CachedSVGDocumentReference* cachedSVGDocumentReference = filterOperation-&gt;cachedSVGDocumentReference();
-    CachedSVGDocument* cachedSVGDocument = cachedSVGDocumentReference ? cachedSVGDocumentReference-&gt;document() : 0;
-
</del><span class="cx">     // If we have an SVG document, this is an external reference. Otherwise
</span><span class="cx">     // we look up the referenced node in the current document.
</span><del>-    if (cachedSVGDocument)
</del><ins>+    Document* document;
+    if (!cachedSVGDocument)
+        document = &amp;renderer.document();
+    else {
</ins><span class="cx">         document = cachedSVGDocument-&gt;document();
</span><ins>+        if (!document)
+            return nullptr;
+    }
</ins><span class="cx"> 
</span><del>-    if (!document)
-        return nullptr;
-
-    Element* filter = document-&gt;getElementById(filterOperation-&gt;fragment());
</del><ins>+    auto* filter = document-&gt;getElementById(filterOperation.fragment());
</ins><span class="cx">     if (!filter) {
</span><span class="cx">         // Although we did not find the referenced filter, it might exist later in the document.
</span><span class="cx">         // FIXME: This skips anonymous RenderObjects. &lt;https://webkit.org/b/131085&gt;
</span><del>-        if (Element* element = renderer-&gt;element())
-            document-&gt;accessSVGExtensions().addPendingResource(filterOperation-&gt;fragment(), element);
</del><ins>+        if (auto* element = renderer.element())
+            document-&gt;accessSVGExtensions().addPendingResource(filterOperation.fragment(), element);
</ins><span class="cx">         return nullptr;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     RefPtr&lt;FilterEffect&gt; effect;
</span><span class="cx"> 
</span><del>-    auto builder = std::make_unique&lt;SVGFilterBuilder&gt;(previousEffect);
</del><ins>+    auto builder = std::make_unique&lt;SVGFilterBuilder&gt;(&amp;previousEffect);
</ins><span class="cx"> 
</span><span class="cx">     for (auto&amp; effectElement : childrenOfType&lt;SVGFilterPrimitiveStandardAttributes&gt;(*filter)) {
</span><span class="cx">         effect = effectElement.build(builder.get(), *this);
</span><span class="lines">@@ -120,12 +120,12 @@
</span><span class="cx"> 
</span><span class="cx">         effectElement.setStandardAttributes(effect.get());
</span><span class="cx">         builder-&gt;add(effectElement.result(), effect);
</span><del>-        m_effects.append(effect);
</del><ins>+        m_effects.append(*effect);
</ins><span class="cx">     }
</span><span class="cx">     return effect;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool FilterEffectRenderer::build(RenderElement* renderer, const FilterOperations&amp; operations, FilterConsumer consumer)
</del><ins>+bool FilterEffectRenderer::build(RenderElement&amp; renderer, const FilterOperations&amp; operations, FilterConsumer consumer)
</ins><span class="cx"> {
</span><span class="cx">     m_hasFilterThatMovesPixels = operations.hasFilterThatMovesPixels();
</span><span class="cx">     if (m_hasFilterThatMovesPixels)
</span><span class="lines">@@ -133,19 +133,19 @@
</span><span class="cx"> 
</span><span class="cx">     m_effects.clear();
</span><span class="cx"> 
</span><del>-    RefPtr&lt;FilterEffect&gt; previousEffect = m_sourceGraphic;
-    for (size_t i = 0; i &lt; operations.operations().size(); ++i) {
</del><ins>+    RefPtr&lt;FilterEffect&gt; previousEffect = m_sourceGraphic.ptr();
+    for (auto&amp; operation : operations.operations()) {
</ins><span class="cx">         RefPtr&lt;FilterEffect&gt; effect;
</span><del>-        FilterOperation&amp; filterOperation = *operations.operations().at(i);
</del><ins>+        auto&amp; filterOperation = *operation;
</ins><span class="cx">         switch (filterOperation.type()) {
</span><span class="cx">         case FilterOperation::REFERENCE: {
</span><del>-            ReferenceFilterOperation&amp; referenceOperation = downcast&lt;ReferenceFilterOperation&gt;(filterOperation);
-            effect = buildReferenceFilter(renderer, previousEffect, &amp;referenceOperation);
</del><ins>+            auto&amp; referenceOperation = downcast&lt;ReferenceFilterOperation&gt;(filterOperation);
+            effect = buildReferenceFilter(renderer, *previousEffect, referenceOperation);
</ins><span class="cx">             referenceOperation.setFilterEffect(effect);
</span><span class="cx">             break;
</span><span class="cx">         }
</span><span class="cx">         case FilterOperation::GRAYSCALE: {
</span><del>-            BasicColorMatrixFilterOperation&amp; colorMatrixOperation = downcast&lt;BasicColorMatrixFilterOperation&gt;(filterOperation);
</del><ins>+            auto&amp; colorMatrixOperation = downcast&lt;BasicColorMatrixFilterOperation&gt;(filterOperation);
</ins><span class="cx">             Vector&lt;float&gt; inputParameters;
</span><span class="cx">             double oneMinusAmount = clampTo(1 - colorMatrixOperation.amount(), 0.0, 1.0);
</span><span class="cx"> 
</span><span class="lines">@@ -173,7 +173,7 @@
</span><span class="cx">             break;
</span><span class="cx">         }
</span><span class="cx">         case FilterOperation::SEPIA: {
</span><del>-            BasicColorMatrixFilterOperation&amp; colorMatrixOperation = downcast&lt;BasicColorMatrixFilterOperation&gt;(filterOperation);
</del><ins>+            auto&amp; colorMatrixOperation = downcast&lt;BasicColorMatrixFilterOperation&gt;(filterOperation);
</ins><span class="cx">             Vector&lt;float&gt; inputParameters;
</span><span class="cx">             double oneMinusAmount = clampTo(1 - colorMatrixOperation.amount(), 0.0, 1.0);
</span><span class="cx"> 
</span><span class="lines">@@ -201,7 +201,7 @@
</span><span class="cx">             break;
</span><span class="cx">         }
</span><span class="cx">         case FilterOperation::SATURATE: {
</span><del>-            BasicColorMatrixFilterOperation&amp; colorMatrixOperation = downcast&lt;BasicColorMatrixFilterOperation&gt;(filterOperation);
</del><ins>+            auto&amp; colorMatrixOperation = downcast&lt;BasicColorMatrixFilterOperation&gt;(filterOperation);
</ins><span class="cx">             Vector&lt;float&gt; inputParameters;
</span><span class="cx">             inputParameters.append(narrowPrecisionToFloat(colorMatrixOperation.amount()));
</span><span class="cx">             effect = FEColorMatrix::create(*this, FECOLORMATRIX_TYPE_SATURATE, inputParameters);
</span><span class="lines">@@ -208,7 +208,7 @@
</span><span class="cx">             break;
</span><span class="cx">         }
</span><span class="cx">         case FilterOperation::HUE_ROTATE: {
</span><del>-            BasicColorMatrixFilterOperation&amp; colorMatrixOperation = downcast&lt;BasicColorMatrixFilterOperation&gt;(filterOperation);
</del><ins>+            auto&amp; colorMatrixOperation = downcast&lt;BasicColorMatrixFilterOperation&gt;(filterOperation);
</ins><span class="cx">             Vector&lt;float&gt; inputParameters;
</span><span class="cx">             inputParameters.append(narrowPrecisionToFloat(colorMatrixOperation.amount()));
</span><span class="cx">             effect = FEColorMatrix::create(*this, FECOLORMATRIX_TYPE_HUEROTATE, inputParameters);
</span><span class="lines">@@ -215,7 +215,7 @@
</span><span class="cx">             break;
</span><span class="cx">         }
</span><span class="cx">         case FilterOperation::INVERT: {
</span><del>-            BasicComponentTransferFilterOperation&amp; componentTransferOperation = downcast&lt;BasicComponentTransferFilterOperation&gt;(filterOperation);
</del><ins>+            auto&amp; componentTransferOperation = downcast&lt;BasicComponentTransferFilterOperation&gt;(filterOperation);
</ins><span class="cx">             ComponentTransferFunction transferFunction;
</span><span class="cx">             transferFunction.type = FECOMPONENTTRANSFER_TYPE_TABLE;
</span><span class="cx">             Vector&lt;float&gt; transferParameters;
</span><span class="lines">@@ -228,7 +228,7 @@
</span><span class="cx">             break;
</span><span class="cx">         }
</span><span class="cx">         case FilterOperation::OPACITY: {
</span><del>-            BasicComponentTransferFilterOperation&amp; componentTransferOperation = downcast&lt;BasicComponentTransferFilterOperation&gt;(filterOperation);
</del><ins>+            auto&amp; componentTransferOperation = downcast&lt;BasicComponentTransferFilterOperation&gt;(filterOperation);
</ins><span class="cx">             ComponentTransferFunction transferFunction;
</span><span class="cx">             transferFunction.type = FECOMPONENTTRANSFER_TYPE_TABLE;
</span><span class="cx">             Vector&lt;float&gt; transferParameters;
</span><span class="lines">@@ -241,7 +241,7 @@
</span><span class="cx">             break;
</span><span class="cx">         }
</span><span class="cx">         case FilterOperation::BRIGHTNESS: {
</span><del>-            BasicComponentTransferFilterOperation&amp; componentTransferOperation = downcast&lt;BasicComponentTransferFilterOperation&gt;(filterOperation);
</del><ins>+            auto&amp; componentTransferOperation = downcast&lt;BasicComponentTransferFilterOperation&gt;(filterOperation);
</ins><span class="cx">             ComponentTransferFunction transferFunction;
</span><span class="cx">             transferFunction.type = FECOMPONENTTRANSFER_TYPE_LINEAR;
</span><span class="cx">             transferFunction.slope = narrowPrecisionToFloat(componentTransferOperation.amount());
</span><span class="lines">@@ -252,7 +252,7 @@
</span><span class="cx">             break;
</span><span class="cx">         }
</span><span class="cx">         case FilterOperation::CONTRAST: {
</span><del>-            BasicComponentTransferFilterOperation&amp; componentTransferOperation = downcast&lt;BasicComponentTransferFilterOperation&gt;(filterOperation);
</del><ins>+            auto&amp; componentTransferOperation = downcast&lt;BasicComponentTransferFilterOperation&gt;(filterOperation);
</ins><span class="cx">             ComponentTransferFunction transferFunction;
</span><span class="cx">             transferFunction.type = FECOMPONENTTRANSFER_TYPE_LINEAR;
</span><span class="cx">             float amount = narrowPrecisionToFloat(componentTransferOperation.amount());
</span><span class="lines">@@ -264,13 +264,13 @@
</span><span class="cx">             break;
</span><span class="cx">         }
</span><span class="cx">         case FilterOperation::BLUR: {
</span><del>-            BlurFilterOperation&amp; blurOperation = downcast&lt;BlurFilterOperation&gt;(filterOperation);
</del><ins>+            auto&amp; blurOperation = downcast&lt;BlurFilterOperation&gt;(filterOperation);
</ins><span class="cx">             float stdDeviation = floatValueForLength(blurOperation.stdDeviation(), 0);
</span><span class="cx">             effect = FEGaussianBlur::create(*this, stdDeviation, stdDeviation, consumer == FilterProperty ? EDGEMODE_NONE : EDGEMODE_DUPLICATE);
</span><span class="cx">             break;
</span><span class="cx">         }
</span><span class="cx">         case FilterOperation::DROP_SHADOW: {
</span><del>-            DropShadowFilterOperation&amp; dropShadowOperation = downcast&lt;DropShadowFilterOperation&gt;(filterOperation);
</del><ins>+            auto&amp; dropShadowOperation = downcast&lt;DropShadowFilterOperation&gt;(filterOperation);
</ins><span class="cx">             effect = FEDropShadow::create(*this, dropShadowOperation.stdDeviation(), dropShadowOperation.stdDeviation(),
</span><span class="cx">                 dropShadowOperation.x(), dropShadowOperation.y(), dropShadowOperation.color(), 1);
</span><span class="cx">             break;
</span><span class="lines">@@ -286,19 +286,18 @@
</span><span class="cx">             effect-&gt;setOperatingColorSpace(ColorSpaceSRGB);
</span><span class="cx">             
</span><span class="cx">             if (filterOperation.type() != FilterOperation::REFERENCE) {
</span><del>-                effect-&gt;inputEffects().append(previousEffect);
-                m_effects.append(effect);
</del><ins>+                effect-&gt;inputEffects().append(WTFMove(previousEffect));
+                m_effects.append(*effect);
</ins><span class="cx">             }
</span><span class="cx">             previousEffect = WTFMove(effect);
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    // If we didn't make any effects, tell our caller we are not valid
-    if (!m_effects.size())
</del><ins>+    // If we didn't make any effects, tell our caller we are not valid.
+    if (m_effects.isEmpty())
</ins><span class="cx">         return false;
</span><span class="cx"> 
</span><span class="cx">     setMaxEffectRects(m_sourceDrawingRegion);
</span><del>-    
</del><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -319,38 +318,40 @@
</span><span class="cx">     // At this point the effect chain has been built, and the
</span><span class="cx">     // source image sizes set. We just need to attach the graphic
</span><span class="cx">     // buffer if we have not yet done so.
</span><del>-    if (!m_graphicsBufferAttached) {
-        IntSize logicalSize(m_sourceDrawingRegion.width(), m_sourceDrawingRegion.height());
-        if (!sourceImage() || sourceImage()-&gt;logicalSize() != logicalSize) {
</del><ins>+
+    if (m_graphicsBufferAttached)
+        return;
+
+    IntSize logicalSize { m_sourceDrawingRegion.size() };
+    if (!sourceImage() || sourceImage()-&gt;logicalSize() != logicalSize) {
</ins><span class="cx"> #if USE(DIRECT2D)
</span><del>-            setSourceImage(ImageBuffer::create(logicalSize, renderingMode(), &amp;targetContext, filterScale()));
</del><ins>+        setSourceImage(ImageBuffer::create(logicalSize, renderingMode(), &amp;targetContext, filterScale()));
</ins><span class="cx"> #else
</span><del>-            UNUSED_PARAM(targetContext);
-            setSourceImage(ImageBuffer::create(logicalSize, renderingMode(), filterScale()));
</del><ins>+        UNUSED_PARAM(targetContext);
+        setSourceImage(ImageBuffer::create(logicalSize, renderingMode(), filterScale()));
</ins><span class="cx"> #endif
</span><del>-        }
-        m_graphicsBufferAttached = true;
</del><span class="cx">     }
</span><ins>+    m_graphicsBufferAttached = true;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void FilterEffectRenderer::clearIntermediateResults()
</span><span class="cx"> {
</span><span class="cx">     m_sourceGraphic-&gt;clearResult();
</span><del>-    for (size_t i = 0; i &lt; m_effects.size(); ++i)
-        m_effects[i]-&gt;clearResult();
</del><ins>+    for (auto&amp; effect : m_effects)
+        effect-&gt;clearResult();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void FilterEffectRenderer::apply()
</span><span class="cx"> {
</span><del>-    RefPtr&lt;FilterEffect&gt; effect = lastEffect();
-    effect-&gt;apply();
-    effect-&gt;transformResultColorSpace(ColorSpaceSRGB);
</del><ins>+    auto&amp; effect = m_effects.last().get();
+    effect.apply();
+    effect.transformResultColorSpace(ColorSpaceSRGB);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> LayoutRect FilterEffectRenderer::computeSourceImageRectForDirtyRect(const LayoutRect&amp; filterBoxRect, const LayoutRect&amp; dirtyRect)
</span><span class="cx"> {
</span><span class="cx">     // The result of this function is the area in the &quot;filterBoxRect&quot; that needs to be repainted, so that we fully cover the &quot;dirtyRect&quot;.
</span><del>-    LayoutRect rectForRepaint = dirtyRect;
</del><ins>+    auto rectForRepaint = dirtyRect;
</ins><span class="cx">     if (hasFilterThatMovesPixels()) {
</span><span class="cx">         // Note that the outsets are reversed here because we are going backwards -&gt; we have the dirty rect and
</span><span class="cx">         // need to find out what is the rectangle that might influence the result inside that dirty rect.
</span><span class="lines">@@ -361,31 +362,55 @@
</span><span class="cx">     return rectForRepaint;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool FilterEffectRendererHelper::prepareFilterEffect(RenderLayer* renderLayer, const LayoutRect&amp; filterBoxRect, const LayoutRect&amp; dirtyRect, const LayoutRect&amp; layerRepaintRect)
</del><ins>+ImageBuffer* FilterEffectRenderer::output() const
</ins><span class="cx"> {
</span><del>-    ASSERT(m_haveFilterEffect &amp;&amp; renderLayer-&gt;filterRenderer());
-    m_renderLayer = renderLayer;
-    m_repaintRect = dirtyRect;
</del><ins>+    return const_cast&lt;FilterEffect&amp;&gt;(m_effects.last().get()).asImageBuffer();
+}
</ins><span class="cx"> 
</span><del>-    FilterEffectRenderer* filter = renderLayer-&gt;filterRenderer();
-    LayoutRect filterSourceRect = filter-&gt;computeSourceImageRectForDirtyRect(filterBoxRect, dirtyRect);
-    m_paintOffset = filterSourceRect.location();
</del><ins>+void FilterEffectRenderer::setMaxEffectRects(const FloatRect&amp; effectRect)
+{
+    for (auto&amp; effect : m_effects)
+        effect-&gt;setMaxEffectRect(effectRect);
+}
</ins><span class="cx"> 
</span><ins>+IntRect FilterEffectRenderer::outputRect() const
+{
+    auto&amp; lastEffect = const_cast&lt;FilterEffect&amp;&gt;(m_effects.last().get());
+    if (!lastEffect.hasResult())
+        return { };
+    return lastEffect.requestedRegionOfInputImageData(IntRect { m_filterRegion });
+}
+
+bool FilterEffectRendererHelper::prepareFilterEffect(RenderLayer&amp; layer, const LayoutRect&amp; filterBoxRect, const LayoutRect&amp; dirtyRect, const LayoutRect&amp; layerRepaintRect)
+{
+    ASSERT(m_haveFilterEffect);
+    ASSERT(layer.filterRenderer());
+
+    auto&amp; filter = *layer.filterRenderer();
+    auto filterSourceRect = filter.computeSourceImageRectForDirtyRect(filterBoxRect, dirtyRect);
+
</ins><span class="cx">     if (filterSourceRect.isEmpty()) {
</span><span class="cx">         // The dirty rect is not in view, just bail out.
</span><span class="cx">         m_haveFilterEffect = false;
</span><span class="cx">         return false;
</span><span class="cx">     }
</span><del>-    
-    bool hasUpdatedBackingStore = filter-&gt;updateBackingStoreRect(filterSourceRect);
-    if (filter-&gt;hasFilterThatMovesPixels()) {
</del><ins>+
+    bool hasUpdatedBackingStore = filter.updateBackingStoreRect(filterSourceRect);
+
+    m_renderLayer = &amp;layer;
+    if (!filter.hasFilterThatMovesPixels())
+        m_repaintRect = dirtyRect;
+    else {
</ins><span class="cx">         if (hasUpdatedBackingStore)
</span><span class="cx">             m_repaintRect = filterSourceRect;
</span><span class="cx">         else {
</span><ins>+            m_repaintRect = dirtyRect;
</ins><span class="cx">             m_repaintRect.unite(layerRepaintRect);
</span><span class="cx">             m_repaintRect.intersect(filterSourceRect);
</span><span class="cx">         }
</span><span class="cx">     }
</span><ins>+    m_paintOffset = filterSourceRect.location();
+
</ins><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -393,25 +418,24 @@
</span><span class="cx"> {
</span><span class="cx">     if (!m_haveFilterEffect)
</span><span class="cx">         return nullptr;
</span><del>-
-    FilterEffectRenderer* filter = m_renderLayer-&gt;filterRenderer();
-    return filter-&gt;inputContext();
</del><ins>+    return m_renderLayer-&gt;filterRenderer()-&gt;inputContext();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool FilterEffectRendererHelper::beginFilterEffect()
</span><span class="cx"> {
</span><span class="cx">     ASSERT(m_renderLayer);
</span><del>-    
-    FilterEffectRenderer* filter = m_renderLayer-&gt;filterRenderer();
-    filter-&gt;allocateBackingStoreIfNeeded(m_targetContext);
</del><ins>+    ASSERT(m_renderLayer-&gt;filterRenderer());
+
+    auto&amp; filter = *m_renderLayer-&gt;filterRenderer();
+    filter.allocateBackingStoreIfNeeded(m_targetContext);
</ins><span class="cx">     // Paint into the context that represents the SourceGraphic of the filter.
</span><del>-    GraphicsContext* sourceGraphicsContext = filter-&gt;inputContext();
-    if (!sourceGraphicsContext || filter-&gt;filterRegion().isEmpty() || ImageBuffer::sizeNeedsClamping(filter-&gt;filterRegion().size())) {
</del><ins>+    auto* sourceGraphicsContext = filter.inputContext();
+    if (!sourceGraphicsContext || filter.filterRegion().isEmpty() || ImageBuffer::sizeNeedsClamping(filter.filterRegion().size())) {
</ins><span class="cx">         // Disable the filters and continue.
</span><span class="cx">         m_haveFilterEffect = false;
</span><span class="cx">         return false;
</span><span class="cx">     }
</span><del>-    
</del><ins>+
</ins><span class="cx">     // Translate the context so that the contents of the layer is captured in the offscreen memory buffer.
</span><span class="cx">     sourceGraphicsContext-&gt;save();
</span><span class="cx">     sourceGraphicsContext-&gt;translate(-m_paintOffset.x(), -m_paintOffset.y());
</span><span class="lines">@@ -424,20 +448,24 @@
</span><span class="cx"> 
</span><span class="cx"> void FilterEffectRendererHelper::applyFilterEffect(GraphicsContext&amp; destinationContext)
</span><span class="cx"> {
</span><del>-    ASSERT(m_haveFilterEffect &amp;&amp; m_renderLayer-&gt;filterRenderer());
-    FilterEffectRenderer* filter = m_renderLayer-&gt;filterRenderer();
-    filter-&gt;inputContext()-&gt;restore();
</del><ins>+    ASSERT(m_haveFilterEffect);
+    ASSERT(m_renderLayer);
+    ASSERT(m_renderLayer-&gt;filterRenderer());
+    ASSERT(m_renderLayer-&gt;filterRenderer()-&gt;inputContext());
</ins><span class="cx"> 
</span><del>-    filter-&gt;apply();
-    
</del><ins>+    auto&amp; filter = *m_renderLayer-&gt;filterRenderer();
+    filter.inputContext()-&gt;restore();
+
+    filter.apply();
+
</ins><span class="cx">     // Get the filtered output and draw it in place.
</span><del>-    LayoutRect destRect = filter-&gt;outputRect();
</del><ins>+    LayoutRect destRect = filter.outputRect();
</ins><span class="cx">     destRect.move(m_paintOffset.x(), m_paintOffset.y());
</span><span class="cx"> 
</span><del>-    if (ImageBuffer* outputBuffer = filter-&gt;output())
</del><ins>+    if (auto* outputBuffer = filter.output())
</ins><span class="cx">         destinationContext.drawImageBuffer(*outputBuffer, snapRectToDevicePixels(destRect, m_renderLayer-&gt;renderer().document().deviceScaleFactor()));
</span><span class="cx"> 
</span><del>-    filter-&gt;clearIntermediateResults();
</del><ins>+    filter.clearIntermediateResults();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingFilterEffectRendererh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/FilterEffectRenderer.h (210468 => 210469)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/FilterEffectRenderer.h        2017-01-07 04:02:06 UTC (rev 210468)
+++ trunk/Source/WebCore/rendering/FilterEffectRenderer.h        2017-01-07 05:23:54 UTC (rev 210469)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2011 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2011-2017 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -26,45 +26,31 @@
</span><span class="cx"> #pragma once
</span><span class="cx"> 
</span><span class="cx"> #include &quot;Filter.h&quot;
</span><del>-#include &quot;FilterEffect.h&quot;
-#include &quot;FilterOperations.h&quot;
-#include &quot;FloatRect.h&quot;
-#include &quot;GraphicsContext.h&quot;
-#include &quot;ImageBuffer.h&quot;
</del><span class="cx"> #include &quot;IntRectExtent.h&quot;
</span><span class="cx"> #include &quot;LayoutRect.h&quot;
</span><del>-#include &quot;SVGFilterBuilder.h&quot;
-#include &quot;SourceGraphic.h&quot;
-#include &lt;wtf/RefCounted.h&gt;
-#include &lt;wtf/RefPtr.h&gt;
</del><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> class Document;
</span><ins>+class FilterEffect;
+class FilterOperations;
</ins><span class="cx"> class GraphicsContext;
</span><ins>+class ReferenceFilterOperation;
</ins><span class="cx"> class RenderElement;
</span><span class="cx"> class RenderLayer;
</span><ins>+class SourceGraphic;
</ins><span class="cx"> 
</span><del>-typedef Vector&lt;RefPtr&lt;FilterEffect&gt;&gt; FilterEffectList;
</del><ins>+enum FilterConsumer { FilterProperty, FilterFunction };
</ins><span class="cx"> 
</span><del>-enum FilterConsumer {
-    FilterProperty,
-    FilterFunction
-};
-
</del><span class="cx"> class FilterEffectRendererHelper {
</span><span class="cx">     WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> public:
</span><del>-    FilterEffectRendererHelper(bool haveFilterEffect, GraphicsContext&amp; targetContext)
-        : m_targetContext(targetContext)
-        , m_haveFilterEffect(haveFilterEffect)
-    {
-    }
-    
</del><ins>+    FilterEffectRendererHelper(bool haveFilterEffect, GraphicsContext&amp; targetContext);
+
</ins><span class="cx">     bool haveFilterEffect() const { return m_haveFilterEffect; }
</span><span class="cx">     bool hasStartedFilterEffect() const { return m_startedFilterEffect; }
</span><span class="cx"> 
</span><del>-    bool prepareFilterEffect(RenderLayer*, const LayoutRect&amp; filterBoxRect, const LayoutRect&amp; dirtyRect, const LayoutRect&amp; layerRepaintRect);
</del><ins>+    bool prepareFilterEffect(RenderLayer&amp;, const LayoutRect&amp; filterBoxRect, const LayoutRect&amp; dirtyRect, const LayoutRect&amp; layerRepaintRect);
</ins><span class="cx">     bool beginFilterEffect();
</span><span class="cx">     void applyFilterEffect(GraphicsContext&amp; destinationContext);
</span><span class="cx">     
</span><span class="lines">@@ -84,63 +70,47 @@
</span><span class="cx"> class FilterEffectRenderer final : public Filter {
</span><span class="cx">     WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> public:
</span><del>-    static RefPtr&lt;FilterEffectRenderer&gt; create()
-    {
-        return adoptRef(new FilterEffectRenderer);
-    }
</del><ins>+    friend class FilterEffectRendererHelper;
</ins><span class="cx"> 
</span><del>-    void setSourceImageRect(const FloatRect&amp; sourceImageRect)
-    { 
-        m_sourceDrawingRegion = sourceImageRect;
-        setMaxEffectRects(sourceImageRect);
-        setFilterRegion(sourceImageRect);
-        m_graphicsBufferAttached = false;
-    }
-    FloatRect sourceImageRect() const override { return m_sourceDrawingRegion; }
</del><ins>+    static Ref&lt;FilterEffectRenderer&gt; create();
</ins><span class="cx"> 
</span><ins>+    void setSourceImageRect(const FloatRect&amp;);
</ins><span class="cx">     void setFilterRegion(const FloatRect&amp; filterRegion) { m_filterRegion = filterRegion; }
</span><del>-    FloatRect filterRegion() const override { return m_filterRegion; }
</del><span class="cx"> 
</span><del>-    GraphicsContext* inputContext();
-    ImageBuffer* output() const { return lastEffect()-&gt;asImageBuffer(); }
</del><ins>+    ImageBuffer* output() const;
</ins><span class="cx"> 
</span><del>-    bool build(RenderElement*, const FilterOperations&amp;, FilterConsumer);
-    RefPtr&lt;FilterEffect&gt; buildReferenceFilter(RenderElement*, PassRefPtr&lt;FilterEffect&gt; previousEffect, ReferenceFilterOperation*);
-    bool updateBackingStoreRect(const FloatRect&amp; filterRect);
-    void allocateBackingStoreIfNeeded(const GraphicsContext&amp;);
</del><ins>+    bool build(RenderElement&amp;, const FilterOperations&amp;, FilterConsumer);
</ins><span class="cx">     void clearIntermediateResults();
</span><span class="cx">     void apply();
</span><del>-    
-    IntRect outputRect() const { return lastEffect()-&gt;hasResult() ? lastEffect()-&gt;requestedRegionOfInputImageData(IntRect(m_filterRegion)) : IntRect(); }
</del><span class="cx"> 
</span><span class="cx">     bool hasFilterThatMovesPixels() const { return m_hasFilterThatMovesPixels; }
</span><del>-    LayoutRect computeSourceImageRectForDirtyRect(const LayoutRect&amp; filterBoxRect, const LayoutRect&amp; dirtyRect);
</del><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    void setMaxEffectRects(const FloatRect&amp; effectRect)
-    {
-        for (size_t i = 0; i &lt; m_effects.size(); ++i) {
-            RefPtr&lt;FilterEffect&gt; effect = m_effects.at(i);
-            effect-&gt;setMaxEffectRect(effectRect);
-        }
-    }
</del><ins>+    FilterEffectRenderer();
+    virtual ~FilterEffectRenderer();
</ins><span class="cx"> 
</span><del>-    FilterEffect* lastEffect() const
-    {
-        if (!m_effects.isEmpty())
-            return m_effects.last().get();
-        return nullptr;
-    }
</del><ins>+    FloatRect sourceImageRect() const final { return m_sourceDrawingRegion; }
+    FloatRect filterRegion() const final { return m_filterRegion; }
</ins><span class="cx"> 
</span><del>-    FilterEffectRenderer();
-    virtual ~FilterEffectRenderer();
-    
</del><ins>+    RefPtr&lt;FilterEffect&gt; buildReferenceFilter(RenderElement&amp;, FilterEffect&amp; previousEffect, ReferenceFilterOperation&amp;);
+
+    void setMaxEffectRects(const FloatRect&amp;);
+
+    GraphicsContext* inputContext();
+
+    bool updateBackingStoreRect(const FloatRect&amp; filterRect);
+    void allocateBackingStoreIfNeeded(const GraphicsContext&amp;);
+
+    IntRect outputRect() const;
+
+    LayoutRect computeSourceImageRectForDirtyRect(const LayoutRect&amp; filterBoxRect, const LayoutRect&amp; dirtyRect);
+
</ins><span class="cx">     FloatRect m_sourceDrawingRegion;
</span><span class="cx">     FloatRect m_filterRegion;
</span><del>-    
-    FilterEffectList m_effects;
-    RefPtr&lt;SourceGraphic&gt; m_sourceGraphic;
-    
</del><ins>+
+    Vector&lt;Ref&lt;FilterEffect&gt;&gt; m_effects;
+    Ref&lt;SourceGraphic&gt; m_sourceGraphic;
+
</ins><span class="cx">     IntRectExtent m_outsets;
</span><span class="cx"> 
</span><span class="cx">     bool m_graphicsBufferAttached { false };
</span><span class="lines">@@ -147,4 +117,18 @@
</span><span class="cx">     bool m_hasFilterThatMovesPixels { false };
</span><span class="cx"> };
</span><span class="cx"> 
</span><ins>+inline FilterEffectRendererHelper::FilterEffectRendererHelper(bool haveFilterEffect, GraphicsContext&amp; targetContext)
+    : m_targetContext(targetContext)
+    , m_haveFilterEffect(haveFilterEffect)
+{
+}
+
+inline void FilterEffectRenderer::setSourceImageRect(const FloatRect&amp; sourceImageRect)
+{
+    m_sourceDrawingRegion = sourceImageRect;
+    setMaxEffectRects(sourceImageRect);
+    setFilterRegion(sourceImageRect);
+    m_graphicsBufferAttached = false;
+}
+
</ins><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderLayercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (210468 => 210469)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderLayer.cpp        2017-01-07 04:02:06 UTC (rev 210468)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp        2017-01-07 05:23:54 UTC (rev 210469)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2006-2016 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2006-2017 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Portions are Copyright (C) 1998 Netscape Communications Corporation.
</span><span class="cx">  *
</span><span class="lines">@@ -459,13 +459,13 @@
</span><span class="cx"> {
</span><span class="cx">     if (!paintsWithFilters())
</span><span class="cx">         return false;
</span><del>-    FilterEffectRenderer* renderer = filterRenderer();
</del><ins>+    auto* renderer = filterRenderer();
</ins><span class="cx">     return renderer &amp;&amp; renderer-&gt;hasFilterThatMovesPixels();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> FilterEffectRenderer* RenderLayer::filterRenderer() const
</span><span class="cx"> {
</span><del>-    FilterInfo* filterInfo = FilterInfo::getIfExists(*this);
</del><ins>+    auto* filterInfo = FilterInfo::getIfExists(*this);
</ins><span class="cx">     return filterInfo ? filterInfo-&gt;renderer() : nullptr;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -4184,36 +4184,43 @@
</span><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool RenderLayer::hasFilterThatIsPainting(GraphicsContext&amp; context, PaintLayerFlags paintFlags) const
</del><ins>+std::pair&lt;RenderLayer::FilterInfo*, std::unique_ptr&lt;FilterEffectRendererHelper&gt;&gt; RenderLayer::filterPainter(GraphicsContext&amp; context, PaintLayerFlags paintFlags) const
</ins><span class="cx"> {
</span><span class="cx">     if (context.paintingDisabled())
</span><del>-        return false;
</del><ins>+        return { };
</ins><span class="cx"> 
</span><span class="cx">     if (paintFlags &amp; PaintLayerPaintingOverlayScrollbars)
</span><del>-        return false;
</del><ins>+        return { };
</ins><span class="cx"> 
</span><del>-    FilterInfo* filterInfo = FilterInfo::getIfExists(*this);
-    bool hasPaintedFilter = filterInfo &amp;&amp; filterInfo-&gt;renderer() &amp;&amp; paintsWithFilters();
-    if (!hasPaintedFilter)
-        return false;
</del><ins>+    if (!paintsWithFilters())
+        return { };
</ins><span class="cx"> 
</span><del>-    auto filterPainter = std::make_unique&lt;FilterEffectRendererHelper&gt;(hasPaintedFilter, context);
-    if (!filterPainter-&gt;haveFilterEffect())
-        return false;
</del><ins>+    auto* info = FilterInfo::getIfExists(*this);
+    if (!info || !info-&gt;renderer())
+        return { };
</ins><span class="cx"> 
</span><del>-    return true;
</del><ins>+    auto helper = std::make_unique&lt;FilterEffectRendererHelper&gt;(true, context);
+    if (!helper-&gt;haveFilterEffect())
+        return { };
+
+    return { info, WTFMove(helper) };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool RenderLayer::hasFilterThatIsPainting(GraphicsContext&amp; context, PaintLayerFlags paintFlags) const
+{
+    return !!filterPainter(context, paintFlags).first;
+}
+
</ins><span class="cx"> std::unique_ptr&lt;FilterEffectRendererHelper&gt; RenderLayer::setupFilters(GraphicsContext&amp; context, LayerPaintingInfo&amp; paintingInfo, PaintLayerFlags paintFlags, const LayoutSize&amp; offsetFromRoot, LayoutRect&amp; rootRelativeBounds, bool&amp; rootRelativeBoundsComputed)
</span><span class="cx"> {
</span><del>-    if (!hasFilterThatIsPainting(context, paintFlags))
</del><ins>+    auto painter = filterPainter(context, paintFlags);
+    if (!painter.first)
</ins><span class="cx">         return nullptr;
</span><span class="cx"> 
</span><del>-    FilterInfo* filterInfo = FilterInfo::getIfExists(*this);
-    bool hasPaintedFilter = filterInfo &amp;&amp; filterInfo-&gt;renderer() &amp;&amp; paintsWithFilters();
-    auto filterPainter = std::make_unique&lt;FilterEffectRendererHelper&gt;(hasPaintedFilter, context);
</del><ins>+    auto&amp; filterInfo = *painter.first;
+    auto&amp; filterPainter = *painter.second;
</ins><span class="cx"> 
</span><del>-    LayoutRect filterRepaintRect = filterInfo-&gt;dirtySourceRect();
</del><ins>+    LayoutRect filterRepaintRect = filterInfo.dirtySourceRect();
</ins><span class="cx">     filterRepaintRect.move(offsetFromRoot);
</span><span class="cx"> 
</span><span class="cx">     if (!rootRelativeBoundsComputed) {
</span><span class="lines">@@ -4221,24 +4228,23 @@
</span><span class="cx">         rootRelativeBoundsComputed = true;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (filterPainter-&gt;prepareFilterEffect(this, enclosingIntRect(rootRelativeBounds), enclosingIntRect(paintingInfo.paintDirtyRect), enclosingIntRect(filterRepaintRect))) {
-        // Now we know for sure, that the source image will be updated, so we can revert our tracking repaint rect back to zero.
-        filterInfo-&gt;resetDirtySourceRect();
</del><ins>+    if (!filterPainter.prepareFilterEffect(*this, enclosingIntRect(rootRelativeBounds), enclosingIntRect(paintingInfo.paintDirtyRect), enclosingIntRect(filterRepaintRect)))
+        return nullptr;
</ins><span class="cx"> 
</span><del>-        if (!filterPainter-&gt;beginFilterEffect())
-            return nullptr;
</del><ins>+    // 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();
</ins><span class="cx"> 
</span><del>-        // Check that we didn't fail to allocate the graphics context for the offscreen buffer.
-        ASSERT(filterPainter-&gt;hasStartedFilterEffect());
</del><ins>+    if (!filterPainter.beginFilterEffect())
+        return nullptr;
</ins><span class="cx"> 
</span><del>-        paintingInfo.paintDirtyRect = filterPainter-&gt;repaintRect();
-        // If the filter needs the full source image, we need to avoid using the clip rectangles.
-        // Otherwise, if for example this layer has overflow:hidden, a drop shadow will not compute correctly.
-        // Note that we will still apply the clipping on the final rendering of the filter.
-        paintingInfo.clipToDirtyRect = !filterInfo-&gt;renderer()-&gt;hasFilterThatMovesPixels();
-        return filterPainter;
-    }
-    return nullptr;
</del><ins>+    paintingInfo.paintDirtyRect = filterPainter.repaintRect();
+
+    // If the filter needs the full source image, we need to avoid using the clip rectangles.
+    // Otherwise, if for example this layer has overflow:hidden, a drop shadow will not compute correctly.
+    // Note that we will still apply the clipping on the final rendering of the filter.
+    paintingInfo.clipToDirtyRect = !filterInfo.renderer()-&gt;hasFilterThatMovesPixels();
+
+    return WTFMove(painter.second);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void RenderLayer::applyFilters(FilterEffectRendererHelper* filterPainter, GraphicsContext&amp; originalContext, const LayerPaintingInfo&amp; paintingInfo, const LayerFragments&amp; layerFragments)
</span><span class="lines">@@ -7007,7 +7013,7 @@
</span><span class="cx"> 
</span><span class="cx">     // If the filter fails to build, remove it from the layer. It will still attempt to
</span><span class="cx">     // go through regular processing (e.g. compositing), but never apply anything.
</span><del>-    if (!filterInfo.renderer()-&gt;build(&amp;renderer(), renderer().style().filter(), FilterProperty))
</del><ins>+    if (!filterInfo.renderer()-&gt;build(renderer(), renderer().style().filter(), FilterProperty))
</ins><span class="cx">         filterInfo.setRenderer(nullptr);
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderLayerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderLayer.h (210468 => 210469)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderLayer.h        2017-01-07 04:02:06 UTC (rev 210468)
+++ trunk/Source/WebCore/rendering/RenderLayer.h        2017-01-07 05:23:54 UTC (rev 210469)
</span><span class="lines">@@ -783,6 +783,8 @@
</span><span class="cx"> 
</span><span class="cx">     bool setupClipPath(GraphicsContext&amp;, const LayerPaintingInfo&amp;, const LayoutSize&amp; offsetFromRoot, LayoutRect&amp; rootRelativeBounds, bool&amp; rootRelativeBoundsComputed);
</span><span class="cx"> 
</span><ins>+    class FilterInfo;
+    std::pair&lt;FilterInfo*, std::unique_ptr&lt;FilterEffectRendererHelper&gt;&gt; filterPainter(GraphicsContext&amp;, PaintLayerFlags) const;
</ins><span class="cx">     bool hasFilterThatIsPainting(GraphicsContext&amp;, PaintLayerFlags) const;
</span><span class="cx">     std::unique_ptr&lt;FilterEffectRendererHelper&gt; setupFilters(GraphicsContext&amp;, LayerPaintingInfo&amp;, PaintLayerFlags, const LayoutSize&amp; offsetFromRoot, LayoutRect&amp; rootRelativeBounds, bool&amp; rootRelativeBoundsComputed);
</span><span class="cx">     void applyFilters(FilterEffectRendererHelper*, GraphicsContext&amp; originalContext, const LayerPaintingInfo&amp;, const LayerFragments&amp;);
</span><span class="lines">@@ -1148,8 +1150,6 @@
</span><span class="cx">     IntRect m_blockSelectionGapsBounds;
</span><span class="cx"> 
</span><span class="cx">     std::unique_ptr&lt;RenderLayerBacking&gt; m_backing;
</span><del>-
-    class FilterInfo;
</del><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> inline void RenderLayer::clearZOrderLists()
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingstyleContentDatacpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/style/ContentData.cpp (210468 => 210469)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/style/ContentData.cpp        2017-01-07 04:02:06 UTC (rev 210468)
+++ trunk/Source/WebCore/rendering/style/ContentData.cpp        2017-01-07 05:23:54 UTC (rev 210469)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><span class="cx"> /*
</span><span class="cx">  * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org)
</span><del>- * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2004-2017 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * This library is free software; you can redistribute it and/or
</span><span class="cx">  * modify it under the terms of the GNU Library General Public
</span><span class="lines">@@ -36,20 +36,18 @@
</span><span class="cx"> std::unique_ptr&lt;ContentData&gt; ContentData::clone() const
</span><span class="cx"> {
</span><span class="cx">     auto result = cloneInternal();
</span><del>-    
-    ContentData* lastNewData = result.get();
-    for (const ContentData* contentData = next(); contentData; contentData = contentData-&gt;next()) {
</del><ins>+    auto* lastNewData = result.get();
+    for (auto* contentData = next(); contentData; contentData = contentData-&gt;next()) {
</ins><span class="cx">         auto newData = contentData-&gt;cloneInternal();
</span><span class="cx">         lastNewData-&gt;setNext(WTFMove(newData));
</span><span class="cx">         lastNewData = lastNewData-&gt;next();
</span><span class="cx">     }
</span><del>-        
</del><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> RenderPtr&lt;RenderObject&gt; ImageContentData::createContentRenderer(Document&amp; document, const RenderStyle&amp; pseudoStyle) const
</span><span class="cx"> {
</span><del>-    auto image = createRenderer&lt;RenderImage&gt;(document, RenderStyle::createStyleInheritingFromPseudoStyle(pseudoStyle), m_image.get());
</del><ins>+    auto image = createRenderer&lt;RenderImage&gt;(document, RenderStyle::createStyleInheritingFromPseudoStyle(pseudoStyle), const_cast&lt;StyleImage*&gt;(m_image.ptr()));
</ins><span class="cx">     image-&gt;initializeStyle();
</span><span class="cx">     image-&gt;setAltText(altText());
</span><span class="cx">     return WTFMove(image);
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingstyleContentDatah"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/style/ContentData.h (210468 => 210469)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/style/ContentData.h        2017-01-07 04:02:06 UTC (rev 210468)
+++ trunk/Source/WebCore/rendering/style/ContentData.h        2017-01-07 05:23:54 UTC (rev 210469)
</span><span class="lines">@@ -2,7 +2,7 @@
</span><span class="cx">  * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
</span><span class="cx">  *           (C) 2000 Antti Koivisto (koivisto@kde.org)
</span><span class="cx">  *           (C) 2000 Dirk Mueller (mueller@kde.org)
</span><del>- * Copyright (C) 2003, 2005, 2006, 2007, 2008, 2010 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2003-2017 Apple Inc. All rights reserved.
</ins><span class="cx">  * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
</span><span class="cx">  *
</span><span class="cx">  * This library is free software; you can redistribute it and/or
</span><span class="lines">@@ -79,37 +79,33 @@
</span><span class="cx"> 
</span><span class="cx"> class ImageContentData final : public ContentData {
</span><span class="cx"> public:
</span><del>-    explicit ImageContentData(PassRefPtr&lt;StyleImage&gt; image)
</del><ins>+    explicit ImageContentData(Ref&lt;StyleImage&gt;&amp;&amp; image)
</ins><span class="cx">         : ContentData(ImageDataType)
</span><del>-        , m_image(image)
</del><ins>+        , m_image(WTFMove(image))
</ins><span class="cx">     {
</span><del>-        ASSERT(m_image);
</del><span class="cx">     }
</span><span class="cx"> 
</span><del>-    const StyleImage&amp; image() const { return *m_image; }
-    void setImage(PassRefPtr&lt;StyleImage&gt; image)
</del><ins>+    const StyleImage&amp; image() const { return m_image.get(); }
+    void setImage(Ref&lt;StyleImage&gt;&amp;&amp; image)
</ins><span class="cx">     {
</span><del>-        ASSERT(image);
-        m_image = image;
</del><ins>+        m_image = WTFMove(image);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    RenderPtr&lt;RenderObject&gt; createContentRenderer(Document&amp;, const RenderStyle&amp;) const override;
-
</del><span class="cx"> private:
</span><del>-    std::unique_ptr&lt;ContentData&gt; cloneInternal() const override
</del><ins>+    RenderPtr&lt;RenderObject&gt; createContentRenderer(Document&amp;, const RenderStyle&amp;) const final;
+    std::unique_ptr&lt;ContentData&gt; cloneInternal() const final
</ins><span class="cx">     {
</span><del>-        std::unique_ptr&lt;ContentData&gt; image = std::make_unique&lt;ImageContentData&gt;(m_image.get());
</del><ins>+        auto image = std::make_unique&lt;ImageContentData&gt;(m_image.copyRef());
</ins><span class="cx">         image-&gt;setAltText(altText());
</span><del>-
-        return image;
</del><ins>+        return WTFMove(image);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    RefPtr&lt;StyleImage&gt; m_image;
</del><ins>+    Ref&lt;StyleImage&gt; m_image;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> inline bool operator==(const ImageContentData&amp; a, const ImageContentData&amp; b)
</span><span class="cx"> {
</span><del>-    return a.image() == b.image();
</del><ins>+    return &amp;a.image() == &amp;b.image();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> inline bool operator!=(const ImageContentData&amp; a, const ImageContentData&amp; b)
</span><span class="lines">@@ -128,10 +124,9 @@
</span><span class="cx">     const String&amp; text() const { return m_text; }
</span><span class="cx">     void setText(const String&amp; text) { m_text = text; }
</span><span class="cx"> 
</span><del>-    RenderPtr&lt;RenderObject&gt; createContentRenderer(Document&amp;, const RenderStyle&amp;) const override;
-
</del><span class="cx"> private:
</span><del>-    std::unique_ptr&lt;ContentData&gt; cloneInternal() const override { return std::make_unique&lt;TextContentData&gt;(text()); }
</del><ins>+    RenderPtr&lt;RenderObject&gt; createContentRenderer(Document&amp;, const RenderStyle&amp;) const final;
+    std::unique_ptr&lt;ContentData&gt; cloneInternal() const final { return std::make_unique&lt;TextContentData&gt;(text()); }
</ins><span class="cx"> 
</span><span class="cx">     String m_text;
</span><span class="cx"> };
</span><span class="lines">@@ -162,13 +157,11 @@
</span><span class="cx">         m_counter = WTFMove(counter);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    RenderPtr&lt;RenderObject&gt; createContentRenderer(Document&amp;, const RenderStyle&amp;) const override;
-
</del><span class="cx"> private:
</span><del>-    std::unique_ptr&lt;ContentData&gt; cloneInternal() const override
</del><ins>+    RenderPtr&lt;RenderObject&gt; createContentRenderer(Document&amp;, const RenderStyle&amp;) const final;
+    std::unique_ptr&lt;ContentData&gt; cloneInternal() const final
</ins><span class="cx">     {
</span><del>-        auto counterData = std::make_unique&lt;CounterContent&gt;(counter());
-        return std::make_unique&lt;CounterContentData&gt;(WTFMove(counterData));
</del><ins>+        return std::make_unique&lt;CounterContentData&gt;(std::make_unique&lt;CounterContent&gt;(counter()));
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     std::unique_ptr&lt;CounterContent&gt; m_counter;
</span><span class="lines">@@ -195,10 +188,9 @@
</span><span class="cx">     QuoteType quote() const { return m_quote; }
</span><span class="cx">     void setQuote(QuoteType quote) { m_quote = quote; }
</span><span class="cx"> 
</span><del>-    RenderPtr&lt;RenderObject&gt; createContentRenderer(Document&amp;, const RenderStyle&amp;) const override;
-
</del><span class="cx"> private:
</span><del>-    std::unique_ptr&lt;ContentData&gt; cloneInternal() const override { return std::make_unique&lt;QuoteContentData&gt;(quote()); }
</del><ins>+    RenderPtr&lt;RenderObject&gt; createContentRenderer(Document&amp;, const RenderStyle&amp;) const final;
+    std::unique_ptr&lt;ContentData&gt; cloneInternal() const final { return std::make_unique&lt;QuoteContentData&gt;(quote()); }
</ins><span class="cx"> 
</span><span class="cx">     QuoteType m_quote;
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingstyleNinePieceImagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/style/NinePieceImage.cpp (210468 => 210469)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/style/NinePieceImage.cpp        2017-01-07 04:02:06 UTC (rev 210468)
+++ trunk/Source/WebCore/rendering/style/NinePieceImage.cpp        2017-01-07 05:23:54 UTC (rev 210469)
</span><span class="lines">@@ -2,7 +2,7 @@
</span><span class="cx">  * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
</span><span class="cx">  *           (C) 2000 Antti Koivisto (koivisto@kde.org)
</span><span class="cx">  *           (C) 2000 Dirk Mueller (mueller@kde.org)
</span><del>- * Copyright (C) 2003, 2005, 2006, 2007, 2008, 2013, 2015 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2003-2017 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * This library is free software; you can redistribute it and/or
</span><span class="cx">  * modify it under the terms of the GNU Library General Public
</span><span class="lines">@@ -33,9 +33,9 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-static DataRef&lt;NinePieceImageData&gt;&amp; defaultData()
</del><ins>+inline DataRef&lt;NinePieceImage::Data&gt;&amp; NinePieceImage::defaultData()
</ins><span class="cx"> {
</span><del>-    static NeverDestroyed&lt;DataRef&lt;NinePieceImageData&gt;&gt; data(NinePieceImageData::create());
</del><ins>+    static NeverDestroyed&lt;DataRef&lt;Data&gt;&gt; data { Data::create() };
</ins><span class="cx">     return data.get();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -44,16 +44,9 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-NinePieceImage::NinePieceImage(PassRefPtr&lt;StyleImage&gt; image, LengthBox imageSlices, bool fill, LengthBox borderSlices, LengthBox outset, ENinePieceImageRule horizontalRule, ENinePieceImageRule verticalRule)
-    : m_data(NinePieceImageData::create())
</del><ins>+NinePieceImage::NinePieceImage(RefPtr&lt;StyleImage&gt;&amp;&amp; image, LengthBox imageSlices, bool fill, LengthBox borderSlices, LengthBox outset, ENinePieceImageRule horizontalRule, ENinePieceImageRule verticalRule)
+    : m_data(Data::create(WTFMove(image), imageSlices, fill, borderSlices, outset, horizontalRule, verticalRule))
</ins><span class="cx"> {
</span><del>-    m_data.access()-&gt;image = image;
-    m_data.access()-&gt;imageSlices = WTFMove(imageSlices);
-    m_data.access()-&gt;borderSlices = WTFMove(borderSlices);
-    m_data.access()-&gt;outset = WTFMove(outset);
-    m_data.access()-&gt;fill = fill;
-    m_data.access()-&gt;horizontalRule = horizontalRule;
-    m_data.access()-&gt;verticalRule = verticalRule;
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> LayoutUnit NinePieceImage::computeSlice(Length length, LayoutUnit width, LayoutUnit slice, LayoutUnit extent)
</span><span class="lines">@@ -195,7 +188,8 @@
</span><span class="cx"> void NinePieceImage::paint(GraphicsContext&amp; graphicsContext, RenderElement* renderer, const RenderStyle&amp; style, const LayoutRect&amp; destination, const LayoutSize&amp; source, float deviceScaleFactor, CompositeOperator op) const
</span><span class="cx"> {
</span><span class="cx">     StyleImage* styleImage = image();
</span><del>-    ASSERT(styleImage &amp;&amp; styleImage-&gt;isLoaded());
</del><ins>+    ASSERT(styleImage);
+    ASSERT(styleImage-&gt;isLoaded());
</ins><span class="cx"> 
</span><span class="cx">     LayoutBoxExtent sourceSlices = computeSlices(source, imageSlices(), styleImage-&gt;imageScaleFactor());
</span><span class="cx">     LayoutBoxExtent destinationSlices = computeSlices(destination.size(), borderSlices(), style.borderWidth(), sourceSlices);
</span><span class="lines">@@ -225,19 +219,26 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-NinePieceImageData::NinePieceImageData()
</del><ins>+inline NinePieceImage::Data::Data()
</ins><span class="cx">     : fill(false)
</span><span class="cx">     , horizontalRule(StretchImageRule)
</span><span class="cx">     , verticalRule(StretchImageRule)
</span><del>-    , image(nullptr)
-    , imageSlices(Length(100, Percent), Length(100, Percent), Length(100, Percent), Length(100, Percent))
-    , borderSlices(Length(1, Relative), Length(1, Relative), Length(1, Relative), Length(1, Relative))
-    , outset(0)
</del><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-inline NinePieceImageData::NinePieceImageData(const NinePieceImageData&amp; other)
-    : RefCounted&lt;NinePieceImageData&gt;()
</del><ins>+inline NinePieceImage::Data::Data(RefPtr&lt;StyleImage&gt;&amp;&amp; image, LengthBox imageSlices, bool fill, LengthBox borderSlices, LengthBox outset, ENinePieceImageRule horizontalRule, ENinePieceImageRule verticalRule)
+    : fill(fill)
+    , horizontalRule(horizontalRule)
+    , verticalRule(verticalRule)
+    , image(WTFMove(image))
+    , imageSlices(imageSlices)
+    , borderSlices(borderSlices)
+    , outset(outset)
+{
+}
+
+inline NinePieceImage::Data::Data(const Data&amp; other)
+    : RefCounted&lt;Data&gt;()
</ins><span class="cx">     , fill(other.fill)
</span><span class="cx">     , horizontalRule(other.horizontalRule)
</span><span class="cx">     , verticalRule(other.verticalRule)
</span><span class="lines">@@ -248,13 +249,23 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-Ref&lt;NinePieceImageData&gt; NinePieceImageData::copy() const
</del><ins>+inline Ref&lt;NinePieceImage::Data&gt; NinePieceImage::Data::create()
</ins><span class="cx"> {
</span><del>-    return adoptRef(*new NinePieceImageData(*this));
</del><ins>+    return adoptRef(*new Data);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool NinePieceImageData::operator==(const NinePieceImageData&amp; other) const
</del><ins>+inline Ref&lt;NinePieceImage::Data&gt; NinePieceImage::Data::create(RefPtr&lt;StyleImage&gt;&amp;&amp; image, LengthBox imageSlices, bool fill, LengthBox borderSlices, LengthBox outset, ENinePieceImageRule horizontalRule, ENinePieceImageRule verticalRule)
</ins><span class="cx"> {
</span><ins>+    return adoptRef(*new Data(WTFMove(image), imageSlices, fill, borderSlices, outset, horizontalRule, verticalRule));
+}
+
+Ref&lt;NinePieceImage::Data&gt; NinePieceImage::Data::copy() const
+{
+    return adoptRef(*new Data(*this));
+}
+
+bool NinePieceImage::Data::operator==(const Data&amp; other) const
+{
</ins><span class="cx">     return arePointingToEqualData(image, other.image)
</span><span class="cx">         &amp;&amp; imageSlices == other.imageSlices
</span><span class="cx">         &amp;&amp; fill == other.fill
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingstyleNinePieceImageh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/style/NinePieceImage.h (210468 => 210469)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/style/NinePieceImage.h        2017-01-07 04:02:06 UTC (rev 210468)
+++ trunk/Source/WebCore/rendering/style/NinePieceImage.h        2017-01-07 05:23:54 UTC (rev 210469)
</span><span class="lines">@@ -2,7 +2,7 @@
</span><span class="cx">  * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
</span><span class="cx">  *           (C) 2000 Antti Koivisto (koivisto@kde.org)
</span><span class="cx">  *           (C) 2000 Dirk Mueller (mueller@kde.org)
</span><del>- * Copyright (C) 2003, 2005, 2006, 2007, 2008, 2013, 2015 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2003-2017 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * This library is free software; you can redistribute it and/or
</span><span class="cx">  * modify it under the terms of the GNU Library General Public
</span><span class="lines">@@ -24,9 +24,6 @@
</span><span class="cx"> #pragma once
</span><span class="cx"> 
</span><span class="cx"> #include &quot;DataRef.h&quot;
</span><del>-#include &quot;LayoutRect.h&quot;
-#include &quot;LayoutSize.h&quot;
-#include &quot;LayoutUnit.h&quot;
</del><span class="cx"> #include &quot;LengthBox.h&quot;
</span><span class="cx"> #include &quot;StyleImage.h&quot;
</span><span class="cx"> #include &lt;wtf/Vector.h&gt;
</span><span class="lines">@@ -33,10 +30,12 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-enum ENinePieceImageRule {
-    StretchImageRule, RoundImageRule, SpaceImageRule, RepeatImageRule
-};
</del><ins>+class LayoutSize;
+class LayoutRect;
+class RenderStyle;
</ins><span class="cx"> 
</span><ins>+enum ENinePieceImageRule { StretchImageRule, RoundImageRule, SpaceImageRule, RepeatImageRule };
+
</ins><span class="cx"> enum ImagePiece {
</span><span class="cx">     MinPiece = 0,
</span><span class="cx">     TopLeftPiece = MinPiece,
</span><span class="lines">@@ -99,33 +98,10 @@
</span><span class="cx">     return NilSide;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-class RenderStyle;
-
-class NinePieceImageData : public RefCounted&lt;NinePieceImageData&gt; {
-public:
-    static Ref&lt;NinePieceImageData&gt; create() { return adoptRef(*new NinePieceImageData); }
-    Ref&lt;NinePieceImageData&gt; copy() const;
-
-    bool operator==(const NinePieceImageData&amp;) const;
-    bool operator!=(const NinePieceImageData&amp; o) const { return !(*this == o); }
-
-    bool fill : 1;
-    unsigned horizontalRule : 2; // ENinePieceImageRule
-    unsigned verticalRule : 2; // ENinePieceImageRule
-    RefPtr&lt;StyleImage&gt; image;
-    LengthBox imageSlices;
-    LengthBox borderSlices;
-    LengthBox outset;
-
-private:
-    NinePieceImageData();
-    NinePieceImageData(const NinePieceImageData&amp;);
-};
-
</del><span class="cx"> class NinePieceImage {
</span><span class="cx"> public:
</span><span class="cx">     NinePieceImage();
</span><del>-    NinePieceImage(PassRefPtr&lt;StyleImage&gt;, LengthBox imageSlices, bool fill, LengthBox borderSlices, LengthBox outset, ENinePieceImageRule horizontalRule, ENinePieceImageRule verticalRule);
</del><ins>+    NinePieceImage(RefPtr&lt;StyleImage&gt;&amp;&amp;, LengthBox imageSlices, bool fill, LengthBox borderSlices, LengthBox outset, ENinePieceImageRule horizontalRule, ENinePieceImageRule verticalRule);
</ins><span class="cx"> 
</span><span class="cx">     bool operator==(const NinePieceImage&amp; other) const { return m_data == other.m_data; }
</span><span class="cx">     bool operator!=(const NinePieceImage&amp; other) const { return m_data != other.m_data; }
</span><span class="lines">@@ -132,8 +108,8 @@
</span><span class="cx"> 
</span><span class="cx">     bool hasImage() const { return m_data-&gt;image; }
</span><span class="cx">     StyleImage* image() const { return m_data-&gt;image.get(); }
</span><del>-    void setImage(PassRefPtr&lt;StyleImage&gt; image) { m_data.access()-&gt;image = image; }
-    
</del><ins>+    void setImage(RefPtr&lt;StyleImage&gt;&amp;&amp; image) { m_data.access()-&gt;image = WTFMove(image); }
+
</ins><span class="cx">     const LengthBox&amp; imageSlices() const { return m_data-&gt;imageSlices; }
</span><span class="cx">     void setImageSlices(LengthBox slices) { m_data.access()-&gt;imageSlices = WTFMove(slices); }
</span><span class="cx"> 
</span><span class="lines">@@ -206,7 +182,31 @@
</span><span class="cx">     void paint(GraphicsContext&amp;, RenderElement*, const RenderStyle&amp;, const LayoutRect&amp; destination, const LayoutSize&amp; source, float deviceScaleFactor, CompositeOperator) const;
</span><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    DataRef&lt;NinePieceImageData&gt; m_data;
</del><ins>+    struct Data : RefCounted&lt;Data&gt; {
+        static Ref&lt;Data&gt; create();
+        static Ref&lt;Data&gt; create(RefPtr&lt;StyleImage&gt;&amp;&amp;, LengthBox imageSlices, bool fill, LengthBox borderSlices, LengthBox outset, ENinePieceImageRule horizontalRule, ENinePieceImageRule verticalRule);
+        Ref&lt;Data&gt; copy() const;
+
+        bool operator==(const Data&amp;) const;
+        bool operator!=(const Data&amp; other) const { return !(*this == other); }
+
+        bool fill : 1;
+        unsigned horizontalRule : 2; // ENinePieceImageRule
+        unsigned verticalRule : 2; // ENinePieceImageRule
+        RefPtr&lt;StyleImage&gt; image;
+        LengthBox imageSlices { { 100, Percent }, { 100, Percent }, { 100, Percent }, { 100, Percent } };
+        LengthBox borderSlices { { 1, Relative }, { 1, Relative }, { 1, Relative }, { 1, Relative } };
+        LengthBox outset { 0 };
+
+    private:
+        Data();
+        Data(RefPtr&lt;StyleImage&gt;&amp;&amp;, LengthBox imageSlices, bool fill, LengthBox borderSlices, LengthBox outset, ENinePieceImageRule horizontalRule, ENinePieceImageRule verticalRule);
+        Data(const Data&amp;);
+    };
+
+    static DataRef&lt;Data&gt;&amp; defaultData();
+
+    DataRef&lt;Data&gt; m_data;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> TextStream&amp; operator&lt;&lt;(TextStream&amp;, const NinePieceImage&amp;);
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingstyleRenderStylecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/style/RenderStyle.cpp (210468 => 210469)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/style/RenderStyle.cpp        2017-01-07 04:02:06 UTC (rev 210468)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.cpp        2017-01-07 05:23:54 UTC (rev 210469)
</span><span class="lines">@@ -1012,11 +1012,11 @@
</span><span class="cx">         return;
</span><span class="cx">         
</span><span class="cx">     if (add) {
</span><del>-        appendContent(std::make_unique&lt;ImageContentData&gt;(image));
</del><ins>+        appendContent(std::make_unique&lt;ImageContentData&gt;(image.releaseNonNull()));
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    rareNonInheritedData.access()-&gt;m_content = std::make_unique&lt;ImageContentData&gt;(WTFMove(image));
</del><ins>+    rareNonInheritedData.access()-&gt;m_content = std::make_unique&lt;ImageContentData&gt;(image.releaseNonNull());
</ins><span class="cx">     if (!rareNonInheritedData.access()-&gt;m_altText.isNull())
</span><span class="cx">         rareNonInheritedData.access()-&gt;m_content-&gt;setAltText(rareNonInheritedData.access()-&gt;m_altText);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingstyleShapeValuecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/style/ShapeValue.cpp (210468 => 210469)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/style/ShapeValue.cpp        2017-01-07 04:02:06 UTC (rev 210468)
+++ trunk/Source/WebCore/rendering/style/ShapeValue.cpp        2017-01-07 05:23:54 UTC (rev 210469)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2014 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2014-2017 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -24,42 +24,30 @@
</span><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> #include &quot;config.h&quot;
</span><del>-
</del><span class="cx"> #include &quot;ShapeValue.h&quot;
</span><span class="cx"> 
</span><span class="cx"> #include &quot;CachedImage.h&quot;
</span><ins>+#include &lt;wtf/PointerComparison.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> bool ShapeValue::isImageValid() const
</span><span class="cx"> {
</span><del>-    if (!image())
</del><ins>+    if (!m_image)
</ins><span class="cx">         return false;
</span><del>-    if (image()-&gt;isCachedImage())
-        return image()-&gt;cachedImage() &amp;&amp; image()-&gt;cachedImage()-&gt;hasImage();
-    return image()-&gt;isGeneratedImage();
</del><ins>+    if (m_image-&gt;isCachedImage()) {
+        auto* cachedImage = m_image-&gt;cachedImage();
+        return cachedImage &amp;&amp; cachedImage-&gt;hasImage();
+    }
+    return m_image-&gt;isGeneratedImage();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-template &lt;typename T&gt;
-bool pointersOrValuesEqual(T p1, T p2)
-{
-    if (p1 == p2)
-        return true;
-    
-    if (!p1 || !p2)
-        return false;
-    
-    return *p1 == *p2;
-}
-
</del><span class="cx"> bool ShapeValue::operator==(const ShapeValue&amp; other) const
</span><span class="cx"> {
</span><del>-    if (m_type != other.m_type || m_cssBox != other.m_cssBox)
-        return false;
-
-    return pointersOrValuesEqual(m_shape.get(), other.m_shape.get())
-        &amp;&amp; pointersOrValuesEqual(m_image.get(), other.m_image.get());
</del><ins>+    return m_type == other.m_type
+        &amp;&amp; m_cssBox == other.m_cssBox
+        &amp;&amp; arePointingToEqualData(m_shape, other.m_shape)
+        &amp;&amp; arePointingToEqualData(m_image, other.m_image);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-
</del><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingstyleShapeValueh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/style/ShapeValue.h (210468 => 210469)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/style/ShapeValue.h        2017-01-07 04:02:06 UTC (rev 210468)
+++ trunk/Source/WebCore/rendering/style/ShapeValue.h        2017-01-07 05:23:54 UTC (rev 210469)
</span><span class="lines">@@ -1,5 +1,6 @@
</span><span class="cx"> /*
</span><span class="cx">  * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved.
</span><ins>+ * Copyright (C) 2014-2017 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -30,49 +31,38 @@
</span><span class="cx"> #pragma once
</span><span class="cx"> 
</span><span class="cx"> #include &quot;BasicShapes.h&quot;
</span><del>-#include &quot;CSSValueKeywords.h&quot;
</del><span class="cx"> #include &quot;StyleImage.h&quot;
</span><del>-#include &lt;wtf/PassRefPtr.h&gt;
</del><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> class ShapeValue : public RefCounted&lt;ShapeValue&gt; {
</span><span class="cx"> public:
</span><del>-    enum class Type {
-        // The None value is defined by a null ShapeValue*
-        Shape,
-        Box,
-        Image
-    };
-
-    static Ref&lt;ShapeValue&gt; createShapeValue(PassRefPtr&lt;BasicShape&gt; shape, CSSBoxType cssBox)
</del><ins>+    static Ref&lt;ShapeValue&gt; create(RefPtr&lt;BasicShape&gt;&amp;&amp; shape, CSSBoxType cssBox)
</ins><span class="cx">     {
</span><del>-        return adoptRef(*new ShapeValue(shape, cssBox));
</del><ins>+        return adoptRef(*new ShapeValue(WTFMove(shape), cssBox));
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    static Ref&lt;ShapeValue&gt; createBoxShapeValue(CSSBoxType boxShape)
</del><ins>+    static Ref&lt;ShapeValue&gt; create(CSSBoxType boxShape)
</ins><span class="cx">     {
</span><span class="cx">         return adoptRef(*new ShapeValue(boxShape));
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    static Ref&lt;ShapeValue&gt; createImageValue(PassRefPtr&lt;StyleImage&gt; image)
</del><ins>+    static Ref&lt;ShapeValue&gt; create(RefPtr&lt;StyleImage&gt;&amp;&amp; image)
</ins><span class="cx">     {
</span><del>-        return adoptRef(*new ShapeValue(image));
</del><ins>+        return adoptRef(*new ShapeValue(WTFMove(image)));
</ins><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    enum class Type { Shape, Box, Image };
</ins><span class="cx">     Type type() const { return m_type; }
</span><span class="cx">     BasicShape* shape() const { return m_shape.get(); }
</span><span class="cx">     CSSBoxType cssBox() const { return m_cssBox; }
</span><del>-
</del><span class="cx">     StyleImage* image() const { return m_image.get(); }
</span><del>-
</del><span class="cx">     bool isImageValid() const;
</span><span class="cx"> 
</span><del>-    void setImage(PassRefPtr&lt;StyleImage&gt; image)
</del><ins>+    void setImage(Ref&lt;StyleImage&gt;&amp;&amp; image)
</ins><span class="cx">     {
</span><del>-        ASSERT(type() == Type::Image);
-        if (m_image != image)
-            m_image = image;
</del><ins>+        ASSERT(m_type == Type::Image);
+        m_image = WTFMove(image);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     bool operator==(const ShapeValue&amp;) const;
</span><span class="lines">@@ -82,23 +72,20 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    ShapeValue(PassRefPtr&lt;BasicShape&gt; shape, CSSBoxType cssBox)
</del><ins>+    ShapeValue(RefPtr&lt;BasicShape&gt;&amp;&amp; shape, CSSBoxType cssBox)
</ins><span class="cx">         : m_type(Type::Shape)
</span><del>-        , m_shape(shape)
</del><ins>+        , m_shape(WTFMove(shape))
</ins><span class="cx">         , m_cssBox(cssBox)
</span><span class="cx">     {
</span><span class="cx">     }
</span><del>-    ShapeValue(Type type)
-        : m_type(type)
-    {
-    }
-    ShapeValue(PassRefPtr&lt;StyleImage&gt; image)
</del><ins>+
+    explicit ShapeValue(RefPtr&lt;StyleImage&gt;&amp;&amp; image)
</ins><span class="cx">         : m_type(Type::Image)
</span><del>-        , m_image(image)
</del><ins>+        , m_image(WTFMove(image))
</ins><span class="cx">     {
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    ShapeValue(CSSBoxType cssBox)
</del><ins>+    explicit ShapeValue(CSSBoxType cssBox)
</ins><span class="cx">         : m_type(Type::Box)
</span><span class="cx">         , m_cssBox(cssBox)
</span><span class="cx">     {
</span></span></pre>
</div>
</div>

</body>
</html>