<!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>[170071] 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/170071">170071</a></dd>
<dt>Author</dt> <dd>simon.fraser@apple.com</dd>
<dt>Date</dt> <dd>2014-06-17 14:06:12 -0700 (Tue, 17 Jun 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>[UI-side compositing] fix reflections on composited layers
https://bugs.webkit.org/show_bug.cgi?id=133942

Reviewed by Tim Horton.

Source/WebCore:

Fix reflections on composited layers. There are two main set of changes.

First, a PlatformCALayerRemote which is a clone has to track the layer
it is a clone of, so it knows where to grab the contents from in the UI process.
This layer may be told that its contents need updating out of order during
recursiveBuildTransaction(), so we need some small changes in RemoteLayerTreeContext
to allow a layer to add itself to the set of layers requiring commit.

In the UI process, a new step is added to RemoteLayerTreeHost::updateLayerTree()
to go through clones, and copy their contents from the origin layer.

The second set of changes makes platformCALayerLayerDidDisplay() work for
UI-side compositing by not taking a PlatformLayer*, but instead a PlatformCALayer*.
PlatformCALayer::setContentsChanged() changed to copyContentsFromLayer() so we know
what the origin layer is.

Test: compositing/reflections/repaint-with-reflection.html

* WebCore.exp.in:
* platform/graphics/GraphicsLayer.h:
(WebCore::GraphicsLayer::layerDidDisplay): Deleted.
* platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
(WebCore::LayerClient::platformCALayerLayerDidDisplay): Deleted.
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::layerDidDisplay):
(WebCore::GraphicsLayerCA::findOrMakeClone):
* platform/graphics/ca/GraphicsLayerCA.h:
* platform/graphics/ca/PlatformCALayer.h:
* platform/graphics/ca/PlatformCALayerClient.h:
(WebCore::PlatformCALayerClient::platformCALayerLayerDidDisplay):
* platform/graphics/ca/mac/PlatformCALayerMac.h:
* platform/graphics/ca/mac/PlatformCALayerMac.mm:
(PlatformCALayerMac::copyContentsFromLayer):
(PlatformCALayerMac::superlayer):
(PlatformCALayerMac::setContentsChanged): Deleted.
* platform/graphics/ca/win/PlatformCALayerWinInternal.cpp:
(PlatformCALayerWinInternal::displayCallback):
* platform/graphics/mac/WebLayer.mm:
(-[WebSimpleLayer display]):

Source/WebKit2:

Fix reflections on composited layers. There are two main set of changes.

First, a PlatformCALayerRemote which is a clone has to track the layer
it is a clone of, so it knows where to grab the contents from in the UI process.
This layer may be told that its contents need updating out of order during
recursiveBuildTransaction(), so we need some small changes in RemoteLayerTreeContext
to allow a layer to add itself to the set of layers requiring commit.

In the UI process, a new step is added to RemoteLayerTreeHost::updateLayerTree()
to go through clones, and copy their contents from the origin layer.

The second set of changes makes platformCALayerLayerDidDisplay() work for
UI-side compositing by not taking a PlatformLayer*, but instead a PlatformCALayer*.
PlatformCALayer::setContentsChanged() changed to copyContentsFromLayer() so we know
what the origin layer is.

* Shared/mac/RemoteLayerBackingStore.mm:
(WebKit::RemoteLayerBackingStore::display): Remove the early return so we can always
call platformCALayerLayerDidDisplay().
* Shared/mac/RemoteLayerTreeTransaction.h:
* Shared/mac/RemoteLayerTreeTransaction.mm:
(WebKit::RemoteLayerTreeTransaction::LayerProperties::LayerProperties):
(WebKit::RemoteLayerTreeTransaction::LayerProperties::encode):
(WebKit::RemoteLayerTreeTransaction::LayerProperties::decode):
(WebKit::dumpChangedLayers):
* UIProcess/mac/RemoteLayerTreeHost.mm:
(WebKit::RemoteLayerTreeHost::updateLayerTree):
* WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
(WebKit::PlatformCALayerRemote::clone):
(WebKit::PlatformCALayerRemote::recursiveBuildTransaction):
(WebKit::PlatformCALayerRemote::copyContentsFromLayer):
(WebKit::PlatformCALayerRemote::setClonedLayer):
(WebKit::PlatformCALayerRemote::setContentsChanged): Deleted.
* WebProcess/WebPage/mac/PlatformCALayerRemote.h:
(WebKit::PlatformCALayerRemote::properties):
(WebKit::PlatformCALayerRemote::context):

LayoutTests:

Test with a reflected div, that repaints on a timer to test backing
store updating on the clone.

* compositing/reflections/repaint-with-reflection-expected.html: Added.
* compositing/reflections/repaint-with-reflection.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="#trunkSourceWebCoreWebCoreexpin">trunk/Source/WebCore/WebCore.exp.in</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsGraphicsLayerh">trunk/Source/WebCore/platform/graphics/GraphicsLayer.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsavfoundationcfMediaPlayerPrivateAVFoundationCFcpp">trunk/Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscaGraphicsLayerCAcpp">trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscaGraphicsLayerCAh">trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscaPlatformCALayerh">trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscaPlatformCALayerClienth">trunk/Source/WebCore/platform/graphics/ca/PlatformCALayerClient.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscamacPlatformCALayerMach">trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscamacPlatformCALayerMacmm">trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscawinPlatformCALayerWincpp">trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscawinPlatformCALayerWinh">trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscawinPlatformCALayerWinInternalcpp">trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWinInternal.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsmacWebLayermm">trunk/Source/WebCore/platform/graphics/mac/WebLayer.mm</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2SharedmacRemoteLayerBackingStoremm">trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStore.mm</a></li>
<li><a href="#trunkSourceWebKit2SharedmacRemoteLayerTreeTransactionh">trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h</a></li>
<li><a href="#trunkSourceWebKit2SharedmacRemoteLayerTreeTransactionmm">trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacRemoteLayerTreeHostmm">trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeHost.mm</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPagemacPlatformCALayerRemotecpp">trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPagemacPlatformCALayerRemoteh">trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPagemacRemoteLayerTreeContexth">trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeContext.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPagemacRemoteLayerTreeContextmm">trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeContext.mm</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestscompositingreflectionsrepaintwithreflectionexpectedhtml">trunk/LayoutTests/compositing/reflections/repaint-with-reflection-expected.html</a></li>
<li><a href="#trunkLayoutTestscompositingreflectionsrepaintwithreflectionhtml">trunk/LayoutTests/compositing/reflections/repaint-with-reflection.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (170070 => 170071)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-06-17 20:19:11 UTC (rev 170070)
+++ trunk/LayoutTests/ChangeLog        2014-06-17 21:06:12 UTC (rev 170071)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2014-06-17  Simon Fraser  &lt;simon.fraser@apple.com&gt;
+
+        [UI-side compositing] fix reflections on composited layers
+        https://bugs.webkit.org/show_bug.cgi?id=133942
+
+        Reviewed by Tim Horton.
+        
+        Test with a reflected div, that repaints on a timer to test backing
+        store updating on the clone.
+
+        * compositing/reflections/repaint-with-reflection-expected.html: Added.
+        * compositing/reflections/repaint-with-reflection.html: Added.
+
</ins><span class="cx"> 2014-06-17  Commit Queue  &lt;commit-queue@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed, rolling out r170058.
</span></span></pre></div>
<a id="trunkLayoutTestscompositingreflectionsrepaintwithreflectionexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/compositing/reflections/repaint-with-reflection-expected.html (0 => 170071)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/compositing/reflections/repaint-with-reflection-expected.html                                (rev 0)
+++ trunk/LayoutTests/compositing/reflections/repaint-with-reflection-expected.html        2014-06-17 21:06:12 UTC (rev 170071)
</span><span class="lines">@@ -0,0 +1,29 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+
+&lt;html&gt;
+&lt;head&gt;
+    &lt;style&gt;
+        .box {
+          width: 100px;
+          height: 100px;
+          background-color: silver;
+          border: 2px solid black;
+          -webkit-box-reflect: below 5px;
+        }
+        
+        .box.changed {
+            background-color: orange;
+        }
+        
+        .composited {
+          -webkit-transform: translateZ(0);
+        }
+        
+    &lt;/style&gt;
+&lt;/head&gt;
+&lt;body&gt;
+
+    &lt;div id=&quot;box&quot; class=&quot;composited changed box&quot;&gt;
+    &lt;/div&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestscompositingreflectionsrepaintwithreflectionhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/compositing/reflections/repaint-with-reflection.html (0 => 170071)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/compositing/reflections/repaint-with-reflection.html                                (rev 0)
+++ trunk/LayoutTests/compositing/reflections/repaint-with-reflection.html        2014-06-17 21:06:12 UTC (rev 170071)
</span><span class="lines">@@ -0,0 +1,44 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+
+&lt;html&gt;
+&lt;head&gt;
+    &lt;style&gt;
+        .box {
+          width: 100px;
+          height: 100px;
+          background-color: silver;
+          border: 2px solid black;
+          -webkit-box-reflect: below 5px;
+        }
+        
+        .box.changed {
+            background-color: orange;
+        }
+        
+        .composited {
+          -webkit-transform: translateZ(0);
+        }
+        
+    &lt;/style&gt;
+    &lt;script&gt;
+        if (window.testRunner)
+            testRunner.waitUntilDone();
+
+        function doTest()
+        {
+            window.setTimeout(function() {
+                document.getElementById('box').classList.add('changed');
+                if (window.testRunner)
+                    testRunner.notifyDone();
+            }, 0);
+        }
+        
+        window.addEventListener('load', doTest, false);
+    &lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+
+    &lt;div id=&quot;box&quot; class=&quot;composited box&quot;&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 (170070 => 170071)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-06-17 20:19:11 UTC (rev 170070)
+++ trunk/Source/WebCore/ChangeLog        2014-06-17 21:06:12 UTC (rev 170071)
</span><span class="lines">@@ -1,3 +1,50 @@
</span><ins>+2014-06-17  Simon Fraser  &lt;simon.fraser@apple.com&gt;
+
+        [UI-side compositing] fix reflections on composited layers
+        https://bugs.webkit.org/show_bug.cgi?id=133942
+
+        Reviewed by Tim Horton.
+
+        Fix reflections on composited layers. There are two main set of changes.
+        
+        First, a PlatformCALayerRemote which is a clone has to track the layer
+        it is a clone of, so it knows where to grab the contents from in the UI process.
+        This layer may be told that its contents need updating out of order during
+        recursiveBuildTransaction(), so we need some small changes in RemoteLayerTreeContext
+        to allow a layer to add itself to the set of layers requiring commit.
+        
+        In the UI process, a new step is added to RemoteLayerTreeHost::updateLayerTree()
+        to go through clones, and copy their contents from the origin layer.
+        
+        The second set of changes makes platformCALayerLayerDidDisplay() work for
+        UI-side compositing by not taking a PlatformLayer*, but instead a PlatformCALayer*.
+        PlatformCALayer::setContentsChanged() changed to copyContentsFromLayer() so we know
+        what the origin layer is.
+
+        Test: compositing/reflections/repaint-with-reflection.html
+
+        * WebCore.exp.in:
+        * platform/graphics/GraphicsLayer.h:
+        (WebCore::GraphicsLayer::layerDidDisplay): Deleted.
+        * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
+        (WebCore::LayerClient::platformCALayerLayerDidDisplay): Deleted.
+        * platform/graphics/ca/GraphicsLayerCA.cpp:
+        (WebCore::GraphicsLayerCA::layerDidDisplay):
+        (WebCore::GraphicsLayerCA::findOrMakeClone):
+        * platform/graphics/ca/GraphicsLayerCA.h:
+        * platform/graphics/ca/PlatformCALayer.h:
+        * platform/graphics/ca/PlatformCALayerClient.h:
+        (WebCore::PlatformCALayerClient::platformCALayerLayerDidDisplay):
+        * platform/graphics/ca/mac/PlatformCALayerMac.h:
+        * platform/graphics/ca/mac/PlatformCALayerMac.mm:
+        (PlatformCALayerMac::copyContentsFromLayer):
+        (PlatformCALayerMac::superlayer):
+        (PlatformCALayerMac::setContentsChanged): Deleted.
+        * platform/graphics/ca/win/PlatformCALayerWinInternal.cpp:
+        (PlatformCALayerWinInternal::displayCallback):
+        * platform/graphics/mac/WebLayer.mm:
+        (-[WebSimpleLayer display]):
+
</ins><span class="cx"> 2014-06-17  Anders Carlsson  &lt;andersca@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Use strongly typed enums for AnimationState and AnimationInputState
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCoreexpin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.exp.in (170070 => 170071)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.exp.in        2014-06-17 20:19:11 UTC (rev 170070)
+++ trunk/Source/WebCore/WebCore.exp.in        2014-06-17 21:06:12 UTC (rev 170071)
</span><span class="lines">@@ -549,7 +549,7 @@
</span><span class="cx"> __ZN7WebCore15GraphicsLayerCA14setDebugBorderERKNS_5ColorEf
</span><span class="cx"> __ZN7WebCore15GraphicsLayerCA14setPreserves3DEb
</span><span class="cx"> __ZN7WebCore15GraphicsLayerCA15addChildAtIndexEPNS_13GraphicsLayerEi
</span><del>-__ZN7WebCore15GraphicsLayerCA15layerDidDisplayEP7CALayer
</del><ins>+__ZN7WebCore15GraphicsLayerCA15layerDidDisplayEPNS_15PlatformCALayerE
</ins><span class="cx"> __ZN7WebCore15GraphicsLayerCA15removeAnimationERKN3WTF6StringE
</span><span class="cx"> __ZN7WebCore15GraphicsLayerCA15setBoundsOriginERKNS_10FloatPointE
</span><span class="cx"> __ZN7WebCore15GraphicsLayerCA15setContentsRectERKNS_9FloatRectE
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsGraphicsLayerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.h (170070 => 170071)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.h        2014-06-17 20:19:11 UTC (rev 170070)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.h        2014-06-17 21:06:12 UTC (rev 170071)
</span><span class="lines">@@ -419,8 +419,6 @@
</span><span class="cx"> 
</span><span class="cx">     // Callback from the underlying graphics system to draw layer contents.
</span><span class="cx">     void paintGraphicsLayerContents(GraphicsContext&amp;, const FloatRect&amp; clip);
</span><del>-    // Callback from the underlying graphics system when the layer has been displayed
-    virtual void layerDidDisplay(PlatformLayer*) { }
</del><span class="cx">     
</span><span class="cx">     // For hosting this GraphicsLayer in a native layer hierarchy.
</span><span class="cx">     virtual PlatformLayer* platformLayer() const { return 0; }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsavfoundationcfMediaPlayerPrivateAVFoundationCFcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp (170070 => 170071)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp        2014-06-17 20:19:11 UTC (rev 170070)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp        2014-06-17 21:06:12 UTC (rev 170071)
</span><span class="lines">@@ -193,7 +193,6 @@
</span><span class="cx"> 
</span><span class="cx">     virtual bool platformCALayerContentsOpaque() const { return false; }
</span><span class="cx">     virtual bool platformCALayerDrawsContent() const { return false; }
</span><del>-    virtual void platformCALayerLayerDidDisplay(PlatformLayer*) { }
</del><span class="cx">     virtual float platformCALayerDeviceScaleFactor() const { return 1; }
</span><span class="cx"> 
</span><span class="cx">     AVFWrapper* m_parent;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscaGraphicsLayerCAcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp (170070 => 170071)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp        2014-06-17 20:19:11 UTC (rev 170070)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp        2014-06-17 21:06:12 UTC (rev 170071)
</span><span class="lines">@@ -949,19 +949,15 @@
</span><span class="cx">     noteLayerPropertyChanged(ContentsCanvasLayerChanged);
</span><span class="cx"> }
</span><span class="cx">     
</span><del>-void GraphicsLayerCA::layerDidDisplay(PlatformLayer* layer)
</del><ins>+void GraphicsLayerCA::layerDidDisplay(PlatformCALayer* layer)
</ins><span class="cx"> {
</span><del>-    PlatformCALayer* currentLayer = PlatformCALayer::platformCALayer(layer);
-    PlatformCALayer* sourceLayer;
</del><span class="cx">     LayerMap* layerCloneMap;
</span><span class="cx"> 
</span><del>-    if (currentLayer == m_layer) {
-        sourceLayer = m_layer.get();
</del><ins>+    if (layer == m_layer)
</ins><span class="cx">         layerCloneMap = m_layerClones.get();
</span><del>-    } else if (currentLayer == m_contentsLayer) {
-        sourceLayer = m_contentsLayer.get();
</del><ins>+    else if (layer == m_contentsLayer)
</ins><span class="cx">         layerCloneMap = m_contentsLayerClones.get();
</span><del>-    } else
</del><ins>+    else
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     if (layerCloneMap) {
</span><span class="lines">@@ -971,10 +967,7 @@
</span><span class="cx">             if (!currClone)
</span><span class="cx">                 continue;
</span><span class="cx"> 
</span><del>-            if (currClone-&gt;contents() != sourceLayer-&gt;contents())
-                currClone-&gt;setContents(sourceLayer-&gt;contents());
-            else
-                currClone-&gt;setContentsChanged();
</del><ins>+            currClone-&gt;copyContentsFromLayer(layer);
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="lines">@@ -3101,7 +3094,7 @@
</span><span class="cx">     } else {
</span><span class="cx">         resultLayer = cloneLayer(sourceLayer, cloneLevel);
</span><span class="cx"> #ifndef NDEBUG
</span><del>-        resultLayer-&gt;setName(String::format(&quot;Clone %d of layer %p&quot;, cloneID[0U], sourceLayer-&gt;platformLayer()));
</del><ins>+        resultLayer-&gt;setName(String::format(&quot;Clone %d of layer %llu&quot;, cloneID[0U], sourceLayer-&gt;layerID()));
</ins><span class="cx"> #endif
</span><span class="cx">         addResult.iterator-&gt;value = resultLayer;
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscaGraphicsLayerCAh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h (170070 => 170071)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h        2014-06-17 20:19:11 UTC (rev 170070)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h        2014-06-17 21:06:12 UTC (rev 170071)
</span><span class="lines">@@ -144,8 +144,6 @@
</span><span class="cx">     virtual void setCustomAppearance(CustomAppearance) override;
</span><span class="cx">     virtual void setCustomBehavior(CustomBehavior) override;
</span><span class="cx"> 
</span><del>-    virtual void layerDidDisplay(PlatformLayer*) override;
-
</del><span class="cx">     virtual void deviceOrPageScaleFactorChanged() override;
</span><span class="cx"> 
</span><span class="cx">     struct CommitState {
</span><span class="lines">@@ -188,7 +186,7 @@
</span><span class="cx"> 
</span><span class="cx">     virtual bool platformCALayerContentsOpaque() const override { return contentsOpaque(); }
</span><span class="cx">     virtual bool platformCALayerDrawsContent() const override { return drawsContent(); }
</span><del>-    virtual void platformCALayerLayerDidDisplay(PlatformLayer* layer) override { return layerDidDisplay(layer); }
</del><ins>+    virtual void platformCALayerLayerDidDisplay(PlatformCALayer* layer) override { return layerDidDisplay(layer); }
</ins><span class="cx">     virtual void platformCALayerSetNeedsToRevalidateTiles() override;
</span><span class="cx">     virtual float platformCALayerDeviceScaleFactor() const override;
</span><span class="cx">     virtual float platformCALayerContentsScaleMultiplierForNewTiles(PlatformCALayer*) const override;
</span><span class="lines">@@ -201,6 +199,7 @@
</span><span class="cx"> 
</span><span class="cx">     virtual bool shouldRepaintOnSizeChange() const override;
</span><span class="cx"> 
</span><ins>+    void layerDidDisplay(PlatformCALayer*);
</ins><span class="cx">     void updateOpacityOnLayer();
</span><span class="cx">     
</span><span class="cx"> #if ENABLE(CSS_FILTERS)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscaPlatformCALayerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h (170070 => 170071)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h        2014-06-17 20:19:11 UTC (rev 170070)
+++ trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h        2014-06-17 21:06:12 UTC (rev 170071)
</span><span class="lines">@@ -102,7 +102,7 @@
</span><span class="cx"> 
</span><span class="cx">     virtual void setNeedsDisplay(const FloatRect* dirtyRect = 0) = 0;
</span><span class="cx"> 
</span><del>-    virtual void setContentsChanged() = 0;
</del><ins>+    virtual void copyContentsFromLayer(PlatformCALayer*) = 0;
</ins><span class="cx"> 
</span><span class="cx">     LayerType layerType() const { return m_layerType; }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscaPlatformCALayerClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/ca/PlatformCALayerClient.h (170070 => 170071)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/ca/PlatformCALayerClient.h        2014-06-17 20:19:11 UTC (rev 170070)
+++ trunk/Source/WebCore/platform/graphics/ca/PlatformCALayerClient.h        2014-06-17 21:06:12 UTC (rev 170071)
</span><span class="lines">@@ -48,7 +48,7 @@
</span><span class="cx">     
</span><span class="cx">     virtual bool platformCALayerContentsOpaque() const = 0;
</span><span class="cx">     virtual bool platformCALayerDrawsContent() const = 0;
</span><del>-    virtual void platformCALayerLayerDidDisplay(PlatformLayer*)  { }
</del><ins>+    virtual void platformCALayerLayerDidDisplay(PlatformCALayer*)  { }
</ins><span class="cx"> 
</span><span class="cx">     virtual void platformCALayerSetNeedsToRevalidateTiles() { }
</span><span class="cx">     virtual float platformCALayerDeviceScaleFactor() const = 0;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscamacPlatformCALayerMach"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.h (170070 => 170071)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.h        2014-06-17 20:19:11 UTC (rev 170070)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.h        2014-06-17 21:06:12 UTC (rev 170071)
</span><span class="lines">@@ -46,7 +46,7 @@
</span><span class="cx"> 
</span><span class="cx">     virtual void setNeedsDisplay(const FloatRect* dirtyRect = 0) override;
</span><span class="cx"> 
</span><del>-    virtual void setContentsChanged() override;
</del><ins>+    virtual void copyContentsFromLayer(PlatformCALayer*) override;
</ins><span class="cx"> 
</span><span class="cx">     virtual PlatformCALayer* superlayer() const override;
</span><span class="cx">     virtual void removeFromSuperlayer() override;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscamacPlatformCALayerMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm (170070 => 170071)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm        2014-06-17 20:19:11 UTC (rev 170070)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm        2014-06-17 21:06:12 UTC (rev 170071)
</span><span class="lines">@@ -323,17 +323,21 @@
</span><span class="cx">         [m_layer.get() setNeedsDisplay];
</span><span class="cx">     END_BLOCK_OBJC_EXCEPTIONS
</span><span class="cx"> }
</span><del>-    
-void PlatformCALayerMac::setContentsChanged()
</del><ins>+
+void PlatformCALayerMac::copyContentsFromLayer(PlatformCALayer* layer)
</ins><span class="cx"> {
</span><span class="cx">     BEGIN_BLOCK_OBJC_EXCEPTIONS
</span><del>-    [m_layer.get() setContentsChanged];
</del><ins>+    CALayer* caLayer = layer-&gt;m_layer.get();
+    if ([m_layer contents] != [caLayer contents])
+        [m_layer setContents:[caLayer contents]];
+    else
+        [m_layer setContentsChanged];
</ins><span class="cx">     END_BLOCK_OBJC_EXCEPTIONS
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> PlatformCALayer* PlatformCALayerMac::superlayer() const
</span><span class="cx"> {
</span><del>-    return platformCALayer([m_layer.get() superlayer]);
</del><ins>+    return platformCALayer([m_layer superlayer]);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void PlatformCALayerMac::removeFromSuperlayer()
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscawinPlatformCALayerWincpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp (170070 => 170071)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp        2014-06-17 20:19:11 UTC (rev 170070)
+++ trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp        2014-06-17 21:06:12 UTC (rev 170071)
</span><span class="lines">@@ -220,14 +220,14 @@
</span><span class="cx">         host-&gt;layerTreeDidChange();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void PlatformCALayerWin::setContentsChanged()
</del><ins>+void PlatformCALayerWin::copyContentsFromLayer(PlatformCALayer* source)
</ins><span class="cx"> {
</span><del>-    // FIXME: There is no equivalent of setContentsChanged in CACF. For now I will
-    // set contents to 0 and then back to its original value to see if that
-    // kicks CACF into redisplaying.
-    RetainPtr&lt;CFTypeRef&gt; contents = CACFLayerGetContents(m_layer.get());
-    CACFLayerSetContents(m_layer.get(), 0);
-    CACFLayerSetContents(m_layer.get(), contents.get());
</del><ins>+    if (source) {
+        RetainPtr&lt;CFTypeRef&gt; contents = CACFLayerGetContents(source-&gt;platformLayer());
+        CACFLayerSetContents(m_layer.get(), contents.get());
+    } else
+        CACFLayerSetContents(m_layer.get(), nullptr);
+
</ins><span class="cx">     setNeedsCommit();
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscawinPlatformCALayerWinh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.h (170070 => 170071)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.h        2014-06-17 20:19:11 UTC (rev 170070)
+++ trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.h        2014-06-17 21:06:12 UTC (rev 170071)
</span><span class="lines">@@ -39,7 +39,7 @@
</span><span class="cx"> 
</span><span class="cx">     virtual void setNeedsDisplay(const FloatRect* dirtyRect = 0) override;
</span><span class="cx"> 
</span><del>-    virtual void setContentsChanged() override;
</del><ins>+    virtual void copyContentsFromLayer(PlatformCALayer*) override;
</ins><span class="cx"> 
</span><span class="cx">     virtual PlatformCALayer* superlayer() const override;
</span><span class="cx">     virtual void removeFromSuperlayer() override;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscawinPlatformCALayerWinInternalcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWinInternal.cpp (170070 => 170071)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWinInternal.cpp        2014-06-17 20:19:11 UTC (rev 170070)
+++ trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWinInternal.cpp        2014-06-17 21:06:12 UTC (rev 170071)
</span><span class="lines">@@ -148,7 +148,7 @@
</span><span class="cx"> 
</span><span class="cx">     CGContextRestoreGState(context);
</span><span class="cx"> 
</span><del>-    owner()-&gt;owner()-&gt;platformCALayerLayerDidDisplay(caLayer);
</del><ins>+    owner()-&gt;owner()-&gt;platformCALayerLayerDidDisplay(owner());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void PlatformCALayerWinInternal::internalSetNeedsDisplay(const FloatRect* dirtyRect)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsmacWebLayermm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/mac/WebLayer.mm (170070 => 170071)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/mac/WebLayer.mm        2014-06-17 20:19:11 UTC (rev 170070)
+++ trunk/Source/WebCore/platform/graphics/mac/WebLayer.mm        2014-06-17 21:06:12 UTC (rev 170071)
</span><span class="lines">@@ -110,7 +110,7 @@
</span><span class="cx">     [super display];
</span><span class="cx">     PlatformCALayer* layer = PlatformCALayer::platformCALayer(self);
</span><span class="cx">     if (layer &amp;&amp; layer-&gt;owner())
</span><del>-        layer-&gt;owner()-&gt;platformCALayerLayerDidDisplay(self);
</del><ins>+        layer-&gt;owner()-&gt;platformCALayerLayerDidDisplay(layer);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)drawInContext:(CGContextRef)context
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (170070 => 170071)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-06-17 20:19:11 UTC (rev 170070)
+++ trunk/Source/WebKit2/ChangeLog        2014-06-17 21:06:12 UTC (rev 170071)
</span><span class="lines">@@ -1,3 +1,47 @@
</span><ins>+2014-06-17  Simon Fraser  &lt;simon.fraser@apple.com&gt;
+
+        [UI-side compositing] fix reflections on composited layers
+        https://bugs.webkit.org/show_bug.cgi?id=133942
+
+        Reviewed by Tim Horton.
+        
+        Fix reflections on composited layers. There are two main set of changes.
+        
+        First, a PlatformCALayerRemote which is a clone has to track the layer
+        it is a clone of, so it knows where to grab the contents from in the UI process.
+        This layer may be told that its contents need updating out of order during
+        recursiveBuildTransaction(), so we need some small changes in RemoteLayerTreeContext
+        to allow a layer to add itself to the set of layers requiring commit.
+        
+        In the UI process, a new step is added to RemoteLayerTreeHost::updateLayerTree()
+        to go through clones, and copy their contents from the origin layer.
+        
+        The second set of changes makes platformCALayerLayerDidDisplay() work for
+        UI-side compositing by not taking a PlatformLayer*, but instead a PlatformCALayer*.
+        PlatformCALayer::setContentsChanged() changed to copyContentsFromLayer() so we know
+        what the origin layer is.
+
+        * Shared/mac/RemoteLayerBackingStore.mm:
+        (WebKit::RemoteLayerBackingStore::display): Remove the early return so we can always
+        call platformCALayerLayerDidDisplay().
+        * Shared/mac/RemoteLayerTreeTransaction.h:
+        * Shared/mac/RemoteLayerTreeTransaction.mm:
+        (WebKit::RemoteLayerTreeTransaction::LayerProperties::LayerProperties):
+        (WebKit::RemoteLayerTreeTransaction::LayerProperties::encode):
+        (WebKit::RemoteLayerTreeTransaction::LayerProperties::decode):
+        (WebKit::dumpChangedLayers):
+        * UIProcess/mac/RemoteLayerTreeHost.mm:
+        (WebKit::RemoteLayerTreeHost::updateLayerTree):
+        * WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
+        (WebKit::PlatformCALayerRemote::clone):
+        (WebKit::PlatformCALayerRemote::recursiveBuildTransaction):
+        (WebKit::PlatformCALayerRemote::copyContentsFromLayer):
+        (WebKit::PlatformCALayerRemote::setClonedLayer):
+        (WebKit::PlatformCALayerRemote::setContentsChanged): Deleted.
+        * WebProcess/WebPage/mac/PlatformCALayerRemote.h:
+        (WebKit::PlatformCALayerRemote::properties):
+        (WebKit::PlatformCALayerRemote::context):
+
</ins><span class="cx"> 2014-06-17  Anders Carlsson  &lt;andersca@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Remove session state methods from WKBrowsingContextController
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedmacRemoteLayerBackingStoremm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStore.mm (170070 => 170071)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStore.mm        2014-06-17 20:19:11 UTC (rev 170070)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStore.mm        2014-06-17 21:06:12 UTC (rev 170071)
</span><span class="lines">@@ -240,20 +240,21 @@
</span><span class="cx">         drawInContext(context, backImage.get());
</span><span class="cx"> 
</span><span class="cx">         m_frontBuffer.surface-&gt;releaseGraphicsContext();
</span><del>-
-        return true;
-    }
</del><ins>+    } else
</ins><span class="cx"> #endif
</span><ins>+    {
+        ASSERT(!m_acceleratesDrawing);
+        std::unique_ptr&lt;GraphicsContext&gt; context = m_frontBuffer.bitmap-&gt;createGraphicsContext();
</ins><span class="cx"> 
</span><del>-    ASSERT(!m_acceleratesDrawing);
-    std::unique_ptr&lt;GraphicsContext&gt; context = m_frontBuffer.bitmap-&gt;createGraphicsContext();
</del><ins>+        RetainPtr&lt;CGImageRef&gt; backImage;
+        if (m_backBuffer.bitmap &amp;&amp; !willPaintEntireBackingStore)
+            backImage = m_backBuffer.bitmap-&gt;makeCGImage();
</ins><span class="cx"> 
</span><del>-    RetainPtr&lt;CGImageRef&gt; backImage;
-    if (m_backBuffer.bitmap &amp;&amp; !willPaintEntireBackingStore)
-        backImage = m_backBuffer.bitmap-&gt;makeCGImage();
-
-    drawInContext(*context, backImage.get());
</del><ins>+        drawInContext(*context, backImage.get());
+    }
</ins><span class="cx">     
</span><ins>+    m_layer-&gt;owner()-&gt;platformCALayerLayerDidDisplay(m_layer);
+    
</ins><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedmacRemoteLayerTreeTransactionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h (170070 => 170071)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h        2014-06-17 20:19:11 UTC (rev 170070)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h        2014-06-17 21:06:12 UTC (rev 170071)
</span><span class="lines">@@ -68,19 +68,20 @@
</span><span class="cx">         MasksToBoundsChanged = 1 &lt;&lt; 15,
</span><span class="cx">         OpaqueChanged = 1 &lt;&lt; 16,
</span><span class="cx">         MaskLayerChanged = 1 &lt;&lt; 17,
</span><del>-        ContentsRectChanged = 1 &lt;&lt; 18,
-        ContentsScaleChanged = 1 &lt;&lt; 19,
-        MinificationFilterChanged = 1 &lt;&lt; 20,
-        MagnificationFilterChanged = 1 &lt;&lt; 21,
-        BlendModeChanged = 1 &lt;&lt; 22,
-        SpeedChanged = 1 &lt;&lt; 23,
-        TimeOffsetChanged = 1 &lt;&lt; 24,
-        BackingStoreChanged = 1 &lt;&lt; 25,
-        FiltersChanged = 1 &lt;&lt; 26,
-        AnimationsChanged = 1 &lt;&lt; 27,
-        EdgeAntialiasingMaskChanged = 1 &lt;&lt; 28,
-        CustomAppearanceChanged = 1 &lt;&lt; 29,
-        CustomBehaviorChanged = 1 &lt;&lt; 30
</del><ins>+        ClonedContentsChanged = 1 &lt;&lt; 18,
+        ContentsRectChanged = 1 &lt;&lt; 19,
+        ContentsScaleChanged = 1 &lt;&lt; 20,
+        MinificationFilterChanged = 1 &lt;&lt; 21,
+        MagnificationFilterChanged = 1 &lt;&lt; 22,
+        BlendModeChanged = 1 &lt;&lt; 23,
+        SpeedChanged = 1 &lt;&lt; 24,
+        TimeOffsetChanged = 1 &lt;&lt; 25,
+        BackingStoreChanged = 1 &lt;&lt; 26,
+        FiltersChanged = 1 &lt;&lt; 27,
+        AnimationsChanged = 1 &lt;&lt; 28,
+        EdgeAntialiasingMaskChanged = 1 &lt;&lt; 29,
+        CustomAppearanceChanged = 1 &lt;&lt; 30,
+        CustomBehaviorChanged = 1 &lt;&lt; 31
</ins><span class="cx">     };
</span><span class="cx">     typedef unsigned LayerChange;
</span><span class="cx"> 
</span><span class="lines">@@ -132,6 +133,7 @@
</span><span class="cx">         std::unique_ptr&lt;RemoteLayerBackingStore&gt; backingStore;
</span><span class="cx">         std::unique_ptr&lt;WebCore::FilterOperations&gt; filters;
</span><span class="cx">         WebCore::GraphicsLayer::PlatformLayerID maskLayerID;
</span><ins>+        WebCore::GraphicsLayer::PlatformLayerID clonedLayerID;
</ins><span class="cx">         double timeOffset;
</span><span class="cx">         float speed;
</span><span class="cx">         float contentsScale;
</span><span class="lines">@@ -160,7 +162,7 @@
</span><span class="cx"> 
</span><span class="cx">     WebCore::GraphicsLayer::PlatformLayerID rootLayerID() const { return m_rootLayerID; }
</span><span class="cx">     void setRootLayerID(WebCore::GraphicsLayer::PlatformLayerID);
</span><del>-    void layerPropertiesChanged(PlatformCALayerRemote*, LayerProperties&amp;);
</del><ins>+    void layerPropertiesChanged(PlatformCALayerRemote*);
</ins><span class="cx">     void setCreatedLayers(Vector&lt;LayerCreationProperties&gt;);
</span><span class="cx">     void setDestroyedLayerIDs(Vector&lt;WebCore::GraphicsLayer::PlatformLayerID&gt;);
</span><span class="cx">     void setLayerIDsWithNewlyUnreachableBackingStore(Vector&lt;WebCore::GraphicsLayer::PlatformLayerID&gt;);
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedmacRemoteLayerTreeTransactionmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm (170070 => 170071)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm        2014-06-17 20:19:11 UTC (rev 170070)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm        2014-06-17 21:06:12 UTC (rev 170071)
</span><span class="lines">@@ -81,6 +81,7 @@
</span><span class="cx">     , anchorPoint(0.5, 0.5, 0)
</span><span class="cx">     , contentsRect(FloatPoint(), FloatSize(1, 1))
</span><span class="cx">     , maskLayerID(0)
</span><ins>+    , clonedLayerID(0)
</ins><span class="cx">     , timeOffset(0)
</span><span class="cx">     , speed(1)
</span><span class="cx">     , contentsScale(1)
</span><span class="lines">@@ -114,6 +115,7 @@
</span><span class="cx">     , bounds(other.bounds)
</span><span class="cx">     , contentsRect(other.contentsRect)
</span><span class="cx">     , maskLayerID(other.maskLayerID)
</span><ins>+    , clonedLayerID(other.clonedLayerID)
</ins><span class="cx">     , timeOffset(other.timeOffset)
</span><span class="cx">     , speed(other.speed)
</span><span class="cx">     , contentsScale(other.contentsScale)
</span><span class="lines">@@ -206,6 +208,9 @@
</span><span class="cx">     if (changedProperties &amp; MaskLayerChanged)
</span><span class="cx">         encoder &lt;&lt; maskLayerID;
</span><span class="cx"> 
</span><ins>+    if (changedProperties &amp; ClonedContentsChanged)
+        encoder &lt;&lt; clonedLayerID;
+
</ins><span class="cx">     if (changedProperties &amp; ContentsRectChanged)
</span><span class="cx">         encoder &lt;&lt; contentsRect;
</span><span class="cx"> 
</span><span class="lines">@@ -356,6 +361,11 @@
</span><span class="cx">             return false;
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    if (result.changedProperties &amp; ClonedContentsChanged) {
+        if (!decoder.decode(result.clonedLayerID))
+            return false;
+    }
+
</ins><span class="cx">     if (result.changedProperties &amp; ContentsRectChanged) {
</span><span class="cx">         if (!decoder.decode(result.contentsRect))
</span><span class="cx">             return false;
</span><span class="lines">@@ -549,7 +559,7 @@
</span><span class="cx">     m_rootLayerID = rootLayerID;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void RemoteLayerTreeTransaction::layerPropertiesChanged(PlatformCALayerRemote* remoteLayer, RemoteLayerTreeTransaction::LayerProperties&amp; properties)
</del><ins>+void RemoteLayerTreeTransaction::layerPropertiesChanged(PlatformCALayerRemote* remoteLayer)
</ins><span class="cx"> {
</span><span class="cx">     m_changedLayers.append(remoteLayer);
</span><span class="cx"> }
</span><span class="lines">@@ -1058,6 +1068,9 @@
</span><span class="cx">         if (layerProperties.changedProperties &amp; RemoteLayerTreeTransaction::MaskLayerChanged)
</span><span class="cx">             dumpProperty(ts, &quot;maskLayer&quot;, layerProperties.maskLayerID);
</span><span class="cx"> 
</span><ins>+        if (layerProperties.changedProperties &amp; RemoteLayerTreeTransaction::ClonedContentsChanged)
+            dumpProperty(ts, &quot;clonedLayer&quot;, layerProperties.clonedLayerID);
+
</ins><span class="cx">         if (layerProperties.changedProperties &amp; RemoteLayerTreeTransaction::ContentsRectChanged)
</span><span class="cx">             dumpProperty(ts, &quot;contentsRect&quot;, layerProperties.contentsRect);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacRemoteLayerTreeHostmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeHost.mm (170070 => 170071)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeHost.mm        2014-06-17 20:19:11 UTC (rev 170070)
+++ trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeHost.mm        2014-06-17 21:06:12 UTC (rev 170071)
</span><span class="lines">@@ -71,6 +71,9 @@
</span><span class="cx">         rootLayerChanged = true;
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    typedef std::pair&lt;GraphicsLayer::PlatformLayerID, GraphicsLayer::PlatformLayerID&gt; LayerIDPair;
+    Vector&lt;LayerIDPair&gt; clonesToUpdate;
+    
</ins><span class="cx">     for (auto&amp; changedLayer : transaction.changedLayerProperties()) {
</span><span class="cx">         auto layerID = changedLayer.key;
</span><span class="cx">         const RemoteLayerTreeTransaction::LayerProperties&amp; properties = *changedLayer.value;
</span><span class="lines">@@ -87,6 +90,9 @@
</span><span class="cx">         if (properties.changedProperties &amp; RemoteLayerTreeTransaction::MaskLayerChanged &amp;&amp; properties.maskLayerID)
</span><span class="cx">             relatedLayers.set(properties.maskLayerID, getLayer(properties.maskLayerID));
</span><span class="cx"> 
</span><ins>+        if (properties.changedProperties &amp; RemoteLayerTreeTransaction::ClonedContentsChanged &amp;&amp; properties.clonedLayerID)
+            clonesToUpdate.append(LayerIDPair(layerID, properties.clonedLayerID));
+
</ins><span class="cx">         if (m_isDebugLayerTreeHost) {
</span><span class="cx">             RemoteLayerTreePropertyApplier::applyProperties(layer, this, properties, relatedLayers);
</span><span class="cx"> 
</span><span class="lines">@@ -96,6 +102,12 @@
</span><span class="cx">         } else
</span><span class="cx">             RemoteLayerTreePropertyApplier::applyProperties(layer, this, properties, relatedLayers);
</span><span class="cx">     }
</span><ins>+    
+    for (const auto&amp; layerPair : clonesToUpdate) {
+        LayerOrView *layer = getLayer(layerPair.first);
+        LayerOrView *clonedLayer = getLayer(layerPair.second);
+        asLayer(layer).contents = asLayer(clonedLayer).contents;
+    }
</ins><span class="cx"> 
</span><span class="cx">     for (auto&amp; destroyedLayer : transaction.destroyedLayers())
</span><span class="cx">         layerWillBeRemoved(destroyedLayer);
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPagemacPlatformCALayerRemotecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp (170070 => 170071)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp        2014-06-17 20:19:11 UTC (rev 170070)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp        2014-06-17 21:06:12 UTC (rev 170071)
</span><span class="lines">@@ -104,6 +104,7 @@
</span><span class="cx"> 
</span><span class="cx">     clone-&gt;m_properties.notePropertiesChanged(static_cast&lt;RemoteLayerTreeTransaction::LayerChange&gt;(m_properties.everChangedProperties &amp; ~RemoteLayerTreeTransaction::BackingStoreChanged));
</span><span class="cx"> 
</span><ins>+    clone-&gt;setClonedLayer(this);
</ins><span class="cx">     return clone.release();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -141,7 +142,7 @@
</span><span class="cx">             return;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        transaction.layerPropertiesChanged(this, m_properties);
</del><ins>+        transaction.layerPropertiesChanged(this);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     for (size_t i = 0; i &lt; m_children.size(); ++i) {
</span><span class="lines">@@ -192,8 +193,14 @@
</span><span class="cx">     m_properties.backingStore-&gt;setNeedsDisplay(enclosingIntRect(*rect));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void PlatformCALayerRemote::setContentsChanged()
</del><ins>+void PlatformCALayerRemote::copyContentsFromLayer(PlatformCALayer* layer)
</ins><span class="cx"> {
</span><ins>+    ASSERT(m_properties.clonedLayerID == layer-&gt;layerID());
+    
+    if (!m_properties.changedProperties)
+        m_context-&gt;layerPropertyChangedWhileBuildingTransaction(this);
+
+    m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::ClonedContentsChanged);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> PlatformCALayer* PlatformCALayerRemote::superlayer() const
</span><span class="lines">@@ -337,6 +344,16 @@
</span><span class="cx">     m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::MaskLayerChanged);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void PlatformCALayerRemote::setClonedLayer(const PlatformCALayer* layer)
+{
+    if (layer)
+        m_properties.clonedLayerID = layer-&gt;layerID();
+    else
+        m_properties.clonedLayerID = 0;
+
+    m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::ClonedContentsChanged);
+}
+
</ins><span class="cx"> bool PlatformCALayerRemote::isOpaque() const
</span><span class="cx"> {
</span><span class="cx">     return m_properties.opaque;
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPagemacPlatformCALayerRemoteh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h (170070 => 170071)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h        2014-06-17 20:19:11 UTC (rev 170070)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h        2014-06-17 21:06:12 UTC (rev 170071)
</span><span class="lines">@@ -49,7 +49,7 @@
</span><span class="cx"> 
</span><span class="cx">     virtual void setNeedsDisplay(const WebCore::FloatRect* dirtyRect = 0) override;
</span><span class="cx"> 
</span><del>-    virtual void setContentsChanged() override;
</del><ins>+    virtual void copyContentsFromLayer(PlatformCALayer*) override;
</ins><span class="cx"> 
</span><span class="cx">     virtual WebCore::PlatformCALayer* superlayer() const override;
</span><span class="cx">     virtual void removeFromSuperlayer() override;
</span><span class="lines">@@ -153,7 +153,10 @@
</span><span class="cx"> 
</span><span class="cx">     virtual uint32_t hostingContextID();
</span><span class="cx"> 
</span><ins>+    void setClonedLayer(const PlatformCALayer*);
+
</ins><span class="cx">     RemoteLayerTreeTransaction::LayerProperties&amp; properties() { return m_properties; }
</span><ins>+    const RemoteLayerTreeTransaction::LayerProperties&amp; properties() const { return m_properties; }
</ins><span class="cx"> 
</span><span class="cx">     void didCommit();
</span><span class="cx"> 
</span><span class="lines">@@ -163,6 +166,8 @@
</span><span class="cx">     PlatformCALayerRemote(WebCore::PlatformCALayer::LayerType, WebCore::PlatformCALayerClient* owner, RemoteLayerTreeContext* context);
</span><span class="cx">     PlatformCALayerRemote(const PlatformCALayerRemote&amp;, WebCore::PlatformCALayerClient*, RemoteLayerTreeContext*);
</span><span class="cx"> 
</span><ins>+    RemoteLayerTreeContext* context() const { return m_context; }
+
</ins><span class="cx"> private:
</span><span class="cx">     virtual bool isPlatformCALayerRemote() const override { return true; }
</span><span class="cx">     void ensureBackingStore();
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPagemacRemoteLayerTreeContexth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeContext.h (170070 => 170071)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeContext.h        2014-06-17 20:19:11 UTC (rev 170070)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeContext.h        2014-06-17 21:06:12 UTC (rev 170071)
</span><span class="lines">@@ -56,6 +56,8 @@
</span><span class="cx"> 
</span><span class="cx">     void buildTransaction(RemoteLayerTreeTransaction&amp;, WebCore::PlatformCALayer&amp; rootLayer);
</span><span class="cx"> 
</span><ins>+    void layerPropertyChangedWhileBuildingTransaction(PlatformCALayerRemote*);
+
</ins><span class="cx">     // From the UI process
</span><span class="cx">     void animationDidStart(WebCore::GraphicsLayer::PlatformLayerID, const String&amp; key, double startTime);
</span><span class="cx"> 
</span><span class="lines">@@ -76,6 +78,8 @@
</span><span class="cx">     HashMap&lt;WebCore::GraphicsLayer::PlatformLayerID, PlatformCALayerRemote*&gt; m_layersAwaitingAnimationStart;
</span><span class="cx"> 
</span><span class="cx">     RemoteLayerBackingStoreCollection m_backingStoreCollection;
</span><ins>+    
+    RemoteLayerTreeTransaction* m_currentTransaction;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPagemacRemoteLayerTreeContextmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeContext.mm (170070 => 170071)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeContext.mm        2014-06-17 20:19:11 UTC (rev 170070)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeContext.mm        2014-06-17 21:06:12 UTC (rev 170071)
</span><span class="lines">@@ -44,6 +44,7 @@
</span><span class="cx"> RemoteLayerTreeContext::RemoteLayerTreeContext(WebPage* webPage)
</span><span class="cx">     : m_webPage(webPage)
</span><span class="cx">     , m_backingStoreCollection(this)
</span><ins>+    , m_currentTransaction(nullptr)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -101,12 +102,20 @@
</span><span class="cx">     PlatformCALayerRemote&amp; rootLayerRemote = toPlatformCALayerRemote(rootLayer);
</span><span class="cx">     transaction.setRootLayerID(rootLayerRemote.layerID());
</span><span class="cx"> 
</span><ins>+    m_currentTransaction = &amp;transaction;
</ins><span class="cx">     rootLayerRemote.recursiveBuildTransaction(transaction);
</span><ins>+    m_currentTransaction = nullptr;
</ins><span class="cx"> 
</span><span class="cx">     transaction.setCreatedLayers(std::move(m_createdLayers));
</span><span class="cx">     transaction.setDestroyedLayerIDs(std::move(m_destroyedLayers));
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void RemoteLayerTreeContext::layerPropertyChangedWhileBuildingTransaction(PlatformCALayerRemote* layer)
+{
+    if (m_currentTransaction)
+        m_currentTransaction-&gt;layerPropertiesChanged(layer);
+}
+
</ins><span class="cx"> void RemoteLayerTreeContext::willStartAnimationOnLayer(PlatformCALayerRemote* layer)
</span><span class="cx"> {
</span><span class="cx">     m_layersAwaitingAnimationStart.add(layer-&gt;layerID(), layer);
</span></span></pre>
</div>
</div>

</body>
</html>