Changeset 239010 in webkit
- Timestamp:
- Dec 8, 2018 1:08:17 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r239006 r239010 1 2018-12-08 Simon Fraser <simon.fraser@apple.com> 2 3 Allow control over child order when adding nodes to the scrolling tree 4 https://bugs.webkit.org/show_bug.cgi?id=176914 5 <rdar://problem/46542237> 6 7 Reviewed by Simon Fraser. 8 9 * platform/mac-wk2/TestExpectations: Mark fast/visual-viewport/tiled-drawing/zoomed-fixed-scrolling-layers-state.html 10 as flakey, which it will be until we attach in z-order. 11 1 12 2018-12-07 Eric Carlson <eric.carlson@apple.com> 2 13 -
trunk/LayoutTests/platform/mac-wk2/TestExpectations
r238935 r239010 322 322 webkit.org/b/148408 tiled-drawing/scrolling/root-overflow-with-mousewheel.html [ Pass Failure Timeout ] 323 323 324 webkit.org/b/192529 fast/visual-viewport/tiled-drawing/zoomed-fixed-scrolling-layers-state.html [ Pass Failure ] 325 324 326 webkit.org/b/139820 fast/frames/lots-of-objects.html [ Pass Timeout ] 325 327 webkit.org/b/139820 fast/frames/lots-of-iframes.html [ Pass Timeout ] -
trunk/Source/WebCore/ChangeLog
r239006 r239010 1 2018-12-08 Frederic Wang <fwang@igalia.com> 2 3 Allow control over child order when adding nodes to the scrolling tree 4 https://bugs.webkit.org/show_bug.cgi?id=176914 5 <rdar://problem/46542237> 6 7 Reviewed by Simon Fraser. 8 9 Based on an earlier patch by Simon Fraser. 10 11 Previously ScrollingCoordinator just allowed nodes to be "attached" with a given parent, 12 but with no control over sibling order. To allow for correct hit-testing overflow and 13 frame scrolling nodes, we have to build the scrolling tree in z-order. 14 15 This patch adds a 'childIndex' parameter to attachNode() which gives control over 16 sibling order. For now, RenderLayerCompositor always uses the default 'notFound' value 17 for childIndex so the current behavior (appending new nodes at the end of child list) is 18 preserved. 19 20 One test marked as flakey, since scrolling tree order is currently dependent on HashSet 21 traversal order. 22 23 * page/scrolling/AsyncScrollingCoordinator.cpp: 24 (WebCore::AsyncScrollingCoordinator::attachToStateTree): 25 (WebCore::AsyncScrollingCoordinator::ensureRootStateNodeForFrameView): 26 * page/scrolling/AsyncScrollingCoordinator.h: 27 * page/scrolling/ScrollingCoordinator.h: 28 (WebCore::ScrollingCoordinator::attachToStateTree): 29 * page/scrolling/ScrollingStateNode.cpp: 30 (WebCore::ScrollingStateNode::insertChild): 31 (WebCore::ScrollingStateNode::indexOfChild const): 32 * page/scrolling/ScrollingStateNode.h: 33 * page/scrolling/ScrollingStateTree.cpp: 34 (WebCore::ScrollingStateTree::nodeTypeAndParentMatch const): 35 (WebCore::ScrollingStateTree::attachNode): 36 * page/scrolling/ScrollingStateTree.h: 37 1 38 2018-12-07 Eric Carlson <eric.carlson@apple.com> 2 39 -
trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp
r238958 r239010 475 475 } 476 476 477 ScrollingNodeID AsyncScrollingCoordinator::attachToStateTree(ScrollingNodeType nodeType, ScrollingNodeID newNodeID, ScrollingNodeID parentID) 478 { 479 return m_scrollingStateTree->attachNode(nodeType, newNodeID, parentID); 477 ScrollingNodeID AsyncScrollingCoordinator::attachToStateTree(ScrollingNodeType nodeType, ScrollingNodeID newNodeID, ScrollingNodeID parentID, size_t childIndex) 478 { 479 LOG_WITH_STREAM(Scrolling, stream << "AsyncScrollingCoordinator::attachToStateTree " << nodeType << " node " << newNodeID << " parent " << parentID << " index " << childIndex); 480 return m_scrollingStateTree->attachNode(nodeType, newNodeID, parentID, childIndex); 480 481 } 481 482 … … 510 511 // RenderLayerCompositor::updateBacking where the node has already been created. 511 512 ASSERT(frameView.frame().isMainFrame()); 512 attachToStateTree(MainFrameScrollingNode, frameView.scrollLayerID(), 0 );513 attachToStateTree(MainFrameScrollingNode, frameView.scrollLayerID(), 0, 0); 513 514 } 514 515 -
trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h
r238958 r239010 98 98 WEBCORE_EXPORT bool requestScrollPositionUpdate(FrameView&, const IntPoint&) override; 99 99 100 WEBCORE_EXPORT ScrollingNodeID attachToStateTree(ScrollingNodeType, ScrollingNodeID newNodeID, ScrollingNodeID parentID ) override;100 WEBCORE_EXPORT ScrollingNodeID attachToStateTree(ScrollingNodeType, ScrollingNodeID newNodeID, ScrollingNodeID parentID, size_t childIndex) override; 101 101 WEBCORE_EXPORT void detachFromStateTree(ScrollingNodeID) override; 102 102 WEBCORE_EXPORT void clearStateTree() override; -
trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h
r238958 r239010 165 165 virtual bool requestScrollPositionUpdate(FrameView&, const IntPoint&) { return false; } 166 166 virtual bool handleWheelEvent(FrameView&, const PlatformWheelEvent&) { return true; } 167 virtual ScrollingNodeID attachToStateTree(ScrollingNodeType, ScrollingNodeID newNodeID, ScrollingNodeID /*parentID*/) { return newNodeID; } 167 virtual ScrollingNodeID attachToStateTree(ScrollingNodeType, ScrollingNodeID newNodeID, ScrollingNodeID /*parentID*/, size_t /*childIndex*/ = notFound) { return newNodeID; } 168 168 169 virtual void detachFromStateTree(ScrollingNodeID) { } 169 170 virtual void clearStateTree() { } -
trunk/Source/WebCore/page/scrolling/ScrollingStateNode.cpp
r238958 r239010 98 98 } 99 99 100 void ScrollingStateNode::insertChild(Ref<ScrollingStateNode>&& childNode, size_t index) 101 { 102 childNode->setParent(this); 103 104 if (!m_children) { 105 ASSERT(!index); 106 m_children = std::make_unique<Vector<RefPtr<ScrollingStateNode>>>(); 107 } 108 109 m_children->insert(index, WTFMove(childNode)); 110 } 111 112 size_t ScrollingStateNode::indexOfChild(ScrollingStateNode& childNode) const 113 { 114 if (!m_children) 115 return notFound; 116 117 return m_children->find(&childNode); 118 } 119 100 120 void ScrollingStateNode::reconcileLayerPositionForViewportRect(const LayoutRect& viewportRect, ScrollingLayerPositionAction action) 101 121 { -
trunk/Source/WebCore/page/scrolling/ScrollingStateNode.h
r238958 r239010 237 237 238 238 void appendChild(Ref<ScrollingStateNode>&&); 239 void insertChild(Ref<ScrollingStateNode>&&, size_t index); 240 241 size_t indexOfChild(ScrollingStateNode&) const; 239 242 240 243 String scrollingStateTreeAsText(ScrollingStateTreeAsTextBehavior = ScrollingStateTreeAsTextBehaviorNormal) const; -
trunk/Source/WebCore/page/scrolling/ScrollingStateTree.cpp
r238958 r239010 83 83 } 84 84 85 bool ScrollingStateTree::nodeTypeAndParentMatch(ScrollingStateNode& node, ScrollingNodeType nodeType, Scrolling NodeID parentID) const85 bool ScrollingStateTree::nodeTypeAndParentMatch(ScrollingStateNode& node, ScrollingNodeType nodeType, ScrollingStateNode* parentNode) const 86 86 { 87 87 if (node.nodeType() != nodeType) 88 88 return false; 89 89 90 auto* parent = stateNodeForID(parentID); 91 if (!parent) 92 return true; 93 94 return node.parent() == parent; 95 } 96 97 ScrollingNodeID ScrollingStateTree::attachNode(ScrollingNodeType nodeType, ScrollingNodeID newNodeID, ScrollingNodeID parentID) 90 return node.parent() == parentNode; 91 } 92 93 ScrollingNodeID ScrollingStateTree::attachNode(ScrollingNodeType nodeType, ScrollingNodeID newNodeID, ScrollingNodeID parentID, size_t childIndex) 98 94 { 99 95 ASSERT(newNodeID); 100 96 101 97 if (auto* node = stateNodeForID(newNodeID)) { 102 if (nodeTypeAndParentMatch(*node, nodeType, parentID)) 98 auto* parent = stateNodeForID(parentID); 99 if (nodeTypeAndParentMatch(*node, nodeType, parent)) { 100 if (!parentID) 101 return newNodeID; 102 103 size_t currentIndex = parent->indexOfChild(*node); 104 if (currentIndex == childIndex) 105 return newNodeID; 106 107 ASSERT(currentIndex != notFound); 108 Ref<ScrollingStateNode> protectedNode(*node); 109 parent->children()->remove(currentIndex); 110 111 if (childIndex == notFound) 112 parent->appendChild(WTFMove(protectedNode)); 113 else 114 parent->insertChild(WTFMove(protectedNode), childIndex); 115 103 116 return newNodeID; 117 } 104 118 105 119 #if ENABLE(ASYNC_SCROLLING) … … 115 129 ScrollingStateNode* newNode = nullptr; 116 130 if (!parentID) { 131 ASSERT(!childIndex || childIndex == notFound); 117 132 // If we're resetting the root node, we should clear the HashMap and destroy the current children. 118 133 clear(); … … 123 138 } else { 124 139 auto* parent = stateNodeForID(parentID); 125 if (!parent) 140 if (!parent) { 141 ASSERT_NOT_REACHED(); 126 142 return 0; 143 } 127 144 128 145 if (nodeType == SubframeScrollingNode && parentID) { 129 146 if (auto orphanedNode = m_orphanedSubframeNodes.take(newNodeID)) { 130 147 newNode = orphanedNode.get(); 131 parent->appendChild(orphanedNode.releaseNonNull()); 148 if (childIndex == notFound) 149 parent->appendChild(orphanedNode.releaseNonNull()); 150 else 151 parent->insertChild(orphanedNode.releaseNonNull(), childIndex); 132 152 } 133 153 } … … 136 156 auto stateNode = createNode(nodeType, newNodeID); 137 157 newNode = stateNode.ptr(); 138 parent->appendChild(WTFMove(stateNode)); 139 } 140 } 141 142 m_stateNodeMap.set(newNodeID, newNode); 158 if (childIndex == notFound) 159 parent->appendChild(WTFMove(stateNode)); 160 else 161 parent->insertChild(WTFMove(stateNode), childIndex); 162 } 163 } 164 165 addNode(*newNode); 143 166 m_nodesRemovedSinceLastCommit.remove(newNodeID); 144 167 return newNodeID; -
trunk/Source/WebCore/page/scrolling/ScrollingStateTree.h
r238958 r239010 52 52 WEBCORE_EXPORT ScrollingStateNode* stateNodeForID(ScrollingNodeID) const; 53 53 54 WEBCORE_EXPORT ScrollingNodeID attachNode(ScrollingNodeType, ScrollingNodeID, ScrollingNodeID parentID );54 WEBCORE_EXPORT ScrollingNodeID attachNode(ScrollingNodeType, ScrollingNodeID, ScrollingNodeID parentID, size_t childIndex); 55 55 void detachNode(ScrollingNodeID); 56 56 void clear(); … … 82 82 Ref<ScrollingStateNode> createNode(ScrollingNodeType, ScrollingNodeID); 83 83 84 bool nodeTypeAndParentMatch(ScrollingStateNode&, ScrollingNodeType, Scrolling NodeID parentID) const;84 bool nodeTypeAndParentMatch(ScrollingStateNode&, ScrollingNodeType, ScrollingStateNode* parentNode) const; 85 85 86 86 enum class SubframeNodeRemoval { Delete, Orphan }; -
trunk/Source/WebKit/ChangeLog
r239007 r239010 1 2018-12-08 Frederic Wang <fwang@igalia.com> 2 3 Allow control over child order when adding nodes to the scrolling tree 4 https://bugs.webkit.org/show_bug.cgi?id=176914 5 <rdar://problem/46542237> 6 7 Reviewed by Simon Fraser. 8 9 Based on an earlier patch by Simon Fraser. 10 11 * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp: 12 (WebKit::RemoteScrollingCoordinatorTransaction::decode): 13 1 14 2018-12-07 Rob Buis <rbuis@igalia.com> 2 15 -
trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp
r238958 r239010 414 414 return false; 415 415 416 m_scrollingStateTree->attachNode(nodeType, nodeID, parentNodeID );416 m_scrollingStateTree->attachNode(nodeType, nodeID, parentNodeID, notFound); // Append new node. 417 417 ScrollingStateNode* newNode = m_scrollingStateTree->stateNodeForID(nodeID); 418 418 ASSERT(newNode);
Note: See TracChangeset
for help on using the changeset viewer.