Changeset 268544 in webkit
- Timestamp:
- Oct 15, 2020 12:24:40 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r268541 r268544 1 2020-10-15 Simon Fraser <simon.fraser@apple.com> 2 3 Scrolls in the passive event region only send one wheel event to the DOM 4 https://bugs.webkit.org/show_bug.cgi?id=217719 5 6 Reviewed by Tim Horton. 7 8 * fast/scrolling/latching/latched-scroll-in-passive-region-expected.txt: Added. 9 * fast/scrolling/latching/latched-scroll-in-passive-region.html: Added. 10 1 11 2020-10-15 Andres Gonzalez <andresg_22@apple.com> 2 12 -
trunk/Source/WebCore/ChangeLog
r268541 r268544 1 2020-10-15 Simon Fraser <simon.fraser@apple.com> 2 3 Scrolls in the passive event region only send one wheel event to the DOM 4 https://bugs.webkit.org/show_bug.cgi?id=217719 5 6 Reviewed by Tim Horton. 7 8 When we hit the scrolling thread latching codepath, we'd always use { WheelEventProcessingSteps::ScrollingThread } 9 for the steps, but that caused us to not send DOM events. 10 11 Latching has to store the steps from when latching occurs (we should not re-hit-test 12 to get the region state on every event), so fix up ScrollingTreeLatchingController to 13 do that. 14 15 Test: fast/scrolling/latching/latched-scroll-in-passive-region.html 16 17 * page/scrolling/ScrollingTree.cpp: 18 (WebCore::ScrollingTree::determineWheelEventProcessing): 19 (WebCore::ScrollingTree::handleWheelEvent): 20 (WebCore::ScrollingTree::handleWheelEventWithNode): 21 * page/scrolling/ScrollingTree.h: 22 * page/scrolling/ScrollingTreeLatchingController.cpp: 23 (WebCore::ScrollingTreeLatchingController::receivedWheelEvent): 24 (WebCore::ScrollingTreeLatchingController::latchingDataForEvent const): 25 (WebCore::ScrollingTreeLatchingController::latchedNodeID const): 26 (WebCore::ScrollingTreeLatchingController::latchedNodeAndSteps const): 27 (WebCore::ScrollingTreeLatchingController::nodeDidHandleEvent): 28 (WebCore::ScrollingTreeLatchingController::nodeWasRemoved): 29 (WebCore::ScrollingTreeLatchingController::clearLatchedNode): 30 (WebCore::ScrollingTreeLatchingController::latchedNodeForEvent const): Deleted. 31 * page/scrolling/ScrollingTreeLatchingController.h: 32 * page/scrolling/ThreadedScrollingTree.cpp: 33 (WebCore::ThreadedScrollingTree::handleWheelEventAfterMainThread): 34 1 35 2020-10-15 Andres Gonzalez <andresg_22@apple.com> 2 36 -
trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp
r268476 r268544 69 69 LockHolder lock(m_treeStateMutex); 70 70 71 auto latchedNode = m_latchingController.latchedNodeForEvent(wheelEvent, m_allowLatching); 72 LOG_WITH_STREAM(ScrollLatching, stream << "ScrollingTree::shouldHandleWheelEventSynchronously " << wheelEvent << " have latched node " << latchedNode); 73 if (latchedNode) 74 return { WheelEventProcessingSteps::ScrollingThread }; 71 auto latchedNodeAndSteps = m_latchingController.latchingDataForEvent(wheelEvent, m_allowLatching); 72 if (latchedNodeAndSteps) { 73 LOG_WITH_STREAM(ScrollLatching, stream << "ScrollingTree::determineWheelEventProcessing " << wheelEvent << " have latched node " << latchedNodeAndSteps->scrollingNodeID << " steps " << latchedNodeAndSteps->processingSteps); 74 return latchedNodeAndSteps->processingSteps; 75 } 75 76 76 77 m_latchingController.receivedWheelEvent(wheelEvent, m_allowLatching); … … 136 137 m_gestureState.receivedWheelEvent(wheelEvent); 137 138 138 if (auto latchedNode ID = m_latchingController.latchedNodeForEvent(wheelEvent, m_allowLatching)) {139 LOG_WITH_STREAM(ScrollLatching, stream << "ScrollingTree::handleWheelEvent: has latched node " << latchedNode ID);140 auto* node = nodeForID( *latchedNodeID);139 if (auto latchedNodeAndSteps = m_latchingController.latchingDataForEvent(wheelEvent, m_allowLatching)) { 140 LOG_WITH_STREAM(ScrollLatching, stream << "ScrollingTree::handleWheelEvent: has latched node " << latchedNodeAndSteps->scrollingNodeID); 141 auto* node = nodeForID(latchedNodeAndSteps->scrollingNodeID); 141 142 if (is<ScrollingTreeScrollingNode>(node)) { 142 143 auto result = downcast<ScrollingTreeScrollingNode>(*node).handleWheelEvent(wheelEvent); 143 144 if (result.wasHandled) { 144 m_latchingController.nodeDidHandleEvent( *latchedNodeID, wheelEvent, m_allowLatching);145 m_gestureState.nodeDidHandleEvent( *latchedNodeID, wheelEvent);145 m_latchingController.nodeDidHandleEvent(latchedNodeAndSteps->scrollingNodeID, processingSteps, wheelEvent, m_allowLatching); 146 m_gestureState.nodeDidHandleEvent(latchedNodeAndSteps->scrollingNodeID, wheelEvent); 146 147 } 147 148 return result; … … 155 156 LOG_WITH_STREAM(Scrolling, stream << "ScrollingTree::handleWheelEvent found node " << (node ? node->scrollingNodeID() : 0) << " for point " << position); 156 157 157 return handleWheelEventWithNode(wheelEvent, node.get());158 return handleWheelEventWithNode(wheelEvent, processingSteps, node.get()); 158 159 }(); 159 160 … … 162 163 } 163 164 164 WheelEventHandlingResult ScrollingTree::handleWheelEventWithNode(const PlatformWheelEvent& wheelEvent, ScrollingTreeNode* node)165 WheelEventHandlingResult ScrollingTree::handleWheelEventWithNode(const PlatformWheelEvent& wheelEvent, OptionSet<WheelEventProcessingSteps> processingSteps, ScrollingTreeNode* node) 165 166 { 166 167 while (node) { … … 170 171 171 172 if (result.wasHandled) { 172 m_latchingController.nodeDidHandleEvent(scrollingNode.scrollingNodeID(), wheelEvent, m_allowLatching);173 m_latchingController.nodeDidHandleEvent(scrollingNode.scrollingNodeID(), processingSteps, wheelEvent, m_allowLatching); 173 174 m_gestureState.nodeDidHandleEvent(scrollingNode.scrollingNodeID(), wheelEvent); 174 175 return result; -
trunk/Source/WebCore/page/scrolling/ScrollingTree.h
r268417 r268544 213 213 214 214 protected: 215 WheelEventHandlingResult handleWheelEventWithNode(const PlatformWheelEvent&, ScrollingTreeNode*);215 WheelEventHandlingResult handleWheelEventWithNode(const PlatformWheelEvent&, OptionSet<WheelEventProcessingSteps>, ScrollingTreeNode*); 216 216 217 217 FloatPoint mainFrameScrollPosition() const; -
trunk/Source/WebCore/page/scrolling/ScrollingTreeLatchingController.cpp
r266333 r268544 48 48 49 49 LockHolder locker(m_latchedNodeMutex); 50 if (wheelEvent.isGestureStart() && m_latchedNode ID&& !latchedNodeIsRelevant()) {50 if (wheelEvent.isGestureStart() && m_latchedNodeAndSteps && !latchedNodeIsRelevant()) { 51 51 LOG_WITH_STREAM(ScrollLatching, stream << "ScrollingTreeLatchingController " << this << " receivedWheelEvent - " << (MonotonicTime::now() - m_lastLatchedNodeInterationTime).milliseconds() << "ms since last event, clearing latched node"); 52 m_latchedNode ID.reset();52 m_latchedNodeAndSteps.reset(); 53 53 } 54 54 } 55 55 56 Optional<Scrolling NodeID> ScrollingTreeLatchingController::latchedNodeForEvent(const PlatformWheelEvent& wheelEvent, bool allowLatching) const56 Optional<ScrollingTreeLatchingController::ScrollingNodeAndProcessingSteps> ScrollingTreeLatchingController::latchingDataForEvent(const PlatformWheelEvent& wheelEvent, bool allowLatching) const 57 57 { 58 58 if (!allowLatching) … … 62 62 63 63 // If we have a latched node, use it. 64 if (wheelEvent.useLatchedEventElement() && m_latchedNode ID&& latchedNodeIsRelevant()) {65 LOG_WITH_STREAM(ScrollLatching, stream << "ScrollingTreeLatchingController " << this << " latchedNodeForEvent: returning " << m_latchedNode ID);66 return m_latchedNode ID.value();64 if (wheelEvent.useLatchedEventElement() && m_latchedNodeAndSteps && latchedNodeIsRelevant()) { 65 LOG_WITH_STREAM(ScrollLatching, stream << "ScrollingTreeLatchingController " << this << " latchedNodeForEvent: returning " << m_latchedNodeAndSteps->scrollingNodeID); 66 return m_latchedNodeAndSteps; 67 67 } 68 68 … … 73 73 { 74 74 LockHolder locker(m_latchedNodeMutex); 75 return m_latchedNodeID; 75 if (m_latchedNodeAndSteps) 76 return m_latchedNodeAndSteps->scrollingNodeID; 77 78 return WTF::nullopt; 76 79 } 77 80 78 void ScrollingTreeLatchingController::nodeDidHandleEvent(ScrollingNodeID scrollingNodeID, const PlatformWheelEvent& wheelEvent, bool allowLatching) 81 Optional<ScrollingTreeLatchingController::ScrollingNodeAndProcessingSteps> ScrollingTreeLatchingController::latchedNodeAndSteps() const 82 { 83 LockHolder locker(m_latchedNodeMutex); 84 return m_latchedNodeAndSteps; 85 } 86 87 void ScrollingTreeLatchingController::nodeDidHandleEvent(ScrollingNodeID scrollingNodeID, OptionSet<WheelEventProcessingSteps> processingSteps, const PlatformWheelEvent& wheelEvent, bool allowLatching) 79 88 { 80 89 if (!allowLatching) … … 83 92 LockHolder locker(m_latchedNodeMutex); 84 93 85 if (wheelEvent.useLatchedEventElement() && m_latchedNode ID == scrollingNodeID) {94 if (wheelEvent.useLatchedEventElement() && m_latchedNodeAndSteps && m_latchedNodeAndSteps->scrollingNodeID == scrollingNodeID) { 86 95 m_lastLatchedNodeInterationTime = MonotonicTime::now(); 87 96 return; … … 92 101 93 102 LOG_WITH_STREAM(ScrollLatching, stream << "ScrollingTreeLatchingController " << this << " nodeDidHandleEvent: latching to " << scrollingNodeID); 94 m_latchedNode ID = scrollingNodeID;103 m_latchedNodeAndSteps = ScrollingNodeAndProcessingSteps { scrollingNodeID, processingSteps }; 95 104 m_lastLatchedNodeInterationTime = MonotonicTime::now(); 96 105 } … … 99 108 { 100 109 LockHolder locker(m_latchedNodeMutex); 101 if ( nodeID == m_latchedNodeID)102 m_latchedNode ID.reset();110 if (m_latchedNodeAndSteps && m_latchedNodeAndSteps->scrollingNodeID == nodeID) 111 m_latchedNodeAndSteps.reset(); 103 112 } 104 113 … … 106 115 { 107 116 LockHolder locker(m_latchedNodeMutex); 108 LOG_WITH_STREAM(ScrollLatching, stream << "ScrollingTreeLatchingController " << this << " clearLatchedNode (was " << m_latchedNodeID << ")");109 m_latchedNode ID.reset();117 LOG_WITH_STREAM(ScrollLatching, stream << "ScrollingTreeLatchingController " << this << " clearLatchedNode"); 118 m_latchedNodeAndSteps.reset(); 110 119 } 111 120 -
trunk/Source/WebCore/page/scrolling/ScrollingTreeLatchingController.h
r266262 r268544 40 40 class ScrollingTreeLatchingController { 41 41 public: 42 struct ScrollingNodeAndProcessingSteps { 43 ScrollingNodeID scrollingNodeID; 44 OptionSet<WheelEventProcessingSteps> processingSteps; 45 }; 46 42 47 ScrollingTreeLatchingController(); 43 48 44 49 void receivedWheelEvent(const PlatformWheelEvent&, bool allowLatching); 45 Optional<ScrollingNodeID> latchedNodeForEvent(const PlatformWheelEvent&, bool allowLatching) const; 46 void nodeDidHandleEvent(ScrollingNodeID, const PlatformWheelEvent&, bool allowLatching); 50 51 Optional<ScrollingNodeAndProcessingSteps> latchingDataForEvent(const PlatformWheelEvent&, bool allowLatching) const; 52 void nodeDidHandleEvent(ScrollingNodeID, OptionSet<WheelEventProcessingSteps>, const PlatformWheelEvent&, bool allowLatching); 47 53 48 54 Optional<ScrollingNodeID> latchedNodeID() const; 55 Optional<ScrollingNodeAndProcessingSteps> latchedNodeAndSteps() const; 49 56 50 57 void nodeWasRemoved(ScrollingNodeID); … … 55 62 56 63 mutable Lock m_latchedNodeMutex; 57 Markable<ScrollingNodeID, IntegralMarkableTraits<ScrollingNodeID, 0>> m_latchedNodeID;64 Optional<ScrollingNodeAndProcessingSteps> m_latchedNodeAndSteps; 58 65 MonotonicTime m_lastLatchedNodeInterationTime; 59 66 }; -
trunk/Source/WebCore/page/scrolling/ThreadedScrollingTree.cpp
r268522 r268544 71 71 72 72 RefPtr<ScrollingTreeNode> targetNode = nodeForID(targetNodeID); 73 auto result = handleWheelEventWithNode(wheelEvent, targetNode.get());73 auto result = handleWheelEventWithNode(wheelEvent, { }, targetNode.get()); 74 74 return result.wasHandled; 75 75 }
Note: See TracChangeset
for help on using the changeset viewer.