<!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 "rendering" 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&& 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&& 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&& instead of RefPtr&& 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&& 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 <darin@apple.com>
+
+ Remove PassRefPtr use from "rendering" 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&& 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&& 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&& instead of RefPtr&& 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&& instead of PassRefPtr.
+ Removed unused constructor that took a type but no data.
+
</ins><span class="cx"> 2017-01-06 Chris Dumez <cdumez@apple.com>
</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->type() == ShapeValue::Type::Shape);
</span><span class="cx">
</span><del>- RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
</del><ins>+ auto list = CSSValueList::createSpaceSeparated();
</ins><span class="cx"> list->append(valueForBasicShape(style, *shapeValue->shape()));
</span><span class="cx"> if (shapeValue->cssBox() != BoxMissing)
</span><span class="cx"> list->append(CSSValuePool::singleton().createValue(shapeValue->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<CSSValueList> valueForItemPositionWithOverflowAlignment(const StyleSelfAlignmentData& 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 "CachedSVGDocumentReference.h"
</span><span class="cx"> #include "CrossfadeGeneratedImage.h"
</span><span class="cx"> #include "FilterEffectRenderer.h"
</span><ins>+#include "GraphicsContext.h"
</ins><span class="cx"> #include "ImageBuffer.h"
</span><span class="cx"> #include "RenderElement.h"
</span><span class="cx"> #include "StyleCachedImage.h"
</span><span class="lines">@@ -109,6 +110,8 @@
</span><span class="cx">
</span><span class="cx"> RefPtr<Image> CSSFilterImageValue::image(RenderElement* renderer, const FloatSize& 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 <https://bugs.webkit.org/show_bug.cgi?id=146663>.
</span><span class="cx"> ResourceLoaderOptions options = CachedResourceLoader::defaultCachedResourceOptions();
</span><del>-
- CachedResourceLoader& cachedResourceLoader = renderer->document().cachedResourceLoader();
- CachedImage* cachedImage = cachedImageForCSSValue(m_imageValue, cachedResourceLoader, options);
-
</del><ins>+ auto* cachedImage = cachedImageForCSSValue(m_imageValue, renderer->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->imageForRenderer(renderer);
-
</del><ins>+ auto* image = cachedImage->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<ImageBuffer> 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->context().drawImage(*image, imageRect);
</span><span class="cx">
</span><del>- RefPtr<FilterEffectRenderer> filterRenderer = FilterEffectRenderer::create();
</del><ins>+ auto filterRenderer = FilterEffectRenderer::create();
</ins><span class="cx"> filterRenderer->setSourceImage(WTFMove(texture));
</span><span class="cx"> filterRenderer->setSourceImageRect(imageRect);
</span><span class="cx"> filterRenderer->setFilterRegion(imageRect);
</span><del>- if (!filterRenderer->build(renderer, m_filterOperations, FilterFunction))
</del><ins>+ if (!filterRenderer->build(*renderer, m_filterOperations, FilterFunction))
</ins><span class="cx"> return Image::nullImage();
</span><span class="cx"> filterRenderer->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&)
</span><span class="cx"> {
</span><del>- for (auto it = clients().begin(), end = clients().end(); it != end; ++it)
- it->key->imageChanged(static_cast<WrappedImagePtr>(this));
</del><ins>+ for (auto& client : clients())
+ client.key->imageChanged(static_cast<WrappedImagePtr>(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<BasicShape> 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->cssBox());
</del><ins>+ return ShapeValue::create(toShape.blend(fromShape, progress), to->cssBox());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static inline PassRefPtr<FilterOperation> 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()->imageSize(anim->renderer(), 1.0) != to.image()->imageSize(anim->renderer(), 1.0))
</span><span class="cx"> return to;
</span><span class="cx">
</span><del>- RefPtr<StyleImage> 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 "FloatRect.h"
</del><span class="cx"> #include "FloatSize.h"
</span><span class="cx"> #include "ImageBuffer.h"
</span><del>-#include <wtf/RefCounted.h>
</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& 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& filterResolution)
+ : m_filterResolution(filterResolution)
+ {
+ }
+
</ins><span class="cx"> private:
</span><span class="cx"> std::unique_ptr<ImageBuffer> 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 "CachedSVGDocument.h"
</span><span class="cx"> #include "CachedSVGDocumentReference.h"
</span><del>-#include "ColorSpace.h"
-#include "Document.h"
</del><span class="cx"> #include "ElementIterator.h"
</span><span class="cx"> #include "FEColorMatrix.h"
</span><span class="cx"> #include "FEComponentTransfer.h"
</span><span class="lines">@@ -37,11 +35,11 @@
</span><span class="cx"> #include "FEDropShadow.h"
</span><span class="cx"> #include "FEGaussianBlur.h"
</span><span class="cx"> #include "FEMerge.h"
</span><del>-#include "FloatConversion.h"
-#include "Frame.h"
</del><span class="cx"> #include "RenderLayer.h"
</span><span class="cx"> #include "SVGElement.h"
</span><ins>+#include "SVGFilterBuilder.h"
</ins><span class="cx"> #include "SVGFilterPrimitiveStandardAttributes.h"
</span><ins>+#include "SourceGraphic.h"
</ins><span class="cx"> #include <algorithm>
</span><span class="cx"> #include <wtf/MathExtras.h>
</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<FilterEffectRenderer> 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() ? &sourceImage()->context() : nullptr;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<FilterEffect> FilterEffectRenderer::buildReferenceFilter(RenderElement* renderer, PassRefPtr<FilterEffect> previousEffect, ReferenceFilterOperation* filterOperation)
</del><ins>+RefPtr<FilterEffect> FilterEffectRenderer::buildReferenceFilter(RenderElement& renderer, FilterEffect& previousEffect, ReferenceFilterOperation& filterOperation)
</ins><span class="cx"> {
</span><del>- if (!renderer)
- return nullptr;
</del><ins>+ auto* cachedSVGDocumentReference = filterOperation.cachedSVGDocumentReference();
+ auto* cachedSVGDocument = cachedSVGDocumentReference ? cachedSVGDocumentReference->document() : nullptr;
</ins><span class="cx">
</span><del>- Document* document = &renderer->document();
-
- CachedSVGDocumentReference* cachedSVGDocumentReference = filterOperation->cachedSVGDocumentReference();
- CachedSVGDocument* cachedSVGDocument = cachedSVGDocumentReference ? cachedSVGDocumentReference->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 = &renderer.document();
+ else {
</ins><span class="cx"> document = cachedSVGDocument->document();
</span><ins>+ if (!document)
+ return nullptr;
+ }
</ins><span class="cx">
</span><del>- if (!document)
- return nullptr;
-
- Element* filter = document->getElementById(filterOperation->fragment());
</del><ins>+ auto* filter = document->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. <https://webkit.org/b/131085>
</span><del>- if (Element* element = renderer->element())
- document->accessSVGExtensions().addPendingResource(filterOperation->fragment(), element);
</del><ins>+ if (auto* element = renderer.element())
+ document->accessSVGExtensions().addPendingResource(filterOperation.fragment(), element);
</ins><span class="cx"> return nullptr;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> RefPtr<FilterEffect> effect;
</span><span class="cx">
</span><del>- auto builder = std::make_unique<SVGFilterBuilder>(previousEffect);
</del><ins>+ auto builder = std::make_unique<SVGFilterBuilder>(&previousEffect);
</ins><span class="cx">
</span><span class="cx"> for (auto& effectElement : childrenOfType<SVGFilterPrimitiveStandardAttributes>(*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->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& operations, FilterConsumer consumer)
</del><ins>+bool FilterEffectRenderer::build(RenderElement& renderer, const FilterOperations& 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<FilterEffect> previousEffect = m_sourceGraphic;
- for (size_t i = 0; i < operations.operations().size(); ++i) {
</del><ins>+ RefPtr<FilterEffect> previousEffect = m_sourceGraphic.ptr();
+ for (auto& operation : operations.operations()) {
</ins><span class="cx"> RefPtr<FilterEffect> effect;
</span><del>- FilterOperation& filterOperation = *operations.operations().at(i);
</del><ins>+ auto& filterOperation = *operation;
</ins><span class="cx"> switch (filterOperation.type()) {
</span><span class="cx"> case FilterOperation::REFERENCE: {
</span><del>- ReferenceFilterOperation& referenceOperation = downcast<ReferenceFilterOperation>(filterOperation);
- effect = buildReferenceFilter(renderer, previousEffect, &referenceOperation);
</del><ins>+ auto& referenceOperation = downcast<ReferenceFilterOperation>(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& colorMatrixOperation = downcast<BasicColorMatrixFilterOperation>(filterOperation);
</del><ins>+ auto& colorMatrixOperation = downcast<BasicColorMatrixFilterOperation>(filterOperation);
</ins><span class="cx"> Vector<float> 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& colorMatrixOperation = downcast<BasicColorMatrixFilterOperation>(filterOperation);
</del><ins>+ auto& colorMatrixOperation = downcast<BasicColorMatrixFilterOperation>(filterOperation);
</ins><span class="cx"> Vector<float> 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& colorMatrixOperation = downcast<BasicColorMatrixFilterOperation>(filterOperation);
</del><ins>+ auto& colorMatrixOperation = downcast<BasicColorMatrixFilterOperation>(filterOperation);
</ins><span class="cx"> Vector<float> 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& colorMatrixOperation = downcast<BasicColorMatrixFilterOperation>(filterOperation);
</del><ins>+ auto& colorMatrixOperation = downcast<BasicColorMatrixFilterOperation>(filterOperation);
</ins><span class="cx"> Vector<float> 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& componentTransferOperation = downcast<BasicComponentTransferFilterOperation>(filterOperation);
</del><ins>+ auto& componentTransferOperation = downcast<BasicComponentTransferFilterOperation>(filterOperation);
</ins><span class="cx"> ComponentTransferFunction transferFunction;
</span><span class="cx"> transferFunction.type = FECOMPONENTTRANSFER_TYPE_TABLE;
</span><span class="cx"> Vector<float> 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& componentTransferOperation = downcast<BasicComponentTransferFilterOperation>(filterOperation);
</del><ins>+ auto& componentTransferOperation = downcast<BasicComponentTransferFilterOperation>(filterOperation);
</ins><span class="cx"> ComponentTransferFunction transferFunction;
</span><span class="cx"> transferFunction.type = FECOMPONENTTRANSFER_TYPE_TABLE;
</span><span class="cx"> Vector<float> 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& componentTransferOperation = downcast<BasicComponentTransferFilterOperation>(filterOperation);
</del><ins>+ auto& componentTransferOperation = downcast<BasicComponentTransferFilterOperation>(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& componentTransferOperation = downcast<BasicComponentTransferFilterOperation>(filterOperation);
</del><ins>+ auto& componentTransferOperation = downcast<BasicComponentTransferFilterOperation>(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& blurOperation = downcast<BlurFilterOperation>(filterOperation);
</del><ins>+ auto& blurOperation = downcast<BlurFilterOperation>(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& dropShadowOperation = downcast<DropShadowFilterOperation>(filterOperation);
</del><ins>+ auto& dropShadowOperation = downcast<DropShadowFilterOperation>(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->setOperatingColorSpace(ColorSpaceSRGB);
</span><span class="cx">
</span><span class="cx"> if (filterOperation.type() != FilterOperation::REFERENCE) {
</span><del>- effect->inputEffects().append(previousEffect);
- m_effects.append(effect);
</del><ins>+ effect->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()->logicalSize() != logicalSize) {
</del><ins>+
+ if (m_graphicsBufferAttached)
+ return;
+
+ IntSize logicalSize { m_sourceDrawingRegion.size() };
+ if (!sourceImage() || sourceImage()->logicalSize() != logicalSize) {
</ins><span class="cx"> #if USE(DIRECT2D)
</span><del>- setSourceImage(ImageBuffer::create(logicalSize, renderingMode(), &targetContext, filterScale()));
</del><ins>+ setSourceImage(ImageBuffer::create(logicalSize, renderingMode(), &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->clearResult();
</span><del>- for (size_t i = 0; i < m_effects.size(); ++i)
- m_effects[i]->clearResult();
</del><ins>+ for (auto& effect : m_effects)
+ effect->clearResult();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void FilterEffectRenderer::apply()
</span><span class="cx"> {
</span><del>- RefPtr<FilterEffect> effect = lastEffect();
- effect->apply();
- effect->transformResultColorSpace(ColorSpaceSRGB);
</del><ins>+ auto& 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& filterBoxRect, const LayoutRect& dirtyRect)
</span><span class="cx"> {
</span><span class="cx"> // The result of this function is the area in the "filterBoxRect" that needs to be repainted, so that we fully cover the "dirtyRect".
</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 -> 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& filterBoxRect, const LayoutRect& dirtyRect, const LayoutRect& layerRepaintRect)
</del><ins>+ImageBuffer* FilterEffectRenderer::output() const
</ins><span class="cx"> {
</span><del>- ASSERT(m_haveFilterEffect && renderLayer->filterRenderer());
- m_renderLayer = renderLayer;
- m_repaintRect = dirtyRect;
</del><ins>+ return const_cast<FilterEffect&>(m_effects.last().get()).asImageBuffer();
+}
</ins><span class="cx">
</span><del>- FilterEffectRenderer* filter = renderLayer->filterRenderer();
- LayoutRect filterSourceRect = filter->computeSourceImageRectForDirtyRect(filterBoxRect, dirtyRect);
- m_paintOffset = filterSourceRect.location();
</del><ins>+void FilterEffectRenderer::setMaxEffectRects(const FloatRect& effectRect)
+{
+ for (auto& effect : m_effects)
+ effect->setMaxEffectRect(effectRect);
+}
</ins><span class="cx">
</span><ins>+IntRect FilterEffectRenderer::outputRect() const
+{
+ auto& lastEffect = const_cast<FilterEffect&>(m_effects.last().get());
+ if (!lastEffect.hasResult())
+ return { };
+ return lastEffect.requestedRegionOfInputImageData(IntRect { m_filterRegion });
+}
+
+bool FilterEffectRendererHelper::prepareFilterEffect(RenderLayer& layer, const LayoutRect& filterBoxRect, const LayoutRect& dirtyRect, const LayoutRect& layerRepaintRect)
+{
+ ASSERT(m_haveFilterEffect);
+ ASSERT(layer.filterRenderer());
+
+ auto& 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->updateBackingStoreRect(filterSourceRect);
- if (filter->hasFilterThatMovesPixels()) {
</del><ins>+
+ bool hasUpdatedBackingStore = filter.updateBackingStoreRect(filterSourceRect);
+
+ m_renderLayer = &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->filterRenderer();
- return filter->inputContext();
</del><ins>+ return m_renderLayer->filterRenderer()->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->filterRenderer();
- filter->allocateBackingStoreIfNeeded(m_targetContext);
</del><ins>+ ASSERT(m_renderLayer->filterRenderer());
+
+ auto& filter = *m_renderLayer->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->inputContext();
- if (!sourceGraphicsContext || filter->filterRegion().isEmpty() || ImageBuffer::sizeNeedsClamping(filter->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->save();
</span><span class="cx"> sourceGraphicsContext->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& destinationContext)
</span><span class="cx"> {
</span><del>- ASSERT(m_haveFilterEffect && m_renderLayer->filterRenderer());
- FilterEffectRenderer* filter = m_renderLayer->filterRenderer();
- filter->inputContext()->restore();
</del><ins>+ ASSERT(m_haveFilterEffect);
+ ASSERT(m_renderLayer);
+ ASSERT(m_renderLayer->filterRenderer());
+ ASSERT(m_renderLayer->filterRenderer()->inputContext());
</ins><span class="cx">
</span><del>- filter->apply();
-
</del><ins>+ auto& filter = *m_renderLayer->filterRenderer();
+ filter.inputContext()->restore();
+
+ filter.apply();
+
</ins><span class="cx"> // Get the filtered output and draw it in place.
</span><del>- LayoutRect destRect = filter->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->output())
</del><ins>+ if (auto* outputBuffer = filter.output())
</ins><span class="cx"> destinationContext.drawImageBuffer(*outputBuffer, snapRectToDevicePixels(destRect, m_renderLayer->renderer().document().deviceScaleFactor()));
</span><span class="cx">
</span><del>- filter->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 "Filter.h"
</span><del>-#include "FilterEffect.h"
-#include "FilterOperations.h"
-#include "FloatRect.h"
-#include "GraphicsContext.h"
-#include "ImageBuffer.h"
</del><span class="cx"> #include "IntRectExtent.h"
</span><span class="cx"> #include "LayoutRect.h"
</span><del>-#include "SVGFilterBuilder.h"
-#include "SourceGraphic.h"
-#include <wtf/RefCounted.h>
-#include <wtf/RefPtr.h>
</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<RefPtr<FilterEffect>> 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& targetContext)
- : m_targetContext(targetContext)
- , m_haveFilterEffect(haveFilterEffect)
- {
- }
-
</del><ins>+ FilterEffectRendererHelper(bool haveFilterEffect, GraphicsContext& 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& filterBoxRect, const LayoutRect& dirtyRect, const LayoutRect& layerRepaintRect);
</del><ins>+ bool prepareFilterEffect(RenderLayer&, const LayoutRect& filterBoxRect, const LayoutRect& dirtyRect, const LayoutRect& layerRepaintRect);
</ins><span class="cx"> bool beginFilterEffect();
</span><span class="cx"> void applyFilterEffect(GraphicsContext& 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<FilterEffectRenderer> create()
- {
- return adoptRef(new FilterEffectRenderer);
- }
</del><ins>+ friend class FilterEffectRendererHelper;
</ins><span class="cx">
</span><del>- void setSourceImageRect(const FloatRect& sourceImageRect)
- {
- m_sourceDrawingRegion = sourceImageRect;
- setMaxEffectRects(sourceImageRect);
- setFilterRegion(sourceImageRect);
- m_graphicsBufferAttached = false;
- }
- FloatRect sourceImageRect() const override { return m_sourceDrawingRegion; }
</del><ins>+ static Ref<FilterEffectRenderer> create();
</ins><span class="cx">
</span><ins>+ void setSourceImageRect(const FloatRect&);
</ins><span class="cx"> void setFilterRegion(const FloatRect& 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()->asImageBuffer(); }
</del><ins>+ ImageBuffer* output() const;
</ins><span class="cx">
</span><del>- bool build(RenderElement*, const FilterOperations&, FilterConsumer);
- RefPtr<FilterEffect> buildReferenceFilter(RenderElement*, PassRefPtr<FilterEffect> previousEffect, ReferenceFilterOperation*);
- bool updateBackingStoreRect(const FloatRect& filterRect);
- void allocateBackingStoreIfNeeded(const GraphicsContext&);
</del><ins>+ bool build(RenderElement&, const FilterOperations&, FilterConsumer);
</ins><span class="cx"> void clearIntermediateResults();
</span><span class="cx"> void apply();
</span><del>-
- IntRect outputRect() const { return lastEffect()->hasResult() ? lastEffect()->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& filterBoxRect, const LayoutRect& dirtyRect);
</del><span class="cx">
</span><span class="cx"> private:
</span><del>- void setMaxEffectRects(const FloatRect& effectRect)
- {
- for (size_t i = 0; i < m_effects.size(); ++i) {
- RefPtr<FilterEffect> effect = m_effects.at(i);
- effect->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<FilterEffect> buildReferenceFilter(RenderElement&, FilterEffect& previousEffect, ReferenceFilterOperation&);
+
+ void setMaxEffectRects(const FloatRect&);
+
+ GraphicsContext* inputContext();
+
+ bool updateBackingStoreRect(const FloatRect& filterRect);
+ void allocateBackingStoreIfNeeded(const GraphicsContext&);
+
+ IntRect outputRect() const;
+
+ LayoutRect computeSourceImageRectForDirtyRect(const LayoutRect& filterBoxRect, const LayoutRect& dirtyRect);
+
</ins><span class="cx"> FloatRect m_sourceDrawingRegion;
</span><span class="cx"> FloatRect m_filterRegion;
</span><del>-
- FilterEffectList m_effects;
- RefPtr<SourceGraphic> m_sourceGraphic;
-
</del><ins>+
+ Vector<Ref<FilterEffect>> m_effects;
+ Ref<SourceGraphic> 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& targetContext)
+ : m_targetContext(targetContext)
+ , m_haveFilterEffect(haveFilterEffect)
+{
+}
+
+inline void FilterEffectRenderer::setSourceImageRect(const FloatRect& 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 && renderer->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->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& context, PaintLayerFlags paintFlags) const
</del><ins>+std::pair<RenderLayer::FilterInfo*, std::unique_ptr<FilterEffectRendererHelper>> RenderLayer::filterPainter(GraphicsContext& 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 & PaintLayerPaintingOverlayScrollbars)
</span><del>- return false;
</del><ins>+ return { };
</ins><span class="cx">
</span><del>- FilterInfo* filterInfo = FilterInfo::getIfExists(*this);
- bool hasPaintedFilter = filterInfo && filterInfo->renderer() && paintsWithFilters();
- if (!hasPaintedFilter)
- return false;
</del><ins>+ if (!paintsWithFilters())
+ return { };
</ins><span class="cx">
</span><del>- auto filterPainter = std::make_unique<FilterEffectRendererHelper>(hasPaintedFilter, context);
- if (!filterPainter->haveFilterEffect())
- return false;
</del><ins>+ auto* info = FilterInfo::getIfExists(*this);
+ if (!info || !info->renderer())
+ return { };
</ins><span class="cx">
</span><del>- return true;
</del><ins>+ auto helper = std::make_unique<FilterEffectRendererHelper>(true, context);
+ if (!helper->haveFilterEffect())
+ return { };
+
+ return { info, WTFMove(helper) };
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+bool RenderLayer::hasFilterThatIsPainting(GraphicsContext& context, PaintLayerFlags paintFlags) const
+{
+ return !!filterPainter(context, paintFlags).first;
+}
+
</ins><span class="cx"> std::unique_ptr<FilterEffectRendererHelper> RenderLayer::setupFilters(GraphicsContext& context, LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags, const LayoutSize& offsetFromRoot, LayoutRect& rootRelativeBounds, bool& 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 && filterInfo->renderer() && paintsWithFilters();
- auto filterPainter = std::make_unique<FilterEffectRendererHelper>(hasPaintedFilter, context);
</del><ins>+ auto& filterInfo = *painter.first;
+ auto& filterPainter = *painter.second;
</ins><span class="cx">
</span><del>- LayoutRect filterRepaintRect = filterInfo->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->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->resetDirtySourceRect();
</del><ins>+ if (!filterPainter.prepareFilterEffect(*this, enclosingIntRect(rootRelativeBounds), enclosingIntRect(paintingInfo.paintDirtyRect), enclosingIntRect(filterRepaintRect)))
+ return nullptr;
</ins><span class="cx">
</span><del>- if (!filterPainter->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->hasStartedFilterEffect());
</del><ins>+ if (!filterPainter.beginFilterEffect())
+ return nullptr;
</ins><span class="cx">
</span><del>- 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()->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()->hasFilterThatMovesPixels();
+
+ return WTFMove(painter.second);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void RenderLayer::applyFilters(FilterEffectRendererHelper* filterPainter, GraphicsContext& originalContext, const LayerPaintingInfo& paintingInfo, const LayerFragments& 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()->build(&renderer(), renderer().style().filter(), FilterProperty))
</del><ins>+ if (!filterInfo.renderer()->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&, const LayerPaintingInfo&, const LayoutSize& offsetFromRoot, LayoutRect& rootRelativeBounds, bool& rootRelativeBoundsComputed);
</span><span class="cx">
</span><ins>+ class FilterInfo;
+ std::pair<FilterInfo*, std::unique_ptr<FilterEffectRendererHelper>> filterPainter(GraphicsContext&, PaintLayerFlags) const;
</ins><span class="cx"> bool hasFilterThatIsPainting(GraphicsContext&, PaintLayerFlags) const;
</span><span class="cx"> std::unique_ptr<FilterEffectRendererHelper> setupFilters(GraphicsContext&, LayerPaintingInfo&, PaintLayerFlags, const LayoutSize& offsetFromRoot, LayoutRect& rootRelativeBounds, bool& rootRelativeBoundsComputed);
</span><span class="cx"> void applyFilters(FilterEffectRendererHelper*, GraphicsContext& originalContext, const LayerPaintingInfo&, const LayerFragments&);
</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<RenderLayerBacking> 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<ContentData> 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->next()) {
</del><ins>+ auto* lastNewData = result.get();
+ for (auto* contentData = next(); contentData; contentData = contentData->next()) {
</ins><span class="cx"> auto newData = contentData->cloneInternal();
</span><span class="cx"> lastNewData->setNext(WTFMove(newData));
</span><span class="cx"> lastNewData = lastNewData->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<RenderObject> ImageContentData::createContentRenderer(Document& document, const RenderStyle& pseudoStyle) const
</span><span class="cx"> {
</span><del>- auto image = createRenderer<RenderImage>(document, RenderStyle::createStyleInheritingFromPseudoStyle(pseudoStyle), m_image.get());
</del><ins>+ auto image = createRenderer<RenderImage>(document, RenderStyle::createStyleInheritingFromPseudoStyle(pseudoStyle), const_cast<StyleImage*>(m_image.ptr()));
</ins><span class="cx"> image->initializeStyle();
</span><span class="cx"> image->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<StyleImage> image)
</del><ins>+ explicit ImageContentData(Ref<StyleImage>&& 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& image() const { return *m_image; }
- void setImage(PassRefPtr<StyleImage> image)
</del><ins>+ const StyleImage& image() const { return m_image.get(); }
+ void setImage(Ref<StyleImage>&& 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<RenderObject> createContentRenderer(Document&, const RenderStyle&) const override;
-
</del><span class="cx"> private:
</span><del>- std::unique_ptr<ContentData> cloneInternal() const override
</del><ins>+ RenderPtr<RenderObject> createContentRenderer(Document&, const RenderStyle&) const final;
+ std::unique_ptr<ContentData> cloneInternal() const final
</ins><span class="cx"> {
</span><del>- std::unique_ptr<ContentData> image = std::make_unique<ImageContentData>(m_image.get());
</del><ins>+ auto image = std::make_unique<ImageContentData>(m_image.copyRef());
</ins><span class="cx"> image->setAltText(altText());
</span><del>-
- return image;
</del><ins>+ return WTFMove(image);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- RefPtr<StyleImage> m_image;
</del><ins>+ Ref<StyleImage> m_image;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> inline bool operator==(const ImageContentData& a, const ImageContentData& b)
</span><span class="cx"> {
</span><del>- return a.image() == b.image();
</del><ins>+ return &a.image() == &b.image();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> inline bool operator!=(const ImageContentData& a, const ImageContentData& b)
</span><span class="lines">@@ -128,10 +124,9 @@
</span><span class="cx"> const String& text() const { return m_text; }
</span><span class="cx"> void setText(const String& text) { m_text = text; }
</span><span class="cx">
</span><del>- RenderPtr<RenderObject> createContentRenderer(Document&, const RenderStyle&) const override;
-
</del><span class="cx"> private:
</span><del>- std::unique_ptr<ContentData> cloneInternal() const override { return std::make_unique<TextContentData>(text()); }
</del><ins>+ RenderPtr<RenderObject> createContentRenderer(Document&, const RenderStyle&) const final;
+ std::unique_ptr<ContentData> cloneInternal() const final { return std::make_unique<TextContentData>(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<RenderObject> createContentRenderer(Document&, const RenderStyle&) const override;
-
</del><span class="cx"> private:
</span><del>- std::unique_ptr<ContentData> cloneInternal() const override
</del><ins>+ RenderPtr<RenderObject> createContentRenderer(Document&, const RenderStyle&) const final;
+ std::unique_ptr<ContentData> cloneInternal() const final
</ins><span class="cx"> {
</span><del>- auto counterData = std::make_unique<CounterContent>(counter());
- return std::make_unique<CounterContentData>(WTFMove(counterData));
</del><ins>+ return std::make_unique<CounterContentData>(std::make_unique<CounterContent>(counter()));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> std::unique_ptr<CounterContent> 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<RenderObject> createContentRenderer(Document&, const RenderStyle&) const override;
-
</del><span class="cx"> private:
</span><del>- std::unique_ptr<ContentData> cloneInternal() const override { return std::make_unique<QuoteContentData>(quote()); }
</del><ins>+ RenderPtr<RenderObject> createContentRenderer(Document&, const RenderStyle&) const final;
+ std::unique_ptr<ContentData> cloneInternal() const final { return std::make_unique<QuoteContentData>(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<NinePieceImageData>& defaultData()
</del><ins>+inline DataRef<NinePieceImage::Data>& NinePieceImage::defaultData()
</ins><span class="cx"> {
</span><del>- static NeverDestroyed<DataRef<NinePieceImageData>> data(NinePieceImageData::create());
</del><ins>+ static NeverDestroyed<DataRef<Data>> 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<StyleImage> image, LengthBox imageSlices, bool fill, LengthBox borderSlices, LengthBox outset, ENinePieceImageRule horizontalRule, ENinePieceImageRule verticalRule)
- : m_data(NinePieceImageData::create())
</del><ins>+NinePieceImage::NinePieceImage(RefPtr<StyleImage>&& 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()->image = image;
- m_data.access()->imageSlices = WTFMove(imageSlices);
- m_data.access()->borderSlices = WTFMove(borderSlices);
- m_data.access()->outset = WTFMove(outset);
- m_data.access()->fill = fill;
- m_data.access()->horizontalRule = horizontalRule;
- m_data.access()->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& graphicsContext, RenderElement* renderer, const RenderStyle& style, const LayoutRect& destination, const LayoutSize& source, float deviceScaleFactor, CompositeOperator op) const
</span><span class="cx"> {
</span><span class="cx"> StyleImage* styleImage = image();
</span><del>- ASSERT(styleImage && styleImage->isLoaded());
</del><ins>+ ASSERT(styleImage);
+ ASSERT(styleImage->isLoaded());
</ins><span class="cx">
</span><span class="cx"> LayoutBoxExtent sourceSlices = computeSlices(source, imageSlices(), styleImage->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& other)
- : RefCounted<NinePieceImageData>()
</del><ins>+inline NinePieceImage::Data::Data(RefPtr<StyleImage>&& 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& other)
+ : RefCounted<Data>()
</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<NinePieceImageData> NinePieceImageData::copy() const
</del><ins>+inline Ref<NinePieceImage::Data> 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& other) const
</del><ins>+inline Ref<NinePieceImage::Data> NinePieceImage::Data::create(RefPtr<StyleImage>&& 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<NinePieceImage::Data> NinePieceImage::Data::copy() const
+{
+ return adoptRef(*new Data(*this));
+}
+
+bool NinePieceImage::Data::operator==(const Data& other) const
+{
</ins><span class="cx"> return arePointingToEqualData(image, other.image)
</span><span class="cx"> && imageSlices == other.imageSlices
</span><span class="cx"> && 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 "DataRef.h"
</span><del>-#include "LayoutRect.h"
-#include "LayoutSize.h"
-#include "LayoutUnit.h"
</del><span class="cx"> #include "LengthBox.h"
</span><span class="cx"> #include "StyleImage.h"
</span><span class="cx"> #include <wtf/Vector.h>
</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<NinePieceImageData> {
-public:
- static Ref<NinePieceImageData> create() { return adoptRef(*new NinePieceImageData); }
- Ref<NinePieceImageData> copy() const;
-
- bool operator==(const NinePieceImageData&) const;
- bool operator!=(const NinePieceImageData& o) const { return !(*this == o); }
-
- bool fill : 1;
- unsigned horizontalRule : 2; // ENinePieceImageRule
- unsigned verticalRule : 2; // ENinePieceImageRule
- RefPtr<StyleImage> image;
- LengthBox imageSlices;
- LengthBox borderSlices;
- LengthBox outset;
-
-private:
- NinePieceImageData();
- NinePieceImageData(const NinePieceImageData&);
-};
-
</del><span class="cx"> class NinePieceImage {
</span><span class="cx"> public:
</span><span class="cx"> NinePieceImage();
</span><del>- NinePieceImage(PassRefPtr<StyleImage>, LengthBox imageSlices, bool fill, LengthBox borderSlices, LengthBox outset, ENinePieceImageRule horizontalRule, ENinePieceImageRule verticalRule);
</del><ins>+ NinePieceImage(RefPtr<StyleImage>&&, LengthBox imageSlices, bool fill, LengthBox borderSlices, LengthBox outset, ENinePieceImageRule horizontalRule, ENinePieceImageRule verticalRule);
</ins><span class="cx">
</span><span class="cx"> bool operator==(const NinePieceImage& other) const { return m_data == other.m_data; }
</span><span class="cx"> bool operator!=(const NinePieceImage& 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->image; }
</span><span class="cx"> StyleImage* image() const { return m_data->image.get(); }
</span><del>- void setImage(PassRefPtr<StyleImage> image) { m_data.access()->image = image; }
-
</del><ins>+ void setImage(RefPtr<StyleImage>&& image) { m_data.access()->image = WTFMove(image); }
+
</ins><span class="cx"> const LengthBox& imageSlices() const { return m_data->imageSlices; }
</span><span class="cx"> void setImageSlices(LengthBox slices) { m_data.access()->imageSlices = WTFMove(slices); }
</span><span class="cx">
</span><span class="lines">@@ -206,7 +182,31 @@
</span><span class="cx"> void paint(GraphicsContext&, RenderElement*, const RenderStyle&, const LayoutRect& destination, const LayoutSize& source, float deviceScaleFactor, CompositeOperator) const;
</span><span class="cx">
</span><span class="cx"> private:
</span><del>- DataRef<NinePieceImageData> m_data;
</del><ins>+ struct Data : RefCounted<Data> {
+ static Ref<Data> create();
+ static Ref<Data> create(RefPtr<StyleImage>&&, LengthBox imageSlices, bool fill, LengthBox borderSlices, LengthBox outset, ENinePieceImageRule horizontalRule, ENinePieceImageRule verticalRule);
+ Ref<Data> copy() const;
+
+ bool operator==(const Data&) const;
+ bool operator!=(const Data& other) const { return !(*this == other); }
+
+ bool fill : 1;
+ unsigned horizontalRule : 2; // ENinePieceImageRule
+ unsigned verticalRule : 2; // ENinePieceImageRule
+ RefPtr<StyleImage> 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<StyleImage>&&, LengthBox imageSlices, bool fill, LengthBox borderSlices, LengthBox outset, ENinePieceImageRule horizontalRule, ENinePieceImageRule verticalRule);
+ Data(const Data&);
+ };
+
+ static DataRef<Data>& defaultData();
+
+ DataRef<Data> m_data;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> TextStream& operator<<(TextStream&, const NinePieceImage&);
</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<ImageContentData>(image));
</del><ins>+ appendContent(std::make_unique<ImageContentData>(image.releaseNonNull()));
</ins><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- rareNonInheritedData.access()->m_content = std::make_unique<ImageContentData>(WTFMove(image));
</del><ins>+ rareNonInheritedData.access()->m_content = std::make_unique<ImageContentData>(image.releaseNonNull());
</ins><span class="cx"> if (!rareNonInheritedData.access()->m_altText.isNull())
</span><span class="cx"> rareNonInheritedData.access()->m_content->setAltText(rareNonInheritedData.access()->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 "config.h"
</span><del>-
</del><span class="cx"> #include "ShapeValue.h"
</span><span class="cx">
</span><span class="cx"> #include "CachedImage.h"
</span><ins>+#include <wtf/PointerComparison.h>
</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()->isCachedImage())
- return image()->cachedImage() && image()->cachedImage()->hasImage();
- return image()->isGeneratedImage();
</del><ins>+ if (m_image->isCachedImage()) {
+ auto* cachedImage = m_image->cachedImage();
+ return cachedImage && cachedImage->hasImage();
+ }
+ return m_image->isGeneratedImage();
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-template <typename T>
-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& 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())
- && pointersOrValuesEqual(m_image.get(), other.m_image.get());
</del><ins>+ return m_type == other.m_type
+ && m_cssBox == other.m_cssBox
+ && arePointingToEqualData(m_shape, other.m_shape)
+ && 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 "BasicShapes.h"
</span><del>-#include "CSSValueKeywords.h"
</del><span class="cx"> #include "StyleImage.h"
</span><del>-#include <wtf/PassRefPtr.h>
</del><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><span class="cx"> class ShapeValue : public RefCounted<ShapeValue> {
</span><span class="cx"> public:
</span><del>- enum class Type {
- // The None value is defined by a null ShapeValue*
- Shape,
- Box,
- Image
- };
-
- static Ref<ShapeValue> createShapeValue(PassRefPtr<BasicShape> shape, CSSBoxType cssBox)
</del><ins>+ static Ref<ShapeValue> create(RefPtr<BasicShape>&& 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<ShapeValue> createBoxShapeValue(CSSBoxType boxShape)
</del><ins>+ static Ref<ShapeValue> 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<ShapeValue> createImageValue(PassRefPtr<StyleImage> image)
</del><ins>+ static Ref<ShapeValue> create(RefPtr<StyleImage>&& 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<StyleImage> image)
</del><ins>+ void setImage(Ref<StyleImage>&& 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&) 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<BasicShape> shape, CSSBoxType cssBox)
</del><ins>+ ShapeValue(RefPtr<BasicShape>&& 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<StyleImage> image)
</del><ins>+
+ explicit ShapeValue(RefPtr<StyleImage>&& 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>