https://bugs.webkit.org/show_bug.cgi?id=99204
authorbdakin@apple.com <bdakin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 12 Oct 2012 20:50:36 +0000 (20:50 +0000)
committerbdakin@apple.com <bdakin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 12 Oct 2012 20:50:36 +0000 (20:50 +0000)
ScrollingStateNodes should keep track of their IDs

Reviewed by Simon Fraser.

There is a HashMap in ScrollingCoordinatorMac that maps
ScrollingNodeIDs to ScrollingStateNodes. The nodes themselves should
keep track of this id. Then the id can be used to make sure
ScrollingStateNodes remove themselves from the HashMap when they are
destroyed, and it will also be useful for associating
ScrollingStateNodes with ScrollingTreeNodes over on the scrolling
thread.

This patch only has the ScrollingStateNodes cache the id. I will
actually make use of the id in follow-up patches.

* page/scrolling/ScrollingStateNode.cpp:
(WebCore::ScrollingStateNode::ScrollingStateNode):
* page/scrolling/ScrollingStateNode.h:
(ScrollingStateNode):
(WebCore::ScrollingStateNode::scrollingNodeID):
* page/scrolling/ScrollingStateScrollingNode.cpp:
(WebCore::ScrollingStateScrollingNode::create):
(WebCore::ScrollingStateScrollingNode::ScrollingStateScrollingNode):
* page/scrolling/ScrollingStateScrollingNode.h:
(ScrollingStateScrollingNode):
* page/scrolling/mac/ScrollingCoordinatorMac.mm:
(WebCore::ScrollingCoordinatorMac::attachToStateTree):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@131221 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/page/scrolling/ScrollingStateNode.cpp
Source/WebCore/page/scrolling/ScrollingStateNode.h
Source/WebCore/page/scrolling/ScrollingStateScrollingNode.cpp
Source/WebCore/page/scrolling/ScrollingStateScrollingNode.h
Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.mm

index 99a3b82..ed64cac 100644 (file)
@@ -1,3 +1,34 @@
+2012-10-12  Beth Dakin  <bdakin@apple.com>
+
+        https://bugs.webkit.org/show_bug.cgi?id=99204
+        ScrollingStateNodes should keep track of their IDs
+
+        Reviewed by Simon Fraser.
+
+        There is a HashMap in ScrollingCoordinatorMac that maps 
+        ScrollingNodeIDs to ScrollingStateNodes. The nodes themselves should 
+        keep track of this id. Then the id can be used to make sure 
+        ScrollingStateNodes remove themselves from the HashMap when they are 
+        destroyed, and it will also be useful for associating 
+        ScrollingStateNodes with ScrollingTreeNodes over on the scrolling 
+        thread.
+  
+        This patch only has the ScrollingStateNodes cache the id. I will 
+        actually make use of the id in follow-up patches.
+
+        * page/scrolling/ScrollingStateNode.cpp:
+        (WebCore::ScrollingStateNode::ScrollingStateNode):
+        * page/scrolling/ScrollingStateNode.h:
+        (ScrollingStateNode):
+        (WebCore::ScrollingStateNode::scrollingNodeID):
+        * page/scrolling/ScrollingStateScrollingNode.cpp:
+        (WebCore::ScrollingStateScrollingNode::create):
+        (WebCore::ScrollingStateScrollingNode::ScrollingStateScrollingNode):
+        * page/scrolling/ScrollingStateScrollingNode.h:
+        (ScrollingStateScrollingNode):
+        * page/scrolling/mac/ScrollingCoordinatorMac.mm:
+        (WebCore::ScrollingCoordinatorMac::attachToStateTree):
+
 2012-10-01  Jer Noble  <jer.noble@apple.com>
 
         Add LSKD support to MediaPlayerPrivateAVFoundation.
 2012-10-01  Jer Noble  <jer.noble@apple.com>
 
         Add LSKD support to MediaPlayerPrivateAVFoundation.
index 495b97d..f5a2bf9 100644 (file)
@@ -32,8 +32,9 @@
 
 namespace WebCore {
 
 
 namespace WebCore {
 
-ScrollingStateNode::ScrollingStateNode(ScrollingStateTree* scrollingStateTree)
+ScrollingStateNode::ScrollingStateNode(ScrollingStateTree* scrollingStateTree, ScrollingNodeID nodeID)
     : m_scrollingStateTree(scrollingStateTree)
     : m_scrollingStateTree(scrollingStateTree)
+    , m_nodeID(nodeID)
     , m_parent(0)
     , m_scrollLayerDidChange(false)
 {
     , m_parent(0)
     , m_scrollLayerDidChange(false)
 {
@@ -44,6 +45,7 @@ ScrollingStateNode::ScrollingStateNode(ScrollingStateTree* scrollingStateTree)
 // node.
 ScrollingStateNode::ScrollingStateNode(ScrollingStateNode* stateNode)
     : m_scrollingStateTree(0)
 // node.
 ScrollingStateNode::ScrollingStateNode(ScrollingStateNode* stateNode)
     : m_scrollingStateTree(0)
+    , m_nodeID(stateNode->scrollingNodeID())
     , m_parent(0)
     , m_scrollLayerDidChange(stateNode->scrollLayerDidChange())
 {
     , m_parent(0)
     , m_scrollLayerDidChange(stateNode->scrollLayerDidChange())
 {
index c637bf3..dc813ac 100644 (file)
@@ -29,6 +29,7 @@
 #if ENABLE(THREADED_SCROLLING)
 
 #include "GraphicsLayer.h"
 #if ENABLE(THREADED_SCROLLING)
 
 #include "GraphicsLayer.h"
+#include "ScrollingCoordinator.h"
 #include <wtf/OwnPtr.h>
 #include <wtf/PassOwnPtr.h>
 #include <wtf/Vector.h>
 #include <wtf/OwnPtr.h>
 #include <wtf/PassOwnPtr.h>
 #include <wtf/Vector.h>
@@ -45,7 +46,7 @@ class ScrollingStateNode {
     WTF_MAKE_NONCOPYABLE(ScrollingStateNode);
 
 public:
     WTF_MAKE_NONCOPYABLE(ScrollingStateNode);
 
 public:
-    ScrollingStateNode(ScrollingStateTree*);
+    ScrollingStateNode(ScrollingStateTree*, ScrollingNodeID);
     virtual ~ScrollingStateNode();
 
     virtual bool isScrollingStateScrollingNode() { return false; }
     virtual ~ScrollingStateNode();
 
     virtual bool isScrollingStateScrollingNode() { return false; }
@@ -68,6 +69,8 @@ public:
     ScrollingStateTree* scrollingStateTree() const { return m_scrollingStateTree; }
     void setScrollingStateTree(ScrollingStateTree* tree) { m_scrollingStateTree = tree; }
 
     ScrollingStateTree* scrollingStateTree() const { return m_scrollingStateTree; }
     void setScrollingStateTree(ScrollingStateTree* tree) { m_scrollingStateTree = tree; }
 
+    ScrollingNodeID scrollingNodeID() const { return m_nodeID; }
+
     ScrollingStateNode* parent() const { return m_parent; }
     void setParent(ScrollingStateNode* parent) { m_parent = parent; }
 
     ScrollingStateNode* parent() const { return m_parent; }
     void setParent(ScrollingStateNode* parent) { m_parent = parent; }
 
@@ -81,8 +84,9 @@ protected:
     ScrollingStateTree* m_scrollingStateTree;
 
 private:
     ScrollingStateTree* m_scrollingStateTree;
 
 private:
-    ScrollingStateNode* m_parent;
+    ScrollingNodeID m_nodeID;
 
 
+    ScrollingStateNode* m_parent;
     OwnPtr<Vector<OwnPtr<ScrollingStateNode> > > m_children;
 
     bool m_scrollLayerDidChange;
     OwnPtr<Vector<OwnPtr<ScrollingStateNode> > > m_children;
 
     bool m_scrollLayerDidChange;
index 4b11681..06ea473 100644 (file)
 
 namespace WebCore {
 
 
 namespace WebCore {
 
-PassOwnPtr<ScrollingStateScrollingNode> ScrollingStateScrollingNode::create(ScrollingStateTree* stateTree)
+PassOwnPtr<ScrollingStateScrollingNode> ScrollingStateScrollingNode::create(ScrollingStateTree* stateTree, ScrollingNodeID nodeID)
 {
 {
-    return adoptPtr(new ScrollingStateScrollingNode(stateTree));
+    return adoptPtr(new ScrollingStateScrollingNode(stateTree, nodeID));
 }
 
 }
 
-ScrollingStateScrollingNode::ScrollingStateScrollingNode(ScrollingStateTree* stateTree)
-    : ScrollingStateNode(stateTree)
+ScrollingStateScrollingNode::ScrollingStateScrollingNode(ScrollingStateTree* stateTree, ScrollingNodeID nodeID)
+    : ScrollingStateNode(stateTree, nodeID)
     , m_changedProperties(0)
     , m_wheelEventHandlerCount(0)
     , m_shouldUpdateScrollLayerPositionOnMainThread(0)
     , m_changedProperties(0)
     , m_wheelEventHandlerCount(0)
     , m_shouldUpdateScrollLayerPositionOnMainThread(0)
index a5029a3..ba9f647 100644 (file)
@@ -39,7 +39,7 @@ namespace WebCore {
 
 class ScrollingStateScrollingNode : public ScrollingStateNode {
 public:
 
 class ScrollingStateScrollingNode : public ScrollingStateNode {
 public:
-    static PassOwnPtr<ScrollingStateScrollingNode> create(ScrollingStateTree*);
+    static PassOwnPtr<ScrollingStateScrollingNode> create(ScrollingStateTree*, ScrollingNodeID);
     virtual ~ScrollingStateScrollingNode();
 
     enum ChangedProperty {
     virtual ~ScrollingStateScrollingNode();
 
     enum ChangedProperty {
@@ -110,7 +110,7 @@ public:
     bool requestedScrollPositionRepresentsProgrammaticScroll() const { return m_requestedScrollPositionRepresentsProgrammaticScroll; }
 
 private:
     bool requestedScrollPositionRepresentsProgrammaticScroll() const { return m_requestedScrollPositionRepresentsProgrammaticScroll; }
 
 private:
-    ScrollingStateScrollingNode(ScrollingStateTree*);
+    ScrollingStateScrollingNode(ScrollingStateTree*, ScrollingNodeID);
     ScrollingStateScrollingNode(ScrollingStateScrollingNode*);
 
     unsigned m_changedProperties;
     ScrollingStateScrollingNode(ScrollingStateScrollingNode*);
 
     unsigned m_changedProperties;
index f71bd38..e09e0fb 100644 (file)
@@ -247,7 +247,7 @@ ScrollingNodeID ScrollingCoordinatorMac::attachToStateTree(ScrollingNodeID scrol
     // FIXME: In the future, this function will have to take a parent ID so that it can
     // append the node in the appropriate spot in the state tree. For now we always assume
     // this is the root node.
     // FIXME: In the future, this function will have to take a parent ID so that it can
     // append the node in the appropriate spot in the state tree. For now we always assume
     // this is the root node.
-    m_scrollingStateTree->setRootStateNode(ScrollingStateScrollingNode::create(m_scrollingStateTree.get()));
+    m_scrollingStateTree->setRootStateNode(ScrollingStateScrollingNode::create(m_scrollingStateTree.get(), scrollLayerID));
     m_stateNodeMap.set(scrollLayerID, m_scrollingStateTree->rootStateNode());
     return scrollLayerID;
 }
     m_stateNodeMap.set(scrollLayerID, m_scrollingStateTree->rootStateNode());
     return scrollLayerID;
 }