summaryrefslogtreecommitdiff
path: root/Source/WebCore/page/scrolling/ScrollingStateTree.h
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
commit1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch)
tree46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/WebCore/page/scrolling/ScrollingStateTree.h
parent32761a6cee1d0dee366b885b7b9c777e67885688 (diff)
downloadWebKitGtk-tarball-master.tar.gz
Diffstat (limited to 'Source/WebCore/page/scrolling/ScrollingStateTree.h')
-rw-r--r--Source/WebCore/page/scrolling/ScrollingStateTree.h56
1 files changed, 32 insertions, 24 deletions
diff --git a/Source/WebCore/page/scrolling/ScrollingStateTree.h b/Source/WebCore/page/scrolling/ScrollingStateTree.h
index 59659e534..3b256151a 100644
--- a/Source/WebCore/page/scrolling/ScrollingStateTree.h
+++ b/Source/WebCore/page/scrolling/ScrollingStateTree.h
@@ -23,14 +23,11 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef ScrollingStateTree_h
-#define ScrollingStateTree_h
+#pragma once
#if ENABLE(ASYNC_SCROLLING) || USE(COORDINATED_GRAPHICS)
-#include "ScrollingStateScrollingNode.h"
-#include <wtf/OwnPtr.h>
-#include <wtf/PassOwnPtr.h>
+#include "ScrollingStateFrameScrollingNode.h"
#include <wtf/RefPtr.h>
namespace WebCore {
@@ -43,29 +40,30 @@ class AsyncScrollingCoordinator;
// the scrolling thread, avoiding locking.
class ScrollingStateTree {
+ WTF_MAKE_FAST_ALLOCATED;
friend class ScrollingStateNode;
public:
-
- static PassOwnPtr<ScrollingStateTree> create(AsyncScrollingCoordinator* = 0);
- ~ScrollingStateTree();
+ WEBCORE_EXPORT ScrollingStateTree(AsyncScrollingCoordinator* = nullptr);
+ WEBCORE_EXPORT ~ScrollingStateTree();
- ScrollingStateScrollingNode* rootStateNode() const { return m_rootStateNode.get(); }
- ScrollingStateNode* stateNodeForID(ScrollingNodeID);
+ ScrollingStateFrameScrollingNode* rootStateNode() const { return m_rootStateNode.get(); }
+ WEBCORE_EXPORT ScrollingStateNode* stateNodeForID(ScrollingNodeID) const;
- ScrollingNodeID attachNode(ScrollingNodeType, ScrollingNodeID, ScrollingNodeID parentID);
+ WEBCORE_EXPORT ScrollingNodeID attachNode(ScrollingNodeType, ScrollingNodeID, ScrollingNodeID parentID);
void detachNode(ScrollingNodeID);
void clear();
- const Vector<ScrollingNodeID>& removedNodes() const { return m_nodesRemovedSinceLastCommit; }
- void setRemovedNodes(Vector<ScrollingNodeID>);
+ const HashSet<ScrollingNodeID>& removedNodes() const { return m_nodesRemovedSinceLastCommit; }
+ WEBCORE_EXPORT void setRemovedNodes(HashSet<ScrollingNodeID>);
// Copies the current tree state and clears the changed properties mask in the original.
- PassOwnPtr<ScrollingStateTree> commit(LayerRepresentation::Type preferredLayerRepresentation);
+ WEBCORE_EXPORT std::unique_ptr<ScrollingStateTree> commit(LayerRepresentation::Type preferredLayerRepresentation);
- void setHasChangedProperties(bool = true);
+ WEBCORE_EXPORT void setHasChangedProperties(bool = true);
bool hasChangedProperties() const { return m_hasChangedProperties; }
bool hasNewRootStateNode() const { return m_hasNewRootStateNode; }
+ void setHasNewRootStateNode(bool hasNewRoot) { m_hasNewRootStateNode = hasNewRoot; }
int nodeCount() const { return m_stateNodeMap.size(); }
@@ -76,17 +74,24 @@ public:
void setPreferredLayerRepresentation(LayerRepresentation::Type representation) { m_preferredLayerRepresentation = representation; }
private:
- ScrollingStateTree(AsyncScrollingCoordinator*);
-
- void setRootStateNode(PassOwnPtr<ScrollingStateScrollingNode> rootStateNode) { m_rootStateNode = rootStateNode; }
+ void setRootStateNode(Ref<ScrollingStateFrameScrollingNode>&& rootStateNode) { m_rootStateNode = WTFMove(rootStateNode); }
void addNode(ScrollingStateNode*);
- void removeNode(ScrollingStateNode*);
- void didRemoveNode(ScrollingNodeID);
+
+ Ref<ScrollingStateNode> createNode(ScrollingNodeType, ScrollingNodeID);
+
+ bool nodeTypeAndParentMatch(ScrollingStateNode&, ScrollingNodeType, ScrollingNodeID parentID) const;
+
+ enum class SubframeNodeRemoval { Delete, Orphan };
+ void removeNodeAndAllDescendants(ScrollingStateNode*, SubframeNodeRemoval = SubframeNodeRemoval::Delete);
+
+ void recursiveNodeWillBeRemoved(ScrollingStateNode* currNode, SubframeNodeRemoval);
+ void willRemoveNode(ScrollingStateNode*);
AsyncScrollingCoordinator* m_scrollingCoordinator;
StateNodeMap m_stateNodeMap;
- OwnPtr<ScrollingStateScrollingNode> m_rootStateNode;
- Vector<ScrollingNodeID> m_nodesRemovedSinceLastCommit;
+ RefPtr<ScrollingStateFrameScrollingNode> m_rootStateNode;
+ HashSet<ScrollingNodeID> m_nodesRemovedSinceLastCommit;
+ HashMap<ScrollingNodeID, RefPtr<ScrollingStateNode>> m_orphanedSubframeNodes;
bool m_hasChangedProperties;
bool m_hasNewRootStateNode;
LayerRepresentation::Type m_preferredLayerRepresentation;
@@ -94,6 +99,9 @@ private:
} // namespace WebCore
-#endif // ENABLE(ASYNC_SCROLLING) || USE(COORDINATED_GRAPHICS)
+#ifndef NDEBUG
+void showScrollingStateTree(const WebCore::ScrollingStateTree*);
+void showScrollingStateTree(const WebCore::ScrollingStateNode*);
+#endif
-#endif // ScrollingStateTree_h
+#endif // ENABLE(ASYNC_SCROLLING) || USE(COORDINATED_GRAPHICS)