Changeset 238898 in webkit
- Timestamp:
- Dec 5, 2018 10:20:56 AM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r238894 r238898 1 2018-12-05 Frederic Wang <fwang@igalia.com> 2 3 Minor refactoring of the scrolling code 4 https://bugs.webkit.org/show_bug.cgi?id=192398 5 6 Reviewed by Simon Fraser. 7 8 Based on an earlier patch by Simon Fraser. 9 10 This patch performs some minor refactoring of the scrolling code: 11 - Rename ScrollingCoordinator::uniqueScrollLayerID() to uniqueScrollingNodeID() since it 12 is really a node id. 13 - Inline ScrollingStateTree::setRootStateNode() so we only need to forward declare 14 ScrollingStateFrameScrollingNode in headers. 15 - Pass argument to ScrollingStateTree::addNode() as a reference rather than a pointer. 16 - Initialize ScrollingStateTree::m_changedProperties and ScrollingStateTree::m_parent in 17 the header file. 18 - Remove obsolete comment about ScrollingCoordinatorMac. 19 20 No new tests, behavior unchanged. 21 22 * page/scrolling/ScrollingCoordinator.cpp: 23 (WebCore::ScrollingCoordinator::uniqueScrollingNodeID): 24 (WebCore::ScrollingCoordinator::uniqueScrollLayerID): Deleted. 25 * page/scrolling/ScrollingCoordinator.h: 26 * page/scrolling/ScrollingStateNode.cpp: 27 (WebCore::ScrollingStateNode::ScrollingStateNode): 28 * page/scrolling/ScrollingStateNode.h: 29 * page/scrolling/ScrollingStateTree.cpp: 30 (WebCore::ScrollingStateTree::attachNode): 31 (WebCore::ScrollingStateTree::setRootStateNode): 32 (WebCore::ScrollingStateTree::addNode): 33 * page/scrolling/ScrollingStateTree.h: 34 (WebCore::ScrollingStateTree::setRootStateNode): Deleted. 35 * page/scrolling/ScrollingTree.cpp: 36 * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h: 37 * rendering/RenderLayerCompositor.cpp: 38 (WebCore::RenderLayerCompositor::attachScrollingNode): 39 1 40 2018-12-05 Wenson Hsieh <wenson_hsieh@apple.com> 2 41 -
trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp
r230952 r238898 362 362 } 363 363 364 ScrollingNodeID ScrollingCoordinator::uniqueScroll LayerID()365 { 366 static ScrollingNodeID uniqueScroll LayerID = 1;367 return uniqueScroll LayerID++;364 ScrollingNodeID ScrollingCoordinator::uniqueScrollingNodeID() 365 { 366 static ScrollingNodeID uniqueScrollingNodeID = 1; 367 return uniqueScrollingNodeID++; 368 368 } 369 369 -
trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h
r238885 r238898 162 162 163 163 // These virtual functions are currently unique to the threaded scrolling architecture. 164 // Their meaningful implementations are in ScrollingCoordinatorMac.165 164 virtual void commitTreeStateIfNeeded() { } 166 165 virtual bool requestScrollPositionUpdate(FrameView&, const IntPoint&) { return false; } … … 199 198 virtual void setScrollPinningBehavior(ScrollPinningBehavior) { } 200 199 201 // Generated a unique id for scroll layers.202 ScrollingNodeID uniqueScroll LayerID();200 // Generated a unique id for scrolling nodes. 201 ScrollingNodeID uniqueScrollingNodeID(); 203 202 204 203 enum MainThreadScrollingReasonFlags { -
trunk/Source/WebCore/page/scrolling/ScrollingStateNode.cpp
r227596 r238898 40 40 : m_nodeType(nodeType) 41 41 , m_nodeID(nodeID) 42 , m_changedProperties(0)43 42 , m_scrollingStateTree(scrollingStateTree) 44 , m_parent(nullptr)45 43 { 46 44 } … … 53 51 , m_changedProperties(stateNode.changedProperties()) 54 52 , m_scrollingStateTree(adoptiveTree) 55 , m_parent(nullptr)56 53 { 57 54 if (hasChangedProperty(ScrollLayer)) 58 55 setLayer(stateNode.layer().toRepresentation(adoptiveTree.preferredLayerRepresentation())); 59 scrollingStateTree().addNode( this);56 scrollingStateTree().addNode(*this); 60 57 } 61 58 -
trunk/Source/WebCore/page/scrolling/ScrollingStateNode.h
r234348 r238898 249 249 250 250 const ScrollingNodeType m_nodeType; 251 ScrollingNodeID m_nodeID;252 ChangedProperties m_changedProperties ;251 const ScrollingNodeID m_nodeID; 252 ChangedProperties m_changedProperties { 0 }; 253 253 254 254 ScrollingStateTree& m_scrollingStateTree; 255 255 256 ScrollingStateNode* m_parent ;256 ScrollingStateNode* m_parent { nullptr }; 257 257 std::unique_ptr<Vector<RefPtr<ScrollingStateNode>>> m_children; 258 258 -
trunk/Source/WebCore/page/scrolling/ScrollingStateTree.cpp
r228264 r238898 106 106 // If the type has changed, we need to destroy and recreate the node with a new ID. 107 107 if (nodeType != node->nodeType()) 108 newNodeID = m_scrollingCoordinator->uniqueScroll LayerID();108 newNodeID = m_scrollingCoordinator->uniqueScrollingNodeID(); 109 109 #endif 110 110 … … 197 197 } 198 198 199 void ScrollingStateTree::addNode(ScrollingStateNode* node) 200 { 201 m_stateNodeMap.add(node->scrollingNodeID(), node); 199 void ScrollingStateTree::setRootStateNode(Ref<ScrollingStateFrameScrollingNode>&& rootStateNode) 200 { 201 m_rootStateNode = WTFMove(rootStateNode); 202 } 203 204 void ScrollingStateTree::addNode(ScrollingStateNode& node) 205 { 206 m_stateNodeMap.add(node.scrollingNodeID(), &node); 202 207 } 203 208 -
trunk/Source/WebCore/page/scrolling/ScrollingStateTree.h
r211033 r238898 28 28 #if ENABLE(ASYNC_SCROLLING) || USE(COORDINATED_GRAPHICS) 29 29 30 #include "ScrollingStateFrameScrollingNode.h" 30 #include "ScrollingCoordinator.h" 31 #include "ScrollingStateNode.h" 31 32 #include <wtf/RefPtr.h> 32 33 … … 34 35 35 36 class AsyncScrollingCoordinator; 37 class ScrollingStateFrameScrollingNode; 36 38 37 39 // The ScrollingStateTree is a tree that managed ScrollingStateNodes. The nodes keep track of the current … … 75 77 76 78 private: 77 void setRootStateNode(Ref<ScrollingStateFrameScrollingNode>&& rootStateNode) { m_rootStateNode = WTFMove(rootStateNode); }78 void addNode(ScrollingStateNode *);79 void setRootStateNode(Ref<ScrollingStateFrameScrollingNode>&&); 80 void addNode(ScrollingStateNode&); 79 81 80 82 Ref<ScrollingStateNode> createNode(ScrollingNodeType, ScrollingNodeID); -
trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp
r223728 r238898 32 32 #include "Logging.h" 33 33 #include "PlatformWheelEvent.h" 34 #include "ScrollingStateFrameScrollingNode.h" 34 35 #include "ScrollingStateTree.h" 35 36 #include "ScrollingTreeFrameScrollingNode.h" -
trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h
r228264 r238898 30 30 #include "ScrollController.h" 31 31 #include "ScrollbarThemeMac.h" 32 #include "ScrollingStateFrameScrollingNode.h" 32 33 #include "ScrollingTreeFrameScrollingNode.h" 33 34 #include <wtf/RetainPtr.h> -
trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp
r238885 r238898 3836 3836 ScrollingNodeID nodeID = backing->scrollingNodeIDForRole(role); 3837 3837 if (!nodeID) 3838 nodeID = scrollingCoordinator->uniqueScroll LayerID();3838 nodeID = scrollingCoordinator->uniqueScrollingNodeID(); 3839 3839 3840 3840 nodeID = scrollingCoordinator->attachToStateTree(nodeType, nodeID, parentNodeID);
Note: See TracChangeset
for help on using the changeset viewer.