https://bugs.webkit.org/show_bug.cgi?id=99204
[WebKit-https.git] / Source / WebCore / page / scrolling / ScrollingStateNode.h
index d662e3c..dc813ac 100644 (file)
 #if ENABLE(THREADED_SCROLLING)
 
 #include "GraphicsLayer.h"
+#include "ScrollingCoordinator.h"
 #include <wtf/OwnPtr.h>
 #include <wtf/PassOwnPtr.h>
+#include <wtf/Vector.h>
 
 #if PLATFORM(MAC)
 #include <wtf/RetainPtr.h>
@@ -44,14 +46,18 @@ class ScrollingStateNode {
     WTF_MAKE_NONCOPYABLE(ScrollingStateNode);
 
 public:
-    ScrollingStateNode(ScrollingStateTree*);
+    ScrollingStateNode(ScrollingStateTree*, ScrollingNodeID);
     virtual ~ScrollingStateNode();
 
-    virtual PassOwnPtr<ScrollingStateNode> cloneNode() = 0;
+    virtual bool isScrollingStateScrollingNode() { return false; }
+
+    virtual PassOwnPtr<ScrollingStateNode> cloneAndResetNode() = 0;
+    void cloneAndResetChildNodes(ScrollingStateNode*);
 
     virtual bool hasChangedProperties() const = 0;
     virtual unsigned changedProperties() const = 0;
     virtual void resetChangedProperties() = 0;
+    virtual void setHasChangedProperties() { setScrollLayerDidChange(true); }
 
     PlatformLayer* platformScrollLayer() const;
     void setScrollLayer(const GraphicsLayer*);
@@ -63,16 +69,14 @@ public:
     ScrollingStateTree* scrollingStateTree() const { return m_scrollingStateTree; }
     void setScrollingStateTree(ScrollingStateTree* tree) { m_scrollingStateTree = tree; }
 
-    ScrollingStateNode* parent() const { return m_parent; }
-    ScrollingStateNode* firstChild() const { return m_firstChild.get(); }
-    ScrollingStateNode* nextSibling() const { return m_nextSibling.get(); }
+    ScrollingNodeID scrollingNodeID() const { return m_nodeID; }
 
+    ScrollingStateNode* parent() const { return m_parent; }
     void setParent(ScrollingStateNode* parent) { m_parent = parent; }
-    void setFirstChild(PassOwnPtr<ScrollingStateNode> firstChild) { m_firstChild = firstChild; }
-    void setNextSibling(PassOwnPtr<ScrollingStateNode> nextSibling) { m_nextSibling = nextSibling; }
 
     void appendChild(PassOwnPtr<ScrollingStateNode>);
-    ScrollingStateNode* traverseNext() const;
+
+    void removeChild(ScrollingStateNode*);
 
 protected:
     ScrollingStateNode(ScrollingStateNode*);
@@ -80,9 +84,10 @@ protected:
     ScrollingStateTree* m_scrollingStateTree;
 
 private:
+    ScrollingNodeID m_nodeID;
+
     ScrollingStateNode* m_parent;
-    OwnPtr<ScrollingStateNode> m_firstChild;
-    OwnPtr<ScrollingStateNode> m_nextSibling;
+    OwnPtr<Vector<OwnPtr<ScrollingStateNode> > > m_children;
 
     bool m_scrollLayerDidChange;