<!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>[161315] trunk/Source/WebCore</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/161315">161315</a></dd>
<dt>Author</dt> <dd>simon.fraser@apple.com</dd>
<dt>Date</dt> <dd>2014-01-04 13:48:03 -0800 (Sat, 04 Jan 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Prepare the ScrollingTree for remote use
https://bugs.webkit.org/show_bug.cgi?id=126493

Reviewed by Sam Weinig.

When committing the scrolling tree, we clone the ScrollingStateTree
to hand off to another thread, or (in future) to encode to send to the
UI process. During this cloning process, two types of layer transformations
take place: for threaded scrolling, we replace GraphicsLayer with PlatformLayers.
For remote scrolling, we'll replace GraphicsLayers with PlatformLayerIDs.
Allow the ScrollingCoordinator to specify which type of transformation occurs
by giving ScrollingStateTree a LayerRepresentation::Type member,
which is consulted during ScrollingStateNode cloning.

Also only copy layers that have changed to avoid setting dirty bits.

Expose some other stuff on ScrollingStateTree which will be needed for
remote scrolling.

* page/scrolling/ScrollingStateFixedNode.cpp:
(WebCore::ScrollingStateFixedNode::syncLayerPositionForViewportRect):
* page/scrolling/ScrollingStateNode.cpp:
(WebCore::ScrollingStateNode::ScrollingStateNode):
* page/scrolling/ScrollingStateNode.h:
(WebCore::LayerRepresentation::operator GraphicsLayer::PlatformLayerID):
(WebCore::LayerRepresentation::toRepresentation):
(WebCore::ScrollingStateNode::changedProperties):
(WebCore::ScrollingStateNode::setChangedProperties):
(WebCore::ScrollingStateNode::parentNodeID):
* page/scrolling/ScrollingStateScrollingNode.cpp:
(WebCore::ScrollingStateScrollingNode::ScrollingStateScrollingNode):
* page/scrolling/ScrollingStateStickyNode.cpp:
(WebCore::ScrollingStateStickyNode::syncLayerPositionForViewportRect):
* page/scrolling/ScrollingStateTree.cpp:
(WebCore::ScrollingStateTree::ScrollingStateTree):
(WebCore::ScrollingStateTree::commit):
(WebCore::ScrollingStateTree::setRemovedNodes):
(WebCore::ScrollingStateTree::stateNodeForID):
* page/scrolling/ScrollingStateTree.h:
(WebCore::ScrollingStateTree::nodeCount):
(WebCore::ScrollingStateTree::nodeMap):
(WebCore::ScrollingStateTree::preferredLayerRepresentation):
(WebCore::ScrollingStateTree::setPreferredLayerRepresentation):
* page/scrolling/mac/ScrollingCoordinatorMac.mm:
(WebCore::ScrollingCoordinatorMac::commitTreeState):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorepagescrollingScrollingStateFixedNodecpp">trunk/Source/WebCore/page/scrolling/ScrollingStateFixedNode.cpp</a></li>
<li><a href="#trunkSourceWebCorepagescrollingScrollingStateNodecpp">trunk/Source/WebCore/page/scrolling/ScrollingStateNode.cpp</a></li>
<li><a href="#trunkSourceWebCorepagescrollingScrollingStateNodeh">trunk/Source/WebCore/page/scrolling/ScrollingStateNode.h</a></li>
<li><a href="#trunkSourceWebCorepagescrollingScrollingStateScrollingNodecpp">trunk/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.cpp</a></li>
<li><a href="#trunkSourceWebCorepagescrollingScrollingStateStickyNodecpp">trunk/Source/WebCore/page/scrolling/ScrollingStateStickyNode.cpp</a></li>
<li><a href="#trunkSourceWebCorepagescrollingScrollingStateTreecpp">trunk/Source/WebCore/page/scrolling/ScrollingStateTree.cpp</a></li>
<li><a href="#trunkSourceWebCorepagescrollingScrollingStateTreeh">trunk/Source/WebCore/page/scrolling/ScrollingStateTree.h</a></li>
<li><a href="#trunkSourceWebCorepagescrollingmacScrollingCoordinatorMacmm">trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (161314 => 161315)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-01-04 20:53:51 UTC (rev 161314)
+++ trunk/Source/WebCore/ChangeLog        2014-01-04 21:48:03 UTC (rev 161315)
</span><span class="lines">@@ -1,3 +1,51 @@
</span><ins>+2014-01-04  Simon Fraser  &lt;simon.fraser@apple.com&gt;
+
+        Prepare the ScrollingTree for remote use
+        https://bugs.webkit.org/show_bug.cgi?id=126493
+
+        Reviewed by Sam Weinig.
+
+        When committing the scrolling tree, we clone the ScrollingStateTree
+        to hand off to another thread, or (in future) to encode to send to the
+        UI process. During this cloning process, two types of layer transformations
+        take place: for threaded scrolling, we replace GraphicsLayer with PlatformLayers.
+        For remote scrolling, we'll replace GraphicsLayers with PlatformLayerIDs.
+        Allow the ScrollingCoordinator to specify which type of transformation occurs
+        by giving ScrollingStateTree a LayerRepresentation::Type member,
+        which is consulted during ScrollingStateNode cloning.
+        
+        Also only copy layers that have changed to avoid setting dirty bits.
+        
+        Expose some other stuff on ScrollingStateTree which will be needed for
+        remote scrolling.
+
+        * page/scrolling/ScrollingStateFixedNode.cpp:
+        (WebCore::ScrollingStateFixedNode::syncLayerPositionForViewportRect):
+        * page/scrolling/ScrollingStateNode.cpp:
+        (WebCore::ScrollingStateNode::ScrollingStateNode):
+        * page/scrolling/ScrollingStateNode.h:
+        (WebCore::LayerRepresentation::operator GraphicsLayer::PlatformLayerID):
+        (WebCore::LayerRepresentation::toRepresentation):
+        (WebCore::ScrollingStateNode::changedProperties):
+        (WebCore::ScrollingStateNode::setChangedProperties):
+        (WebCore::ScrollingStateNode::parentNodeID):
+        * page/scrolling/ScrollingStateScrollingNode.cpp:
+        (WebCore::ScrollingStateScrollingNode::ScrollingStateScrollingNode):
+        * page/scrolling/ScrollingStateStickyNode.cpp:
+        (WebCore::ScrollingStateStickyNode::syncLayerPositionForViewportRect):
+        * page/scrolling/ScrollingStateTree.cpp:
+        (WebCore::ScrollingStateTree::ScrollingStateTree):
+        (WebCore::ScrollingStateTree::commit):
+        (WebCore::ScrollingStateTree::setRemovedNodes):
+        (WebCore::ScrollingStateTree::stateNodeForID):
+        * page/scrolling/ScrollingStateTree.h:
+        (WebCore::ScrollingStateTree::nodeCount):
+        (WebCore::ScrollingStateTree::nodeMap):
+        (WebCore::ScrollingStateTree::preferredLayerRepresentation):
+        (WebCore::ScrollingStateTree::setPreferredLayerRepresentation):
+        * page/scrolling/mac/ScrollingCoordinatorMac.mm:
+        (WebCore::ScrollingCoordinatorMac::commitTreeState):
+
</ins><span class="cx"> 2014-01-04  Sam Weinig  &lt;sam@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Move LineBreaker functions to LineBreaker.cpp
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingScrollingStateFixedNodecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/ScrollingStateFixedNode.cpp (161314 => 161315)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/ScrollingStateFixedNode.cpp        2014-01-04 20:53:51 UTC (rev 161314)
+++ trunk/Source/WebCore/page/scrolling/ScrollingStateFixedNode.cpp        2014-01-04 21:48:03 UTC (rev 161315)
</span><span class="lines">@@ -72,7 +72,8 @@
</span><span class="cx"> void ScrollingStateFixedNode::syncLayerPositionForViewportRect(const LayoutRect&amp; viewportRect)
</span><span class="cx"> {
</span><span class="cx">     FloatPoint position = m_constraints.layerPositionForViewportRect(viewportRect);
</span><del>-    static_cast&lt;GraphicsLayer*&gt;(layer())-&gt;syncPosition(position);
</del><ins>+    if (layer().representsGraphicsLayer())
+        static_cast&lt;GraphicsLayer*&gt;(layer())-&gt;syncPosition(position);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void ScrollingStateFixedNode::dumpProperties(TextStream&amp; ts, int indent) const
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingScrollingStateNodecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/ScrollingStateNode.cpp (161314 => 161315)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/ScrollingStateNode.cpp        2014-01-04 20:53:51 UTC (rev 161314)
+++ trunk/Source/WebCore/page/scrolling/ScrollingStateNode.cpp        2014-01-04 21:48:03 UTC (rev 161315)
</span><span class="lines">@@ -54,9 +54,8 @@
</span><span class="cx">     , m_scrollingStateTree(adoptiveTree)
</span><span class="cx">     , m_parent(0)
</span><span class="cx"> {
</span><del>-    // The cloned tree references PlatformLayers, which are safe to send to the scrolling thread.
-    // FIXME: this Mac threaded-scrolling assumption doesn't belong here.
-    setLayer(stateNode.layer().toPlatformLayer());
</del><ins>+    if (hasChangedProperty(ScrollLayer))
+        setLayer(stateNode.layer().toRepresentation(adoptiveTree.preferredLayerRepresentation()));
</ins><span class="cx">     scrollingStateTree().addNode(this);
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingScrollingStateNodeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/ScrollingStateNode.h (161314 => 161315)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/ScrollingStateNode.h        2014-01-04 20:53:51 UTC (rev 161314)
+++ trunk/Source/WebCore/page/scrolling/ScrollingStateNode.h        2014-01-04 21:48:03 UTC (rev 161315)
</span><span class="lines">@@ -52,7 +52,7 @@
</span><span class="cx"> // c) Remote scrolling UI process, where LayerRepresentation wraps just a PlatformLayerID.
</span><span class="cx"> class LayerRepresentation {
</span><span class="cx"> public:
</span><del>-    enum LayerRepresentationType {
</del><ins>+    enum Type {
</ins><span class="cx">         EmptyRepresentation,
</span><span class="cx">         GraphicsLayerRepresentation,
</span><span class="cx">         PlatformLayerRepresentation,
</span><span class="lines">@@ -97,7 +97,7 @@
</span><span class="cx"> 
</span><span class="cx">     operator GraphicsLayer::PlatformLayerID() const
</span><span class="cx">     {
</span><del>-        ASSERT(m_representation == PlatformLayerIDRepresentation || m_representation == GraphicsLayerRepresentation);
</del><ins>+        ASSERT(m_representation != PlatformLayerRepresentation);
</ins><span class="cx">         return m_layerID;
</span><span class="cx">     }
</span><span class="cx">     
</span><span class="lines">@@ -120,16 +120,25 @@
</span><span class="cx">         return true;
</span><span class="cx">     }
</span><span class="cx">     
</span><del>-    LayerRepresentation toPlatformLayer() const
</del><ins>+    LayerRepresentation toRepresentation(Type representation) const
</ins><span class="cx">     {
</span><del>-        ASSERT(m_representation == GraphicsLayerRepresentation);
-        return m_graphicsLayer ? m_graphicsLayer-&gt;platformLayer() : nullptr;
</del><ins>+        switch (representation) {
+        case EmptyRepresentation:
+            return LayerRepresentation();
+        case GraphicsLayerRepresentation:
+            ASSERT(m_representation == GraphicsLayerRepresentation);
+            return *this;
+        case PlatformLayerRepresentation:
+            return m_graphicsLayer ? m_graphicsLayer-&gt;platformLayer() : nullptr;
+        case PlatformLayerIDRepresentation:
+            return LayerRepresentation(m_layerID);
+        }
+        return LayerRepresentation();
</ins><span class="cx">     }
</span><del>-    
</del><ins>+
</ins><span class="cx">     bool representsGraphicsLayer() const { return m_representation == GraphicsLayerRepresentation; }
</span><del>-    bool representsPlatformLayer() const { return m_representation == PlatformLayerRepresentation; }
</del><span class="cx">     bool representsPlatformLayerID() const { return m_representation == PlatformLayerIDRepresentation; }
</span><del>-
</del><ins>+    
</ins><span class="cx"> private:
</span><span class="cx">     union {
</span><span class="cx">         GraphicsLayer* m_graphicsLayer;
</span><span class="lines">@@ -137,7 +146,7 @@
</span><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx">     GraphicsLayer::PlatformLayerID m_layerID;
</span><del>-    LayerRepresentationType m_representation;
</del><ins>+    Type m_representation;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> class ScrollingStateNode {
</span><span class="lines">@@ -162,6 +171,9 @@
</span><span class="cx">     void resetChangedProperties() { m_changedProperties = 0; }
</span><span class="cx">     void setPropertyChanged(unsigned propertyBit);
</span><span class="cx"> 
</span><ins>+    ChangedProperties changedProperties() const { return m_changedProperties; }
+    void setChangedProperties(ChangedProperties changedProperties) { m_changedProperties = changedProperties; }
+    
</ins><span class="cx">     virtual void syncLayerPositionForViewportRect(const LayoutRect&amp; /*viewportRect*/) { }
</span><span class="cx"> 
</span><span class="cx">     const LayerRepresentation&amp; layer() const { return m_layer; }
</span><span class="lines">@@ -173,6 +185,7 @@
</span><span class="cx"> 
</span><span class="cx">     ScrollingStateNode* parent() const { return m_parent; }
</span><span class="cx">     void setParent(ScrollingStateNode* parent) { m_parent = parent; }
</span><ins>+    ScrollingNodeID parentNodeID() const { return m_parent ? m_parent-&gt;scrollingNodeID() : 0; }
</ins><span class="cx"> 
</span><span class="cx">     Vector&lt;OwnPtr&lt;ScrollingStateNode&gt;&gt;* children() const { return m_children.get(); }
</span><span class="cx"> 
</span><span class="lines">@@ -188,7 +201,6 @@
</span><span class="cx">     void dump(TextStream&amp;, int indent) const;
</span><span class="cx"> 
</span><span class="cx">     virtual void dumpProperties(TextStream&amp;, int indent) const = 0;
</span><del>-    ChangedProperties changedProperties() const { return m_changedProperties; }
</del><span class="cx">     void willBeRemovedFromStateTree();
</span><span class="cx"> 
</span><span class="cx">     const ScrollingNodeType m_nodeType;
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingScrollingStateScrollingNodecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.cpp (161314 => 161315)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.cpp        2014-01-04 20:53:51 UTC (rev 161314)
+++ trunk/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.cpp        2014-01-04 21:48:03 UTC (rev 161315)
</span><span class="lines">@@ -75,11 +75,14 @@
</span><span class="cx">     , m_requestedScrollPosition(stateNode.requestedScrollPosition())
</span><span class="cx">     , m_requestedScrollPositionRepresentsProgrammaticScroll(stateNode.requestedScrollPositionRepresentsProgrammaticScroll())
</span><span class="cx"> {
</span><del>-    // The cloned tree references PlatformLayers, which are safe to send to the scrolling thread.
-    // FIXME: this Mac threaded-scrolling assumption doesn't belong here.
-    setCounterScrollingLayer(stateNode.counterScrollingLayer().toPlatformLayer());
-    setHeaderLayer(stateNode.headerLayer().toPlatformLayer());
-    setFooterLayer(stateNode.footerLayer().toPlatformLayer());
</del><ins>+    if (hasChangedProperty(CounterScrollingLayer))
+        setCounterScrollingLayer(stateNode.counterScrollingLayer().toRepresentation(adoptiveTree.preferredLayerRepresentation()));
+
+    if (hasChangedProperty(HeaderLayer))
+        setHeaderLayer(stateNode.headerLayer().toRepresentation(adoptiveTree.preferredLayerRepresentation()));
+
+    if (hasChangedProperty(FooterLayer))
+        setFooterLayer(stateNode.footerLayer().toRepresentation(adoptiveTree.preferredLayerRepresentation()));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> ScrollingStateScrollingNode::~ScrollingStateScrollingNode()
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingScrollingStateStickyNodecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/ScrollingStateStickyNode.cpp (161314 => 161315)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/ScrollingStateStickyNode.cpp        2014-01-04 20:53:51 UTC (rev 161314)
+++ trunk/Source/WebCore/page/scrolling/ScrollingStateStickyNode.cpp        2014-01-04 21:48:03 UTC (rev 161315)
</span><span class="lines">@@ -72,7 +72,8 @@
</span><span class="cx"> void ScrollingStateStickyNode::syncLayerPositionForViewportRect(const LayoutRect&amp; viewportRect)
</span><span class="cx"> {
</span><span class="cx">     FloatPoint position = m_constraints.layerPositionForConstrainingRect(viewportRect);
</span><del>-    static_cast&lt;GraphicsLayer*&gt;(layer())-&gt;syncPosition(position);
</del><ins>+    if (layer().representsGraphicsLayer())
+        static_cast&lt;GraphicsLayer*&gt;(layer())-&gt;syncPosition(position);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void ScrollingStateStickyNode::dumpProperties(TextStream&amp; ts, int indent) const
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingScrollingStateTreecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/ScrollingStateTree.cpp (161314 => 161315)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/ScrollingStateTree.cpp        2014-01-04 20:53:51 UTC (rev 161314)
+++ trunk/Source/WebCore/page/scrolling/ScrollingStateTree.cpp        2014-01-04 21:48:03 UTC (rev 161315)
</span><span class="lines">@@ -44,6 +44,7 @@
</span><span class="cx">     : m_scrollingCoordinator(scrollingCoordinator)
</span><span class="cx">     , m_hasChangedProperties(false)
</span><span class="cx">     , m_hasNewRootStateNode(false)
</span><ins>+    , m_preferredLayerRepresentation(LayerRepresentation::GraphicsLayerRepresentation)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -140,10 +141,12 @@
</span><span class="cx">     m_stateNodeMap.clear();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-PassOwnPtr&lt;ScrollingStateTree&gt; ScrollingStateTree::commit()
</del><ins>+PassOwnPtr&lt;ScrollingStateTree&gt; ScrollingStateTree::commit(LayerRepresentation::Type preferredLayerRepresentation)
</ins><span class="cx"> {
</span><span class="cx">     // This function clones and resets the current state tree, but leaves the tree structure intact.
</span><span class="cx">     OwnPtr&lt;ScrollingStateTree&gt; treeStateClone = ScrollingStateTree::create();
</span><ins>+    treeStateClone-&gt;setPreferredLayerRepresentation(preferredLayerRepresentation);
+
</ins><span class="cx">     if (m_rootStateNode)
</span><span class="cx">         treeStateClone-&gt;setRootStateNode(static_pointer_cast&lt;ScrollingStateScrollingNode&gt;(m_rootStateNode-&gt;cloneAndReset(*treeStateClone)));
</span><span class="cx"> 
</span><span class="lines">@@ -192,12 +195,17 @@
</span><span class="cx">     setHasChangedProperties();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void ScrollingStateTree::setRemovedNodes(Vector&lt;ScrollingNodeID&gt; nodes)
+{
+    m_nodesRemovedSinceLastCommit = std::move(nodes);
+}
+
</ins><span class="cx"> ScrollingStateNode* ScrollingStateTree::stateNodeForID(ScrollingNodeID scrollLayerID)
</span><span class="cx"> {
</span><span class="cx">     if (!scrollLayerID)
</span><span class="cx">         return 0;
</span><span class="cx"> 
</span><del>-    HashMap&lt;ScrollingNodeID, ScrollingStateNode*&gt;::const_iterator it = m_stateNodeMap.find(scrollLayerID);
</del><ins>+    auto it = m_stateNodeMap.find(scrollLayerID);
</ins><span class="cx">     if (it == m_stateNodeMap.end())
</span><span class="cx">         return 0;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingScrollingStateTreeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/ScrollingStateTree.h (161314 => 161315)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/ScrollingStateTree.h        2014-01-04 20:53:51 UTC (rev 161314)
+++ trunk/Source/WebCore/page/scrolling/ScrollingStateTree.h        2014-01-04 21:48:03 UTC (rev 161315)
</span><span class="lines">@@ -57,15 +57,24 @@
</span><span class="cx">     void clear();
</span><span class="cx">     
</span><span class="cx">     const Vector&lt;ScrollingNodeID&gt;&amp; removedNodes() const { return m_nodesRemovedSinceLastCommit; }
</span><ins>+    void setRemovedNodes(Vector&lt;ScrollingNodeID&gt;);
</ins><span class="cx"> 
</span><span class="cx">     // Copies the current tree state and clears the changed properties mask in the original.
</span><del>-    PassOwnPtr&lt;ScrollingStateTree&gt; commit();
</del><ins>+    PassOwnPtr&lt;ScrollingStateTree&gt; commit(LayerRepresentation::Type preferredLayerRepresentation);
</ins><span class="cx"> 
</span><span class="cx">     void setHasChangedProperties(bool = true);
</span><span class="cx">     bool hasChangedProperties() const { return m_hasChangedProperties; }
</span><span class="cx"> 
</span><span class="cx">     bool hasNewRootStateNode() const { return m_hasNewRootStateNode; }
</span><ins>+    
+    int nodeCount() const { return m_stateNodeMap.size(); }
</ins><span class="cx"> 
</span><ins>+    typedef HashMap&lt;ScrollingNodeID, ScrollingStateNode*&gt; StateNodeMap;
+    const StateNodeMap&amp; nodeMap() const { return m_stateNodeMap; }
+
+    LayerRepresentation::Type preferredLayerRepresentation() const { return m_preferredLayerRepresentation; }
+    void setPreferredLayerRepresentation(LayerRepresentation::Type representation) { m_preferredLayerRepresentation = representation; }
+
</ins><span class="cx"> private:
</span><span class="cx">     ScrollingStateTree(AsyncScrollingCoordinator*);
</span><span class="cx"> 
</span><span class="lines">@@ -75,11 +84,12 @@
</span><span class="cx">     void didRemoveNode(ScrollingNodeID);
</span><span class="cx"> 
</span><span class="cx">     AsyncScrollingCoordinator* m_scrollingCoordinator;
</span><del>-    HashMap&lt;ScrollingNodeID, ScrollingStateNode*&gt; m_stateNodeMap;
</del><ins>+    StateNodeMap m_stateNodeMap;
</ins><span class="cx">     OwnPtr&lt;ScrollingStateScrollingNode&gt; m_rootStateNode;
</span><span class="cx">     Vector&lt;ScrollingNodeID&gt; m_nodesRemovedSinceLastCommit;
</span><span class="cx">     bool m_hasChangedProperties;
</span><span class="cx">     bool m_hasNewRootStateNode;
</span><ins>+    LayerRepresentation::Type m_preferredLayerRepresentation;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingmacScrollingCoordinatorMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.mm (161314 => 161315)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.mm        2014-01-04 20:53:51 UTC (rev 161314)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.mm        2014-01-04 21:48:03 UTC (rev 161315)
</span><span class="lines">@@ -110,7 +110,7 @@
</span><span class="cx"> {
</span><span class="cx">     ASSERT(scrollingStateTree()-&gt;hasChangedProperties());
</span><span class="cx"> 
</span><del>-    OwnPtr&lt;ScrollingStateTree&gt; treeState = scrollingStateTree()-&gt;commit();
</del><ins>+    OwnPtr&lt;ScrollingStateTree&gt; treeState = scrollingStateTree()-&gt;commit(LayerRepresentation::PlatformLayerRepresentation);
</ins><span class="cx">     ScrollingThread::dispatch(bind(&amp;ThreadedScrollingTree::commitNewTreeState, toThreadedScrollingTree(scrollingTree()), treeState.release()));
</span><span class="cx"> 
</span><span class="cx">     updateTiledScrollingIndicator();
</span></span></pre>
</div>
</div>

</body>
</html>