Changeset 258679 in webkit
- Timestamp:
- Mar 18, 2020 9:06:37 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 36 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r258674 r258679 1 2020-03-18 Simon Fraser <simon.fraser@apple.com> 2 3 eventSender.monitorWheelEvents() is very fragile 4 https://bugs.webkit.org/show_bug.cgi?id=197819 5 <rdar://problem/51319456> 6 7 Reviewed by Tim Horton. 8 9 * platform/mac-wk2/TestExpectations: 10 * platform/win/TestExpectations: 11 * tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-2d-overflow.html: Need to call eventSender.monitorWheelEvents() 12 for each subtest. 13 1 14 2020-03-18 Said Abou-Hallawa <sabouhallawa@apple.com> 2 15 -
trunk/LayoutTests/platform/mac-wk2/TestExpectations
r258649 r258679 1060 1060 webkit.org/b/208062 http/wpt/fetch/disable-speculative-for-reload.html [ Pass Failure ] 1061 1061 1062 webkit.org/b/208160 fast/scrolling/overflow-scroll-past-max.html [ Pass Failure ]1063 1064 1062 webkit.org/b/208222 [ Release ] imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-iceConnectionState.https.html [ Pass Failure ] 1065 1063 -
trunk/LayoutTests/platform/win/TestExpectations
r258613 r258679 277 277 fast/events/wheelevent-in-vertical-scrollbar-in-rtl.html [ Failure ] 278 278 scrollbars/scroll-rtl-or-bt-layer.html [ Timeout ] 279 webkit.org/b/208559 fast/scrolling/arrow-key-scroll-in-rtl-document.html [ Skip ] 280 webkit.org/b/208559 fast/scrolling/programmatic-scroll-to-zero-zero.html [ Skip ] 279 281 280 282 # TODO Needs testRunner.enableAutoResizeMode() -
trunk/LayoutTests/tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-2d-overflow.html
r243359 r258679 57 57 y: divTarget.scrollTop 58 58 }; 59 60 eventSender.monitorWheelEvents(); 59 61 eventSender.mouseMoveTo(100, 100); 60 62 eventSender.mouseScrollByWithWheelAndMomentumPhases(-1, 0, "began", "none"); … … 85 87 }; 86 88 89 eventSender.monitorWheelEvents(); 87 90 eventSender.mouseMoveTo(100, 100); 88 91 eventSender.mouseScrollByWithWheelAndMomentumPhases(1, 1, "began", "none"); … … 109 112 }; 110 113 114 eventSender.monitorWheelEvents(); 111 115 eventSender.mouseMoveTo(100, 100); 112 116 eventSender.mouseScrollByWithWheelAndMomentumPhases(-1, -1, "began", "none"); … … 123 127 function onLoad() { 124 128 if (window.eventSender) { 125 eventSender.monitorWheelEvents();126 129 internals.setPlatformMomentumScrollingPredictionEnabled(false); 127 130 setTimeout(scrollGlideTest, 0); -
trunk/Source/WebCore/ChangeLog
r258676 r258679 1 2020-03-18 Simon Fraser <simon.fraser@apple.com> 2 3 eventSender.monitorWheelEvents() is very fragile 4 https://bugs.webkit.org/show_bug.cgi?id=197819 5 <rdar://problem/51319456> 6 7 Reviewed by Tim Horton. 8 9 Deflake tests using eventSender.monitorWheelEvents() by fixing several causes of flakiness, 10 adding back changes from r257844 that were reverted in r258558. 11 12 First, have EventSendingController keep track of whether it's seen then "end" event 13 for the scrolling and momentum phases, and pass this down to WheelEventTestMonitor, which 14 now waits until it sees these, which prevents premature triggering which was a common cause of 15 failure before. 16 17 Second, remove WheelEventTestMonitor's 1/60s timer and instead have WheelEventTestMonitor test 18 for completion in a callout from the end of Page::updateRendering(), which makes it test 19 and fire at a more consistent time. 20 21 Third, push WheelEventTestMonitor to the ScrollingTree, so that reasons for deferral 22 can be added on the scrolling thread. This fixes an issue where the RunLoop::main().dispatch() 23 used to send the "ScrollingThreadSyncNeeded" reason to the main thread would get delayed, 24 also resulting in a premature trigger. 25 26 * Modules/applepay/ApplePaySession.cpp: Unified sources! 27 * dom/WindowEventLoop.cpp: Unified sources! 28 * page/EventHandler.cpp: 29 (WebCore::EventHandler::handleWheelEvent): 30 * page/FrameView.cpp: 31 (WebCore::FrameView::scrollOffsetChangedViaPlatformWidgetImpl): 32 * page/Page.cpp: 33 (WebCore::Page::doAfterUpdateRendering): 34 (WebCore::Page::wheelEventTestMonitor const): 35 (WebCore::Page::clearWheelEventTestMonitor): 36 (WebCore::Page::isMonitoringWheelEvents const): 37 (WebCore::Page::ensureWheelEventTestMonitor): 38 * page/Page.h: 39 (WebCore::Page::wheelEventTestMonitor const): Deleted. 40 (WebCore::Page::clearWheelEventTestMonitor): Deleted. 41 (WebCore::Page::isMonitoringWheelEvents const): Deleted. 42 * page/WheelEventTestMonitor.cpp: 43 (WebCore::WheelEventTestMonitor::WheelEventTestMonitor): 44 (WebCore::WheelEventTestMonitor::clearAllTestDeferrals): 45 (WebCore::WheelEventTestMonitor::setTestCallbackAndStartMonitoring): 46 (WebCore::WheelEventTestMonitor::deferForReason): 47 (WebCore::WheelEventTestMonitor::removeDeferralForReason): 48 (WebCore::WheelEventTestMonitor::receivedWheelEvent): 49 (WebCore::WheelEventTestMonitor::scheduleCallbackCheck): 50 (WebCore::WheelEventTestMonitor::checkShouldFireCallbacks): 51 (WebCore::operator<<): 52 (WebCore::WheelEventTestMonitor::setTestCallbackAndStartNotificationTimer): Deleted. 53 (WebCore::WheelEventTestMonitor::triggerTestTimerFired): Deleted. 54 * page/WheelEventTestMonitor.h: 55 (WebCore::WheelEventTestMonitorCompletionDeferrer::WheelEventTestMonitorCompletionDeferrer): 56 (WebCore::WheelEventTestMonitorCompletionDeferrer::~WheelEventTestMonitorCompletionDeferrer): 57 * page/scrolling/AsyncScrollingCoordinator.cpp: 58 (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated): 59 (WebCore::AsyncScrollingCoordinator::deferWheelEventTestCompletionForReason const): Deleted. 60 (WebCore::AsyncScrollingCoordinator::removeWheelEventTestCompletionDeferralForReason const): Deleted. 61 * page/scrolling/AsyncScrollingCoordinator.h: 62 * page/scrolling/ScrollingCoordinator.h: 63 (WebCore::ScrollingCoordinator::startMonitoringWheelEvents): 64 (WebCore::ScrollingCoordinator::stopMonitoringWheelEvents): 65 * page/scrolling/ScrollingTree.cpp: 66 (WebCore::ScrollingTree::handleWheelEvent): 67 * page/scrolling/ScrollingTree.h: 68 (WebCore::ScrollingTree::setWheelEventTestMonitor): 69 (WebCore::ScrollingTree::receivedWheelEvent): 70 * page/scrolling/ThreadedScrollingTree.cpp: 71 (WebCore::ThreadedScrollingTree::scrollingTreeNodeDidScroll): 72 (WebCore::ThreadedScrollingTree::deferWheelEventTestCompletionForReason): Deleted. 73 (WebCore::ThreadedScrollingTree::removeWheelEventTestCompletionDeferralForReason): Deleted. 74 * page/scrolling/ThreadedScrollingTree.h: 75 * page/scrolling/mac/ScrollingCoordinatorMac.h: 76 * page/scrolling/mac/ScrollingCoordinatorMac.mm: 77 (WebCore::ScrollingCoordinatorMac::startMonitoringWheelEvents): 78 (WebCore::ScrollingCoordinatorMac::stopMonitoringWheelEvents): 79 * page/scrolling/mac/ScrollingTreeMac.h: 80 * page/scrolling/mac/ScrollingTreeMac.mm: 81 (ScrollingTreeMac::setWheelEventTestMonitor): 82 (ScrollingTreeMac::receivedWheelEvent): 83 (ScrollingTreeMac::deferWheelEventTestCompletionForReason): 84 (ScrollingTreeMac::removeWheelEventTestCompletionDeferralForReason): 85 * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm: 86 (WebCore::ScrollingTreeScrollingNodeDelegateMac::deferWheelEventTestCompletionForReason const): 87 (WebCore::ScrollingTreeScrollingNodeDelegateMac::removeWheelEventTestCompletionDeferralForReason const): 88 * testing/js/WebCoreTestSupport.cpp: 89 (WebCoreTestSupport::setWheelEventMonitorTestCallbackAndStartMonitoring): 90 (WebCoreTestSupport::setTestCallbackAndStartNotificationTimer): Deleted. 91 * testing/js/WebCoreTestSupport.h: 92 1 93 2020-03-18 Fujii Hironori <Hironori.Fujii@sony.com> 2 94 -
trunk/Source/WebCore/Modules/applepay/ApplePaySession.cpp
r252057 r258679 64 64 #include "UserGestureIndicator.h" 65 65 #include <wtf/IsoMallocInlines.h> 66 #include <wtf/RunLoop.h> 66 67 67 68 #if USE(APPLE_INTERNAL_SDK) -
trunk/Source/WebCore/dom/WindowEventLoop.cpp
r257199 r258679 35 35 #include "SecurityOrigin.h" 36 36 #include "ThreadGlobalData.h" 37 #include <wtf/RunLoop.h> 37 38 38 39 namespace WebCore { -
trunk/Source/WebCore/page/EventHandler.cpp
r258558 r258679 104 104 #include "WheelEvent.h" 105 105 #include "WheelEventDeltaFilter.h" 106 #include "WheelEventTestMonitor.h" 106 107 #include "WindowsKeyboardCodes.h" 107 108 #include <wtf/Assertions.h> … … 2826 2827 #endif 2827 2828 2829 #if PLATFORM(COCOA) 2830 LOG_WITH_STREAM(WheelEventTestMonitor, stream << "EventHandler::handleWheelEvent on main thread, phase " << event.phase() << " momentum phase " << event.momentumPhase()); 2831 if (auto monitor = m_frame.page()->wheelEventTestMonitor()) 2832 monitor->receivedWheelEvent(event); 2833 2834 WheelEventTestMonitorCompletionDeferrer deferrer(m_frame.page()->wheelEventTestMonitor().get(), this, WheelEventTestMonitor::DeferReason::HandlingWheelEventOnMainThread); 2835 #endif 2836 2828 2837 m_isHandlingWheelEvent = true; 2829 2838 setFrameWasScrolledByUser(); -
trunk/Source/WebCore/page/FrameView.cpp
r258558 r258679 2446 2446 void FrameView::scrollOffsetChangedViaPlatformWidgetImpl(const ScrollOffset& oldOffset, const ScrollOffset& newOffset) 2447 2447 { 2448 #if PLATFORM(COCOA) 2449 WheelEventTestMonitorCompletionDeferrer deferrer(frame().page()->wheelEventTestMonitor().get(), this, WheelEventTestMonitor::DeferReason::ContentScrollInProgress); 2450 #endif 2451 2448 2452 updateLayerPositionsAfterScrolling(); 2449 2453 updateCompositingLayersAfterScrolling(); -
trunk/Source/WebCore/page/Page.cpp
r258628 r258679 131 131 #include "VoidCallback.h" 132 132 #include "WheelEventDeltaFilter.h" 133 #include "WheelEventTestMonitor.h" 133 134 #include "Widget.h" 134 135 #include <wtf/FileSystem.h> … … 1390 1391 document->updateTouchEventRegions(); 1391 1392 #endif 1393 1394 if (UNLIKELY(isMonitoringWheelEvents())) 1395 wheelEventTestMonitor()->checkShouldFireCallbacks(); 1392 1396 1393 1397 #if ASSERT_ENABLED … … 2622 2626 #endif 2623 2627 2628 RefPtr<WheelEventTestMonitor> Page::wheelEventTestMonitor() const 2629 { 2630 return m_wheelEventTestMonitor; 2631 } 2632 2633 void Page::clearWheelEventTestMonitor() 2634 { 2635 if (m_scrollingCoordinator) 2636 m_scrollingCoordinator->stopMonitoringWheelEvents(); 2637 2638 m_wheelEventTestMonitor = nullptr; 2639 } 2640 2641 bool Page::isMonitoringWheelEvents() const 2642 { 2643 return !!m_wheelEventTestMonitor; 2644 } 2645 2624 2646 WheelEventTestMonitor& Page::ensureWheelEventTestMonitor() 2625 2647 { 2626 2648 if (!m_wheelEventTestMonitor) { 2627 m_wheelEventTestMonitor = adoptRef(new WheelEventTestMonitor( ));2649 m_wheelEventTestMonitor = adoptRef(new WheelEventTestMonitor(*this)); 2628 2650 // We need to update the scrolling coordinator so that the mainframe scrolling node can expect wheel event test triggers. 2629 2651 if (auto* frameView = mainFrame().view()) { 2630 if (m_scrollingCoordinator) 2652 if (m_scrollingCoordinator) { 2653 m_scrollingCoordinator->startMonitoringWheelEvents(); 2631 2654 m_scrollingCoordinator->updateIsMonitoringWheelEventsForFrameView(*frameView); 2655 } 2632 2656 } 2633 2657 } -
trunk/Source/WebCore/page/Page.h
r258528 r258679 41 41 #include "ViewportArguments.h" 42 42 #include "VisibilityState.h" 43 #include "WheelEventTestMonitor.h"44 43 #include <memory> 45 44 #include <pal/SessionID.h> … … 148 147 class WebGLStateTracker; 149 148 class WheelEventDeltaFilter; 149 class WheelEventTestMonitor; 150 150 151 151 using SharedStringHash = uint32_t; … … 650 650 #endif 651 651 652 RefPtr<WheelEventTestMonitor> wheelEventTestMonitor() const { return m_wheelEventTestMonitor; }652 WEBCORE_EXPORT RefPtr<WheelEventTestMonitor> wheelEventTestMonitor() const; 653 653 WEBCORE_EXPORT WheelEventTestMonitor& ensureWheelEventTestMonitor(); 654 void clearWheelEventTestMonitor() { m_wheelEventTestMonitor = nullptr; }655 bool isMonitoringWheelEvents() const { return !!m_wheelEventTestMonitor; }654 WEBCORE_EXPORT void clearWheelEventTestMonitor(); 655 WEBCORE_EXPORT bool isMonitoringWheelEvents() const; 656 656 657 657 #if ENABLE(VIDEO) -
trunk/Source/WebCore/page/WheelEventTestMonitor.cpp
r258558 r258679 31 31 32 32 #include "Logging.h" 33 #include "Page.h" 33 34 #include <wtf/OptionSet.h> 35 #include <wtf/RunLoop.h> 34 36 #include <wtf/text/TextStream.h> 35 37 … … 41 43 namespace WebCore { 42 44 43 WheelEventTestMonitor::WheelEventTestMonitor( )44 : m_ testForCompletionTimer(RunLoop::current(), this, &WheelEventTestMonitor::triggerTestTimerFired)45 WheelEventTestMonitor::WheelEventTestMonitor(Page& page) 46 : m_page(page) 45 47 { 46 48 } … … 48 50 void WheelEventTestMonitor::clearAllTestDeferrals() 49 51 { 52 LockHolder lock(m_mutex); 53 50 54 ASSERT(isMainThread()); 51 55 m_deferCompletionReasons.clear(); 52 56 m_completionCallback = nullptr; 53 m_testForCompletionTimer.stop(); 54 LOG_WITH_STREAM(WheelEventTestMonitor, stream << " (=) WheelEventTestMonitor::clearAllTestDeferrals: cleared all test state."); 57 m_everHadDeferral = false; 58 m_receivedWheelEndOrCancel = false; 59 m_receivedMomentumEnd = false; 60 LOG_WITH_STREAM(WheelEventTestMonitor, stream << " WheelEventTestMonitor::clearAllTestDeferrals: cleared all test state."); 55 61 } 56 62 57 void WheelEventTestMonitor::setTestCallbackAndStart NotificationTimer(WTF::Function<void()>&& functionCallback)63 void WheelEventTestMonitor::setTestCallbackAndStartMonitoring(bool expectWheelEndOrCancel, bool expectMomentumEnd, WTF::Function<void()>&& functionCallback) 58 64 { 59 65 ASSERT(isMainThread()); 60 66 m_completionCallback = WTFMove(functionCallback); 61 62 if (!m_testForCompletionTimer.isActive()) 63 m_testForCompletionTimer.startRepeating(1_s / 60.); 67 #if ENABLE(KINETIC_SCROLLING) 68 m_expectWheelEndOrCancel = expectWheelEndOrCancel; 69 m_expectMomentumEnd = expectMomentumEnd; 70 #else 71 UNUSED_PARAM(expectWheelEndOrCancel); 72 UNUSED_PARAM(expectMomentumEnd); 73 #endif 74 75 LOG_WITH_STREAM(WheelEventTestMonitor, stream << " WheelEventTestMonitor::setTestCallbackAndStartMonitoring - expect end/cancel " << expectWheelEndOrCancel << ", expect momenum end " << expectMomentumEnd); 64 76 } 65 77 66 78 void WheelEventTestMonitor::deferForReason(ScrollableAreaIdentifier identifier, DeferReason reason) 67 79 { 68 ASSERT(isMainThread()); 80 LockHolder lock(m_mutex); 81 69 82 m_deferCompletionReasons.ensure(identifier, [] { 70 83 return OptionSet<DeferReason>(); 71 84 }).iterator->value.add(reason); 72 85 86 m_everHadDeferral = true; 87 73 88 LOG_WITH_STREAM(WheelEventTestMonitor, stream << " (=) WheelEventTestMonitor::deferForReason: id=" << identifier << ", reason=" << reason); 74 89 } … … 76 91 void WheelEventTestMonitor::removeDeferralForReason(ScrollableAreaIdentifier identifier, DeferReason reason) 77 92 { 78 ASSERT(isMainThread()); 93 LockHolder lock(m_mutex); 94 79 95 auto it = m_deferCompletionReasons.find(identifier); 80 96 if (it == m_deferCompletionReasons.end()) … … 86 102 if (it->value.isEmpty()) 87 103 m_deferCompletionReasons.remove(it); 104 105 scheduleCallbackCheck(); 88 106 } 89 90 void WheelEventTestMonitor:: triggerTestTimerFired()107 108 void WheelEventTestMonitor::receivedWheelEvent(const PlatformWheelEvent& event) 91 109 { 92 ASSERT(isMainThread()); 93 if (!m_deferCompletionReasons.isEmpty()) { 94 LOG_WITH_STREAM(WheelEventTestMonitor, stream << " WheelEventTestMonitor::triggerTestTimerFired - scrolling still active, reasons " << m_deferCompletionReasons); 110 #if ENABLE(KINETIC_SCROLLING) 111 if (event.phase() == PlatformWheelEventPhaseEnded || event.phase() == PlatformWheelEventPhaseCancelled) 112 m_receivedWheelEndOrCancel = true; 113 114 if (event.momentumPhase() == PlatformWheelEventPhaseEnded) 115 m_receivedMomentumEnd = true; 116 #endif 117 } 118 119 void WheelEventTestMonitor::scheduleCallbackCheck() 120 { 121 if (isMainThread()) { 122 m_page.scheduleRenderingUpdate(); 95 123 return; 96 124 } 97 125 98 auto functionCallback = WTFMove(m_completionCallback); 99 m_testForCompletionTimer.stop(); 126 RunLoop::main().dispatch([weakPage = makeWeakPtr(m_page)] { 127 if (weakPage) 128 weakPage->scheduleRenderingUpdate(); 129 }); 130 } 100 131 101 LOG_WITH_STREAM(WheelEventTestMonitor, stream << " WheelEventTestMonitor::triggerTestTimerFired: scrolling is idle, FIRING TEST"); 102 if (functionCallback) 132 void WheelEventTestMonitor::checkShouldFireCallbacks() 133 { 134 ASSERT(isMainThread()); 135 { 136 LockHolder lock(m_mutex); 137 138 if (!m_deferCompletionReasons.isEmpty()) { 139 LOG_WITH_STREAM(WheelEventTestMonitor, stream << " WheelEventTestMonitor::checkShouldFireCallbacks - scrolling still active, reasons " << m_deferCompletionReasons); 140 return; 141 } 142 143 if (!m_everHadDeferral) { 144 LOG_WITH_STREAM(WheelEventTestMonitor, stream << " WheelEventTestMonitor::checkShouldFireCallbacks - have not yet seen any deferral reasons"); 145 return; 146 } 147 148 if (m_expectWheelEndOrCancel && !m_receivedWheelEndOrCancel) { 149 LOG_WITH_STREAM(WheelEventTestMonitor, stream << " WheelEventTestMonitor::checkShouldFireCallbacks - have not seen end of of wheel phase"); 150 return; 151 } 152 153 if (m_expectMomentumEnd && !m_receivedMomentumEnd) { 154 LOG_WITH_STREAM(WheelEventTestMonitor, stream << " WheelEventTestMonitor::checkShouldFireCallbacks - have not seen end of of momentum phase"); 155 return; 156 } 157 } 158 159 if (auto functionCallback = WTFMove(m_completionCallback)) { 160 LOG_WITH_STREAM(WheelEventTestMonitor, stream << " WheelEventTestMonitor::checkShouldFireCallbacks: scrolling is idle, FIRING TEST"); 103 161 functionCallback(); 162 } else 163 LOG_WITH_STREAM(WheelEventTestMonitor, stream << " WheelEventTestMonitor::checkShouldFireCallbacks - no callback"); 104 164 } 105 165 … … 108 168 switch (reason) { 109 169 case WheelEventTestMonitor::HandlingWheelEvent: ts << "handling wheel event"; break; 170 case WheelEventTestMonitor::HandlingWheelEventOnMainThread: ts << "handling wheel event on main thread"; break; 110 171 case WheelEventTestMonitor::RubberbandInProgress: ts << "rubberbanding"; break; 111 172 case WheelEventTestMonitor::ScrollSnapInProgress: ts << "scroll-snapping"; break; -
trunk/Source/WebCore/page/WheelEventTestMonitor.h
r258558 r258679 29 29 #pragma once 30 30 31 #include "PlatformWheelEvent.h" 31 32 #include <functional> 32 33 #include <wtf/Function.h> 33 34 #include <wtf/HashMap.h> 34 35 #include <wtf/Lock.h> 35 #include <wtf/RunLoop.h>36 #include <wtf/StdSet.h>37 36 #include <wtf/ThreadSafeRefCounted.h> 38 37 39 38 namespace WebCore { 40 39 40 class Page; 41 41 42 class WheelEventTestMonitor : public ThreadSafeRefCounted<WheelEventTestMonitor> { 42 43 WTF_MAKE_NONCOPYABLE(WheelEventTestMonitor); WTF_MAKE_FAST_ALLOCATED; 43 44 public: 44 WheelEventTestMonitor( );45 WheelEventTestMonitor(Page&); 45 46 46 WEBCORE_EXPORT void setTestCallbackAndStart NotificationTimer(WTF::Function<void()>&&);47 WEBCORE_EXPORT void setTestCallbackAndStartMonitoring(bool expectWheelEndOrCancel, bool expectMomentumEnd, WTF::Function<void()>&&); 47 48 WEBCORE_EXPORT void clearAllTestDeferrals(); 48 49 49 50 enum DeferReason { 50 HandlingWheelEvent = 1 << 0, 51 RubberbandInProgress = 1 << 1, 52 ScrollSnapInProgress = 1 << 2, 53 ScrollingThreadSyncNeeded = 1 << 3, 54 ContentScrollInProgress = 1 << 4, 51 HandlingWheelEvent = 1 << 0, 52 HandlingWheelEventOnMainThread = 1 << 1, 53 RubberbandInProgress = 1 << 2, 54 ScrollSnapInProgress = 1 << 3, 55 ScrollingThreadSyncNeeded = 1 << 4, 56 ContentScrollInProgress = 1 << 5, 55 57 }; 56 58 typedef const void* ScrollableAreaIdentifier; 57 59 60 WEBCORE_EXPORT void receivedWheelEvent(const PlatformWheelEvent&); 58 61 WEBCORE_EXPORT void deferForReason(ScrollableAreaIdentifier, DeferReason); 59 62 WEBCORE_EXPORT void removeDeferralForReason(ScrollableAreaIdentifier, DeferReason); 60 63 61 void triggerTestTimerFired();64 void checkShouldFireCallbacks(); 62 65 63 66 using ScrollableAreaReasonMap = WTF::HashMap<ScrollableAreaIdentifier, OptionSet<DeferReason>>; 64 67 65 68 private: 69 void scheduleCallbackCheck(); 70 66 71 WTF::Function<void()> m_completionCallback; 67 RunLoop::Timer<WheelEventTestMonitor> m_testForCompletionTimer;72 Page& m_page; 68 73 74 Lock m_mutex; 69 75 ScrollableAreaReasonMap m_deferCompletionReasons; 76 bool m_expectWheelEndOrCancel { false }; 77 bool m_receivedWheelEndOrCancel { false }; 78 bool m_expectMomentumEnd { false }; 79 bool m_receivedMomentumEnd { false }; 80 bool m_everHadDeferral { false }; 81 }; 82 83 class WheelEventTestMonitorCompletionDeferrer { 84 public: 85 WheelEventTestMonitorCompletionDeferrer(WheelEventTestMonitor* monitor, WheelEventTestMonitor::ScrollableAreaIdentifier identifier, WheelEventTestMonitor::DeferReason reason) 86 : m_monitor(monitor) 87 , m_identifier(identifier) 88 , m_reason(reason) 89 { 90 if (m_monitor) 91 m_monitor->deferForReason(m_identifier, m_reason); 92 } 93 94 ~WheelEventTestMonitorCompletionDeferrer() 95 { 96 if (m_monitor) 97 m_monitor->removeDeferralForReason(m_identifier, m_reason); 98 } 99 100 private: 101 RefPtr<WheelEventTestMonitor> m_monitor; 102 WheelEventTestMonitor::ScrollableAreaIdentifier m_identifier; 103 WheelEventTestMonitor::DeferReason m_reason; 70 104 }; 71 105 -
trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp
r258098 r258679 139 139 auto* page = frameView.frame().page(); 140 140 if (page && page->isMonitoringWheelEvents()) { 141 LOG_WITH_STREAM(WheelEventTestMonitor, stream << " AsyncScrollingCoordinator::frameViewLayoutUpdated: Expects wheel event test trigger: " << page->isMonitoringWheelEvents());142 143 141 auto* node = m_scrollingStateTree->stateNodeForID(frameView.scrollingNodeID()); 144 142 if (!is<ScrollingStateFrameScrollingNode>(node)) … … 827 825 } 828 826 829 void AsyncScrollingCoordinator::deferWheelEventTestCompletionForReason(WheelEventTestMonitor::ScrollableAreaIdentifier identifier, WheelEventTestMonitor::DeferReason reason) const830 {831 ASSERT(isMainThread());832 if (!m_page || !m_page->isMonitoringWheelEvents())833 return;834 835 if (const auto& trigger = m_page->wheelEventTestMonitor()) {836 LOG_WITH_STREAM(WheelEventTestMonitor, stream << " (!) AsyncScrollingCoordinator::deferForReason: Deferring " << identifier << " for reason " << reason);837 trigger->deferForReason(identifier, reason);838 }839 }840 841 void AsyncScrollingCoordinator::removeWheelEventTestCompletionDeferralForReason(WheelEventTestMonitor::ScrollableAreaIdentifier identifier, WheelEventTestMonitor::DeferReason reason) const842 {843 ASSERT(isMainThread());844 if (!m_page || !m_page->isMonitoringWheelEvents())845 return;846 847 if (const auto& trigger = m_page->wheelEventTestMonitor()) {848 LOG_WITH_STREAM(WheelEventTestMonitor, stream << " (!) AsyncScrollingCoordinator::removeWheelEventTestCompletionDeferralForReason: Deferring " << identifier << " for reason " << reason);849 trigger->removeDeferralForReason(identifier, reason);850 }851 }852 827 #endif 853 828 -
trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h
r258098 r258679 56 56 #if PLATFORM(COCOA) 57 57 WEBCORE_EXPORT void setActiveScrollSnapIndices(ScrollingNodeID, unsigned horizontalIndex, unsigned verticalIndex); 58 void deferWheelEventTestCompletionForReason(WheelEventTestMonitor::ScrollableAreaIdentifier, WheelEventTestMonitor::DeferReason) const;59 void removeWheelEventTestCompletionDeferralForReason(WheelEventTestMonitor::ScrollableAreaIdentifier, WheelEventTestMonitor::DeferReason) const;60 58 #endif 61 59 -
trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h
r258098 r258679 181 181 virtual void updateIsMonitoringWheelEventsForFrameView(const FrameView&) { } 182 182 183 virtual void startMonitoringWheelEvents() { } 184 virtual void stopMonitoringWheelEvents() { } 185 183 186 protected: 184 187 explicit ScrollingCoordinator(Page*); -
trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp
r258055 r258679 97 97 LockHolder locker(m_treeMutex); 98 98 99 if (isMonitoringWheelEvents()) 100 receivedWheelEvent(wheelEvent); 101 99 102 if (!asyncFrameOrOverflowScrollingEnabled()) { 100 103 if (m_rootNode) -
trunk/Source/WebCore/page/scrolling/ScrollingTree.h
r258044 r258679 34 34 #include <wtf/HashMap.h> 35 35 #include <wtf/Lock.h> 36 #include <wtf/MonotonicTime.h> 36 37 #include <wtf/ThreadSafeRefCounted.h> 37 38 #include <wtf/TypeCasts.h> … … 108 109 virtual void setActiveScrollSnapIndices(ScrollingNodeID, unsigned /*horizontalIndex*/, unsigned /*verticalIndex*/) { } 109 110 111 virtual void setWheelEventTestMonitor(RefPtr<WheelEventTestMonitor>&&) { } 112 110 113 virtual void deferWheelEventTestCompletionForReason(WheelEventTestMonitor::ScrollableAreaIdentifier, WheelEventTestMonitor::DeferReason) { } 111 114 virtual void removeWheelEventTestCompletionDeferralForReason(WheelEventTestMonitor::ScrollableAreaIdentifier, WheelEventTestMonitor::DeferReason) { } … … 179 182 180 183 WEBCORE_EXPORT virtual RefPtr<ScrollingTreeNode> scrollingNodeForPoint(FloatPoint); 184 virtual void receivedWheelEvent(const PlatformWheelEvent&) { } 181 185 182 186 Lock m_treeMutex; // Protects the scrolling tree. -
trunk/Source/WebCore/page/scrolling/ThreadedScrollingTree.cpp
r257996 r258679 100 100 101 101 auto scrollPosition = node.currentScrollPosition(); 102 103 102 if (node.isRootNode()) 104 103 setMainFrameScrollPosition(scrollPosition); … … 117 116 deferWheelEventTestCompletionForReason(reinterpret_cast<WheelEventTestMonitor::ScrollableAreaIdentifier>(node.scrollingNodeID()), WheelEventTestMonitor::ScrollingThreadSyncNeeded); 118 117 #endif 119 RunLoop::main().dispatch([scrollingCoordinator = m_scrollingCoordinator, nodeID = node.scrollingNodeID(), scrollPosition, layoutViewportOrigin, scrollingLayerPositionAction, monitoringWheelEvents] { 120 scrollingCoordinator->scheduleUpdateScrollPositionAfterAsyncScroll(nodeID, scrollPosition, layoutViewportOrigin, scrollingLayerPositionAction); 118 119 RunLoop::main().dispatch([strongThis = makeRef(*this), nodeID = node.scrollingNodeID(), scrollPosition, layoutViewportOrigin, scrollingLayerPositionAction, monitoringWheelEvents] { 120 strongThis->m_scrollingCoordinator->scheduleUpdateScrollPositionAfterAsyncScroll(nodeID, scrollPosition, layoutViewportOrigin, scrollingLayerPositionAction); 121 121 #if PLATFORM(MAC) 122 122 if (monitoringWheelEvents) 123 s crollingCoordinator->removeWheelEventTestCompletionDeferralForReason(reinterpret_cast<WheelEventTestMonitor::ScrollableAreaIdentifier>(nodeID), WheelEventTestMonitor::ScrollingThreadSyncNeeded);123 strongThis->removeWheelEventTestCompletionDeferralForReason(reinterpret_cast<WheelEventTestMonitor::ScrollableAreaIdentifier>(nodeID), WheelEventTestMonitor::ScrollingThreadSyncNeeded); 124 124 #else 125 125 UNUSED_PARAM(monitoringWheelEvents); … … 204 204 } 205 205 206 void ThreadedScrollingTree::deferWheelEventTestCompletionForReason(WheelEventTestMonitor::ScrollableAreaIdentifier identifier, WheelEventTestMonitor::DeferReason reason)207 {208 if (!m_scrollingCoordinator)209 return;210 211 RunLoop::main().dispatch([scrollingCoordinator = m_scrollingCoordinator, identifier, reason] {212 scrollingCoordinator->deferWheelEventTestCompletionForReason(identifier, reason);213 });214 }215 216 void ThreadedScrollingTree::removeWheelEventTestCompletionDeferralForReason(WheelEventTestMonitor::ScrollableAreaIdentifier identifier, WheelEventTestMonitor::DeferReason reason)217 {218 if (!m_scrollingCoordinator)219 return;220 221 RunLoop::main().dispatch([scrollingCoordinator = m_scrollingCoordinator, identifier, reason] {222 scrollingCoordinator->removeWheelEventTestCompletionDeferralForReason(identifier, reason);223 });224 }225 226 206 #endif 227 207 -
trunk/Source/WebCore/page/scrolling/ThreadedScrollingTree.h
r257996 r258679 66 66 void handleWheelEventPhase(PlatformWheelEventPhase) override; 67 67 void setActiveScrollSnapIndices(ScrollingNodeID, unsigned horizontalIndex, unsigned verticalIndex) override; 68 69 void deferWheelEventTestCompletionForReason(WheelEventTestMonitor::ScrollableAreaIdentifier, WheelEventTestMonitor::DeferReason) override;70 void removeWheelEventTestCompletionDeferralForReason(WheelEventTestMonitor::ScrollableAreaIdentifier, WheelEventTestMonitor::DeferReason) override;71 68 #endif 72 69 -
trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.h
r258541 r258679 48 48 49 49 void updateTiledScrollingIndicator(); 50 51 void startMonitoringWheelEvents() final; 52 void stopMonitoringWheelEvents() final; 50 53 }; 51 54 -
trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.mm
r258541 r258679 137 137 } 138 138 139 void ScrollingCoordinatorMac::startMonitoringWheelEvents() 140 { 141 auto monitor = m_page->wheelEventTestMonitor(); 142 scrollingTree()->setWheelEventTestMonitor(WTFMove(monitor)); 143 } 144 145 void ScrollingCoordinatorMac::stopMonitoringWheelEvents() 146 { 147 scrollingTree()->setWheelEventTestMonitor(nullptr); 148 } 149 139 150 } // namespace WebCore 140 151 -
trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeMac.h
r258044 r258679 32 32 namespace WebCore { 33 33 34 class WheelEventTestMonitor; 35 34 36 class ScrollingTreeMac final : public ThreadedScrollingTree { 35 37 public: … … 43 45 RefPtr<ScrollingTreeNode> scrollingNodeForPoint(FloatPoint) final; 44 46 47 void setWheelEventTestMonitor(RefPtr<WheelEventTestMonitor>&&) final; 48 49 void receivedWheelEvent(const PlatformWheelEvent&) final; 50 51 void deferWheelEventTestCompletionForReason(WheelEventTestMonitor::ScrollableAreaIdentifier, WheelEventTestMonitor::DeferReason) final; 52 void removeWheelEventTestCompletionDeferralForReason(WheelEventTestMonitor::ScrollableAreaIdentifier, WheelEventTestMonitor::DeferReason) final; 53 45 54 void lockLayersForHitTesting() final; 46 55 void unlockLayersForHitTesting() final; … … 48 57 // This lock protects the CALayer/PlatformCALayer tree. 49 58 Lock m_layerHitTestMutex; 59 60 RefPtr<WheelEventTestMonitor> m_wheelEventTestMonitor; 50 61 }; 51 62 -
trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeMac.mm
r258044 r258679 27 27 #include "ScrollingTreeMac.h" 28 28 29 #include "Logging.h" 29 30 #include "PlatformCALayer.h" 30 31 #include "ScrollingTreeFixedNode.h" … … 36 37 #include "ScrollingTreeStickyNode.h" 37 38 #include "WebLayer.h" 39 #include "WheelEventTestMonitor.h" 40 #include <wtf/text/TextStream.h> 38 41 39 42 #if ENABLE(ASYNC_SCROLLING) && ENABLE(SCROLLING_THREAD) … … 189 192 } 190 193 194 void ScrollingTreeMac::setWheelEventTestMonitor(RefPtr<WheelEventTestMonitor>&& monitor) 195 { 196 m_wheelEventTestMonitor = WTFMove(monitor); 197 } 198 199 void ScrollingTreeMac::receivedWheelEvent(const PlatformWheelEvent& event) 200 { 201 auto monitor = m_wheelEventTestMonitor; 202 if (monitor) 203 monitor->receivedWheelEvent(event); 204 } 205 206 void ScrollingTreeMac::deferWheelEventTestCompletionForReason(WheelEventTestMonitor::ScrollableAreaIdentifier identifier, WheelEventTestMonitor::DeferReason reason) 207 { 208 auto monitor = m_wheelEventTestMonitor; 209 if (!monitor) 210 return; 211 212 LOG_WITH_STREAM(WheelEventTestMonitor, stream << " (!) ScrollingTreeMac::deferForReason: Deferring on " << identifier << " for reason " << reason); 213 monitor->deferForReason(identifier, reason); 214 } 215 216 void ScrollingTreeMac::removeWheelEventTestCompletionDeferralForReason(WheelEventTestMonitor::ScrollableAreaIdentifier identifier, WheelEventTestMonitor::DeferReason reason) 217 { 218 auto monitor = m_wheelEventTestMonitor; 219 if (!monitor) 220 return; 221 222 LOG_WITH_STREAM(WheelEventTestMonitor, stream << " (!) ScrollingTreeMac::removeDeferralForReason: Removing deferral on " << identifier << " for reason " << reason); 223 monitor->removeDeferralForReason(identifier, reason); 224 } 225 191 226 #endif // ENABLE(ASYNC_SCROLLING) && ENABLE(SCROLLING_THREAD) -
trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm
r255037 r258679 308 308 return; 309 309 310 LOG_WITH_STREAM(WheelEventTestMonitor, stream << isMainThread() << " ScrollingTreeScrollingNodeDelegateMac::deferForReason: STARTING deferral for " << identifier << " because of " << reason);311 310 scrollingTree().deferWheelEventTestCompletionForReason(identifier, reason); 312 311 } … … 317 316 return; 318 317 319 LOG_WITH_STREAM(WheelEventTestMonitor, stream << isMainThread() << " ScrollingTreeScrollingNodeDelegateMac::deferForReason: ENDING deferral for " << identifier << " because of " << reason);320 318 scrollingTree().removeWheelEventTestCompletionDeferralForReason(identifier, reason); 321 319 } -
trunk/Source/WebCore/testing/js/WebCoreTestSupport.cpp
r258044 r258679 89 89 } 90 90 91 void set TestCallbackAndStartNotificationTimer(WebCore::Frame& frame, JSContextRef context, JSObjectRef jsCallbackFunction)91 void setWheelEventMonitorTestCallbackAndStartMonitoring(bool expectWheelEndOrCancel, bool expectMomentumEnd, WebCore::Frame& frame, JSContextRef context, JSObjectRef jsCallbackFunction) 92 92 { 93 93 Page* page = frame.page(); … … 97 97 JSValueProtect(context, jsCallbackFunction); 98 98 99 page->ensureWheelEventTestMonitor().setTestCallbackAndStart NotificationTimer([=](void) {99 page->ensureWheelEventTestMonitor().setTestCallbackAndStartMonitoring(expectWheelEndOrCancel, expectMomentumEnd, [=](void) { 100 100 JSObjectCallAsFunction(context, jsCallbackFunction, nullptr, 0, nullptr, nullptr); 101 101 JSValueUnprotect(context, jsCallbackFunction); -
trunk/Source/WebCore/testing/js/WebCoreTestSupport.h
r256215 r258679 48 48 void resetInternalsObject(JSContextRef) TEST_SUPPORT_EXPORT; 49 49 void monitorWheelEvents(WebCore::Frame&) TEST_SUPPORT_EXPORT; 50 void set TestCallbackAndStartNotificationTimer(WebCore::Frame&, JSContextRef, JSObjectRef) TEST_SUPPORT_EXPORT;50 void setWheelEventMonitorTestCallbackAndStartMonitoring(bool expectWheelEndOrCancel, bool expectMomentumEnd, WebCore::Frame&, JSContextRef, JSObjectRef) TEST_SUPPORT_EXPORT; 51 51 void clearWheelEventTestMonitor(WebCore::Frame&) TEST_SUPPORT_EXPORT; 52 52 -
trunk/Source/WebKit/ChangeLog
r258678 r258679 1 2020-03-18 Simon Fraser <simon.fraser@apple.com> 2 3 eventSender.monitorWheelEvents() is very fragile 4 https://bugs.webkit.org/show_bug.cgi?id=197819 5 <rdar://problem/51319456> 6 7 Reviewed by Tim Horton. 8 9 Deflake tests using eventSender.monitorWheelEvents() by fixing several causes of flakiness, 10 adding back changes from r257844 that were reverted in r258558. 11 12 First, have EventSendingController keep track of whether it's seen then "end" event 13 for the scrolling and momentum phases, and pass this down to WheelEventTestMonitor, which 14 now waits until it sees these, which prevents premature triggering which was a common cause of 15 failure before. 16 17 Second, remove WheelEventTestMonitor's 1/60s timer and instead have WheelEventTestMonitor test 18 for completion in a callout from the end of Page::updateRendering(), which makes it test 19 and fire at a more consistent time. 20 21 Third, push WheelEventTestMonitor to the ScrollingTree, so that reasons for deferral 22 can be added on the scrolling thread. This fixes an issue where the RunLoop::main().dispatch() 23 used to send the "ScrollingThreadSyncNeeded" reason to the main thread would get delayed, 24 also resulting in a premature trigger. 25 26 * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: 27 (WKBundlePageRegisterScrollOperationCompletionCallback): 28 * WebProcess/InjectedBundle/API/c/WKBundlePage.h: 29 1 30 2020-03-18 Alex Christensen <achristensen@webkit.org> 2 31 -
trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp
r258663 r258679 705 705 } 706 706 707 bool WKBundlePageRegisterScrollOperationCompletionCallback(WKBundlePageRef pageRef, WKBundlePageTestNotificationCallback callback, void* context)707 bool WKBundlePageRegisterScrollOperationCompletionCallback(WKBundlePageRef pageRef, WKBundlePageTestNotificationCallback callback, bool expectWheelEndOrCancel, bool expectMomentumEnd, void* context) 708 708 { 709 709 if (!callback) … … 715 715 return false; 716 716 717 page->ensureWheelEventTestMonitor().setTestCallbackAndStart NotificationTimer([=]() {717 page->ensureWheelEventTestMonitor().setTestCallbackAndStartMonitoring(expectWheelEndOrCancel, expectMomentumEnd, [=]() { 718 718 callback(context); 719 719 }); -
trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePage.h
r239719 r258679 122 122 typedef void (*WKBundlePageTestNotificationCallback)(void* context); 123 123 // Returns true if the callback function will be called, else false. 124 WK_EXPORT bool WKBundlePageRegisterScrollOperationCompletionCallback(WKBundlePageRef, WKBundlePageTestNotificationCallback, void* context);124 WK_EXPORT bool WKBundlePageRegisterScrollOperationCompletionCallback(WKBundlePageRef, WKBundlePageTestNotificationCallback, bool expectWheelEndOrCancel, bool expectMomentumEnd, void* context); 125 125 126 126 // Call the given callback after both a postTask() on the page's document's ScriptExecutionContext, and a zero-delay timer. -
trunk/Tools/ChangeLog
r258672 r258679 1 2020-03-18 Simon Fraser <simon.fraser@apple.com> 2 3 eventSender.monitorWheelEvents() is very fragile 4 https://bugs.webkit.org/show_bug.cgi?id=197819 5 <rdar://problem/51319456> 6 7 Reviewed by Tim Horton. 8 9 Deflake tests using eventSender.monitorWheelEvents() by fixing several causes of flakiness, 10 adding back changes from r257844 that were reverted in r258558. 11 12 First, have EventSendingController keep track of whether it's seen then "end" event 13 for the scrolling and momentum phases, and pass this down to WheelEventTestMonitor, which 14 now waits until it sees these, which prevents premature triggering which was a common cause of 15 failure before. 16 17 Second, remove WheelEventTestMonitor's 1/60s timer and instead have WheelEventTestMonitor test 18 for completion in a callout from the end of Page::updateRendering(), which makes it test 19 and fire at a more consistent time. 20 21 Third, push WheelEventTestMonitor to the ScrollingTree, so that reasons for deferral 22 can be added on the scrolling thread. This fixes an issue where the RunLoop::main().dispatch() 23 used to send the "ScrollingThreadSyncNeeded" reason to the main thread would get delayed, 24 also resulting in a premature trigger. 25 26 * DumpRenderTree/mac/EventSendingController.h: 27 * DumpRenderTree/mac/EventSendingController.mm: 28 (-[EventSendingController mouseScrollByX:andY:withWheel:andMomentumPhases:]): 29 (-[EventSendingController monitorWheelEvents]): 30 (-[EventSendingController callAfterScrollingCompletes:]): 31 * DumpRenderTree/win/EventSender.cpp: 32 (mouseScrollBy): 33 * WebKitTestRunner/InjectedBundle/EventSendingController.cpp: 34 (WTR::EventSendingController::mouseScrollByWithWheelAndMomentumPhases): 35 (WTR::EventSendingController::monitorWheelEvents): 36 (WTR::EventSendingController::callAfterScrollingCompletes): 37 * WebKitTestRunner/InjectedBundle/EventSendingController.h: 38 1 39 2020-03-18 John Wilander <wilander@apple.com> 2 40 -
trunk/Tools/DumpRenderTree/mac/EventSendingController.h
r257161 r258679 39 39 int eventNumber; 40 40 double timeOffset; 41 #if PLATFORM(MAC) 42 BOOL _sentWheelPhaseEndOrCancel; 43 BOOL _sentMomentumPhaseEnd; 44 #endif 41 45 #if PLATFORM(IOS_FAMILY) 42 46 NSMutableArray* touches; -
trunk/Tools/DumpRenderTree/mac/EventSendingController.mm
r258558 r258679 853 853 { 854 854 #if PLATFORM(MAC) 855 [[[mainFrame frameView] documentView] layout]; 856 855 857 uint32_t phase = 0; 856 858 if ([phaseName isEqualToString: @"none"]) 857 859 phase = 0; 858 860 else if ([phaseName isEqualToString: @"began"]) 859 phase = 1; // kCGScrollPhaseBegan861 phase = kCGScrollPhaseBegan; 860 862 else if ([phaseName isEqualToString: @"changed"]) 861 phase = 2; //kCGScrollPhaseChanged;863 phase = kCGScrollPhaseChanged; 862 864 else if ([phaseName isEqualToString: @"ended"]) 863 phase = 4; // kCGScrollPhaseEnded865 phase = kCGScrollPhaseEnded; 864 866 else if ([phaseName isEqualToString: @"cancelled"]) 865 phase = 8; // kCGScrollPhaseCancelled867 phase = kCGScrollPhaseCancelled; 866 868 else if ([phaseName isEqualToString: @"maybegin"]) 867 phase = 128; // kCGScrollPhaseMayBegin869 phase = kCGScrollPhaseMayBegin; 868 870 869 871 uint32_t momentum = 0; 870 872 if ([momentumName isEqualToString: @"none"]) 871 momentum = 0; //kCGMomentumScrollPhaseNone;873 momentum = kCGMomentumScrollPhaseNone; 872 874 else if ([momentumName isEqualToString:@"begin"]) 873 momentum = 1; //kCGMomentumScrollPhaseBegin;875 momentum = kCGMomentumScrollPhaseBegin; 874 876 else if ([momentumName isEqualToString:@"continue"]) 875 momentum = 2; //kCGMomentumScrollPhaseContinue;877 momentum = kCGMomentumScrollPhaseContinue; 876 878 else if ([momentumName isEqualToString:@"end"]) 877 momentum = 3; // kCGMomentumScrollPhaseEnd; 879 momentum = kCGMomentumScrollPhaseEnd; 880 881 if (phase == kCGScrollPhaseEnded || phase == kCGScrollPhaseCancelled) 882 _sentWheelPhaseEndOrCancel = YES; 883 884 if (momentum == kCGMomentumScrollPhaseEnd) 885 _sentMomentumPhaseEnd = YES; 878 886 879 887 CGEventRef cgScrollEvent = CGEventCreateScrollWheelEvent(NULL, kCGScrollEventUnitLine, 2, y, x); … … 1388 1396 return; 1389 1397 1398 _sentWheelPhaseEndOrCancel = NO; 1399 _sentMomentumPhaseEnd = NO; 1390 1400 WebCoreTestSupport::monitorWheelEvents(*frame); 1391 1401 #endif … … 1404 1414 1405 1415 JSGlobalContextRef globalContext = [mainFrame globalContext]; 1406 WebCoreTestSupport::set TestCallbackAndStartNotificationTimer(*frame, globalContext, jsCallbackFunction);1416 WebCoreTestSupport::setWheelEventMonitorTestCallbackAndStartMonitoring(_sentWheelPhaseEndOrCancel, _sentMomentumPhaseEnd, *frame, globalContext, jsCallbackFunction); 1407 1417 #endif 1408 1418 } -
trunk/Tools/DumpRenderTree/win/EventSender.cpp
r258558 r258679 833 833 ::GetWindowRect(webViewWindow, &rect); 834 834 835 COMPtr<IWebFramePrivate> framePrivate; 836 if (SUCCEEDED(frame->QueryInterface(&framePrivate))) 837 framePrivate->layout(); 838 835 839 if (x) { 836 840 UINT scrollChars = 1; … … 924 928 925 929 WebCore::Frame* coreFrame = core(static_cast<WebFrame*>(frame2.get())); 926 WebCoreTestSupport::set TestCallbackAndStartNotificationTimer(*coreFrame, globalContext, jsCallbackFunction);930 WebCoreTestSupport::setWheelEventMonitorTestCallbackAndStartMonitoring(false, false, *coreFrame, globalContext, jsCallbackFunction); 927 931 928 932 return JSValueMakeUndefined(context); -
trunk/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp
r248846 r258679 493 493 uint64_t phase = cgEventPhaseFromString(phaseStr); 494 494 uint64_t momentum = cgEventMomentumPhaseFromString(momentumStr); 495 496 if (phase == 4 /* kCGScrollPhaseEnded */ || phase == 8 /* kCGScrollPhaseCancelled */) 497 m_sentWheelPhaseEndOrCancel = true; 498 499 if (momentum == 3 /* kCGMomentumScrollPhaseEnd */) 500 m_sentWheelMomentumPhaseEnd = true; 495 501 496 502 WKRetainPtr<WKStringRef> phaseKey = adoptWK(WKStringCreateWithUTF8CString("Phase")); … … 609 615 WKBundlePageRef page = InjectedBundle::singleton().page()->page(); 610 616 617 m_sentWheelPhaseEndOrCancel = false; 618 m_sentWheelMomentumPhaseEnd = false; 611 619 WKBundlePageStartMonitoringScrollOperations(page); 612 620 } … … 651 659 auto scrollCompletionCallbackData = makeUnique<ScrollCompletionCallbackData>(context, functionCallbackObject); 652 660 auto scrollCompletionCallbackDataPtr = scrollCompletionCallbackData.release(); 653 bool callbackWillBeCalled = WKBundlePageRegisterScrollOperationCompletionCallback(page, executeCallback, scrollCompletionCallbackDataPtr);661 bool callbackWillBeCalled = WKBundlePageRegisterScrollOperationCompletionCallback(page, executeCallback, m_sentWheelPhaseEndOrCancel, m_sentWheelMomentumPhaseEnd, scrollCompletionCallbackDataPtr); 654 662 if (!callbackWillBeCalled) { 655 663 // Reassign raw pointer to std::unique_ptr<> so it will not be leaked. -
trunk/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.h
r214586 r258679 88 88 EventSendingController(); 89 89 WKPoint m_position; 90 bool m_sentWheelPhaseEndOrCancel { false }; 91 bool m_sentWheelMomentumPhaseEnd { false }; 90 92 }; 91 93
Note: See TracChangeset
for help on using the changeset viewer.