<!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>[167208] 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/167208">167208</a></dd>
<dt>Author</dt> <dd>darin@apple.com</dd>
<dt>Date</dt> <dd>2014-04-13 21:28:25 -0700 (Sun, 13 Apr 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Use unique_ptr for FillLayer::m_next
https://bugs.webkit.org/show_bug.cgi?id=75222

Reviewed by Dan Bernstein.

* css/DeprecatedStyleBuilder.cpp:
(WebCore::ApplyPropertyFillLayer::applyInheritValue):
Renamed currChild to just child and prevChild to previousChild.
Changed code to pass ownership of the new FillLayer immediately.
Changed some loops to be for loops.
(WebCore::ApplyPropertyFillLayer::applyInitialValue): Ditto.
(WebCore::ApplyPropertyFillLayer::applyValue): Ditto.

* rendering/RenderBox.cpp:
(WebCore::RenderBox::backgroundHasOpaqueTopLayer): Use reference
instead of pointer.
(WebCore::RenderBox::paintFillLayers): Ditto.
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::paintFillLayerExtended): Ditto.

* rendering/style/FillLayer.cpp:
(WebCore::FillLayer::FillLayer): Removed m_next initializer since it is now an
OwnPtr and initializes automatically. In a couple other places, changed m_next
initializer to use make_unique.
(WebCore::FillLayer::~FillLayer): Wrote loop for deletion of m_next.
(WebCore::FillLayer::operator=): Removed unneeded explicit deletion of m_next.
(WebCore::FillLayer::cullEmptyLayers): Ditto.
(WebCore::clipMax): Marked inline.
(WebCore::FillLayer::computeClipMax): Rewrote to use a loop instead of recursion.
(WebCore::FillLayer::containsImage): Ditto.
(WebCore::FillLayer::imagesAreLoaded): Ditto.
(WebCore::FillLayer::hasOpaqueImage): Rewrote to use &amp;&amp; instead of multiple if.
(WebCore::FillLayer::hasImage): Rewrote to use a loop instead of recursion.
(WebCore::FillLayer::hasFixedImage): Ditto.

* rendering/style/FillLayer.h: Changed m_next to be a unique_ptr.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorecssDeprecatedStyleBuildercpp">trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderBoxcpp">trunk/Source/WebCore/rendering/RenderBox.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderBoxModelObjectcpp">trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingstyleFillLayercpp">trunk/Source/WebCore/rendering/style/FillLayer.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingstyleFillLayerh">trunk/Source/WebCore/rendering/style/FillLayer.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (167207 => 167208)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-04-14 02:57:33 UTC (rev 167207)
+++ trunk/Source/WebCore/ChangeLog        2014-04-14 04:28:25 UTC (rev 167208)
</span><span class="lines">@@ -1,3 +1,42 @@
</span><ins>+2014-04-12  Darin Adler  &lt;darin@apple.com&gt;
+
+        Use unique_ptr for FillLayer::m_next
+        https://bugs.webkit.org/show_bug.cgi?id=75222
+
+        Reviewed by Dan Bernstein.
+
+        * css/DeprecatedStyleBuilder.cpp:
+        (WebCore::ApplyPropertyFillLayer::applyInheritValue):
+        Renamed currChild to just child and prevChild to previousChild.
+        Changed code to pass ownership of the new FillLayer immediately.
+        Changed some loops to be for loops.
+        (WebCore::ApplyPropertyFillLayer::applyInitialValue): Ditto.
+        (WebCore::ApplyPropertyFillLayer::applyValue): Ditto.
+
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::backgroundHasOpaqueTopLayer): Use reference
+        instead of pointer.
+        (WebCore::RenderBox::paintFillLayers): Ditto.
+        * rendering/RenderBoxModelObject.cpp:
+        (WebCore::RenderBoxModelObject::paintFillLayerExtended): Ditto.
+
+        * rendering/style/FillLayer.cpp:
+        (WebCore::FillLayer::FillLayer): Removed m_next initializer since it is now an
+        OwnPtr and initializes automatically. In a couple other places, changed m_next
+        initializer to use make_unique.
+        (WebCore::FillLayer::~FillLayer): Wrote loop for deletion of m_next.
+        (WebCore::FillLayer::operator=): Removed unneeded explicit deletion of m_next.
+        (WebCore::FillLayer::cullEmptyLayers): Ditto.
+        (WebCore::clipMax): Marked inline.
+        (WebCore::FillLayer::computeClipMax): Rewrote to use a loop instead of recursion.
+        (WebCore::FillLayer::containsImage): Ditto.
+        (WebCore::FillLayer::imagesAreLoaded): Ditto.
+        (WebCore::FillLayer::hasOpaqueImage): Rewrote to use &amp;&amp; instead of multiple if.
+        (WebCore::FillLayer::hasImage): Rewrote to use a loop instead of recursion.
+        (WebCore::FillLayer::hasFixedImage): Ditto.
+
+        * rendering/style/FillLayer.h: Changed m_next to be a unique_ptr.
+
</ins><span class="cx"> 2014-04-13  Andy Estes  &lt;aestes@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [QuickLook] Move file system-related code into WebKit
</span></span></pre></div>
<a id="trunkSourceWebCorecssDeprecatedStyleBuildercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp (167207 => 167208)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp        2014-04-14 02:57:33 UTC (rev 167207)
+++ trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp        2014-04-14 04:28:25 UTC (rev 167208)
</span><span class="lines">@@ -520,72 +520,60 @@
</span><span class="cx">         if (*(styleResolver-&gt;parentStyle()-&gt;*layersFunction)() == *(styleResolver-&gt;style()-&gt;*layersFunction)())
</span><span class="cx">             return;
</span><span class="cx"> 
</span><del>-        FillLayer* currChild = (styleResolver-&gt;style()-&gt;*accessLayersFunction)();
-        FillLayer* prevChild = 0;
-        const FillLayer* currParent = (styleResolver-&gt;parentStyle()-&gt;*layersFunction)();
-        while (currParent &amp;&amp; (currParent-&gt;*testFunction)()) {
-            if (!currChild) {
-                /* Need to make a new layer.*/
-                currChild = new FillLayer(fillLayerType);
-                prevChild-&gt;setNext(currChild);
</del><ins>+        auto* child = (styleResolver-&gt;style()-&gt;*accessLayersFunction)();
+        FillLayer* previousChild = nullptr;
+        for (auto* parent = (styleResolver-&gt;parentStyle()-&gt;*layersFunction)(); parent &amp;&amp; (parent-&gt;*testFunction)(); parent = parent-&gt;next()) {
+            if (!child) {
+                previousChild-&gt;setNext(std::make_unique&lt;FillLayer&gt;(fillLayerType));
+                child = previousChild-&gt;next();
</ins><span class="cx">             }
</span><del>-            (currChild-&gt;*setFunction)((currParent-&gt;*getFunction)());
-            prevChild = currChild;
-            currChild = prevChild-&gt;next();
-            currParent = currParent-&gt;next();
</del><ins>+            (child-&gt;*setFunction)((parent-&gt;*getFunction)());
+            previousChild = child;
+            child = previousChild-&gt;next();
</ins><span class="cx">         }
</span><del>-
-        while (currChild) {
-            /* Reset any remaining layers to not have the property set. */
-            (currChild-&gt;*clearFunction)();
-            currChild = currChild-&gt;next();
-        }
</del><ins>+        for (; child; child = child-&gt;next())
+            (child-&gt;*clearFunction)();
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver)
</span><span class="cx">     {
</span><span class="cx">         // Check for (single-layer) no-op before clearing anything.
</span><span class="cx">         const FillLayer&amp; layers = *(styleResolver-&gt;style()-&gt;*layersFunction)();
</span><del>-        bool firstLayerHasValue = (layers.*testFunction)();
-        if (!layers.next() &amp;&amp; (!firstLayerHasValue || (layers.*getFunction)() == (*initialFunction)(fillLayerType)))
</del><ins>+        if (!layers.next() &amp;&amp; (!(layers.*testFunction)() || (layers.*getFunction)() == (*initialFunction)(fillLayerType)))
</ins><span class="cx">             return;
</span><span class="cx"> 
</span><del>-        FillLayer* currChild = (styleResolver-&gt;style()-&gt;*accessLayersFunction)();
-        (currChild-&gt;*setFunction)((*initialFunction)(fillLayerType));
-        for (currChild = currChild-&gt;next(); currChild; currChild = currChild-&gt;next())
-            (currChild-&gt;*clearFunction)();
</del><ins>+        FillLayer* child = (styleResolver-&gt;style()-&gt;*accessLayersFunction)();
+        (child-&gt;*setFunction)((*initialFunction)(fillLayerType));
+        for (child = child-&gt;next(); child; child = child-&gt;next())
+            (child-&gt;*clearFunction)();
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
</span><span class="cx">     {
</span><del>-        FillLayer* currChild = (styleResolver-&gt;style()-&gt;*accessLayersFunction)();
-        FillLayer* prevChild = 0;
</del><ins>+        FillLayer* child = (styleResolver-&gt;style()-&gt;*accessLayersFunction)();
+        FillLayer* previousChild = nullptr;
</ins><span class="cx">         if (value-&gt;isValueList()
</span><span class="cx"> #if ENABLE(CSS_IMAGE_SET)
</span><span class="cx">         &amp;&amp; !value-&gt;isImageSetValue()
</span><span class="cx"> #endif
</span><span class="cx">         ) {
</span><del>-            /* Walk each value and put it into a layer, creating new layers as needed. */
-            CSSValueList* valueList = toCSSValueList(value);
-            for (unsigned int i = 0; i &lt; valueList-&gt;length(); i++) {
-                if (!currChild) {
-                    /* Need to make a new layer to hold this value */
-                    currChild = new FillLayer(fillLayerType);
-                    prevChild-&gt;setNext(currChild);
</del><ins>+            // Walk each value and put it into a layer, creating new layers as needed.
+            CSSValueList&amp; valueList = toCSSValueList(*value);
+            for (unsigned i = 0; i &lt; valueList.length(); i++) {
+                if (!child) {
+                    previousChild-&gt;setNext(std::make_unique&lt;FillLayer&gt;(fillLayerType));
+                    child = previousChild-&gt;next();
</ins><span class="cx">                 }
</span><del>-                (styleResolver-&gt;styleMap()-&gt;*mapFillFunction)(propertyId, currChild, valueList-&gt;itemWithoutBoundsCheck(i));
-                prevChild = currChild;
-                currChild = currChild-&gt;next();
</del><ins>+                (styleResolver-&gt;styleMap()-&gt;*mapFillFunction)(propertyId, child, valueList.itemWithoutBoundsCheck(i));
+                previousChild = child;
+                child = child-&gt;next();
</ins><span class="cx">             }
</span><span class="cx">         } else {
</span><del>-            (styleResolver-&gt;styleMap()-&gt;*mapFillFunction)(propertyId, currChild, value);
-            currChild = currChild-&gt;next();
</del><ins>+            (styleResolver-&gt;styleMap()-&gt;*mapFillFunction)(propertyId, child, value);
+            child = child-&gt;next();
</ins><span class="cx">         }
</span><del>-        while (currChild) {
-            /* Reset all remaining layers to not have the property set. */
-            (currChild-&gt;*clearFunction)();
-            currChild = currChild-&gt;next();
-        }
</del><ins>+        for (; child; child = child-&gt;next())
+            (child-&gt;*clearFunction)();
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     static PropertyHandler createHandler() { return PropertyHandler(&amp;applyInheritValue, &amp;applyInitialValue, &amp;applyValue); }
</span><span class="lines">@@ -2499,9 +2487,9 @@
</span><span class="cx"> #endif
</span><span class="cx">     setPropertyHandler(CSSPropertyWebkitBoxDirection, ApplyPropertyDefault&lt;EBoxDirection, &amp;RenderStyle::boxDirection, EBoxDirection, &amp;RenderStyle::setBoxDirection, EBoxDirection, &amp;RenderStyle::initialBoxDirection&gt;::createHandler());
</span><span class="cx">     setPropertyHandler(CSSPropertyWebkitBoxFlex, ApplyPropertyDefault&lt;float, &amp;RenderStyle::boxFlex, float, &amp;RenderStyle::setBoxFlex, float, &amp;RenderStyle::initialBoxFlex&gt;::createHandler());
</span><del>-    setPropertyHandler(CSSPropertyWebkitBoxFlexGroup, ApplyPropertyDefault&lt;unsigned int, &amp;RenderStyle::boxFlexGroup, unsigned int, &amp;RenderStyle::setBoxFlexGroup, unsigned int, &amp;RenderStyle::initialBoxFlexGroup&gt;::createHandler());
</del><ins>+    setPropertyHandler(CSSPropertyWebkitBoxFlexGroup, ApplyPropertyDefault&lt;unsigned, &amp;RenderStyle::boxFlexGroup, unsigned, &amp;RenderStyle::setBoxFlexGroup, unsigned, &amp;RenderStyle::initialBoxFlexGroup&gt;::createHandler());
</ins><span class="cx">     setPropertyHandler(CSSPropertyWebkitBoxLines, ApplyPropertyDefault&lt;EBoxLines, &amp;RenderStyle::boxLines, EBoxLines, &amp;RenderStyle::setBoxLines, EBoxLines, &amp;RenderStyle::initialBoxLines&gt;::createHandler());
</span><del>-    setPropertyHandler(CSSPropertyWebkitBoxOrdinalGroup, ApplyPropertyDefault&lt;unsigned int, &amp;RenderStyle::boxOrdinalGroup, unsigned int, &amp;RenderStyle::setBoxOrdinalGroup, unsigned int, &amp;RenderStyle::initialBoxOrdinalGroup&gt;::createHandler());
</del><ins>+    setPropertyHandler(CSSPropertyWebkitBoxOrdinalGroup, ApplyPropertyDefault&lt;unsigned, &amp;RenderStyle::boxOrdinalGroup, unsigned, &amp;RenderStyle::setBoxOrdinalGroup, unsigned, &amp;RenderStyle::initialBoxOrdinalGroup&gt;::createHandler());
</ins><span class="cx">     setPropertyHandler(CSSPropertyWebkitBoxOrient, ApplyPropertyDefault&lt;EBoxOrient, &amp;RenderStyle::boxOrient, EBoxOrient, &amp;RenderStyle::setBoxOrient, EBoxOrient, &amp;RenderStyle::initialBoxOrient&gt;::createHandler());
</span><span class="cx">     setPropertyHandler(CSSPropertyWebkitBoxPack, ApplyPropertyDefault&lt;EBoxPack, &amp;RenderStyle::boxPack, EBoxPack, &amp;RenderStyle::setBoxPack, EBoxPack, &amp;RenderStyle::initialBoxPack&gt;::createHandler());
</span><span class="cx">     setPropertyHandler(CSSPropertyWebkitColorCorrection, ApplyPropertyDefault&lt;ColorSpace, &amp;RenderStyle::colorSpace, ColorSpace, &amp;RenderStyle::setColorSpace, ColorSpace, &amp;RenderStyle::initialColorSpace&gt;::createHandler());
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBoxcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (167207 => 167208)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBox.cpp        2014-04-14 02:57:33 UTC (rev 167207)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp        2014-04-14 04:28:25 UTC (rev 167208)
</span><span class="lines">@@ -1409,7 +1409,7 @@
</span><span class="cx">     if (hasOverflowClip() &amp;&amp; fillLayer-&gt;attachment() == LocalBackgroundAttachment)
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><del>-    if (fillLayer-&gt;hasOpaqueImage(this) &amp;&amp; fillLayer-&gt;hasRepeatXY() &amp;&amp; fillLayer-&gt;image()-&gt;canRender(this, style().effectiveZoom()))
</del><ins>+    if (fillLayer-&gt;hasOpaqueImage(*this) &amp;&amp; fillLayer-&gt;hasRepeatXY() &amp;&amp; fillLayer-&gt;image()-&gt;canRender(this, style().effectiveZoom()))
</ins><span class="cx">         return true;
</span><span class="cx"> 
</span><span class="cx">     // If there is only one layer and no image, check whether the background color is opaque
</span><span class="lines">@@ -1511,7 +1511,7 @@
</span><span class="cx">             shouldDrawBackgroundInSeparateBuffer = true;
</span><span class="cx"> 
</span><span class="cx">         // The clipOccludesNextLayers condition must be evaluated first to avoid short-circuiting.
</span><del>-        if (curLayer-&gt;clipOccludesNextLayers(curLayer == fillLayer) &amp;&amp; curLayer-&gt;hasOpaqueImage(this) &amp;&amp; curLayer-&gt;image()-&gt;canRender(this, style().effectiveZoom()) &amp;&amp; curLayer-&gt;hasRepeatXY() &amp;&amp; curLayer-&gt;blendMode() == BlendModeNormal)
</del><ins>+        if (curLayer-&gt;clipOccludesNextLayers(curLayer == fillLayer) &amp;&amp; curLayer-&gt;hasOpaqueImage(*this) &amp;&amp; curLayer-&gt;image()-&gt;canRender(this, style().effectiveZoom()) &amp;&amp; curLayer-&gt;hasRepeatXY() &amp;&amp; curLayer-&gt;blendMode() == BlendModeNormal)
</ins><span class="cx">             break;
</span><span class="cx">         curLayer = curLayer-&gt;next();
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBoxModelObjectcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp (167207 => 167208)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp        2014-04-14 02:57:33 UTC (rev 167207)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp        2014-04-14 04:28:25 UTC (rev 167208)
</span><span class="lines">@@ -774,7 +774,7 @@
</span><span class="cx">     if (!bgLayer-&gt;next()) {
</span><span class="cx">         LayoutRect backgroundRect(scrolledPaintRect);
</span><span class="cx">         bool boxShadowShouldBeAppliedToBackground = this-&gt;boxShadowShouldBeAppliedToBackground(bleedAvoidance, box);
</span><del>-        if (boxShadowShouldBeAppliedToBackground || !shouldPaintBackgroundImage || !bgLayer-&gt;hasOpaqueImage(this) || !bgLayer-&gt;hasRepeatXY()) {
</del><ins>+        if (boxShadowShouldBeAppliedToBackground || !shouldPaintBackgroundImage || !bgLayer-&gt;hasOpaqueImage(*this) || !bgLayer-&gt;hasRepeatXY()) {
</ins><span class="cx">             if (!boxShadowShouldBeAppliedToBackground)
</span><span class="cx">                 backgroundRect.intersect(paintInfo.rect);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingstyleFillLayercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/style/FillLayer.cpp (167207 => 167208)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/style/FillLayer.cpp        2014-04-14 02:57:33 UTC (rev 167207)
+++ trunk/Source/WebCore/rendering/style/FillLayer.cpp        2014-04-14 04:28:25 UTC (rev 167208)
</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 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2014 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">@@ -25,24 +25,23 @@
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> struct SameSizeAsFillLayer {
</span><del>-    FillLayer* m_next;
</del><ins>+    FillLayer* next;
</ins><span class="cx"> 
</span><del>-    RefPtr&lt;StyleImage&gt; m_image;
</del><ins>+    RefPtr&lt;StyleImage&gt; image;
</ins><span class="cx"> 
</span><del>-    Length m_xPosition;
-    Length m_yPosition;
</del><ins>+    Length x;
+    Length y;
</ins><span class="cx"> 
</span><del>-    LengthSize m_sizeLength;
</del><ins>+    LengthSize sizeLength;
</ins><span class="cx"> 
</span><del>-    unsigned m_bitfields: 32;
-    unsigned m_bitfields2: 1;
</del><ins>+    unsigned bitfields : 32;
+    unsigned bitfields2 : 11;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> COMPILE_ASSERT(sizeof(FillLayer) == sizeof(SameSizeAsFillLayer), FillLayer_should_stay_small);
</span><span class="cx"> 
</span><span class="cx"> FillLayer::FillLayer(EFillLayerType type)
</span><del>-    : m_next(0)
-    , m_image(FillLayer::initialFillImage(type))
</del><ins>+    : m_image(FillLayer::initialFillImage(type))
</ins><span class="cx">     , m_xPosition(FillLayer::initialFillXPosition(type))
</span><span class="cx">     , m_yPosition(FillLayer::initialFillYPosition(type))
</span><span class="cx">     , m_sizeLength(FillLayer::initialFillSizeLength(type))
</span><span class="lines">@@ -74,7 +73,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> FillLayer::FillLayer(const FillLayer&amp; o)
</span><del>-    : m_next(o.m_next ? new FillLayer(*o.m_next) : 0)
</del><ins>+    : m_next(o.m_next ? std::make_unique&lt;FillLayer&gt;(*o.m_next) : nullptr)
</ins><span class="cx">     , m_image(o.m_image)
</span><span class="cx">     , m_xPosition(o.m_xPosition)
</span><span class="cx">     , m_yPosition(o.m_yPosition)
</span><span class="lines">@@ -108,15 +107,13 @@
</span><span class="cx"> 
</span><span class="cx"> FillLayer::~FillLayer()
</span><span class="cx"> {
</span><del>-    delete m_next;
</del><ins>+    // Delete the layers in a loop rather than allowing recursive calls to the destructors.
+    for (std::unique_ptr&lt;FillLayer&gt; next = std::move(m_next); next; next = std::move(next-&gt;m_next)) { }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> FillLayer&amp; FillLayer::operator=(const FillLayer&amp; o)
</span><span class="cx"> {
</span><del>-    if (m_next != o.m_next) {
-        delete m_next;
-        m_next = o.m_next ? new FillLayer(*o.m_next) : 0;
-    }
</del><ins>+    m_next = o.m_next ? std::make_unique&lt;FillLayer&gt;(*o.m_next) : nullptr;
</ins><span class="cx"> 
</span><span class="cx">     m_image = o.m_image;
</span><span class="cx">     m_xPosition = o.m_xPosition;
</span><span class="lines">@@ -155,14 +152,14 @@
</span><span class="cx"> bool FillLayer::operator==(const FillLayer&amp; o) const
</span><span class="cx"> {
</span><span class="cx">     // We do not check the &quot;isSet&quot; booleans for each property, since those are only used during initial construction
</span><del>-    // to propagate patterns into layers.  All layer comparisons happen after values have all been filled in anyway.
</del><ins>+    // to propagate patterns into layers. All layer comparisons happen after values have all been filled in anyway.
</ins><span class="cx">     return StyleImage::imagesEquivalent(m_image.get(), o.m_image.get()) &amp;&amp; m_xPosition == o.m_xPosition &amp;&amp; m_yPosition == o.m_yPosition
</span><del>-            &amp;&amp; m_backgroundXOrigin == o.m_backgroundXOrigin &amp;&amp; m_backgroundYOrigin == o.m_backgroundYOrigin
-            &amp;&amp; m_attachment == o.m_attachment &amp;&amp; m_clip == o.m_clip &amp;&amp; m_composite == o.m_composite
-            &amp;&amp; m_blendMode == o.m_blendMode &amp;&amp; m_origin == o.m_origin &amp;&amp; m_repeatX == o.m_repeatX
-            &amp;&amp; m_repeatY == o.m_repeatY &amp;&amp; m_sizeType == o.m_sizeType &amp;&amp; m_maskSourceType == o.m_maskSourceType
-            &amp;&amp; m_sizeLength == o.m_sizeLength &amp;&amp; m_type == o.m_type
-            &amp;&amp; ((m_next &amp;&amp; o.m_next) ? *m_next == *o.m_next : m_next == o.m_next);
</del><ins>+        &amp;&amp; m_backgroundXOrigin == o.m_backgroundXOrigin &amp;&amp; m_backgroundYOrigin == o.m_backgroundYOrigin
+        &amp;&amp; m_attachment == o.m_attachment &amp;&amp; m_clip == o.m_clip &amp;&amp; m_composite == o.m_composite
+        &amp;&amp; m_blendMode == o.m_blendMode &amp;&amp; m_origin == o.m_origin &amp;&amp; m_repeatX == o.m_repeatX
+        &amp;&amp; m_repeatY == o.m_repeatY &amp;&amp; m_sizeType == o.m_sizeType &amp;&amp; m_maskSourceType == o.m_maskSourceType
+        &amp;&amp; m_sizeLength == o.m_sizeLength &amp;&amp; m_type == o.m_type
+        &amp;&amp; ((m_next &amp;&amp; o.m_next) ? *m_next == *o.m_next : m_next == o.m_next);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void FillLayer::fillUnsetProperties()
</span><span class="lines">@@ -290,18 +287,15 @@
</span><span class="cx"> 
</span><span class="cx"> void FillLayer::cullEmptyLayers()
</span><span class="cx"> {
</span><del>-    FillLayer* next;
-    for (FillLayer* p = this; p; p = next) {
-        next = p-&gt;m_next;
-        if (next &amp;&amp; !next-&gt;isImageSet()) {
-            delete next;
-            p-&gt;m_next = 0;
</del><ins>+    for (FillLayer* layer = this; layer; layer = layer-&gt;m_next.get()) {
+        if (layer-&gt;m_next &amp;&amp; !layer-&gt;m_next-&gt;isImageSet()) {
+            layer-&gt;m_next = nullptr;
</ins><span class="cx">             break;
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static EFillBox clipMax(EFillBox clipA, EFillBox clipB)
</del><ins>+static inline EFillBox clipMax(EFillBox clipA, EFillBox clipB)
</ins><span class="cx"> {
</span><span class="cx">     if (clipA == BorderFillBox || clipB == BorderFillBox)
</span><span class="cx">         return BorderFillBox;
</span><span class="lines">@@ -314,11 +308,15 @@
</span><span class="cx"> 
</span><span class="cx"> void FillLayer::computeClipMax() const
</span><span class="cx"> {
</span><del>-    if (m_next) {
-        m_next-&gt;computeClipMax();
-        m_clipMax = clipMax(clip(), m_next-&gt;clip());
-    } else
-        m_clipMax = m_clip;
</del><ins>+    Vector&lt;const FillLayer*, 4&gt; layers;
+    for (auto* layer = this; layer; layer = layer-&gt;m_next.get())
+        layers.append(layer);
+    EFillBox computedClipMax = TextFillBox;
+    for (unsigned i = layers.size(); i; --i) {
+        auto&amp; layer = *layers[i - 1];
+        computedClipMax = clipMax(computedClipMax, layer.clip());
+        layer.m_clipMax = computedClipMax;
+    }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool FillLayer::clipOccludesNextLayers(bool firstLayer) const
</span><span class="lines">@@ -328,29 +326,25 @@
</span><span class="cx">     return m_clip == m_clipMax;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool FillLayer::containsImage(StyleImage* s) const
</del><ins>+bool FillLayer::containsImage(StyleImage&amp; image) const
</ins><span class="cx"> {
</span><del>-    if (!s)
-        return false;
-    if (m_image &amp;&amp; *s == *m_image)
-        return true;
-    if (m_next)
-        return m_next-&gt;containsImage(s);
</del><ins>+    for (auto* layer = this; layer; layer = layer-&gt;m_next.get()) {
+        if (layer-&gt;m_image &amp;&amp; image == *layer-&gt;m_image)
+            return true;
+    }
</ins><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool FillLayer::imagesAreLoaded() const
</span><span class="cx"> {
</span><del>-    const FillLayer* curr;
-    for (curr = this; curr; curr = curr-&gt;next()) {
-        if (curr-&gt;m_image &amp;&amp; !curr-&gt;m_image-&gt;isLoaded())
</del><ins>+    for (auto* layer = this; layer; layer = layer-&gt;m_next.get()) {
+        if (layer-&gt;m_image &amp;&amp; !layer-&gt;m_image-&gt;isLoaded())
</ins><span class="cx">             return false;
</span><span class="cx">     }
</span><del>-
</del><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool FillLayer::hasOpaqueImage(const RenderElement* renderer) const
</del><ins>+bool FillLayer::hasOpaqueImage(const RenderElement&amp; renderer) const
</ins><span class="cx"> {
</span><span class="cx">     if (!m_image)
</span><span class="cx">         return false;
</span><span class="lines">@@ -358,18 +352,30 @@
</span><span class="cx">     if (m_composite == CompositeClear || m_composite == CompositeCopy)
</span><span class="cx">         return true;
</span><span class="cx"> 
</span><del>-    if (m_blendMode != BlendModeNormal)
-        return false;
</del><ins>+    return m_blendMode == BlendModeNormal &amp;&amp; m_composite == CompositeSourceOver &amp;&amp; m_image-&gt;knownToBeOpaque(&amp;renderer);
+}
</ins><span class="cx"> 
</span><del>-    if (m_composite == CompositeSourceOver)
-        return m_image-&gt;knownToBeOpaque(renderer);
</del><ins>+bool FillLayer::hasRepeatXY() const
+{
+    return m_repeatX == RepeatFill &amp;&amp; m_repeatY == RepeatFill;
+}
</ins><span class="cx"> 
</span><ins>+bool FillLayer::hasImage() const
+{
+    for (auto* layer = this; layer; layer = layer-&gt;m_next.get()) {
+        if (layer-&gt;m_image)
+            return true;
+    }
</ins><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool FillLayer::hasRepeatXY() const
</del><ins>+bool FillLayer::hasFixedImage() const
</ins><span class="cx"> {
</span><del>-    return m_repeatX == RepeatFill &amp;&amp; m_repeatY == RepeatFill;
</del><ins>+    for (auto* layer = this; layer; layer = layer-&gt;m_next.get()) {
+        if (layer-&gt;m_image &amp;&amp; layer-&gt;m_attachment == FixedBackgroundAttachment)
+            return true;
+    }
+    return false;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingstyleFillLayerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/style/FillLayer.h (167207 => 167208)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/style/FillLayer.h        2014-04-14 02:57:33 UTC (rev 167207)
+++ trunk/Source/WebCore/rendering/style/FillLayer.h        2014-04-14 04:28:25 UTC (rev 167208)
</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 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2003, 2005, 2006, 2007, 2008, 2014 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">@@ -26,7 +26,6 @@
</span><span class="cx"> #define FillLayer_h
</span><span class="cx"> 
</span><span class="cx"> #include &quot;GraphicsTypes.h&quot;
</span><del>-#include &quot;Length.h&quot;
</del><span class="cx"> #include &quot;LengthSize.h&quot;
</span><span class="cx"> #include &quot;RenderStyleConstants.h&quot;
</span><span class="cx"> #include &quot;StyleImage.h&quot;
</span><span class="lines">@@ -42,29 +41,30 @@
</span><span class="cx">     {
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    FillSize(EFillSizeType t, LengthSize size)
-        : type(t)
-        , size(std::move(size))
</del><ins>+    FillSize(EFillSizeType type, const LengthSize&amp; size)
+        : type(type)
+        , size(size)
</ins><span class="cx">     {
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    bool operator==(const FillSize&amp; o) const
-    {
-        return type == o.type &amp;&amp; size == o.size;
-    }
-    bool operator!=(const FillSize&amp; o) const
-    {
-        return !(*this == o);
-    }
-
</del><span class="cx">     EFillSizeType type;
</span><span class="cx">     LengthSize size;
</span><span class="cx"> };
</span><span class="cx"> 
</span><ins>+inline bool operator==(const FillSize&amp; a, const FillSize&amp; b)
+{
+    return a.type == b.type &amp;&amp; a.size == b.size;
+}
+
+inline bool operator!=(const FillSize&amp; a, const FillSize&amp; b)
+{
+    return !(a == b);
+}
+
</ins><span class="cx"> class FillLayer {
</span><span class="cx">     WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> public:
</span><del>-    FillLayer(EFillLayerType);
</del><ins>+    explicit FillLayer(EFillLayerType);
</ins><span class="cx">     ~FillLayer();
</span><span class="cx"> 
</span><span class="cx">     StyleImage* image() const { return m_image.get(); }
</span><span class="lines">@@ -84,8 +84,8 @@
</span><span class="cx">     FillSize size() const { return FillSize(static_cast&lt;EFillSizeType&gt;(m_sizeType), m_sizeLength); }
</span><span class="cx">     EMaskSourceType maskSourceType() const { return static_cast&lt;EMaskSourceType&gt;(m_maskSourceType); }
</span><span class="cx"> 
</span><del>-    const FillLayer* next() const { return m_next; }
-    FillLayer* next() { return m_next; }
</del><ins>+    const FillLayer* next() const { return m_next.get(); }
+    FillLayer* next() { return m_next.get(); }
</ins><span class="cx"> 
</span><span class="cx">     bool isImageSet() const { return m_imageSet; }
</span><span class="cx">     bool isXPositionSet() const { return m_xPosSet; }
</span><span class="lines">@@ -101,7 +101,7 @@
</span><span class="cx">     bool isSizeSet() const { return m_sizeType != SizeNone; }
</span><span class="cx">     bool isMaskSourceTypeSet() const { return m_maskSourceTypeSet; }
</span><span class="cx"> 
</span><del>-    void setImage(PassRefPtr&lt;StyleImage&gt; i) { m_image = i; m_imageSet = true; }
</del><ins>+    void setImage(PassRefPtr&lt;StyleImage&gt; image) { m_image = image; m_imageSet = true; }
</ins><span class="cx">     void setXPosition(Length length) { m_xPosition = std::move(length); m_xPosSet = true; }
</span><span class="cx">     void setYPosition(Length length) { m_yPosition = std::move(length); m_yPosSet = true; }
</span><span class="cx">     void setBackgroundXOrigin(BackgroundEdgeOrigin o) { m_backgroundXOrigin = o; m_backgroundOriginSet = true; }
</span><span class="lines">@@ -119,16 +119,8 @@
</span><span class="cx">     void setMaskSourceType(EMaskSourceType m) { m_maskSourceType = m; m_maskSourceTypeSet = true; }
</span><span class="cx"> 
</span><span class="cx">     void clearImage() { m_image.clear(); m_imageSet = false; }
</span><del>-    void clearXPosition()
-    {
-        m_xPosSet = false;
-        m_backgroundOriginSet = false;
-    }
-    void clearYPosition()
-    {
-        m_yPosSet = false;
-        m_backgroundOriginSet = false;
-    }
</del><ins>+    void clearXPosition() { m_xPosSet = false; m_backgroundOriginSet = false; }
+    void clearYPosition() { m_yPosSet = false; m_backgroundOriginSet = false; }
</ins><span class="cx"> 
</span><span class="cx">     void clearAttachment() { m_attachmentSet = false; }
</span><span class="cx">     void clearClip() { m_clipSet = false; }
</span><span class="lines">@@ -140,35 +132,19 @@
</span><span class="cx">     void clearSize() { m_sizeType = SizeNone; }
</span><span class="cx">     void clearMaskSourceType() { m_maskSourceTypeSet = false; }
</span><span class="cx"> 
</span><del>-    void setNext(FillLayer* n) { if (m_next != n) { delete m_next; m_next = n; } }
</del><ins>+    void setNext(std::unique_ptr&lt;FillLayer&gt; next) { m_next = std::move(next); }
</ins><span class="cx"> 
</span><del>-    FillLayer&amp; operator=(const FillLayer&amp; o);    
-    FillLayer(const FillLayer&amp; o);
</del><ins>+    FillLayer&amp; operator=(const FillLayer&amp;);
+    FillLayer(const FillLayer&amp;);
</ins><span class="cx"> 
</span><del>-    bool operator==(const FillLayer&amp; o) const;
-    bool operator!=(const FillLayer&amp; o) const
-    {
-        return !(*this == o);
-    }
</del><ins>+    bool operator==(const FillLayer&amp;) const;
+    bool operator!=(const FillLayer&amp; other) const { return !(*this == other); }
</ins><span class="cx"> 
</span><del>-    bool containsImage(StyleImage*) const;
</del><ins>+    bool containsImage(StyleImage&amp;) const;
</ins><span class="cx">     bool imagesAreLoaded() const;
</span><del>-
-    bool hasImage() const
-    {
-        if (m_image)
-            return true;
-        return m_next ? m_next-&gt;hasImage() : false;
-    }
-
-    bool hasFixedImage() const
-    {
-        if (m_image &amp;&amp; m_attachment == FixedBackgroundAttachment)
-            return true;
-        return m_next ? m_next-&gt;hasFixedImage() : false;
-    }
-
-    bool hasOpaqueImage(const RenderElement*) const;
</del><ins>+    bool hasImage() const;
+    bool hasFixedImage() const;
+    bool hasOpaqueImage(const RenderElement&amp;) const;
</ins><span class="cx">     bool hasRepeatXY() const;
</span><span class="cx">     bool clipOccludesNextLayers(bool firstLayer) const;
</span><span class="cx"> 
</span><span class="lines">@@ -197,10 +173,8 @@
</span><span class="cx"> 
</span><span class="cx">     void computeClipMax() const;
</span><span class="cx"> 
</span><del>-    FillLayer() { }
</del><ins>+    std::unique_ptr&lt;FillLayer&gt; m_next;
</ins><span class="cx"> 
</span><del>-    FillLayer* m_next;
-
</del><span class="cx">     RefPtr&lt;StyleImage&gt; m_image;
</span><span class="cx"> 
</span><span class="cx">     Length m_xPosition;
</span></span></pre>
</div>
</div>

</body>
</html>