<!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>[169972] trunk</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/169972">169972</a></dd>
<dt>Author</dt> <dd>simon.fraser@apple.com</dd>
<dt>Date</dt> <dd>2014-06-14 10:40:49 -0700 (Sat, 14 Jun 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Masks disappear when layers become tiled
https://bugs.webkit.org/show_bug.cgi?id=133892
&lt;rdar://problem/17309793&gt;

Reviewed by Tim Horton.

Source/WebCore:
There were several problems with tiled mask layers.

First, when a layer became tiled it failed to re-apply the platform layer
for its mask; fixed by adding MaskLayerChanged to the set of flags in
swapFromOrToTiledLayer().

Secondly, in CA, a mask layer's superlayer is the layer which is it masking,
so the if (oldLayer-&gt;superlayer())... code in swapFromOrToTiledLayer() would
erroneously try to swap out a sublayer on the superlayer with the mask.

Thirdly, the mask layer is updated after its host layer, but when the mask layer
become tiled, there was no code that updated the mask platform layer on its
host layer. Fix by:
    1. setting a bit on a layer to note that it's being used as a mask.
    2. setting the parent of such a layer to its host layer (mimicking CA)
    3. when the mask becomes tiled, dirtying the MaskLayerChanged bit on
       its parent and adding a clause to commitLayerChangesAfterSublayers()
       to update the mask layer.

Finally, ASSERTION FAILED: owningGraphicsLayer()-&gt;isCommittingChanges() would
fire because we failed to set the m_isCommittingChanges flag while committing
the mask layer. Fix by moving the TemporaryChange&lt;bool&gt; that sets this flag
into commitLayerChangesBeforeSublayers() and commitLayerChangesAfterSublayers().

Also used safe casts in more places in GraphicsLayerCA.

Tests: compositing/masks/become-tiled-mask.html
       compositing/masks/cease-tiled-mask.html
       compositing/masks/tiled-mask.html

* platform/graphics/GraphicsLayer.cpp:
(WebCore::GraphicsLayer::GraphicsLayer):
(WebCore::GraphicsLayer::removeFromParent):
(WebCore::GraphicsLayer::setMaskLayer):
* platform/graphics/GraphicsLayer.h:
(WebCore::GraphicsLayer::setIsMaskLayer):
(WebCore::GraphicsLayer::isMaskLayer):
(WebCore::GraphicsLayer::setMaskLayer): Deleted.
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::removeFromParent):
(WebCore::GraphicsLayerCA::setMaskLayer):
(WebCore::GraphicsLayerCA::recursiveVisibleRectChangeRequiresFlush):
(WebCore::GraphicsLayerCA::recursiveCommitChanges):
(WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers):
(WebCore::GraphicsLayerCA::commitLayerChangesAfterSublayers):
(WebCore::GraphicsLayerCA::updateSublayerList):
(WebCore::GraphicsLayerCA::ensureStructuralLayer):
(WebCore::GraphicsLayerCA::updateMaskLayer):
(WebCore::GraphicsLayerCA::replicatedLayerRoot):
(WebCore::GraphicsLayerCA::createFilterAnimationsFromKeyframes):
(WebCore::GraphicsLayerCA::swapFromOrToTiledLayer):
(WebCore::GraphicsLayerCA::propagateLayerChangeToReplicas):
(WebCore::GraphicsLayerCA::fetchCloneLayers):

LayoutTests:
Tests for masking as they go into and out of tiled mode.

* compositing/masks/become-tiled-mask-expected.html: Added.
* compositing/masks/become-tiled-mask.html: Added.
* compositing/masks/cease-tiled-mask-expected.html: Added.
* compositing/masks/cease-tiled-mask.html: Added.
* compositing/masks/tiled-mask-expected.html: Added.
* compositing/masks/tiled-mask.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsGraphicsLayercpp">trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsGraphicsLayerh">trunk/Source/WebCore/platform/graphics/GraphicsLayer.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscaGraphicsLayerCAcpp">trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestscompositingmasksbecometiledmaskexpectedhtml">trunk/LayoutTests/compositing/masks/become-tiled-mask-expected.html</a></li>
<li><a href="#trunkLayoutTestscompositingmasksbecometiledmaskhtml">trunk/LayoutTests/compositing/masks/become-tiled-mask.html</a></li>
<li><a href="#trunkLayoutTestscompositingmasksceasetiledmaskexpectedhtml">trunk/LayoutTests/compositing/masks/cease-tiled-mask-expected.html</a></li>
<li><a href="#trunkLayoutTestscompositingmasksceasetiledmaskhtml">trunk/LayoutTests/compositing/masks/cease-tiled-mask.html</a></li>
<li><a href="#trunkLayoutTestscompositingmaskstiledmaskexpectedhtml">trunk/LayoutTests/compositing/masks/tiled-mask-expected.html</a></li>
<li><a href="#trunkLayoutTestscompositingmaskstiledmaskhtml">trunk/LayoutTests/compositing/masks/tiled-mask.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (169971 => 169972)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-06-14 17:12:04 UTC (rev 169971)
+++ trunk/LayoutTests/ChangeLog        2014-06-14 17:40:49 UTC (rev 169972)
</span><span class="lines">@@ -1,3 +1,20 @@
</span><ins>+2014-06-14  Simon Fraser  &lt;simon.fraser@apple.com&gt;
+
+        Masks disappear when layers become tiled
+        https://bugs.webkit.org/show_bug.cgi?id=133892
+        &lt;rdar://problem/17309793&gt;
+
+        Reviewed by Tim Horton.
+        
+        Tests for masking as they go into and out of tiled mode.
+
+        * compositing/masks/become-tiled-mask-expected.html: Added.
+        * compositing/masks/become-tiled-mask.html: Added.
+        * compositing/masks/cease-tiled-mask-expected.html: Added.
+        * compositing/masks/cease-tiled-mask.html: Added.
+        * compositing/masks/tiled-mask-expected.html: Added.
+        * compositing/masks/tiled-mask.html: Added.
+
</ins><span class="cx"> 2014-06-14  Commit Queue  &lt;commit-queue@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed, rolling out r169963.
</span></span></pre></div>
<a id="trunkLayoutTestscompositingmasksbecometiledmaskexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/compositing/masks/become-tiled-mask-expected.html (0 => 169972)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/compositing/masks/become-tiled-mask-expected.html                                (rev 0)
+++ trunk/LayoutTests/compositing/masks/become-tiled-mask-expected.html        2014-06-14 17:40:49 UTC (rev 169972)
</span><span class="lines">@@ -0,0 +1,37 @@
</span><ins>+&lt;!DOCTYPE&gt;
+
+&lt;html&gt;
+&lt;head&gt;
+  &lt;style&gt;
+    .container {
+        height: 300px;
+        width: 400px;
+        border: 2px solid black;
+        overflow: hidden;
+    }
+
+    .box {
+        height: 300px;
+        width: 2800px;
+        border: 1px solid black;
+        background-color: gray;
+    }
+
+    .composited {
+        -webkit-transform: translateZ(0);
+    }
+
+    .masked {
+        -webkit-mask-image: url(../resources/alpha-gradient.png);
+        -webkit-mask-repeat: repeat-x;
+    }
+  &lt;/style&gt;
+&lt;/head&gt;
+&lt;body&gt;
+
+    &lt;div class=&quot;composited container&quot;&gt;
+        &lt;div id=&quot;box&quot; class=&quot;composited masked box&quot;&gt;&lt;/div&gt; 
+    &lt;/div&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestscompositingmasksbecometiledmaskhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/compositing/masks/become-tiled-mask.html (0 => 169972)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/compositing/masks/become-tiled-mask.html                                (rev 0)
+++ trunk/LayoutTests/compositing/masks/become-tiled-mask.html        2014-06-14 17:40:49 UTC (rev 169972)
</span><span class="lines">@@ -0,0 +1,56 @@
</span><ins>+&lt;!DOCTYPE&gt;
+
+&lt;html&gt;
+&lt;head&gt;
+  &lt;style&gt;
+    .container {
+        height: 300px;
+        width: 400px;
+        border: 2px solid black;
+        overflow: hidden;
+    }
+
+    .box {
+        height: 300px;
+        width: 410px;
+        border: 1px solid black;
+        background-color: gray;
+    }
+
+    .large.box {
+        width: 2800px;
+    }
+
+    .composited {
+        -webkit-transform: translateZ(0);
+    }
+
+    .masked {
+        -webkit-mask-image: url(../resources/alpha-gradient.png);
+        -webkit-mask-repeat: repeat-x;
+    }
+  &lt;/style&gt;
+  &lt;script&gt;
+    if (window.testRunner)
+        testRunner.waitUntilDone();
+
+    function doTest()
+    {
+        window.setTimeout(function() {
+            document.getElementById('box').classList.add('large');
+            if (window.testRunner)
+                testRunner.notifyDone();
+        }, 0);
+    }
+
+    window.addEventListener('load', doTest, false);
+  &lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+
+    &lt;div class=&quot;composited container&quot;&gt;
+        &lt;div id=&quot;box&quot; class=&quot;composited masked box&quot;&gt;&lt;/div&gt; 
+    &lt;/div&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestscompositingmasksceasetiledmaskexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/compositing/masks/cease-tiled-mask-expected.html (0 => 169972)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/compositing/masks/cease-tiled-mask-expected.html                                (rev 0)
+++ trunk/LayoutTests/compositing/masks/cease-tiled-mask-expected.html        2014-06-14 17:40:49 UTC (rev 169972)
</span><span class="lines">@@ -0,0 +1,37 @@
</span><ins>+&lt;!DOCTYPE&gt;
+
+&lt;html&gt;
+&lt;head&gt;
+  &lt;style&gt;
+    .container {
+        height: 300px;
+        width: 400px;
+        border: 2px solid black;
+        overflow: hidden;
+    }
+
+    .box {
+        height: 300px;
+        width: 410px;
+        border: 1px solid black;
+        background-color: gray;
+    }
+
+    .composited {
+        -webkit-transform: translateZ(0);
+    }
+
+    .masked {
+        -webkit-mask-image: url(../resources/alpha-gradient.png);
+        -webkit-mask-repeat: repeat-x;
+    }
+  &lt;/style&gt;
+&lt;/head&gt;
+&lt;body&gt;
+
+    &lt;div class=&quot;composited container&quot;&gt;
+        &lt;div id=&quot;box&quot; class=&quot;composited masked box&quot;&gt;&lt;/div&gt; 
+    &lt;/div&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestscompositingmasksceasetiledmaskhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/compositing/masks/cease-tiled-mask.html (0 => 169972)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/compositing/masks/cease-tiled-mask.html                                (rev 0)
+++ trunk/LayoutTests/compositing/masks/cease-tiled-mask.html        2014-06-14 17:40:49 UTC (rev 169972)
</span><span class="lines">@@ -0,0 +1,56 @@
</span><ins>+&lt;!DOCTYPE&gt;
+
+&lt;html&gt;
+&lt;head&gt;
+  &lt;style&gt;
+    .container {
+        height: 300px;
+        width: 400px;
+        border: 2px solid black;
+        overflow: hidden;
+    }
+
+    .box {
+        height: 300px;
+        width: 410px;
+        border: 1px solid black;
+        background-color: gray;
+    }
+
+    .large.box {
+        width: 2800px;
+    }
+
+    .composited {
+        -webkit-transform: translateZ(0);
+    }
+
+    .masked {
+        -webkit-mask-image: url(../resources/alpha-gradient.png);
+        -webkit-mask-repeat: repeat-x;
+    }
+  &lt;/style&gt;
+  &lt;script&gt;
+    if (window.testRunner)
+        testRunner.waitUntilDone();
+
+    function doTest()
+    {
+        window.setTimeout(function() {
+            document.getElementById('box').classList.remove('large');
+            if (window.testRunner)
+                testRunner.notifyDone();
+        }, 0);
+    }
+
+    window.addEventListener('load', doTest, false);
+  &lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+
+    &lt;div class=&quot;composited container&quot;&gt;
+        &lt;div id=&quot;box&quot; class=&quot;composited masked large box&quot;&gt;&lt;/div&gt; 
+    &lt;/div&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestscompositingmaskstiledmaskexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/compositing/masks/tiled-mask-expected.html (0 => 169972)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/compositing/masks/tiled-mask-expected.html                                (rev 0)
+++ trunk/LayoutTests/compositing/masks/tiled-mask-expected.html        2014-06-14 17:40:49 UTC (rev 169972)
</span><span class="lines">@@ -0,0 +1,37 @@
</span><ins>+&lt;!DOCTYPE&gt;
+
+&lt;html&gt;
+&lt;head&gt;
+  &lt;style&gt;
+    .container {
+        height: 300px;
+        width: 400px;
+        border: 2px solid black;
+        overflow: hidden;
+    }
+
+    .box {
+        height: 300px;
+        width: 410px;
+        border: 1px solid black;
+        background-color: gray;
+    }
+
+    .composited {
+        -webkit-transform: translateZ(0);
+    }
+
+    .masked {
+        -webkit-mask-image: url(../resources/alpha-gradient.png);
+        -webkit-mask-repeat: repeat-x;
+    }
+  &lt;/style&gt;
+&lt;/head&gt;
+&lt;body&gt;
+
+    &lt;div class=&quot;composited container&quot;&gt;
+        &lt;div class=&quot;composited masked box&quot;&gt;&lt;/div&gt; 
+    &lt;/div&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestscompositingmaskstiledmaskhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/compositing/masks/tiled-mask.html (0 => 169972)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/compositing/masks/tiled-mask.html                                (rev 0)
+++ trunk/LayoutTests/compositing/masks/tiled-mask.html        2014-06-14 17:40:49 UTC (rev 169972)
</span><span class="lines">@@ -0,0 +1,37 @@
</span><ins>+&lt;!DOCTYPE&gt;
+
+&lt;html&gt;
+&lt;head&gt;
+  &lt;style&gt;
+    .container {
+        height: 300px;
+        width: 400px;
+        border: 2px solid black;
+        overflow: hidden;
+    }
+
+    .box {
+        height: 300px;
+        width: 2800px;
+        border: 1px solid black;
+        background-color: gray;
+    }
+
+    .composited {
+        -webkit-transform: translateZ(0);
+    }
+
+    .masked {
+        -webkit-mask-image: url(../resources/alpha-gradient.png);
+        -webkit-mask-repeat: repeat-x;
+    }
+  &lt;/style&gt;
+&lt;/head&gt;
+&lt;body&gt;
+
+    &lt;div class=&quot;composited container&quot;&gt;
+        &lt;div class=&quot;composited masked box&quot;&gt;&lt;/div&gt; 
+    &lt;/div&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (169971 => 169972)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-06-14 17:12:04 UTC (rev 169971)
+++ trunk/Source/WebCore/ChangeLog        2014-06-14 17:40:49 UTC (rev 169972)
</span><span class="lines">@@ -1,3 +1,65 @@
</span><ins>+2014-06-14  Simon Fraser  &lt;simon.fraser@apple.com&gt;
+
+        Masks disappear when layers become tiled
+        https://bugs.webkit.org/show_bug.cgi?id=133892
+        &lt;rdar://problem/17309793&gt;
+
+        Reviewed by Tim Horton.
+        
+        There were several problems with tiled mask layers.
+        
+        First, when a layer became tiled it failed to re-apply the platform layer
+        for its mask; fixed by adding MaskLayerChanged to the set of flags in
+        swapFromOrToTiledLayer().
+        
+        Secondly, in CA, a mask layer's superlayer is the layer which is it masking,
+        so the if (oldLayer-&gt;superlayer())... code in swapFromOrToTiledLayer() would
+        erroneously try to swap out a sublayer on the superlayer with the mask.
+        
+        Thirdly, the mask layer is updated after its host layer, but when the mask layer
+        become tiled, there was no code that updated the mask platform layer on its
+        host layer. Fix by:
+            1. setting a bit on a layer to note that it's being used as a mask.
+            2. setting the parent of such a layer to its host layer (mimicking CA)
+            3. when the mask becomes tiled, dirtying the MaskLayerChanged bit on
+               its parent and adding a clause to commitLayerChangesAfterSublayers()
+               to update the mask layer.
+        
+        Finally, ASSERTION FAILED: owningGraphicsLayer()-&gt;isCommittingChanges() would
+        fire because we failed to set the m_isCommittingChanges flag while committing
+        the mask layer. Fix by moving the TemporaryChange&lt;bool&gt; that sets this flag
+        into commitLayerChangesBeforeSublayers() and commitLayerChangesAfterSublayers().
+        
+        Also used safe casts in more places in GraphicsLayerCA.
+
+        Tests: compositing/masks/become-tiled-mask.html
+               compositing/masks/cease-tiled-mask.html
+               compositing/masks/tiled-mask.html
+
+        * platform/graphics/GraphicsLayer.cpp:
+        (WebCore::GraphicsLayer::GraphicsLayer):
+        (WebCore::GraphicsLayer::removeFromParent):
+        (WebCore::GraphicsLayer::setMaskLayer):
+        * platform/graphics/GraphicsLayer.h:
+        (WebCore::GraphicsLayer::setIsMaskLayer):
+        (WebCore::GraphicsLayer::isMaskLayer):
+        (WebCore::GraphicsLayer::setMaskLayer): Deleted.
+        * platform/graphics/ca/GraphicsLayerCA.cpp:
+        (WebCore::GraphicsLayerCA::removeFromParent):
+        (WebCore::GraphicsLayerCA::setMaskLayer):
+        (WebCore::GraphicsLayerCA::recursiveVisibleRectChangeRequiresFlush):
+        (WebCore::GraphicsLayerCA::recursiveCommitChanges):
+        (WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers):
+        (WebCore::GraphicsLayerCA::commitLayerChangesAfterSublayers):
+        (WebCore::GraphicsLayerCA::updateSublayerList):
+        (WebCore::GraphicsLayerCA::ensureStructuralLayer):
+        (WebCore::GraphicsLayerCA::updateMaskLayer):
+        (WebCore::GraphicsLayerCA::replicatedLayerRoot):
+        (WebCore::GraphicsLayerCA::createFilterAnimationsFromKeyframes):
+        (WebCore::GraphicsLayerCA::swapFromOrToTiledLayer):
+        (WebCore::GraphicsLayerCA::propagateLayerChangeToReplicas):
+        (WebCore::GraphicsLayerCA::fetchCloneLayers):
+
</ins><span class="cx"> 2014-06-14  peavo@outlook.com  &lt;peavo@outlook.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [Curl] Compile errors related to http headers.
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsGraphicsLayercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp (169971 => 169972)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp        2014-06-14 17:12:04 UTC (rev 169971)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp        2014-06-14 17:40:49 UTC (rev 169972)
</span><span class="lines">@@ -90,6 +90,7 @@
</span><span class="cx">     , m_appliesPageScale(false)
</span><span class="cx">     , m_showDebugBorder(false)
</span><span class="cx">     , m_showRepaintCounter(false)
</span><ins>+    , m_isMaskLayer(false)
</ins><span class="cx">     , m_paintingPhase(GraphicsLayerPaintAllWithOverflowClip)
</span><span class="cx">     , m_contentsOrientation(CompositingCoordinatesTopDown)
</span><span class="cx">     , m_parent(0)
</span><span class="lines">@@ -260,10 +261,27 @@
</span><span class="cx">             }
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        setParent(0);
</del><ins>+        setParent(nullptr);
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void GraphicsLayer::setMaskLayer(GraphicsLayer* layer)
+{
+    if (layer == m_maskLayer)
+        return;
+
+    if (layer) {
+        layer-&gt;removeFromParent();
+        layer-&gt;setParent(this);
+        layer-&gt;setIsMaskLayer(true);
+    } else if (m_maskLayer) {
+        m_maskLayer-&gt;setParent(nullptr);
+        m_maskLayer-&gt;setIsMaskLayer(false);
+    }
+    
+    m_maskLayer = layer;
+}
+
</ins><span class="cx"> void GraphicsLayer::noteDeviceOrPageScaleFactorChangedIncludingDescendants()
</span><span class="cx"> {
</span><span class="cx">     deviceOrPageScaleFactorChanged();
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsGraphicsLayerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.h (169971 => 169972)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.h        2014-06-14 17:12:04 UTC (rev 169971)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.h        2014-06-14 17:40:49 UTC (rev 169972)
</span><span class="lines">@@ -261,8 +261,12 @@
</span><span class="cx">     void removeAllChildren();
</span><span class="cx">     virtual void removeFromParent();
</span><span class="cx"> 
</span><ins>+    // The parent() of a maskLayer is set to the layer being masked.
</ins><span class="cx">     GraphicsLayer* maskLayer() const { return m_maskLayer; }
</span><del>-    virtual void setMaskLayer(GraphicsLayer* layer) { m_maskLayer = layer; }
</del><ins>+    virtual void setMaskLayer(GraphicsLayer*);
+
+    void setIsMaskLayer(bool isMask) { m_isMaskLayer = isMask; }
+    bool isMaskLayer() const { return m_isMaskLayer; }
</ins><span class="cx">     
</span><span class="cx">     // The given layer will replicate this layer and its children; the replica renders behind this layer.
</span><span class="cx">     virtual void setReplicatedByLayer(GraphicsLayer*);
</span><span class="lines">@@ -593,6 +597,7 @@
</span><span class="cx">     bool m_appliesPageScale : 1; // Set for the layer which has the page scale applied to it.
</span><span class="cx">     bool m_showDebugBorder : 1;
</span><span class="cx">     bool m_showRepaintCounter : 1;
</span><ins>+    bool m_isMaskLayer : 1;
</ins><span class="cx">     
</span><span class="cx">     GraphicsLayerPaintingPhase m_paintingPhase;
</span><span class="cx">     CompositingCoordinatesOrientation m_contentsOrientation; // affects orientation of layer contents
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscaGraphicsLayerCAcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp (169971 => 169972)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp        2014-06-14 17:12:04 UTC (rev 169971)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp        2014-06-14 17:40:49 UTC (rev 169972)
</span><span class="lines">@@ -456,7 +456,7 @@
</span><span class="cx"> void GraphicsLayerCA::removeFromParent()
</span><span class="cx"> {
</span><span class="cx">     if (m_parent)
</span><del>-        static_cast&lt;GraphicsLayerCA*&gt;(m_parent)-&gt;noteSublayersChanged();
</del><ins>+        toGraphicsLayerCA(m_parent)-&gt;noteSublayersChanged();
</ins><span class="cx">     GraphicsLayer::removeFromParent();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -471,7 +471,7 @@
</span><span class="cx">     propagateLayerChangeToReplicas();
</span><span class="cx">     
</span><span class="cx">     if (m_replicatedLayer)
</span><del>-        static_cast&lt;GraphicsLayerCA*&gt;(m_replicatedLayer)-&gt;propagateLayerChangeToReplicas();
</del><ins>+        toGraphicsLayerCA(m_replicatedLayer)-&gt;propagateLayerChangeToReplicas();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void GraphicsLayerCA::setReplicatedLayer(GraphicsLayer* layer)
</span><span class="lines">@@ -1035,7 +1035,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (m_maskLayer) {
</span><del>-        GraphicsLayerCA* maskLayerCA = static_cast&lt;GraphicsLayerCA*&gt;(m_maskLayer);
</del><ins>+        GraphicsLayerCA* maskLayerCA = toGraphicsLayerCA(m_maskLayer);
</ins><span class="cx">         if (maskLayerCA-&gt;recursiveVisibleRectChangeRequiresFlush(localState))
</span><span class="cx">             return true;
</span><span class="cx">     }
</span><span class="lines">@@ -1044,13 +1044,13 @@
</span><span class="cx">     size_t numChildren = childLayers.size();
</span><span class="cx">     
</span><span class="cx">     for (size_t i = 0; i &lt; numChildren; ++i) {
</span><del>-        GraphicsLayerCA* curChild = static_cast&lt;GraphicsLayerCA*&gt;(childLayers[i]);
</del><ins>+        GraphicsLayerCA* curChild = toGraphicsLayerCA(childLayers[i]);
</ins><span class="cx">         if (curChild-&gt;recursiveVisibleRectChangeRequiresFlush(localState))
</span><span class="cx">             return true;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (m_replicaLayer)
</span><del>-        if (static_cast&lt;GraphicsLayerCA*&gt;(m_replicaLayer)-&gt;recursiveVisibleRectChangeRequiresFlush(localState))
</del><ins>+        if (toGraphicsLayerCA(m_replicaLayer)-&gt;recursiveVisibleRectChangeRequiresFlush(localState))
</ins><span class="cx">             return true;
</span><span class="cx">     
</span><span class="cx">     return false;
</span><span class="lines">@@ -1150,6 +1150,12 @@
</span><span class="cx">     if (visibleRect != m_visibleRect) {
</span><span class="cx">         m_uncommittedChanges |= VisibleRectChanged;
</span><span class="cx">         m_visibleRect = visibleRect;
</span><ins>+        
+        if (GraphicsLayerCA* maskLayer = toGraphicsLayerCA(m_maskLayer)) {
+            // FIXME: this assumes that the mask layer has the same geometry as this layer (which is currently always true).
+            maskLayer-&gt;m_uncommittedChanges |= VisibleRectChanged;
+            maskLayer-&gt;m_visibleRect = visibleRect;
+        }
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx"> #ifdef VISIBLE_TILE_WASH
</span><span class="lines">@@ -1187,39 +1193,31 @@
</span><span class="cx">     if (affectedByPageScale)
</span><span class="cx">         baseRelativePosition += m_position;
</span><span class="cx">     
</span><del>-    {
-        TemporaryChange&lt;bool&gt; committingChangesChange(m_isCommittingChanges, true);
-        commitLayerChangesBeforeSublayers(childCommitState, pageScaleFactor, baseRelativePosition, oldVisibleRect);
-    }
</del><ins>+    commitLayerChangesBeforeSublayers(childCommitState, pageScaleFactor, baseRelativePosition, oldVisibleRect);
</ins><span class="cx"> 
</span><span class="cx">     if (isRunningTransformAnimation()) {
</span><span class="cx">         childCommitState.ancestorHasTransformAnimation = true;
</span><span class="cx">         affectedByTransformAnimation = true;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (m_maskLayer) {
-        GraphicsLayerCA* maskLayerCA = static_cast&lt;GraphicsLayerCA*&gt;(m_maskLayer);
-        maskLayerCA-&gt;commitLayerChangesBeforeSublayers(childCommitState, pageScaleFactor, baseRelativePosition, maskLayerCA-&gt;visibleRect());
-    }
</del><ins>+    if (GraphicsLayerCA* maskLayer = toGraphicsLayerCA(m_maskLayer))
+        maskLayer-&gt;commitLayerChangesBeforeSublayers(childCommitState, pageScaleFactor, baseRelativePosition, oldVisibleRect);
</ins><span class="cx"> 
</span><span class="cx">     const Vector&lt;GraphicsLayer*&gt;&amp; childLayers = children();
</span><span class="cx">     size_t numChildren = childLayers.size();
</span><span class="cx">     
</span><span class="cx">     for (size_t i = 0; i &lt; numChildren; ++i) {
</span><del>-        GraphicsLayerCA* curChild = static_cast&lt;GraphicsLayerCA*&gt;(childLayers[i]);
</del><ins>+        GraphicsLayerCA* curChild = toGraphicsLayerCA(childLayers[i]);
</ins><span class="cx">         curChild-&gt;recursiveCommitChanges(childCommitState, localState, pageScaleFactor, baseRelativePosition, affectedByPageScale);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (m_replicaLayer)
-        static_cast&lt;GraphicsLayerCA*&gt;(m_replicaLayer)-&gt;recursiveCommitChanges(childCommitState, localState, pageScaleFactor, baseRelativePosition, affectedByPageScale);
</del><ins>+    if (GraphicsLayerCA* replicaLayer = toGraphicsLayerCA(m_replicaLayer))
+        replicaLayer-&gt;recursiveCommitChanges(childCommitState, localState, pageScaleFactor, baseRelativePosition, affectedByPageScale);
</ins><span class="cx"> 
</span><del>-    if (m_maskLayer)
-        static_cast&lt;GraphicsLayerCA*&gt;(m_maskLayer)-&gt;commitLayerChangesAfterSublayers(childCommitState);
</del><ins>+    if (GraphicsLayerCA* maskLayer = toGraphicsLayerCA(m_maskLayer))
+        maskLayer-&gt;commitLayerChangesAfterSublayers(childCommitState);
</ins><span class="cx"> 
</span><del>-    {
-        TemporaryChange&lt;bool&gt; committingChangesChange(m_isCommittingChanges, true);
-        commitLayerChangesAfterSublayers(childCommitState);
-    }
</del><ins>+    commitLayerChangesAfterSublayers(childCommitState);
</ins><span class="cx"> 
</span><span class="cx">     if (affectedByTransformAnimation &amp;&amp; m_layer-&gt;layerType() == PlatformCALayer::LayerTypeTiledBackingLayer)
</span><span class="cx">         client().notifyFlushBeforeDisplayRefresh(this);
</span><span class="lines">@@ -1270,6 +1268,8 @@
</span><span class="cx"> 
</span><span class="cx"> void GraphicsLayerCA::commitLayerChangesBeforeSublayers(CommitState&amp; commitState, float pageScaleFactor, const FloatPoint&amp; positionRelativeToBase, const FloatRect&amp; oldVisibleRect)
</span><span class="cx"> {
</span><ins>+    TemporaryChange&lt;bool&gt; committingChangesChange(m_isCommittingChanges, true);
+
</ins><span class="cx">     ++commitState.treeDepth;
</span><span class="cx">     if (m_structuralLayer)
</span><span class="cx">         ++commitState.treeDepth;
</span><span class="lines">@@ -1364,8 +1364,12 @@
</span><span class="cx">     if (m_uncommittedChanges &amp; ContentsRectsChanged) // Needs to happen before ChildrenChanged
</span><span class="cx">         updateContentsRects();
</span><span class="cx"> 
</span><del>-    if (m_uncommittedChanges &amp; MaskLayerChanged)
</del><ins>+    if (m_uncommittedChanges &amp; MaskLayerChanged) {
</ins><span class="cx">         updateMaskLayer();
</span><ins>+        // If the mask layer becomes tiled it can set this flag again. Clear the flag so that
+        // commitLayerChangesAfterSublayers doesn't update the mask again in the normal case.
+        m_uncommittedChanges &amp;= ~MaskLayerChanged;
+    }
</ins><span class="cx"> 
</span><span class="cx">     if (m_uncommittedChanges &amp; ContentsNeedsDisplay)
</span><span class="cx">         updateContentsNeedsDisplay();
</span><span class="lines">@@ -1398,6 +1402,11 @@
</span><span class="cx">     if (!m_uncommittedChanges)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    TemporaryChange&lt;bool&gt; committingChangesChange(m_isCommittingChanges, true);
+
+    if (m_uncommittedChanges &amp; MaskLayerChanged)
+        updateMaskLayer();
+
</ins><span class="cx">     if (m_uncommittedChanges &amp; ChildrenChanged)
</span><span class="cx">         updateSublayerList(commitState.treeDepth &gt; cMaxLayerTreeDepth);
</span><span class="cx"> 
</span><span class="lines">@@ -1441,7 +1450,7 @@
</span><span class="cx"> 
</span><span class="cx">     if (m_structuralLayer) {
</span><span class="cx">         if (m_replicaLayer)
</span><del>-            structuralLayerChildren.append(static_cast&lt;GraphicsLayerCA*&gt;(m_replicaLayer)-&gt;primaryLayer());
</del><ins>+            structuralLayerChildren.append(toGraphicsLayerCA(m_replicaLayer)-&gt;primaryLayer());
</ins><span class="cx">     
</span><span class="cx">         structuralLayerChildren.append(m_layer);
</span><span class="cx">     }
</span><span class="lines">@@ -1456,7 +1465,7 @@
</span><span class="cx">     const Vector&lt;GraphicsLayer*&gt;&amp; childLayers = children();
</span><span class="cx">     size_t numChildren = childLayers.size();
</span><span class="cx">     for (size_t i = 0; i &lt; numChildren; ++i) {
</span><del>-        GraphicsLayerCA* curChild = static_cast&lt;GraphicsLayerCA*&gt;(childLayers[i]);
</del><ins>+        GraphicsLayerCA* curChild = toGraphicsLayerCA(childLayers[i]);
</ins><span class="cx">         PlatformCALayer* childLayer = curChild-&gt;layerForSuperlayer();
</span><span class="cx">         childListForSublayers.append(childLayer);
</span><span class="cx">     }
</span><span class="lines">@@ -1741,7 +1750,7 @@
</span><span class="cx"> 
</span><span class="cx">     // We've changed the layer that our parent added to its sublayer list, so tell it to update
</span><span class="cx">     // sublayers again in its commitLayerChangesAfterSublayers().
</span><del>-    static_cast&lt;GraphicsLayerCA*&gt;(parent())-&gt;noteSublayersChanged(DontScheduleFlush);
</del><ins>+    toGraphicsLayerCA(parent())-&gt;noteSublayersChanged(DontScheduleFlush);
</ins><span class="cx"> 
</span><span class="cx">     // Set properties of m_layer to their default values, since these are expressed on on the structural layer.
</span><span class="cx">     FloatPoint point(m_size.width() / 2.0f, m_size.height() / 2.0f);
</span><span class="lines">@@ -2035,10 +2044,10 @@
</span><span class="cx"> 
</span><span class="cx"> void GraphicsLayerCA::updateMaskLayer()
</span><span class="cx"> {
</span><del>-    PlatformCALayer* maskCALayer = m_maskLayer ? static_cast&lt;GraphicsLayerCA*&gt;(m_maskLayer)-&gt;primaryLayer() : 0;
</del><ins>+    PlatformCALayer* maskCALayer = m_maskLayer ? toGraphicsLayerCA(m_maskLayer)-&gt;primaryLayer() : 0;
</ins><span class="cx">     m_layer-&gt;setMask(maskCALayer);
</span><span class="cx"> 
</span><del>-    LayerMap* maskLayerCloneMap = m_maskLayer ? static_cast&lt;GraphicsLayerCA*&gt;(m_maskLayer)-&gt;primaryLayerClones() : 0;
</del><ins>+    LayerMap* maskLayerCloneMap = m_maskLayer ? toGraphicsLayerCA(m_maskLayer)-&gt;primaryLayerClones() : 0;
</ins><span class="cx">     
</span><span class="cx">     if (LayerMap* layerCloneMap = m_layerClones.get()) {
</span><span class="cx">         LayerMap::const_iterator end = layerCloneMap-&gt;end();
</span><span class="lines">@@ -2091,7 +2100,7 @@
</span><span class="cx">     if (!m_replicatedLayer || replicaState.replicaDepth() == ReplicaState::maxReplicaDepth)
</span><span class="cx">         return 0;
</span><span class="cx"> 
</span><del>-    GraphicsLayerCA* replicatedLayer = static_cast&lt;GraphicsLayerCA*&gt;(m_replicatedLayer);
</del><ins>+    GraphicsLayerCA* replicatedLayer = toGraphicsLayerCA(m_replicatedLayer);
</ins><span class="cx">     
</span><span class="cx">     RefPtr&lt;PlatformCALayer&gt; clonedLayerRoot = replicatedLayer-&gt;fetchCloneLayers(this, replicaState, RootCloneLevel);
</span><span class="cx">     FloatPoint cloneRootPosition = replicatedLayer-&gt;positionForCloneRootLayer();
</span><span class="lines">@@ -2423,7 +2432,7 @@
</span><span class="cx">     int listIndex = validateFilterOperations(valueList);
</span><span class="cx">     if (listIndex &lt; 0)
</span><span class="cx">         return false;
</span><del>-        
</del><ins>+
</ins><span class="cx">     const FilterOperations&amp; operations = static_cast&lt;const FilterAnimationValue&amp;&gt;(valueList.at(listIndex)).value();
</span><span class="cx">     // Make sure the platform layer didn't fallback to using software filter compositing instead.
</span><span class="cx">     if (!filtersCanBeComposited(operations))
</span><span class="lines">@@ -3006,11 +3015,17 @@
</span><span class="cx">         m_layer-&gt;appendSublayer(m_visibleTileWashLayer.get());
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    // Skip this step if we don't have a superlayer. This is probably a benign
-    // case that happens while restructuring the layer tree, and also occurs with
-    // WebKit2 page overlays, which can become tiled but are out-of-tree.
-    if (oldLayer-&gt;superlayer())
</del><ins>+    if (isMaskLayer()) {
+        // A mask layer's superlayer is the layer that it masks. Set the MaskLayerChanged dirty bit
+        // so that the parent will fix up the platform layers in commitLayerChangesAfterSublayers().
+        if (GraphicsLayer* parentLayer = parent())
+            toGraphicsLayerCA(parentLayer)-&gt;noteLayerPropertyChanged(MaskLayerChanged);
+    } else if (oldLayer-&gt;superlayer()) {
+        // Skip this step if we don't have a superlayer. This is probably a benign
+        // case that happens while restructuring the layer tree, and also occurs with
+        // WebKit2 page overlays, which can become tiled but are out-of-tree.
</ins><span class="cx">         oldLayer-&gt;superlayer()-&gt;replaceSublayer(oldLayer.get(), m_layer.get());
</span><ins>+    }
</ins><span class="cx"> 
</span><span class="cx">     m_uncommittedChanges |= ChildrenChanged
</span><span class="cx">         | GeometryChanged
</span><span class="lines">@@ -3023,6 +3038,7 @@
</span><span class="cx">         | ContentsScaleChanged
</span><span class="cx">         | AcceleratesDrawingChanged
</span><span class="cx">         | FiltersChanged
</span><ins>+        | MaskLayerChanged
</ins><span class="cx">         | OpacityChanged
</span><span class="cx">         | DebugIndicatorsChanged;
</span><span class="cx">     
</span><span class="lines">@@ -3143,12 +3159,12 @@
</span><span class="cx"> void GraphicsLayerCA::propagateLayerChangeToReplicas()
</span><span class="cx"> {
</span><span class="cx">     for (GraphicsLayer* currLayer = this; currLayer; currLayer = currLayer-&gt;parent()) {
</span><del>-        GraphicsLayerCA* currLayerCA = static_cast&lt;GraphicsLayerCA*&gt;(currLayer);
</del><ins>+        GraphicsLayerCA* currLayerCA = toGraphicsLayerCA(currLayer);
</ins><span class="cx">         if (!currLayerCA-&gt;hasCloneLayers())
</span><span class="cx">             break;
</span><span class="cx"> 
</span><span class="cx">         if (currLayerCA-&gt;replicaLayer())
</span><del>-            static_cast&lt;GraphicsLayerCA*&gt;(currLayerCA-&gt;replicaLayer())-&gt;noteLayerPropertyChanged(ReplicatedLayerChanged);
</del><ins>+            toGraphicsLayerCA(currLayerCA-&gt;replicaLayer())-&gt;noteLayerPropertyChanged(ReplicatedLayerChanged);
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -3161,7 +3177,7 @@
</span><span class="cx">     ensureCloneLayers(replicaState.cloneID(), primaryLayer, structuralLayer, contentsLayer, contentsClippingLayer, cloneLevel);
</span><span class="cx"> 
</span><span class="cx">     if (m_maskLayer) {
</span><del>-        RefPtr&lt;PlatformCALayer&gt; maskClone = static_cast&lt;GraphicsLayerCA*&gt;(m_maskLayer)-&gt;fetchCloneLayers(replicaRoot, replicaState, IntermediateCloneLevel);
</del><ins>+        RefPtr&lt;PlatformCALayer&gt; maskClone = toGraphicsLayerCA(m_maskLayer)-&gt;fetchCloneLayers(replicaRoot, replicaState, IntermediateCloneLevel);
</ins><span class="cx">         primaryLayer-&gt;setMask(maskClone.get());
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -3188,7 +3204,7 @@
</span><span class="cx">     if (m_replicaLayer &amp;&amp; m_replicaLayer != replicaRoot) {
</span><span class="cx">         // We have nested replicas. Ask the replica layer for a clone of its contents.
</span><span class="cx">         replicaState.setBranchType(ReplicaState::ReplicaBranch);
</span><del>-        replicaLayer = static_cast&lt;GraphicsLayerCA*&gt;(m_replicaLayer)-&gt;fetchCloneLayers(replicaRoot, replicaState, RootCloneLevel);
</del><ins>+        replicaLayer = toGraphicsLayerCA(m_replicaLayer)-&gt;fetchCloneLayers(replicaRoot, replicaState, RootCloneLevel);
</ins><span class="cx">         replicaState.setBranchType(ReplicaState::ChildBranch);
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -3221,7 +3237,7 @@
</span><span class="cx"> 
</span><span class="cx">         size_t numChildren = childLayers.size();
</span><span class="cx">         for (size_t i = 0; i &lt; numChildren; ++i) {
</span><del>-            GraphicsLayerCA* curChild = static_cast&lt;GraphicsLayerCA*&gt;(childLayers[i]);
</del><ins>+            GraphicsLayerCA* curChild = toGraphicsLayerCA(childLayers[i]);
</ins><span class="cx"> 
</span><span class="cx">             RefPtr&lt;PlatformCALayer&gt; childLayer = curChild-&gt;fetchCloneLayers(replicaRoot, replicaState, IntermediateCloneLevel);
</span><span class="cx">             if (childLayer)
</span></span></pre>
</div>
</div>

</body>
</html>