From 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c Mon Sep 17 00:00:00 2001 From: Lorry Tar Creator Date: Tue, 27 Jun 2017 06:07:23 +0000 Subject: webkitgtk-2.16.5 --- Source/WebCore/page/scrolling/ScrollingStateTree.h | 56 ++++++++++++---------- 1 file changed, 32 insertions(+), 24 deletions(-) (limited to 'Source/WebCore/page/scrolling/ScrollingStateTree.h') 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 -#include +#include "ScrollingStateFrameScrollingNode.h" #include 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 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& removedNodes() const { return m_nodesRemovedSinceLastCommit; } - void setRemovedNodes(Vector); + const HashSet& removedNodes() const { return m_nodesRemovedSinceLastCommit; } + WEBCORE_EXPORT void setRemovedNodes(HashSet); // Copies the current tree state and clears the changed properties mask in the original. - PassOwnPtr commit(LayerRepresentation::Type preferredLayerRepresentation); + WEBCORE_EXPORT std::unique_ptr 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 rootStateNode) { m_rootStateNode = rootStateNode; } + void setRootStateNode(Ref&& rootStateNode) { m_rootStateNode = WTFMove(rootStateNode); } void addNode(ScrollingStateNode*); - void removeNode(ScrollingStateNode*); - void didRemoveNode(ScrollingNodeID); + + Ref 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 m_rootStateNode; - Vector m_nodesRemovedSinceLastCommit; + RefPtr m_rootStateNode; + HashSet m_nodesRemovedSinceLastCommit; + HashMap> 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) -- cgit v1.2.1