Title: [141703] trunk/Source/WebCore
Revision
141703
Author
simon.fra...@apple.com
Date
2013-02-02 13:03:16 -0800 (Sat, 02 Feb 2013)

Log Message

Fixed and sticky nodes have no nodeID set
https://bugs.webkit.org/show_bug.cgi?id=108734

Reviewed by Sam Weinig.

Push ScrollingNodeIDs onto scrolling nodes at construction time, and thereafter
treat them as readonly. Previously, only the root scrolling node would have a node ID.

Node IDs aren't actually used by the scrolling tree yet, but are useful for debugging.

Not testable since we only dump the scrolling state tree, not the scrolling
node tree in tests.

* page/scrolling/ScrollingTree.cpp:
(WebCore::ScrollingTree::ScrollingTree): No longer create the root node here;
we can only create it when we know what its ID will be.
(WebCore::ScrollingTree::updateTreeFromStateNode): Create the root node if
necessary. Pass node IDs into create methods.
* page/scrolling/ScrollingTreeNode.cpp:
(WebCore::ScrollingTreeNode::ScrollingTreeNode):
* page/scrolling/ScrollingTreeNode.h:
* page/scrolling/ScrollingTreeScrollingNode.cpp:
(WebCore::ScrollingTreeScrollingNode::ScrollingTreeScrollingNode):
* page/scrolling/ScrollingTreeScrollingNode.h:
* page/scrolling/mac/ScrollingTreeFixedNode.h:
* page/scrolling/mac/ScrollingTreeFixedNode.mm:
(WebCore::ScrollingTreeFixedNode::create):
(WebCore::ScrollingTreeFixedNode::ScrollingTreeFixedNode):
* page/scrolling/mac/ScrollingTreeScrollingNodeMac.h:
* page/scrolling/mac/ScrollingTreeScrollingNodeMac.mm:
(WebCore::ScrollingTreeScrollingNode::create):
(WebCore::ScrollingTreeScrollingNodeMac::ScrollingTreeScrollingNodeMac):
* page/scrolling/mac/ScrollingTreeStickyNode.h:
* page/scrolling/mac/ScrollingTreeStickyNode.mm:
(WebCore::ScrollingTreeStickyNode::create):
(WebCore::ScrollingTreeStickyNode::ScrollingTreeStickyNode):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (141702 => 141703)


--- trunk/Source/WebCore/ChangeLog	2013-02-02 20:59:25 UTC (rev 141702)
+++ trunk/Source/WebCore/ChangeLog	2013-02-02 21:03:16 UTC (rev 141703)
@@ -1,3 +1,42 @@
+2013-02-02  Simon Fraser  <simon.fra...@apple.com>
+
+        Fixed and sticky nodes have no nodeID set
+        https://bugs.webkit.org/show_bug.cgi?id=108734
+
+        Reviewed by Sam Weinig.
+        
+        Push ScrollingNodeIDs onto scrolling nodes at construction time, and thereafter
+        treat them as readonly. Previously, only the root scrolling node would have a node ID.
+        
+        Node IDs aren't actually used by the scrolling tree yet, but are useful for debugging.
+
+        Not testable since we only dump the scrolling state tree, not the scrolling
+        node tree in tests.
+
+        * page/scrolling/ScrollingTree.cpp:
+        (WebCore::ScrollingTree::ScrollingTree): No longer create the root node here;
+        we can only create it when we know what its ID will be.
+        (WebCore::ScrollingTree::updateTreeFromStateNode): Create the root node if
+        necessary. Pass node IDs into create methods.
+        * page/scrolling/ScrollingTreeNode.cpp:
+        (WebCore::ScrollingTreeNode::ScrollingTreeNode):
+        * page/scrolling/ScrollingTreeNode.h:
+        * page/scrolling/ScrollingTreeScrollingNode.cpp:
+        (WebCore::ScrollingTreeScrollingNode::ScrollingTreeScrollingNode):
+        * page/scrolling/ScrollingTreeScrollingNode.h:
+        * page/scrolling/mac/ScrollingTreeFixedNode.h:
+        * page/scrolling/mac/ScrollingTreeFixedNode.mm:
+        (WebCore::ScrollingTreeFixedNode::create):
+        (WebCore::ScrollingTreeFixedNode::ScrollingTreeFixedNode):
+        * page/scrolling/mac/ScrollingTreeScrollingNodeMac.h:
+        * page/scrolling/mac/ScrollingTreeScrollingNodeMac.mm:
+        (WebCore::ScrollingTreeScrollingNode::create):
+        (WebCore::ScrollingTreeScrollingNodeMac::ScrollingTreeScrollingNodeMac):
+        * page/scrolling/mac/ScrollingTreeStickyNode.h:
+        * page/scrolling/mac/ScrollingTreeStickyNode.mm:
+        (WebCore::ScrollingTreeStickyNode::create):
+        (WebCore::ScrollingTreeStickyNode::ScrollingTreeStickyNode):
+
 2013-02-02  Takashi Sakamoto  <ta...@google.com>
 
         Making -webkit-image-set() the first value of background property causes crash.

Modified: trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp (141702 => 141703)


--- trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp	2013-02-02 20:59:25 UTC (rev 141702)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp	2013-02-02 21:03:16 UTC (rev 141703)
@@ -48,7 +48,6 @@
 
 ScrollingTree::ScrollingTree(ScrollingCoordinator* scrollingCoordinator)
     : m_scrollingCoordinator(scrollingCoordinator)
-    , m_rootNode(ScrollingTreeScrollingNode::create(this))
     , m_hasWheelEventHandlers(false)
     , m_canGoBack(false)
     , m_canGoForward(false)
@@ -157,24 +156,27 @@
     } else {
         // If the node isn't found, it's either new and needs to be added to the tree, or there is a new ID for our
         // root node.
+        ScrollingNodeID nodeID = stateNode->scrollingNodeID();
         if (!stateNode->parent()) {
             // This is the root node.
-            m_rootNode->setScrollingNodeID(stateNode->scrollingNodeID());
-            m_nodeMap.set(stateNode->scrollingNodeID(), m_rootNode.get());
+            if (!m_rootNode)
+                m_rootNode = ScrollingTreeScrollingNode::create(this, nodeID);
+
+            m_nodeMap.set(nodeID, m_rootNode.get());
             m_rootNode->update(stateNode);
         } else {
             OwnPtr<ScrollingTreeNode> newNode;
             if (stateNode->isScrollingNode())
-                newNode = ScrollingTreeScrollingNode::create(this);
+                newNode = ScrollingTreeScrollingNode::create(this, nodeID);
             else if (stateNode->isFixedNode())
-                newNode = ScrollingTreeFixedNode::create(this);
+                newNode = ScrollingTreeFixedNode::create(this, nodeID);
             else if (stateNode->isStickyNode())
-                newNode = ScrollingTreeStickyNode::create(this);
+                newNode = ScrollingTreeStickyNode::create(this, nodeID);
             else
                 ASSERT_NOT_REACHED();
 
             ScrollingTreeNode* newNodeRawPtr = newNode.get();
-            m_nodeMap.set(stateNode->scrollingNodeID(), newNodeRawPtr);
+            m_nodeMap.set(nodeID, newNodeRawPtr);
             ScrollingTreeNodeMap::const_iterator it = m_nodeMap.find(stateNode->parent()->scrollingNodeID());
             ASSERT(it != m_nodeMap.end());
             if (it != m_nodeMap.end()) {

Modified: trunk/Source/WebCore/page/scrolling/ScrollingTreeNode.cpp (141702 => 141703)


--- trunk/Source/WebCore/page/scrolling/ScrollingTreeNode.cpp	2013-02-02 20:59:25 UTC (rev 141702)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTreeNode.cpp	2013-02-02 21:03:16 UTC (rev 141703)
@@ -32,9 +32,9 @@
 
 namespace WebCore {
 
-ScrollingTreeNode::ScrollingTreeNode(ScrollingTree* scrollingTree)
+ScrollingTreeNode::ScrollingTreeNode(ScrollingTree* scrollingTree, ScrollingNodeID nodeID)
     : m_scrollingTree(scrollingTree)
-    , m_nodeID(0)
+    , m_nodeID(nodeID)
     , m_parent(0)
 {
 }

Modified: trunk/Source/WebCore/page/scrolling/ScrollingTreeNode.h (141702 => 141703)


--- trunk/Source/WebCore/page/scrolling/ScrollingTreeNode.h	2013-02-02 20:59:25 UTC (rev 141702)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTreeNode.h	2013-02-02 21:03:16 UTC (rev 141703)
@@ -41,7 +41,7 @@
 
 class ScrollingTreeNode {
 public:
-    explicit ScrollingTreeNode(ScrollingTree*);
+    explicit ScrollingTreeNode(ScrollingTree*, ScrollingNodeID);
     virtual ~ScrollingTreeNode();
 
     virtual void update(ScrollingStateNode*) = 0;
@@ -49,7 +49,6 @@
     virtual void parentScrollPositionDidChange(const IntRect& viewportRect, const FloatSize& cumulativeDelta) = 0;
 
     ScrollingNodeID scrollingNodeID() const { return m_nodeID; }
-    void setScrollingNodeID(ScrollingNodeID nodeID) { m_nodeID = nodeID; }
 
     ScrollingTreeNode* parent() const { return m_parent; }
     void setParent(ScrollingTreeNode* parent) { m_parent = parent; }

Modified: trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp (141702 => 141703)


--- trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp	2013-02-02 20:59:25 UTC (rev 141702)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp	2013-02-02 21:03:16 UTC (rev 141703)
@@ -32,8 +32,8 @@
 
 namespace WebCore {
 
-ScrollingTreeScrollingNode::ScrollingTreeScrollingNode(ScrollingTree* scrollingTree)
-    : ScrollingTreeNode(scrollingTree)
+ScrollingTreeScrollingNode::ScrollingTreeScrollingNode(ScrollingTree* scrollingTree, ScrollingNodeID nodeID)
+    : ScrollingTreeNode(scrollingTree, nodeID)
     , m_frameScaleFactor(1)
     , m_shouldUpdateScrollLayerPositionOnMainThread(0)
     , m_horizontalScrollElasticity(ScrollElasticityNone)

Modified: trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h (141702 => 141703)


--- trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h	2013-02-02 20:59:25 UTC (rev 141702)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h	2013-02-02 21:03:16 UTC (rev 141703)
@@ -42,7 +42,7 @@
 
 class ScrollingTreeScrollingNode : public ScrollingTreeNode {
 public:
-    static PassOwnPtr<ScrollingTreeScrollingNode> create(ScrollingTree*);
+    static PassOwnPtr<ScrollingTreeScrollingNode> create(ScrollingTree*, ScrollingNodeID);
     virtual ~ScrollingTreeScrollingNode();
 
     virtual void update(ScrollingStateNode*) OVERRIDE;
@@ -56,7 +56,7 @@
     MainThreadScrollingReasons shouldUpdateScrollLayerPositionOnMainThread() const { return m_shouldUpdateScrollLayerPositionOnMainThread; }
 
 protected:
-    explicit ScrollingTreeScrollingNode(ScrollingTree*);
+    explicit ScrollingTreeScrollingNode(ScrollingTree*, ScrollingNodeID);
 
     const IntRect& viewportRect() const { return m_viewportRect; }
     const IntSize& contentsSize() const { return m_contentsSize; }

Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFixedNode.h (141702 => 141703)


--- trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFixedNode.h	2013-02-02 20:59:25 UTC (rev 141702)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFixedNode.h	2013-02-02 21:03:16 UTC (rev 141703)
@@ -40,12 +40,12 @@
 
 class ScrollingTreeFixedNode : public ScrollingTreeNode {
 public:
-    static PassOwnPtr<ScrollingTreeFixedNode> create(ScrollingTree*);
+    static PassOwnPtr<ScrollingTreeFixedNode> create(ScrollingTree*, ScrollingNodeID);
 
     virtual ~ScrollingTreeFixedNode();
 
 private:
-    ScrollingTreeFixedNode(ScrollingTree*);
+    ScrollingTreeFixedNode(ScrollingTree*, ScrollingNodeID);
 
     virtual void update(ScrollingStateNode*) OVERRIDE;
     virtual void parentScrollPositionDidChange(const IntRect& viewportRect, const FloatSize& cumulativeDelta) OVERRIDE;

Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFixedNode.mm (141702 => 141703)


--- trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFixedNode.mm	2013-02-02 20:59:25 UTC (rev 141702)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFixedNode.mm	2013-02-02 21:03:16 UTC (rev 141703)
@@ -33,13 +33,13 @@
 
 namespace WebCore {
 
-PassOwnPtr<ScrollingTreeFixedNode> ScrollingTreeFixedNode::create(ScrollingTree* scrollingTree)
+PassOwnPtr<ScrollingTreeFixedNode> ScrollingTreeFixedNode::create(ScrollingTree* scrollingTree, ScrollingNodeID nodeID)
 {
-    return adoptPtr(new ScrollingTreeFixedNode(scrollingTree));
+    return adoptPtr(new ScrollingTreeFixedNode(scrollingTree, nodeID));
 }
 
-ScrollingTreeFixedNode::ScrollingTreeFixedNode(ScrollingTree* scrollingTree)
-    : ScrollingTreeNode(scrollingTree)
+ScrollingTreeFixedNode::ScrollingTreeFixedNode(ScrollingTree* scrollingTree, ScrollingNodeID nodeID)
+    : ScrollingTreeNode(scrollingTree, nodeID)
 {
 }
 

Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeMac.h (141702 => 141703)


--- trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeMac.h	2013-02-02 20:59:25 UTC (rev 141702)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeMac.h	2013-02-02 21:03:16 UTC (rev 141703)
@@ -38,7 +38,7 @@
 
 class ScrollingTreeScrollingNodeMac : public ScrollingTreeScrollingNode, private ScrollElasticityControllerClient {
 public:
-    explicit ScrollingTreeScrollingNodeMac(ScrollingTree*);
+    explicit ScrollingTreeScrollingNodeMac(ScrollingTree*, ScrollingNodeID);
     virtual ~ScrollingTreeScrollingNodeMac();
 
 private:

Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeMac.mm (141702 => 141703)


--- trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeMac.mm	2013-02-02 20:59:25 UTC (rev 141702)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeMac.mm	2013-02-02 21:03:16 UTC (rev 141703)
@@ -47,13 +47,13 @@
 static void logWheelEventHandlerCountChanged(unsigned);
 
 
-PassOwnPtr<ScrollingTreeScrollingNode> ScrollingTreeScrollingNode::create(ScrollingTree* scrollingTree)
+PassOwnPtr<ScrollingTreeScrollingNode> ScrollingTreeScrollingNode::create(ScrollingTree* scrollingTree, ScrollingNodeID nodeID)
 {
-    return adoptPtr(new ScrollingTreeScrollingNodeMac(scrollingTree));
+    return adoptPtr(new ScrollingTreeScrollingNodeMac(scrollingTree, nodeID));
 }
 
-ScrollingTreeScrollingNodeMac::ScrollingTreeScrollingNodeMac(ScrollingTree* scrollingTree)
-    : ScrollingTreeScrollingNode(scrollingTree)
+ScrollingTreeScrollingNodeMac::ScrollingTreeScrollingNodeMac(ScrollingTree* scrollingTree, ScrollingNodeID nodeID)
+    : ScrollingTreeScrollingNode(scrollingTree, nodeID)
     , m_scrollElasticityController(this)
     , m_lastScrollHadUnfilledPixels(false)
 {

Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeStickyNode.h (141702 => 141703)


--- trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeStickyNode.h	2013-02-02 20:59:25 UTC (rev 141702)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeStickyNode.h	2013-02-02 21:03:16 UTC (rev 141703)
@@ -40,12 +40,12 @@
 
 class ScrollingTreeStickyNode : public ScrollingTreeNode {
 public:
-    static PassOwnPtr<ScrollingTreeStickyNode> create(ScrollingTree*);
+    static PassOwnPtr<ScrollingTreeStickyNode> create(ScrollingTree*, ScrollingNodeID);
 
     virtual ~ScrollingTreeStickyNode();
 
 private:
-    ScrollingTreeStickyNode(ScrollingTree*);
+    ScrollingTreeStickyNode(ScrollingTree*, ScrollingNodeID);
 
     virtual void update(ScrollingStateNode*) OVERRIDE;
     virtual void parentScrollPositionDidChange(const IntRect& viewportRect, const FloatSize& cumulativeDelta) OVERRIDE;

Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeStickyNode.mm (141702 => 141703)


--- trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeStickyNode.mm	2013-02-02 20:59:25 UTC (rev 141702)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeStickyNode.mm	2013-02-02 21:03:16 UTC (rev 141703)
@@ -33,13 +33,13 @@
 
 namespace WebCore {
 
-PassOwnPtr<ScrollingTreeStickyNode> ScrollingTreeStickyNode::create(ScrollingTree* scrollingTree)
+PassOwnPtr<ScrollingTreeStickyNode> ScrollingTreeStickyNode::create(ScrollingTree* scrollingTree, ScrollingNodeID nodeID)
 {
-    return adoptPtr(new ScrollingTreeStickyNode(scrollingTree));
+    return adoptPtr(new ScrollingTreeStickyNode(scrollingTree, nodeID));
 }
 
-ScrollingTreeStickyNode::ScrollingTreeStickyNode(ScrollingTree* scrollingTree)
-    : ScrollingTreeNode(scrollingTree)
+ScrollingTreeStickyNode::ScrollingTreeStickyNode(ScrollingTree* scrollingTree, ScrollingNodeID nodeID)
+    : ScrollingTreeNode(scrollingTree, nodeID)
 {
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to