haikuwebkit/Source/WebCore/page/WheelEventTestMonitor.cpp

193 lines
7.6 KiB
C++
Raw Permalink Normal View History

Rename WheelEventTestTrigger and improve naming in related code https://bugs.webkit.org/show_bug.cgi?id=202772 Reviewed by Tim Horton. Change the "test trigger" terminology to "monitor wheel events"; after all, tests call monitorWheelEvents() and callAfterScrollingCompletes(), and this is not triggering a test. Source/WebCore: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * page/FrameView.cpp: (WebCore::FrameView::adjustScrollbarsForLayout): (WebCore::FrameView::setScrollPosition): (WebCore::FrameView::didAddScrollbar): * page/Page.cpp: (WebCore::Page::ensureWheelEventTestMonitor): (WebCore::Page::ensureTestTrigger): Deleted. * page/Page.h: (WebCore::Page::wheelEventTestMonitor const): (WebCore::Page::clearWheelEventTestMonitor): (WebCore::Page::isMonitoringWheelEvents const): (WebCore::Page::testTrigger const): Deleted. (WebCore::Page::clearTrigger): Deleted. (WebCore::Page::expectsWheelEventTriggers const): Deleted. * page/WheelEventTestMonitor.cpp: Added. (WebCore::WheelEventTestMonitor::WheelEventTestMonitor): (WebCore::WheelEventTestMonitor::clearAllTestDeferrals): (WebCore::WheelEventTestMonitor::setTestCallbackAndStartNotificationTimer): (WebCore::WheelEventTestMonitor::deferForReason): (WebCore::WheelEventTestMonitor::removeDeferralForReason): (WebCore::WheelEventTestMonitor::triggerTestTimerFired): (WebCore::operator<<): * page/WheelEventTestMonitor.h: Renamed from Source/WebCore/page/WheelEventTestTrigger.h. * page/WheelEventTestTrigger.cpp: Removed. * page/mac/EventHandlerMac.mm: (WebCore::EventHandler::platformPrepareForWheelEvents): * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated): (WebCore::AsyncScrollingCoordinator::updateIsMonitoringWheelEventsForFrameView): (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll): (WebCore::AsyncScrollingCoordinator::deferWheelEventTestCompletionForReason const): (WebCore::AsyncScrollingCoordinator::removeWheelEventTestCompletionDeferralForReason const): (WebCore::AsyncScrollingCoordinator::updateExpectsWheelEventTestTriggerWithFrameView): Deleted. (WebCore::AsyncScrollingCoordinator::deferTestsForReason const): Deleted. (WebCore::AsyncScrollingCoordinator::removeTestDeferralForReason const): Deleted. * page/scrolling/AsyncScrollingCoordinator.h: * page/scrolling/ScrollingCoordinator.h: (WebCore::ScrollingCoordinator::updateIsMonitoringWheelEventsForFrameView): (WebCore::ScrollingCoordinator::updateExpectsWheelEventTestTriggerWithFrameView): Deleted. * page/scrolling/ScrollingStateScrollingNode.cpp: (WebCore::ScrollingStateScrollingNode::ScrollingStateScrollingNode): (WebCore::ScrollingStateScrollingNode::setPropertyChangedBitsAfterReattach): (WebCore::ScrollingStateScrollingNode::setIsMonitoringWheelEvents): (WebCore::ScrollingStateScrollingNode::dumpProperties const): (WebCore::ScrollingStateScrollingNode::setExpectsWheelEventTestTrigger): Deleted. * page/scrolling/ScrollingStateScrollingNode.h: (WebCore::ScrollingStateScrollingNode::isMonitoringWheelEvents const): (WebCore::ScrollingStateScrollingNode::expectsWheelEventTestTrigger const): Deleted. * page/scrolling/ScrollingTree.h: (WebCore::ScrollingTree::deferWheelEventTestCompletionForReason): (WebCore::ScrollingTree::removeWheelEventTestCompletionDeferralForReason): (WebCore::ScrollingTree::deferTestsForReason): Deleted. (WebCore::ScrollingTree::removeTestDeferralForReason): Deleted. * page/scrolling/ScrollingTreeScrollingNode.cpp: (WebCore::ScrollingTreeScrollingNode::commitStateBeforeChildren): * page/scrolling/ScrollingTreeScrollingNode.h: * page/scrolling/ThreadedScrollingTree.cpp: (WebCore::ThreadedScrollingTree::deferWheelEventTestCompletionForReason): (WebCore::ThreadedScrollingTree::removeWheelEventTestCompletionDeferralForReason): (WebCore::ThreadedScrollingTree::deferTestsForReason): Deleted. (WebCore::ThreadedScrollingTree::removeTestDeferralForReason): Deleted. * page/scrolling/ThreadedScrollingTree.h: * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h: * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm: (WebCore::ScrollingTreeScrollingNodeDelegateMac::handleWheelEvent): (WebCore::ScrollingTreeScrollingNodeDelegateMac::deferWheelEventTestCompletionForReason const): (WebCore::ScrollingTreeScrollingNodeDelegateMac::removeWheelEventTestCompletionDeferralForReason const): (WebCore::ScrollingTreeScrollingNodeDelegateMac::deferTestsForReason const): Deleted. (WebCore::ScrollingTreeScrollingNodeDelegateMac::removeTestDeferralForReason const): Deleted. * platform/Logging.h: * platform/ScrollAnimator.cpp: (WebCore::ScrollAnimator::deferWheelEventTestCompletionForReason const): (WebCore::ScrollAnimator::removeWheelEventTestCompletionDeferralForReason const): (WebCore::ScrollAnimator::deferTestsForReason const): Deleted. (WebCore::ScrollAnimator::removeTestDeferralForReason const): Deleted. * platform/ScrollAnimator.h: (WebCore::ScrollAnimator::ScrollAnimator::setWheelEventTestMonitor): (WebCore::ScrollAnimator::ScrollAnimator::setWheelEventTestTrigger): Deleted. * platform/cocoa/ScrollController.h: (WebCore::ScrollControllerClient::deferWheelEventTestCompletionForReason const): (WebCore::ScrollControllerClient::removeWheelEventTestCompletionDeferralForReason const): (WebCore::ScrollControllerClient::deferTestsForReason const): Deleted. (WebCore::ScrollControllerClient::removeTestDeferralForReason const): Deleted. * platform/cocoa/ScrollController.mm: (WebCore::ScrollController::startSnapRubberbandTimer): (WebCore::ScrollController::stopSnapRubberbandTimer): (WebCore::ScrollController::scheduleStatelessScrollSnap): (WebCore::ScrollController::startDeferringWheelEventTestCompletionDueToScrollSnapping): (WebCore::ScrollController::stopDeferringWheelEventTestCompletionDueToScrollSnapping): (WebCore::ScrollController::startScrollSnapTimer): (WebCore::ScrollController::stopScrollSnapTimer): (WebCore::ScrollController::startDeferringTestsDueToScrollSnapping): Deleted. (WebCore::ScrollController::stopDeferringTestsDueToScrollSnapping): Deleted. * platform/mac/ScrollAnimatorMac.mm: (WebCore::ScrollAnimatorMac::didBeginScrollGesture const): (WebCore::ScrollAnimatorMac::didEndScrollGesture const): (WebCore::ScrollAnimatorMac::sendContentAreaScrolledSoon): (WebCore::ScrollAnimatorMac::sendContentAreaScrolledTimerFired): * rendering/RenderBox.cpp: (WebCore::setupWheelEventMonitor): (WebCore::RenderBox::setScrollLeft): (WebCore::RenderBox::setScrollTop): (WebCore::setupWheelEventTestTrigger): Deleted. * rendering/RenderLayer.cpp: (WebCore::RenderLayer::createScrollbar): * rendering/RenderListBox.cpp: (WebCore::setupWheelEventTestMonitor): (WebCore::RenderListBox::setScrollTop): (WebCore::RenderListBox::createScrollbar): (WebCore::setupWheelEventTestTrigger): Deleted. * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::monitorWheelEvents): (WebCoreTestSupport::setTestCallbackAndStartNotificationTimer): (WebCoreTestSupport::clearWheelEventTestMonitor): (WebCoreTestSupport::clearWheelEventTestTrigger): Deleted. * testing/js/WebCoreTestSupport.h: Source/WebKit: * UIProcess/API/C/WKPage.cpp: (WKPageClearWheelEventTestMonitor): (WKPageClearWheelEventTestTrigger): Deleted. * UIProcess/API/C/WKPage.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::clearWheelEventTestMonitor): (WebKit::WebPageProxy::clearWheelEventTestTrigger): Deleted. * UIProcess/WebPageProxy.h: * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageStartMonitoringScrollOperations): (WKBundlePageRegisterScrollOperationCompletionCallback): * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::createScrollbar): * WebProcess/WebPage/EventDispatcher.cpp: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::clearWheelEventTestMonitor): (WebKit::WebPage::clearWheelEventTestTrigger): Deleted. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: Tools: * DumpRenderTree/mac/DumpRenderTree.mm: (resetWebViewToConsistentStateBeforeTesting): * WebKitTestRunner/TestController.cpp: (WTR::TestController::resetStateToConsistentValues): Canonical link: https://commits.webkit.org/216237@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@250946 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-10-10 00:24:44 +00:00
/*
* Copyright (C) 2015-2019 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of Apple Inc. ("Apple") nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include "WheelEventTestMonitor.h"
#include "Logging.h"
eventSender.monitorWheelEvents() is very fragile https://bugs.webkit.org/show_bug.cgi?id=197819 <rdar://problem/51319456> Reviewed by Tim Horton. Source/WebCore: Deflake tests using eventSender.monitorWheelEvents() by fixing several causes of flakiness, adding back changes from r257844 that were reverted in r258558. First, have EventSendingController keep track of whether it's seen then "end" event for the scrolling and momentum phases, and pass this down to WheelEventTestMonitor, which now waits until it sees these, which prevents premature triggering which was a common cause of failure before. Second, remove WheelEventTestMonitor's 1/60s timer and instead have WheelEventTestMonitor test for completion in a callout from the end of Page::updateRendering(), which makes it test and fire at a more consistent time. Third, push WheelEventTestMonitor to the ScrollingTree, so that reasons for deferral can be added on the scrolling thread. This fixes an issue where the RunLoop::main().dispatch() used to send the "ScrollingThreadSyncNeeded" reason to the main thread would get delayed, also resulting in a premature trigger. * Modules/applepay/ApplePaySession.cpp: Unified sources! * dom/WindowEventLoop.cpp: Unified sources! * page/EventHandler.cpp: (WebCore::EventHandler::handleWheelEvent): * page/FrameView.cpp: (WebCore::FrameView::scrollOffsetChangedViaPlatformWidgetImpl): * page/Page.cpp: (WebCore::Page::doAfterUpdateRendering): (WebCore::Page::wheelEventTestMonitor const): (WebCore::Page::clearWheelEventTestMonitor): (WebCore::Page::isMonitoringWheelEvents const): (WebCore::Page::ensureWheelEventTestMonitor): * page/Page.h: (WebCore::Page::wheelEventTestMonitor const): Deleted. (WebCore::Page::clearWheelEventTestMonitor): Deleted. (WebCore::Page::isMonitoringWheelEvents const): Deleted. * page/WheelEventTestMonitor.cpp: (WebCore::WheelEventTestMonitor::WheelEventTestMonitor): (WebCore::WheelEventTestMonitor::clearAllTestDeferrals): (WebCore::WheelEventTestMonitor::setTestCallbackAndStartMonitoring): (WebCore::WheelEventTestMonitor::deferForReason): (WebCore::WheelEventTestMonitor::removeDeferralForReason): (WebCore::WheelEventTestMonitor::receivedWheelEvent): (WebCore::WheelEventTestMonitor::scheduleCallbackCheck): (WebCore::WheelEventTestMonitor::checkShouldFireCallbacks): (WebCore::operator<<): (WebCore::WheelEventTestMonitor::setTestCallbackAndStartNotificationTimer): Deleted. (WebCore::WheelEventTestMonitor::triggerTestTimerFired): Deleted. * page/WheelEventTestMonitor.h: (WebCore::WheelEventTestMonitorCompletionDeferrer::WheelEventTestMonitorCompletionDeferrer): (WebCore::WheelEventTestMonitorCompletionDeferrer::~WheelEventTestMonitorCompletionDeferrer): * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated): (WebCore::AsyncScrollingCoordinator::deferWheelEventTestCompletionForReason const): Deleted. (WebCore::AsyncScrollingCoordinator::removeWheelEventTestCompletionDeferralForReason const): Deleted. * page/scrolling/AsyncScrollingCoordinator.h: * page/scrolling/ScrollingCoordinator.h: (WebCore::ScrollingCoordinator::startMonitoringWheelEvents): (WebCore::ScrollingCoordinator::stopMonitoringWheelEvents): * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::handleWheelEvent): * page/scrolling/ScrollingTree.h: (WebCore::ScrollingTree::setWheelEventTestMonitor): (WebCore::ScrollingTree::receivedWheelEvent): * page/scrolling/ThreadedScrollingTree.cpp: (WebCore::ThreadedScrollingTree::scrollingTreeNodeDidScroll): (WebCore::ThreadedScrollingTree::deferWheelEventTestCompletionForReason): Deleted. (WebCore::ThreadedScrollingTree::removeWheelEventTestCompletionDeferralForReason): Deleted. * page/scrolling/ThreadedScrollingTree.h: * page/scrolling/mac/ScrollingCoordinatorMac.h: * page/scrolling/mac/ScrollingCoordinatorMac.mm: (WebCore::ScrollingCoordinatorMac::startMonitoringWheelEvents): (WebCore::ScrollingCoordinatorMac::stopMonitoringWheelEvents): * page/scrolling/mac/ScrollingTreeMac.h: * page/scrolling/mac/ScrollingTreeMac.mm: (ScrollingTreeMac::setWheelEventTestMonitor): (ScrollingTreeMac::receivedWheelEvent): (ScrollingTreeMac::deferWheelEventTestCompletionForReason): (ScrollingTreeMac::removeWheelEventTestCompletionDeferralForReason): * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm: (WebCore::ScrollingTreeScrollingNodeDelegateMac::deferWheelEventTestCompletionForReason const): (WebCore::ScrollingTreeScrollingNodeDelegateMac::removeWheelEventTestCompletionDeferralForReason const): * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::setWheelEventMonitorTestCallbackAndStartMonitoring): (WebCoreTestSupport::setTestCallbackAndStartNotificationTimer): Deleted. * testing/js/WebCoreTestSupport.h: Source/WebKit: Deflake tests using eventSender.monitorWheelEvents() by fixing several causes of flakiness, adding back changes from r257844 that were reverted in r258558. First, have EventSendingController keep track of whether it's seen then "end" event for the scrolling and momentum phases, and pass this down to WheelEventTestMonitor, which now waits until it sees these, which prevents premature triggering which was a common cause of failure before. Second, remove WheelEventTestMonitor's 1/60s timer and instead have WheelEventTestMonitor test for completion in a callout from the end of Page::updateRendering(), which makes it test and fire at a more consistent time. Third, push WheelEventTestMonitor to the ScrollingTree, so that reasons for deferral can be added on the scrolling thread. This fixes an issue where the RunLoop::main().dispatch() used to send the "ScrollingThreadSyncNeeded" reason to the main thread would get delayed, also resulting in a premature trigger. * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageRegisterScrollOperationCompletionCallback): * WebProcess/InjectedBundle/API/c/WKBundlePage.h: Tools: Deflake tests using eventSender.monitorWheelEvents() by fixing several causes of flakiness, adding back changes from r257844 that were reverted in r258558. First, have EventSendingController keep track of whether it's seen then "end" event for the scrolling and momentum phases, and pass this down to WheelEventTestMonitor, which now waits until it sees these, which prevents premature triggering which was a common cause of failure before. Second, remove WheelEventTestMonitor's 1/60s timer and instead have WheelEventTestMonitor test for completion in a callout from the end of Page::updateRendering(), which makes it test and fire at a more consistent time. Third, push WheelEventTestMonitor to the ScrollingTree, so that reasons for deferral can be added on the scrolling thread. This fixes an issue where the RunLoop::main().dispatch() used to send the "ScrollingThreadSyncNeeded" reason to the main thread would get delayed, also resulting in a premature trigger. * DumpRenderTree/mac/EventSendingController.h: * DumpRenderTree/mac/EventSendingController.mm: (-[EventSendingController mouseScrollByX:andY:withWheel:andMomentumPhases:]): (-[EventSendingController monitorWheelEvents]): (-[EventSendingController callAfterScrollingCompletes:]): * DumpRenderTree/win/EventSender.cpp: (mouseScrollBy): * WebKitTestRunner/InjectedBundle/EventSendingController.cpp: (WTR::EventSendingController::mouseScrollByWithWheelAndMomentumPhases): (WTR::EventSendingController::monitorWheelEvents): (WTR::EventSendingController::callAfterScrollingCompletes): * WebKitTestRunner/InjectedBundle/EventSendingController.h: LayoutTests: * platform/mac-wk2/TestExpectations: * platform/win/TestExpectations: * tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-2d-overflow.html: Need to call eventSender.monitorWheelEvents() for each subtest. Canonical link: https://commits.webkit.org/222192@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@258679 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-03-19 04:06:37 +00:00
#include "Page.h"
#include <wtf/OptionSet.h>
eventSender.monitorWheelEvents() is very fragile https://bugs.webkit.org/show_bug.cgi?id=197819 <rdar://problem/51319456> Reviewed by Tim Horton. Source/WebCore: Deflake tests using eventSender.monitorWheelEvents() by fixing several causes of flakiness, adding back changes from r257844 that were reverted in r258558. First, have EventSendingController keep track of whether it's seen then "end" event for the scrolling and momentum phases, and pass this down to WheelEventTestMonitor, which now waits until it sees these, which prevents premature triggering which was a common cause of failure before. Second, remove WheelEventTestMonitor's 1/60s timer and instead have WheelEventTestMonitor test for completion in a callout from the end of Page::updateRendering(), which makes it test and fire at a more consistent time. Third, push WheelEventTestMonitor to the ScrollingTree, so that reasons for deferral can be added on the scrolling thread. This fixes an issue where the RunLoop::main().dispatch() used to send the "ScrollingThreadSyncNeeded" reason to the main thread would get delayed, also resulting in a premature trigger. * Modules/applepay/ApplePaySession.cpp: Unified sources! * dom/WindowEventLoop.cpp: Unified sources! * page/EventHandler.cpp: (WebCore::EventHandler::handleWheelEvent): * page/FrameView.cpp: (WebCore::FrameView::scrollOffsetChangedViaPlatformWidgetImpl): * page/Page.cpp: (WebCore::Page::doAfterUpdateRendering): (WebCore::Page::wheelEventTestMonitor const): (WebCore::Page::clearWheelEventTestMonitor): (WebCore::Page::isMonitoringWheelEvents const): (WebCore::Page::ensureWheelEventTestMonitor): * page/Page.h: (WebCore::Page::wheelEventTestMonitor const): Deleted. (WebCore::Page::clearWheelEventTestMonitor): Deleted. (WebCore::Page::isMonitoringWheelEvents const): Deleted. * page/WheelEventTestMonitor.cpp: (WebCore::WheelEventTestMonitor::WheelEventTestMonitor): (WebCore::WheelEventTestMonitor::clearAllTestDeferrals): (WebCore::WheelEventTestMonitor::setTestCallbackAndStartMonitoring): (WebCore::WheelEventTestMonitor::deferForReason): (WebCore::WheelEventTestMonitor::removeDeferralForReason): (WebCore::WheelEventTestMonitor::receivedWheelEvent): (WebCore::WheelEventTestMonitor::scheduleCallbackCheck): (WebCore::WheelEventTestMonitor::checkShouldFireCallbacks): (WebCore::operator<<): (WebCore::WheelEventTestMonitor::setTestCallbackAndStartNotificationTimer): Deleted. (WebCore::WheelEventTestMonitor::triggerTestTimerFired): Deleted. * page/WheelEventTestMonitor.h: (WebCore::WheelEventTestMonitorCompletionDeferrer::WheelEventTestMonitorCompletionDeferrer): (WebCore::WheelEventTestMonitorCompletionDeferrer::~WheelEventTestMonitorCompletionDeferrer): * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated): (WebCore::AsyncScrollingCoordinator::deferWheelEventTestCompletionForReason const): Deleted. (WebCore::AsyncScrollingCoordinator::removeWheelEventTestCompletionDeferralForReason const): Deleted. * page/scrolling/AsyncScrollingCoordinator.h: * page/scrolling/ScrollingCoordinator.h: (WebCore::ScrollingCoordinator::startMonitoringWheelEvents): (WebCore::ScrollingCoordinator::stopMonitoringWheelEvents): * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::handleWheelEvent): * page/scrolling/ScrollingTree.h: (WebCore::ScrollingTree::setWheelEventTestMonitor): (WebCore::ScrollingTree::receivedWheelEvent): * page/scrolling/ThreadedScrollingTree.cpp: (WebCore::ThreadedScrollingTree::scrollingTreeNodeDidScroll): (WebCore::ThreadedScrollingTree::deferWheelEventTestCompletionForReason): Deleted. (WebCore::ThreadedScrollingTree::removeWheelEventTestCompletionDeferralForReason): Deleted. * page/scrolling/ThreadedScrollingTree.h: * page/scrolling/mac/ScrollingCoordinatorMac.h: * page/scrolling/mac/ScrollingCoordinatorMac.mm: (WebCore::ScrollingCoordinatorMac::startMonitoringWheelEvents): (WebCore::ScrollingCoordinatorMac::stopMonitoringWheelEvents): * page/scrolling/mac/ScrollingTreeMac.h: * page/scrolling/mac/ScrollingTreeMac.mm: (ScrollingTreeMac::setWheelEventTestMonitor): (ScrollingTreeMac::receivedWheelEvent): (ScrollingTreeMac::deferWheelEventTestCompletionForReason): (ScrollingTreeMac::removeWheelEventTestCompletionDeferralForReason): * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm: (WebCore::ScrollingTreeScrollingNodeDelegateMac::deferWheelEventTestCompletionForReason const): (WebCore::ScrollingTreeScrollingNodeDelegateMac::removeWheelEventTestCompletionDeferralForReason const): * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::setWheelEventMonitorTestCallbackAndStartMonitoring): (WebCoreTestSupport::setTestCallbackAndStartNotificationTimer): Deleted. * testing/js/WebCoreTestSupport.h: Source/WebKit: Deflake tests using eventSender.monitorWheelEvents() by fixing several causes of flakiness, adding back changes from r257844 that were reverted in r258558. First, have EventSendingController keep track of whether it's seen then "end" event for the scrolling and momentum phases, and pass this down to WheelEventTestMonitor, which now waits until it sees these, which prevents premature triggering which was a common cause of failure before. Second, remove WheelEventTestMonitor's 1/60s timer and instead have WheelEventTestMonitor test for completion in a callout from the end of Page::updateRendering(), which makes it test and fire at a more consistent time. Third, push WheelEventTestMonitor to the ScrollingTree, so that reasons for deferral can be added on the scrolling thread. This fixes an issue where the RunLoop::main().dispatch() used to send the "ScrollingThreadSyncNeeded" reason to the main thread would get delayed, also resulting in a premature trigger. * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageRegisterScrollOperationCompletionCallback): * WebProcess/InjectedBundle/API/c/WKBundlePage.h: Tools: Deflake tests using eventSender.monitorWheelEvents() by fixing several causes of flakiness, adding back changes from r257844 that were reverted in r258558. First, have EventSendingController keep track of whether it's seen then "end" event for the scrolling and momentum phases, and pass this down to WheelEventTestMonitor, which now waits until it sees these, which prevents premature triggering which was a common cause of failure before. Second, remove WheelEventTestMonitor's 1/60s timer and instead have WheelEventTestMonitor test for completion in a callout from the end of Page::updateRendering(), which makes it test and fire at a more consistent time. Third, push WheelEventTestMonitor to the ScrollingTree, so that reasons for deferral can be added on the scrolling thread. This fixes an issue where the RunLoop::main().dispatch() used to send the "ScrollingThreadSyncNeeded" reason to the main thread would get delayed, also resulting in a premature trigger. * DumpRenderTree/mac/EventSendingController.h: * DumpRenderTree/mac/EventSendingController.mm: (-[EventSendingController mouseScrollByX:andY:withWheel:andMomentumPhases:]): (-[EventSendingController monitorWheelEvents]): (-[EventSendingController callAfterScrollingCompletes:]): * DumpRenderTree/win/EventSender.cpp: (mouseScrollBy): * WebKitTestRunner/InjectedBundle/EventSendingController.cpp: (WTR::EventSendingController::mouseScrollByWithWheelAndMomentumPhases): (WTR::EventSendingController::monitorWheelEvents): (WTR::EventSendingController::callAfterScrollingCompletes): * WebKitTestRunner/InjectedBundle/EventSendingController.h: LayoutTests: * platform/mac-wk2/TestExpectations: * platform/win/TestExpectations: * tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-2d-overflow.html: Need to call eventSender.monitorWheelEvents() for each subtest. Canonical link: https://commits.webkit.org/222192@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@258679 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-03-19 04:06:37 +00:00
#include <wtf/RunLoop.h>
Rename WheelEventTestTrigger and improve naming in related code https://bugs.webkit.org/show_bug.cgi?id=202772 Reviewed by Tim Horton. Change the "test trigger" terminology to "monitor wheel events"; after all, tests call monitorWheelEvents() and callAfterScrollingCompletes(), and this is not triggering a test. Source/WebCore: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * page/FrameView.cpp: (WebCore::FrameView::adjustScrollbarsForLayout): (WebCore::FrameView::setScrollPosition): (WebCore::FrameView::didAddScrollbar): * page/Page.cpp: (WebCore::Page::ensureWheelEventTestMonitor): (WebCore::Page::ensureTestTrigger): Deleted. * page/Page.h: (WebCore::Page::wheelEventTestMonitor const): (WebCore::Page::clearWheelEventTestMonitor): (WebCore::Page::isMonitoringWheelEvents const): (WebCore::Page::testTrigger const): Deleted. (WebCore::Page::clearTrigger): Deleted. (WebCore::Page::expectsWheelEventTriggers const): Deleted. * page/WheelEventTestMonitor.cpp: Added. (WebCore::WheelEventTestMonitor::WheelEventTestMonitor): (WebCore::WheelEventTestMonitor::clearAllTestDeferrals): (WebCore::WheelEventTestMonitor::setTestCallbackAndStartNotificationTimer): (WebCore::WheelEventTestMonitor::deferForReason): (WebCore::WheelEventTestMonitor::removeDeferralForReason): (WebCore::WheelEventTestMonitor::triggerTestTimerFired): (WebCore::operator<<): * page/WheelEventTestMonitor.h: Renamed from Source/WebCore/page/WheelEventTestTrigger.h. * page/WheelEventTestTrigger.cpp: Removed. * page/mac/EventHandlerMac.mm: (WebCore::EventHandler::platformPrepareForWheelEvents): * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated): (WebCore::AsyncScrollingCoordinator::updateIsMonitoringWheelEventsForFrameView): (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll): (WebCore::AsyncScrollingCoordinator::deferWheelEventTestCompletionForReason const): (WebCore::AsyncScrollingCoordinator::removeWheelEventTestCompletionDeferralForReason const): (WebCore::AsyncScrollingCoordinator::updateExpectsWheelEventTestTriggerWithFrameView): Deleted. (WebCore::AsyncScrollingCoordinator::deferTestsForReason const): Deleted. (WebCore::AsyncScrollingCoordinator::removeTestDeferralForReason const): Deleted. * page/scrolling/AsyncScrollingCoordinator.h: * page/scrolling/ScrollingCoordinator.h: (WebCore::ScrollingCoordinator::updateIsMonitoringWheelEventsForFrameView): (WebCore::ScrollingCoordinator::updateExpectsWheelEventTestTriggerWithFrameView): Deleted. * page/scrolling/ScrollingStateScrollingNode.cpp: (WebCore::ScrollingStateScrollingNode::ScrollingStateScrollingNode): (WebCore::ScrollingStateScrollingNode::setPropertyChangedBitsAfterReattach): (WebCore::ScrollingStateScrollingNode::setIsMonitoringWheelEvents): (WebCore::ScrollingStateScrollingNode::dumpProperties const): (WebCore::ScrollingStateScrollingNode::setExpectsWheelEventTestTrigger): Deleted. * page/scrolling/ScrollingStateScrollingNode.h: (WebCore::ScrollingStateScrollingNode::isMonitoringWheelEvents const): (WebCore::ScrollingStateScrollingNode::expectsWheelEventTestTrigger const): Deleted. * page/scrolling/ScrollingTree.h: (WebCore::ScrollingTree::deferWheelEventTestCompletionForReason): (WebCore::ScrollingTree::removeWheelEventTestCompletionDeferralForReason): (WebCore::ScrollingTree::deferTestsForReason): Deleted. (WebCore::ScrollingTree::removeTestDeferralForReason): Deleted. * page/scrolling/ScrollingTreeScrollingNode.cpp: (WebCore::ScrollingTreeScrollingNode::commitStateBeforeChildren): * page/scrolling/ScrollingTreeScrollingNode.h: * page/scrolling/ThreadedScrollingTree.cpp: (WebCore::ThreadedScrollingTree::deferWheelEventTestCompletionForReason): (WebCore::ThreadedScrollingTree::removeWheelEventTestCompletionDeferralForReason): (WebCore::ThreadedScrollingTree::deferTestsForReason): Deleted. (WebCore::ThreadedScrollingTree::removeTestDeferralForReason): Deleted. * page/scrolling/ThreadedScrollingTree.h: * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h: * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm: (WebCore::ScrollingTreeScrollingNodeDelegateMac::handleWheelEvent): (WebCore::ScrollingTreeScrollingNodeDelegateMac::deferWheelEventTestCompletionForReason const): (WebCore::ScrollingTreeScrollingNodeDelegateMac::removeWheelEventTestCompletionDeferralForReason const): (WebCore::ScrollingTreeScrollingNodeDelegateMac::deferTestsForReason const): Deleted. (WebCore::ScrollingTreeScrollingNodeDelegateMac::removeTestDeferralForReason const): Deleted. * platform/Logging.h: * platform/ScrollAnimator.cpp: (WebCore::ScrollAnimator::deferWheelEventTestCompletionForReason const): (WebCore::ScrollAnimator::removeWheelEventTestCompletionDeferralForReason const): (WebCore::ScrollAnimator::deferTestsForReason const): Deleted. (WebCore::ScrollAnimator::removeTestDeferralForReason const): Deleted. * platform/ScrollAnimator.h: (WebCore::ScrollAnimator::ScrollAnimator::setWheelEventTestMonitor): (WebCore::ScrollAnimator::ScrollAnimator::setWheelEventTestTrigger): Deleted. * platform/cocoa/ScrollController.h: (WebCore::ScrollControllerClient::deferWheelEventTestCompletionForReason const): (WebCore::ScrollControllerClient::removeWheelEventTestCompletionDeferralForReason const): (WebCore::ScrollControllerClient::deferTestsForReason const): Deleted. (WebCore::ScrollControllerClient::removeTestDeferralForReason const): Deleted. * platform/cocoa/ScrollController.mm: (WebCore::ScrollController::startSnapRubberbandTimer): (WebCore::ScrollController::stopSnapRubberbandTimer): (WebCore::ScrollController::scheduleStatelessScrollSnap): (WebCore::ScrollController::startDeferringWheelEventTestCompletionDueToScrollSnapping): (WebCore::ScrollController::stopDeferringWheelEventTestCompletionDueToScrollSnapping): (WebCore::ScrollController::startScrollSnapTimer): (WebCore::ScrollController::stopScrollSnapTimer): (WebCore::ScrollController::startDeferringTestsDueToScrollSnapping): Deleted. (WebCore::ScrollController::stopDeferringTestsDueToScrollSnapping): Deleted. * platform/mac/ScrollAnimatorMac.mm: (WebCore::ScrollAnimatorMac::didBeginScrollGesture const): (WebCore::ScrollAnimatorMac::didEndScrollGesture const): (WebCore::ScrollAnimatorMac::sendContentAreaScrolledSoon): (WebCore::ScrollAnimatorMac::sendContentAreaScrolledTimerFired): * rendering/RenderBox.cpp: (WebCore::setupWheelEventMonitor): (WebCore::RenderBox::setScrollLeft): (WebCore::RenderBox::setScrollTop): (WebCore::setupWheelEventTestTrigger): Deleted. * rendering/RenderLayer.cpp: (WebCore::RenderLayer::createScrollbar): * rendering/RenderListBox.cpp: (WebCore::setupWheelEventTestMonitor): (WebCore::RenderListBox::setScrollTop): (WebCore::RenderListBox::createScrollbar): (WebCore::setupWheelEventTestTrigger): Deleted. * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::monitorWheelEvents): (WebCoreTestSupport::setTestCallbackAndStartNotificationTimer): (WebCoreTestSupport::clearWheelEventTestMonitor): (WebCoreTestSupport::clearWheelEventTestTrigger): Deleted. * testing/js/WebCoreTestSupport.h: Source/WebKit: * UIProcess/API/C/WKPage.cpp: (WKPageClearWheelEventTestMonitor): (WKPageClearWheelEventTestTrigger): Deleted. * UIProcess/API/C/WKPage.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::clearWheelEventTestMonitor): (WebKit::WebPageProxy::clearWheelEventTestTrigger): Deleted. * UIProcess/WebPageProxy.h: * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageStartMonitoringScrollOperations): (WKBundlePageRegisterScrollOperationCompletionCallback): * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::createScrollbar): * WebProcess/WebPage/EventDispatcher.cpp: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::clearWheelEventTestMonitor): (WebKit::WebPage::clearWheelEventTestTrigger): Deleted. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: Tools: * DumpRenderTree/mac/DumpRenderTree.mm: (resetWebViewToConsistentStateBeforeTesting): * WebKitTestRunner/TestController.cpp: (WTR::TestController::resetStateToConsistentValues): Canonical link: https://commits.webkit.org/216237@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@250946 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-10-10 00:24:44 +00:00
#include <wtf/text/TextStream.h>
#if !LOG_DISABLED
#include <wtf/text/CString.h>
#include <wtf/text/StringBuilder.h>
#endif
namespace WebCore {
eventSender.monitorWheelEvents() is very fragile https://bugs.webkit.org/show_bug.cgi?id=197819 <rdar://problem/51319456> Reviewed by Tim Horton. Source/WebCore: Deflake tests using eventSender.monitorWheelEvents() by fixing several causes of flakiness, adding back changes from r257844 that were reverted in r258558. First, have EventSendingController keep track of whether it's seen then "end" event for the scrolling and momentum phases, and pass this down to WheelEventTestMonitor, which now waits until it sees these, which prevents premature triggering which was a common cause of failure before. Second, remove WheelEventTestMonitor's 1/60s timer and instead have WheelEventTestMonitor test for completion in a callout from the end of Page::updateRendering(), which makes it test and fire at a more consistent time. Third, push WheelEventTestMonitor to the ScrollingTree, so that reasons for deferral can be added on the scrolling thread. This fixes an issue where the RunLoop::main().dispatch() used to send the "ScrollingThreadSyncNeeded" reason to the main thread would get delayed, also resulting in a premature trigger. * Modules/applepay/ApplePaySession.cpp: Unified sources! * dom/WindowEventLoop.cpp: Unified sources! * page/EventHandler.cpp: (WebCore::EventHandler::handleWheelEvent): * page/FrameView.cpp: (WebCore::FrameView::scrollOffsetChangedViaPlatformWidgetImpl): * page/Page.cpp: (WebCore::Page::doAfterUpdateRendering): (WebCore::Page::wheelEventTestMonitor const): (WebCore::Page::clearWheelEventTestMonitor): (WebCore::Page::isMonitoringWheelEvents const): (WebCore::Page::ensureWheelEventTestMonitor): * page/Page.h: (WebCore::Page::wheelEventTestMonitor const): Deleted. (WebCore::Page::clearWheelEventTestMonitor): Deleted. (WebCore::Page::isMonitoringWheelEvents const): Deleted. * page/WheelEventTestMonitor.cpp: (WebCore::WheelEventTestMonitor::WheelEventTestMonitor): (WebCore::WheelEventTestMonitor::clearAllTestDeferrals): (WebCore::WheelEventTestMonitor::setTestCallbackAndStartMonitoring): (WebCore::WheelEventTestMonitor::deferForReason): (WebCore::WheelEventTestMonitor::removeDeferralForReason): (WebCore::WheelEventTestMonitor::receivedWheelEvent): (WebCore::WheelEventTestMonitor::scheduleCallbackCheck): (WebCore::WheelEventTestMonitor::checkShouldFireCallbacks): (WebCore::operator<<): (WebCore::WheelEventTestMonitor::setTestCallbackAndStartNotificationTimer): Deleted. (WebCore::WheelEventTestMonitor::triggerTestTimerFired): Deleted. * page/WheelEventTestMonitor.h: (WebCore::WheelEventTestMonitorCompletionDeferrer::WheelEventTestMonitorCompletionDeferrer): (WebCore::WheelEventTestMonitorCompletionDeferrer::~WheelEventTestMonitorCompletionDeferrer): * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated): (WebCore::AsyncScrollingCoordinator::deferWheelEventTestCompletionForReason const): Deleted. (WebCore::AsyncScrollingCoordinator::removeWheelEventTestCompletionDeferralForReason const): Deleted. * page/scrolling/AsyncScrollingCoordinator.h: * page/scrolling/ScrollingCoordinator.h: (WebCore::ScrollingCoordinator::startMonitoringWheelEvents): (WebCore::ScrollingCoordinator::stopMonitoringWheelEvents): * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::handleWheelEvent): * page/scrolling/ScrollingTree.h: (WebCore::ScrollingTree::setWheelEventTestMonitor): (WebCore::ScrollingTree::receivedWheelEvent): * page/scrolling/ThreadedScrollingTree.cpp: (WebCore::ThreadedScrollingTree::scrollingTreeNodeDidScroll): (WebCore::ThreadedScrollingTree::deferWheelEventTestCompletionForReason): Deleted. (WebCore::ThreadedScrollingTree::removeWheelEventTestCompletionDeferralForReason): Deleted. * page/scrolling/ThreadedScrollingTree.h: * page/scrolling/mac/ScrollingCoordinatorMac.h: * page/scrolling/mac/ScrollingCoordinatorMac.mm: (WebCore::ScrollingCoordinatorMac::startMonitoringWheelEvents): (WebCore::ScrollingCoordinatorMac::stopMonitoringWheelEvents): * page/scrolling/mac/ScrollingTreeMac.h: * page/scrolling/mac/ScrollingTreeMac.mm: (ScrollingTreeMac::setWheelEventTestMonitor): (ScrollingTreeMac::receivedWheelEvent): (ScrollingTreeMac::deferWheelEventTestCompletionForReason): (ScrollingTreeMac::removeWheelEventTestCompletionDeferralForReason): * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm: (WebCore::ScrollingTreeScrollingNodeDelegateMac::deferWheelEventTestCompletionForReason const): (WebCore::ScrollingTreeScrollingNodeDelegateMac::removeWheelEventTestCompletionDeferralForReason const): * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::setWheelEventMonitorTestCallbackAndStartMonitoring): (WebCoreTestSupport::setTestCallbackAndStartNotificationTimer): Deleted. * testing/js/WebCoreTestSupport.h: Source/WebKit: Deflake tests using eventSender.monitorWheelEvents() by fixing several causes of flakiness, adding back changes from r257844 that were reverted in r258558. First, have EventSendingController keep track of whether it's seen then "end" event for the scrolling and momentum phases, and pass this down to WheelEventTestMonitor, which now waits until it sees these, which prevents premature triggering which was a common cause of failure before. Second, remove WheelEventTestMonitor's 1/60s timer and instead have WheelEventTestMonitor test for completion in a callout from the end of Page::updateRendering(), which makes it test and fire at a more consistent time. Third, push WheelEventTestMonitor to the ScrollingTree, so that reasons for deferral can be added on the scrolling thread. This fixes an issue where the RunLoop::main().dispatch() used to send the "ScrollingThreadSyncNeeded" reason to the main thread would get delayed, also resulting in a premature trigger. * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageRegisterScrollOperationCompletionCallback): * WebProcess/InjectedBundle/API/c/WKBundlePage.h: Tools: Deflake tests using eventSender.monitorWheelEvents() by fixing several causes of flakiness, adding back changes from r257844 that were reverted in r258558. First, have EventSendingController keep track of whether it's seen then "end" event for the scrolling and momentum phases, and pass this down to WheelEventTestMonitor, which now waits until it sees these, which prevents premature triggering which was a common cause of failure before. Second, remove WheelEventTestMonitor's 1/60s timer and instead have WheelEventTestMonitor test for completion in a callout from the end of Page::updateRendering(), which makes it test and fire at a more consistent time. Third, push WheelEventTestMonitor to the ScrollingTree, so that reasons for deferral can be added on the scrolling thread. This fixes an issue where the RunLoop::main().dispatch() used to send the "ScrollingThreadSyncNeeded" reason to the main thread would get delayed, also resulting in a premature trigger. * DumpRenderTree/mac/EventSendingController.h: * DumpRenderTree/mac/EventSendingController.mm: (-[EventSendingController mouseScrollByX:andY:withWheel:andMomentumPhases:]): (-[EventSendingController monitorWheelEvents]): (-[EventSendingController callAfterScrollingCompletes:]): * DumpRenderTree/win/EventSender.cpp: (mouseScrollBy): * WebKitTestRunner/InjectedBundle/EventSendingController.cpp: (WTR::EventSendingController::mouseScrollByWithWheelAndMomentumPhases): (WTR::EventSendingController::monitorWheelEvents): (WTR::EventSendingController::callAfterScrollingCompletes): * WebKitTestRunner/InjectedBundle/EventSendingController.h: LayoutTests: * platform/mac-wk2/TestExpectations: * platform/win/TestExpectations: * tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-2d-overflow.html: Need to call eventSender.monitorWheelEvents() for each subtest. Canonical link: https://commits.webkit.org/222192@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@258679 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-03-19 04:06:37 +00:00
WheelEventTestMonitor::WheelEventTestMonitor(Page& page)
: m_page(page)
Rename WheelEventTestTrigger and improve naming in related code https://bugs.webkit.org/show_bug.cgi?id=202772 Reviewed by Tim Horton. Change the "test trigger" terminology to "monitor wheel events"; after all, tests call monitorWheelEvents() and callAfterScrollingCompletes(), and this is not triggering a test. Source/WebCore: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * page/FrameView.cpp: (WebCore::FrameView::adjustScrollbarsForLayout): (WebCore::FrameView::setScrollPosition): (WebCore::FrameView::didAddScrollbar): * page/Page.cpp: (WebCore::Page::ensureWheelEventTestMonitor): (WebCore::Page::ensureTestTrigger): Deleted. * page/Page.h: (WebCore::Page::wheelEventTestMonitor const): (WebCore::Page::clearWheelEventTestMonitor): (WebCore::Page::isMonitoringWheelEvents const): (WebCore::Page::testTrigger const): Deleted. (WebCore::Page::clearTrigger): Deleted. (WebCore::Page::expectsWheelEventTriggers const): Deleted. * page/WheelEventTestMonitor.cpp: Added. (WebCore::WheelEventTestMonitor::WheelEventTestMonitor): (WebCore::WheelEventTestMonitor::clearAllTestDeferrals): (WebCore::WheelEventTestMonitor::setTestCallbackAndStartNotificationTimer): (WebCore::WheelEventTestMonitor::deferForReason): (WebCore::WheelEventTestMonitor::removeDeferralForReason): (WebCore::WheelEventTestMonitor::triggerTestTimerFired): (WebCore::operator<<): * page/WheelEventTestMonitor.h: Renamed from Source/WebCore/page/WheelEventTestTrigger.h. * page/WheelEventTestTrigger.cpp: Removed. * page/mac/EventHandlerMac.mm: (WebCore::EventHandler::platformPrepareForWheelEvents): * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated): (WebCore::AsyncScrollingCoordinator::updateIsMonitoringWheelEventsForFrameView): (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll): (WebCore::AsyncScrollingCoordinator::deferWheelEventTestCompletionForReason const): (WebCore::AsyncScrollingCoordinator::removeWheelEventTestCompletionDeferralForReason const): (WebCore::AsyncScrollingCoordinator::updateExpectsWheelEventTestTriggerWithFrameView): Deleted. (WebCore::AsyncScrollingCoordinator::deferTestsForReason const): Deleted. (WebCore::AsyncScrollingCoordinator::removeTestDeferralForReason const): Deleted. * page/scrolling/AsyncScrollingCoordinator.h: * page/scrolling/ScrollingCoordinator.h: (WebCore::ScrollingCoordinator::updateIsMonitoringWheelEventsForFrameView): (WebCore::ScrollingCoordinator::updateExpectsWheelEventTestTriggerWithFrameView): Deleted. * page/scrolling/ScrollingStateScrollingNode.cpp: (WebCore::ScrollingStateScrollingNode::ScrollingStateScrollingNode): (WebCore::ScrollingStateScrollingNode::setPropertyChangedBitsAfterReattach): (WebCore::ScrollingStateScrollingNode::setIsMonitoringWheelEvents): (WebCore::ScrollingStateScrollingNode::dumpProperties const): (WebCore::ScrollingStateScrollingNode::setExpectsWheelEventTestTrigger): Deleted. * page/scrolling/ScrollingStateScrollingNode.h: (WebCore::ScrollingStateScrollingNode::isMonitoringWheelEvents const): (WebCore::ScrollingStateScrollingNode::expectsWheelEventTestTrigger const): Deleted. * page/scrolling/ScrollingTree.h: (WebCore::ScrollingTree::deferWheelEventTestCompletionForReason): (WebCore::ScrollingTree::removeWheelEventTestCompletionDeferralForReason): (WebCore::ScrollingTree::deferTestsForReason): Deleted. (WebCore::ScrollingTree::removeTestDeferralForReason): Deleted. * page/scrolling/ScrollingTreeScrollingNode.cpp: (WebCore::ScrollingTreeScrollingNode::commitStateBeforeChildren): * page/scrolling/ScrollingTreeScrollingNode.h: * page/scrolling/ThreadedScrollingTree.cpp: (WebCore::ThreadedScrollingTree::deferWheelEventTestCompletionForReason): (WebCore::ThreadedScrollingTree::removeWheelEventTestCompletionDeferralForReason): (WebCore::ThreadedScrollingTree::deferTestsForReason): Deleted. (WebCore::ThreadedScrollingTree::removeTestDeferralForReason): Deleted. * page/scrolling/ThreadedScrollingTree.h: * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h: * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm: (WebCore::ScrollingTreeScrollingNodeDelegateMac::handleWheelEvent): (WebCore::ScrollingTreeScrollingNodeDelegateMac::deferWheelEventTestCompletionForReason const): (WebCore::ScrollingTreeScrollingNodeDelegateMac::removeWheelEventTestCompletionDeferralForReason const): (WebCore::ScrollingTreeScrollingNodeDelegateMac::deferTestsForReason const): Deleted. (WebCore::ScrollingTreeScrollingNodeDelegateMac::removeTestDeferralForReason const): Deleted. * platform/Logging.h: * platform/ScrollAnimator.cpp: (WebCore::ScrollAnimator::deferWheelEventTestCompletionForReason const): (WebCore::ScrollAnimator::removeWheelEventTestCompletionDeferralForReason const): (WebCore::ScrollAnimator::deferTestsForReason const): Deleted. (WebCore::ScrollAnimator::removeTestDeferralForReason const): Deleted. * platform/ScrollAnimator.h: (WebCore::ScrollAnimator::ScrollAnimator::setWheelEventTestMonitor): (WebCore::ScrollAnimator::ScrollAnimator::setWheelEventTestTrigger): Deleted. * platform/cocoa/ScrollController.h: (WebCore::ScrollControllerClient::deferWheelEventTestCompletionForReason const): (WebCore::ScrollControllerClient::removeWheelEventTestCompletionDeferralForReason const): (WebCore::ScrollControllerClient::deferTestsForReason const): Deleted. (WebCore::ScrollControllerClient::removeTestDeferralForReason const): Deleted. * platform/cocoa/ScrollController.mm: (WebCore::ScrollController::startSnapRubberbandTimer): (WebCore::ScrollController::stopSnapRubberbandTimer): (WebCore::ScrollController::scheduleStatelessScrollSnap): (WebCore::ScrollController::startDeferringWheelEventTestCompletionDueToScrollSnapping): (WebCore::ScrollController::stopDeferringWheelEventTestCompletionDueToScrollSnapping): (WebCore::ScrollController::startScrollSnapTimer): (WebCore::ScrollController::stopScrollSnapTimer): (WebCore::ScrollController::startDeferringTestsDueToScrollSnapping): Deleted. (WebCore::ScrollController::stopDeferringTestsDueToScrollSnapping): Deleted. * platform/mac/ScrollAnimatorMac.mm: (WebCore::ScrollAnimatorMac::didBeginScrollGesture const): (WebCore::ScrollAnimatorMac::didEndScrollGesture const): (WebCore::ScrollAnimatorMac::sendContentAreaScrolledSoon): (WebCore::ScrollAnimatorMac::sendContentAreaScrolledTimerFired): * rendering/RenderBox.cpp: (WebCore::setupWheelEventMonitor): (WebCore::RenderBox::setScrollLeft): (WebCore::RenderBox::setScrollTop): (WebCore::setupWheelEventTestTrigger): Deleted. * rendering/RenderLayer.cpp: (WebCore::RenderLayer::createScrollbar): * rendering/RenderListBox.cpp: (WebCore::setupWheelEventTestMonitor): (WebCore::RenderListBox::setScrollTop): (WebCore::RenderListBox::createScrollbar): (WebCore::setupWheelEventTestTrigger): Deleted. * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::monitorWheelEvents): (WebCoreTestSupport::setTestCallbackAndStartNotificationTimer): (WebCoreTestSupport::clearWheelEventTestMonitor): (WebCoreTestSupport::clearWheelEventTestTrigger): Deleted. * testing/js/WebCoreTestSupport.h: Source/WebKit: * UIProcess/API/C/WKPage.cpp: (WKPageClearWheelEventTestMonitor): (WKPageClearWheelEventTestTrigger): Deleted. * UIProcess/API/C/WKPage.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::clearWheelEventTestMonitor): (WebKit::WebPageProxy::clearWheelEventTestTrigger): Deleted. * UIProcess/WebPageProxy.h: * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageStartMonitoringScrollOperations): (WKBundlePageRegisterScrollOperationCompletionCallback): * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::createScrollbar): * WebProcess/WebPage/EventDispatcher.cpp: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::clearWheelEventTestMonitor): (WebKit::WebPage::clearWheelEventTestTrigger): Deleted. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: Tools: * DumpRenderTree/mac/DumpRenderTree.mm: (resetWebViewToConsistentStateBeforeTesting): * WebKitTestRunner/TestController.cpp: (WTR::TestController::resetStateToConsistentValues): Canonical link: https://commits.webkit.org/216237@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@250946 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-10-10 00:24:44 +00:00
{
}
void WheelEventTestMonitor::clearAllTestDeferrals()
{
Use CheckedLock more in WebCore https://bugs.webkit.org/show_bug.cgi?id=226026 Reviewed by Geoffrey Garen. Use CheckedLock more in WebCore to benefit from Clang Thread Safety Analysis. * Modules/indexeddb/IDBObjectStore.cpp: (WebCore::IDBObjectStore::createIndex): (WebCore::IDBObjectStore::index): (WebCore::IDBObjectStore::deleteIndex): (WebCore::IDBObjectStore::rollbackForVersionChangeAbort): (WebCore::IDBObjectStore::visitReferencedIndexes const): (WebCore::IDBObjectStore::renameReferencedIndex): * Modules/indexeddb/IDBObjectStore.h: * Modules/indexeddb/IDBTransaction.cpp: (WebCore::IDBTransaction::objectStore): (WebCore::IDBTransaction::internalAbort): (WebCore::IDBTransaction::createObjectStore): (WebCore::IDBTransaction::renameObjectStore): (WebCore::IDBTransaction::renameIndex): (WebCore::IDBTransaction::deleteObjectStore): (WebCore::IDBTransaction::visitReferencedObjectStores const): * Modules/indexeddb/IDBTransaction.h: * Modules/indexeddb/client/IDBConnectionProxy.cpp: (WebCore::IDBClient::IDBConnectionProxy::openDatabase): (WebCore::IDBClient::IDBConnectionProxy::deleteDatabase): (WebCore::IDBClient::IDBConnectionProxy::completeOpenDBRequest): (WebCore::IDBClient::IDBConnectionProxy::saveOperation): (WebCore::IDBClient::IDBConnectionProxy::completeOperation): (WebCore::IDBClient::IDBConnectionProxy::fireVersionChangeEvent): (WebCore::IDBClient::IDBConnectionProxy::notifyOpenDBRequestBlocked): (WebCore::IDBClient::IDBConnectionProxy::establishTransaction): (WebCore::IDBClient::IDBConnectionProxy::didStartTransaction): (WebCore::IDBClient::IDBConnectionProxy::commitTransaction): (WebCore::IDBClient::IDBConnectionProxy::didCommitTransaction): (WebCore::IDBClient::IDBConnectionProxy::abortTransaction): (WebCore::IDBClient::IDBConnectionProxy::didAbortTransaction): (WebCore::IDBClient::IDBConnectionProxy::didCloseFromServer): (WebCore::IDBClient::IDBConnectionProxy::connectionToServerLost): (WebCore::IDBClient::IDBConnectionProxy::scheduleMainThreadTasks): (WebCore::IDBClient::IDBConnectionProxy::handleMainThreadTasks): (WebCore::IDBClient::IDBConnectionProxy::getAllDatabaseNamesAndVersions): (WebCore::IDBClient::IDBConnectionProxy::didGetAllDatabaseNamesAndVersions): (WebCore::IDBClient::IDBConnectionProxy::registerDatabaseConnection): (WebCore::IDBClient::IDBConnectionProxy::unregisterDatabaseConnection): (WebCore::IDBClient::IDBConnectionProxy::forgetActiveOperations): (WebCore::IDBClient::IDBConnectionProxy::forgetTransaction): (WebCore::IDBClient::IDBConnectionProxy::forgetActivityForCurrentThread): (WebCore::IDBClient::IDBConnectionProxy::setContextSuspended): * Modules/indexeddb/client/IDBConnectionProxy.h: * Modules/mediastream/RTCRtpSFrameTransformer.cpp: (WebCore::RTCRtpSFrameTransformer::setEncryptionKey): (WebCore::RTCRtpSFrameTransformer::decryptFrame): (WebCore::RTCRtpSFrameTransformer::encryptFrame): * Modules/mediastream/RTCRtpSFrameTransformer.h: * Modules/mediastream/RTCRtpScriptTransform.cpp: (WebCore::RTCRtpScriptTransform::setTransformer): (WebCore::RTCRtpScriptTransform::setupTransformer): (WebCore::RTCRtpScriptTransform::clear): * Modules/mediastream/RTCRtpScriptTransform.h: * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.cpp: (WebCore::LibWebRTCDataChannelHandler::setClient): (WebCore::LibWebRTCDataChannelHandler::checkState): (WebCore::LibWebRTCDataChannelHandler::OnMessage): (WebCore::LibWebRTCDataChannelHandler::OnBufferedAmountChange): * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.h: * Modules/mediastream/libwebrtc/LibWebRTCRtpTransformBackend.cpp: (WebCore::LibWebRTCRtpTransformBackend::setInputCallback): (WebCore::LibWebRTCRtpTransformBackend::setOutputCallback): (WebCore::LibWebRTCRtpTransformBackend::processTransformedFrame): (WebCore::LibWebRTCRtpTransformBackend::Transform): * Modules/mediastream/libwebrtc/LibWebRTCRtpTransformBackend.h: * inspector/agents/WebHeapAgent.cpp: (WebCore::SendGarbageCollectionEventsTask::addGarbageCollection): (WebCore::SendGarbageCollectionEventsTask::reset): (WebCore::SendGarbageCollectionEventsTask::timerFired): * page/ResourceUsageThread.cpp: (WebCore::ResourceUsageThread::addObserver): (WebCore::ResourceUsageThread::removeObserver): (WebCore::ResourceUsageThread::waitUntilObservers): (WebCore::ResourceUsageThread::notifyObservers): * page/ResourceUsageThread.h: * page/WheelEventTestMonitor.cpp: (WebCore::WheelEventTestMonitor::clearAllTestDeferrals): (WebCore::WheelEventTestMonitor::setTestCallbackAndStartMonitoring): (WebCore::WheelEventTestMonitor::deferForReason): (WebCore::WheelEventTestMonitor::removeDeferralForReason): (WebCore::WheelEventTestMonitor::receivedWheelEvent): (WebCore::WheelEventTestMonitor::checkShouldFireCallbacks): * page/WheelEventTestMonitor.h: (WebCore::WheelEventTestMonitor::WTF_GUARDED_BY_LOCK): * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::computeWheelProcessingSteps): (WebCore::ScrollingTree::determineWheelEventProcessing): (WebCore::ScrollingTree::handleWheelEvent): (WebCore::ScrollingTree::commitTreeState): (WebCore::ScrollingTree::mainFrameScrollPosition const): (WebCore::ScrollingTree::setMainFrameScrollPosition): (WebCore::ScrollingTree::setGestureState): (WebCore::ScrollingTree::gestureState): (WebCore::ScrollingTree::eventTrackingTypeForPoint): (WebCore::ScrollingTree::isRubberBandInProgressForNode): (WebCore::ScrollingTree::setRubberBandingInProgressForNode): (WebCore::ScrollingTree::isUserScrollInProgressForNode): (WebCore::ScrollingTree::setUserScrollInProgressForNode): (WebCore::ScrollingTree::clearNodesWithUserScrollInProgress): (WebCore::ScrollingTree::isScrollSnapInProgressForNode): (WebCore::ScrollingTree::setNodeScrollSnapInProgress): (WebCore::ScrollingTree::setMainFramePinnedState): (WebCore::ScrollingTree::setMainFrameCanRubberBand): (WebCore::ScrollingTree::mainFrameCanRubberBandInDirection): (WebCore::ScrollingTree::addPendingScrollUpdate): (WebCore::ScrollingTree::takePendingScrollUpdates): (WebCore::ScrollingTree::setScrollPinningBehavior): (WebCore::ScrollingTree::scrollPinningBehavior): (WebCore::ScrollingTree::willWheelEventStartSwipeGesture): (WebCore::ScrollingTree::windowScreenDidChange): (WebCore::ScrollingTree::displayID): (WebCore::ScrollingTree::hasProcessedWheelEventsRecently): (WebCore::ScrollingTree::willProcessWheelEvent): (WebCore::ScrollingTree::nominalFramesPerSecond): (WebCore::ScrollingTree::scrollingTreeAsText): * page/scrolling/ScrollingTree.h: * page/scrolling/ScrollingTreeLatchingController.cpp: (WebCore::ScrollingTreeLatchingController::receivedWheelEvent): (WebCore::ScrollingTreeLatchingController::latchingDataForEvent const): (WebCore::ScrollingTreeLatchingController::latchedNodeID const): (WebCore::ScrollingTreeLatchingController::latchedNodeAndSteps const): (WebCore::ScrollingTreeLatchingController::nodeDidHandleEvent): (WebCore::ScrollingTreeLatchingController::nodeWasRemoved): (WebCore::ScrollingTreeLatchingController::clearLatchedNode): * page/scrolling/ScrollingTreeLatchingController.h: * platform/audio/HRTFDatabaseLoader.cpp: (WebCore::HRTFDatabaseLoader::loadAsynchronously): (WebCore::HRTFDatabaseLoader::waitForLoaderThreadCompletion): * platform/audio/HRTFDatabaseLoader.h: * platform/audio/cocoa/AudioDestinationCocoa.cpp: (WebCore::AudioDestinationCocoa::hasEnoughFrames const): (WebCore::AudioDestinationCocoa::render): (WebCore::AudioDestinationCocoa::renderOnRenderingThead): * platform/audio/cocoa/AudioDestinationCocoa.h: * platform/encryptedmedia/CDMProxy.cpp: (WebCore::CDMProxy::instance const): (WebCore::CDMProxy::setInstance): (WebCore::CDMProxy::startedWaitingForKey const): (WebCore::CDMProxy::stoppedWaitingForKey const): * platform/encryptedmedia/CDMProxy.h: * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp: (WebCore::MediaPlayerPrivateAVFoundation::MediaPlayerPrivateAVFoundation): (WebCore::MediaPlayerPrivateAVFoundation::setDelayCallbacks const): (WebCore::MediaPlayerPrivateAVFoundation::clearMainThreadPendingFlag): (WebCore::MediaPlayerPrivateAVFoundation::scheduleMainThreadNotification): (WebCore::MediaPlayerPrivateAVFoundation::dispatchNotification): * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm: (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::processNewVideoSample): * platform/graphics/cg/IOSurfacePool.cpp: (WebCore::IOSurfacePool::takeSurface): (WebCore::IOSurfacePool::addSurface): (WebCore::IOSurfacePool::setPoolSize): (WebCore::IOSurfacePool::collectionTimerFired): (WebCore::IOSurfacePool::discardAllSurfaces): * platform/graphics/cg/IOSurfacePool.h: (WebCore::IOSurfacePool::WTF_GUARDED_BY_LOCK): * platform/graphics/cg/SubimageCacheWithTimer.cpp: (WebCore::SubimageCacheWithTimer::pruneCacheTimerFired): (WebCore::SubimageCacheWithTimer::subimage): (WebCore::SubimageCacheWithTimer::clearImageAndSubimages): (WebCore::SubimageCacheWithTimer::clearAll): * platform/graphics/cg/SubimageCacheWithTimer.h: * platform/graphics/cocoa/FontCacheCoreText.cpp: (WebCore::FontDatabase::collectionForFamily): (WebCore::FontDatabase::clear): * platform/network/cocoa/WebCoreNSURLSession.mm: (WebCore::WebCoreNSURLSessionDataTaskClient::clearTask): (WebCore::WebCoreNSURLSessionDataTaskClient::dataSent): (WebCore::WebCoreNSURLSessionDataTaskClient::responseReceived): (WebCore::WebCoreNSURLSessionDataTaskClient::shouldCacheResponse): (WebCore::WebCoreNSURLSessionDataTaskClient::dataReceived): (WebCore::WebCoreNSURLSessionDataTaskClient::redirectReceived): (WebCore::WebCoreNSURLSessionDataTaskClient::accessControlCheckFailed): (WebCore::WebCoreNSURLSessionDataTaskClient::loadFailed): (WebCore::WebCoreNSURLSessionDataTaskClient::loadFinished): * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.h: * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm: (-[WebCoreResourceHandleAsOperationQueueDelegate detachHandle]): (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willSendRequest:redirectResponse:]): (-[WebCoreResourceHandleAsOperationQueueDelegate connection:canAuthenticateAgainstProtectionSpace:]): (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willCacheResponse:]): * storage/StorageQuotaManager.cpp: (WebCore::StorageQuotaManager::requestSpaceOnBackgroundThread): (WebCore::StorageQuotaManager::resetQuotaUpdatedBasedOnUsageForTesting): (WebCore::StorageQuotaManager::resetQuotaForTesting): * storage/StorageQuotaManager.h: (WebCore::StorageQuotaManager::WTF_GUARDED_BY_LOCK): * workers/WorkerOrWorkletScriptController.cpp: (WebCore::WorkerOrWorkletScriptController::scheduleExecutionTermination): (WebCore::WorkerOrWorkletScriptController::isTerminatingExecution const): * workers/WorkerOrWorkletScriptController.h: (WebCore::WorkerOrWorkletScriptController::WTF_GUARDED_BY_LOCK): Canonical link: https://commits.webkit.org/237960@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277805 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-20 18:41:33 +00:00
Locker locker { m_lock };
eventSender.monitorWheelEvents() is very fragile https://bugs.webkit.org/show_bug.cgi?id=197819 <rdar://problem/51319456> Reviewed by Tim Horton. Source/WebCore: Deflake tests using eventSender.monitorWheelEvents() by fixing several causes of flakiness, adding back changes from r257844 that were reverted in r258558. First, have EventSendingController keep track of whether it's seen then "end" event for the scrolling and momentum phases, and pass this down to WheelEventTestMonitor, which now waits until it sees these, which prevents premature triggering which was a common cause of failure before. Second, remove WheelEventTestMonitor's 1/60s timer and instead have WheelEventTestMonitor test for completion in a callout from the end of Page::updateRendering(), which makes it test and fire at a more consistent time. Third, push WheelEventTestMonitor to the ScrollingTree, so that reasons for deferral can be added on the scrolling thread. This fixes an issue where the RunLoop::main().dispatch() used to send the "ScrollingThreadSyncNeeded" reason to the main thread would get delayed, also resulting in a premature trigger. * Modules/applepay/ApplePaySession.cpp: Unified sources! * dom/WindowEventLoop.cpp: Unified sources! * page/EventHandler.cpp: (WebCore::EventHandler::handleWheelEvent): * page/FrameView.cpp: (WebCore::FrameView::scrollOffsetChangedViaPlatformWidgetImpl): * page/Page.cpp: (WebCore::Page::doAfterUpdateRendering): (WebCore::Page::wheelEventTestMonitor const): (WebCore::Page::clearWheelEventTestMonitor): (WebCore::Page::isMonitoringWheelEvents const): (WebCore::Page::ensureWheelEventTestMonitor): * page/Page.h: (WebCore::Page::wheelEventTestMonitor const): Deleted. (WebCore::Page::clearWheelEventTestMonitor): Deleted. (WebCore::Page::isMonitoringWheelEvents const): Deleted. * page/WheelEventTestMonitor.cpp: (WebCore::WheelEventTestMonitor::WheelEventTestMonitor): (WebCore::WheelEventTestMonitor::clearAllTestDeferrals): (WebCore::WheelEventTestMonitor::setTestCallbackAndStartMonitoring): (WebCore::WheelEventTestMonitor::deferForReason): (WebCore::WheelEventTestMonitor::removeDeferralForReason): (WebCore::WheelEventTestMonitor::receivedWheelEvent): (WebCore::WheelEventTestMonitor::scheduleCallbackCheck): (WebCore::WheelEventTestMonitor::checkShouldFireCallbacks): (WebCore::operator<<): (WebCore::WheelEventTestMonitor::setTestCallbackAndStartNotificationTimer): Deleted. (WebCore::WheelEventTestMonitor::triggerTestTimerFired): Deleted. * page/WheelEventTestMonitor.h: (WebCore::WheelEventTestMonitorCompletionDeferrer::WheelEventTestMonitorCompletionDeferrer): (WebCore::WheelEventTestMonitorCompletionDeferrer::~WheelEventTestMonitorCompletionDeferrer): * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated): (WebCore::AsyncScrollingCoordinator::deferWheelEventTestCompletionForReason const): Deleted. (WebCore::AsyncScrollingCoordinator::removeWheelEventTestCompletionDeferralForReason const): Deleted. * page/scrolling/AsyncScrollingCoordinator.h: * page/scrolling/ScrollingCoordinator.h: (WebCore::ScrollingCoordinator::startMonitoringWheelEvents): (WebCore::ScrollingCoordinator::stopMonitoringWheelEvents): * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::handleWheelEvent): * page/scrolling/ScrollingTree.h: (WebCore::ScrollingTree::setWheelEventTestMonitor): (WebCore::ScrollingTree::receivedWheelEvent): * page/scrolling/ThreadedScrollingTree.cpp: (WebCore::ThreadedScrollingTree::scrollingTreeNodeDidScroll): (WebCore::ThreadedScrollingTree::deferWheelEventTestCompletionForReason): Deleted. (WebCore::ThreadedScrollingTree::removeWheelEventTestCompletionDeferralForReason): Deleted. * page/scrolling/ThreadedScrollingTree.h: * page/scrolling/mac/ScrollingCoordinatorMac.h: * page/scrolling/mac/ScrollingCoordinatorMac.mm: (WebCore::ScrollingCoordinatorMac::startMonitoringWheelEvents): (WebCore::ScrollingCoordinatorMac::stopMonitoringWheelEvents): * page/scrolling/mac/ScrollingTreeMac.h: * page/scrolling/mac/ScrollingTreeMac.mm: (ScrollingTreeMac::setWheelEventTestMonitor): (ScrollingTreeMac::receivedWheelEvent): (ScrollingTreeMac::deferWheelEventTestCompletionForReason): (ScrollingTreeMac::removeWheelEventTestCompletionDeferralForReason): * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm: (WebCore::ScrollingTreeScrollingNodeDelegateMac::deferWheelEventTestCompletionForReason const): (WebCore::ScrollingTreeScrollingNodeDelegateMac::removeWheelEventTestCompletionDeferralForReason const): * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::setWheelEventMonitorTestCallbackAndStartMonitoring): (WebCoreTestSupport::setTestCallbackAndStartNotificationTimer): Deleted. * testing/js/WebCoreTestSupport.h: Source/WebKit: Deflake tests using eventSender.monitorWheelEvents() by fixing several causes of flakiness, adding back changes from r257844 that were reverted in r258558. First, have EventSendingController keep track of whether it's seen then "end" event for the scrolling and momentum phases, and pass this down to WheelEventTestMonitor, which now waits until it sees these, which prevents premature triggering which was a common cause of failure before. Second, remove WheelEventTestMonitor's 1/60s timer and instead have WheelEventTestMonitor test for completion in a callout from the end of Page::updateRendering(), which makes it test and fire at a more consistent time. Third, push WheelEventTestMonitor to the ScrollingTree, so that reasons for deferral can be added on the scrolling thread. This fixes an issue where the RunLoop::main().dispatch() used to send the "ScrollingThreadSyncNeeded" reason to the main thread would get delayed, also resulting in a premature trigger. * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageRegisterScrollOperationCompletionCallback): * WebProcess/InjectedBundle/API/c/WKBundlePage.h: Tools: Deflake tests using eventSender.monitorWheelEvents() by fixing several causes of flakiness, adding back changes from r257844 that were reverted in r258558. First, have EventSendingController keep track of whether it's seen then "end" event for the scrolling and momentum phases, and pass this down to WheelEventTestMonitor, which now waits until it sees these, which prevents premature triggering which was a common cause of failure before. Second, remove WheelEventTestMonitor's 1/60s timer and instead have WheelEventTestMonitor test for completion in a callout from the end of Page::updateRendering(), which makes it test and fire at a more consistent time. Third, push WheelEventTestMonitor to the ScrollingTree, so that reasons for deferral can be added on the scrolling thread. This fixes an issue where the RunLoop::main().dispatch() used to send the "ScrollingThreadSyncNeeded" reason to the main thread would get delayed, also resulting in a premature trigger. * DumpRenderTree/mac/EventSendingController.h: * DumpRenderTree/mac/EventSendingController.mm: (-[EventSendingController mouseScrollByX:andY:withWheel:andMomentumPhases:]): (-[EventSendingController monitorWheelEvents]): (-[EventSendingController callAfterScrollingCompletes:]): * DumpRenderTree/win/EventSender.cpp: (mouseScrollBy): * WebKitTestRunner/InjectedBundle/EventSendingController.cpp: (WTR::EventSendingController::mouseScrollByWithWheelAndMomentumPhases): (WTR::EventSendingController::monitorWheelEvents): (WTR::EventSendingController::callAfterScrollingCompletes): * WebKitTestRunner/InjectedBundle/EventSendingController.h: LayoutTests: * platform/mac-wk2/TestExpectations: * platform/win/TestExpectations: * tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-2d-overflow.html: Need to call eventSender.monitorWheelEvents() for each subtest. Canonical link: https://commits.webkit.org/222192@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@258679 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-03-19 04:06:37 +00:00
ASSERT(isMainThread());
Rename WheelEventTestTrigger and improve naming in related code https://bugs.webkit.org/show_bug.cgi?id=202772 Reviewed by Tim Horton. Change the "test trigger" terminology to "monitor wheel events"; after all, tests call monitorWheelEvents() and callAfterScrollingCompletes(), and this is not triggering a test. Source/WebCore: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * page/FrameView.cpp: (WebCore::FrameView::adjustScrollbarsForLayout): (WebCore::FrameView::setScrollPosition): (WebCore::FrameView::didAddScrollbar): * page/Page.cpp: (WebCore::Page::ensureWheelEventTestMonitor): (WebCore::Page::ensureTestTrigger): Deleted. * page/Page.h: (WebCore::Page::wheelEventTestMonitor const): (WebCore::Page::clearWheelEventTestMonitor): (WebCore::Page::isMonitoringWheelEvents const): (WebCore::Page::testTrigger const): Deleted. (WebCore::Page::clearTrigger): Deleted. (WebCore::Page::expectsWheelEventTriggers const): Deleted. * page/WheelEventTestMonitor.cpp: Added. (WebCore::WheelEventTestMonitor::WheelEventTestMonitor): (WebCore::WheelEventTestMonitor::clearAllTestDeferrals): (WebCore::WheelEventTestMonitor::setTestCallbackAndStartNotificationTimer): (WebCore::WheelEventTestMonitor::deferForReason): (WebCore::WheelEventTestMonitor::removeDeferralForReason): (WebCore::WheelEventTestMonitor::triggerTestTimerFired): (WebCore::operator<<): * page/WheelEventTestMonitor.h: Renamed from Source/WebCore/page/WheelEventTestTrigger.h. * page/WheelEventTestTrigger.cpp: Removed. * page/mac/EventHandlerMac.mm: (WebCore::EventHandler::platformPrepareForWheelEvents): * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated): (WebCore::AsyncScrollingCoordinator::updateIsMonitoringWheelEventsForFrameView): (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll): (WebCore::AsyncScrollingCoordinator::deferWheelEventTestCompletionForReason const): (WebCore::AsyncScrollingCoordinator::removeWheelEventTestCompletionDeferralForReason const): (WebCore::AsyncScrollingCoordinator::updateExpectsWheelEventTestTriggerWithFrameView): Deleted. (WebCore::AsyncScrollingCoordinator::deferTestsForReason const): Deleted. (WebCore::AsyncScrollingCoordinator::removeTestDeferralForReason const): Deleted. * page/scrolling/AsyncScrollingCoordinator.h: * page/scrolling/ScrollingCoordinator.h: (WebCore::ScrollingCoordinator::updateIsMonitoringWheelEventsForFrameView): (WebCore::ScrollingCoordinator::updateExpectsWheelEventTestTriggerWithFrameView): Deleted. * page/scrolling/ScrollingStateScrollingNode.cpp: (WebCore::ScrollingStateScrollingNode::ScrollingStateScrollingNode): (WebCore::ScrollingStateScrollingNode::setPropertyChangedBitsAfterReattach): (WebCore::ScrollingStateScrollingNode::setIsMonitoringWheelEvents): (WebCore::ScrollingStateScrollingNode::dumpProperties const): (WebCore::ScrollingStateScrollingNode::setExpectsWheelEventTestTrigger): Deleted. * page/scrolling/ScrollingStateScrollingNode.h: (WebCore::ScrollingStateScrollingNode::isMonitoringWheelEvents const): (WebCore::ScrollingStateScrollingNode::expectsWheelEventTestTrigger const): Deleted. * page/scrolling/ScrollingTree.h: (WebCore::ScrollingTree::deferWheelEventTestCompletionForReason): (WebCore::ScrollingTree::removeWheelEventTestCompletionDeferralForReason): (WebCore::ScrollingTree::deferTestsForReason): Deleted. (WebCore::ScrollingTree::removeTestDeferralForReason): Deleted. * page/scrolling/ScrollingTreeScrollingNode.cpp: (WebCore::ScrollingTreeScrollingNode::commitStateBeforeChildren): * page/scrolling/ScrollingTreeScrollingNode.h: * page/scrolling/ThreadedScrollingTree.cpp: (WebCore::ThreadedScrollingTree::deferWheelEventTestCompletionForReason): (WebCore::ThreadedScrollingTree::removeWheelEventTestCompletionDeferralForReason): (WebCore::ThreadedScrollingTree::deferTestsForReason): Deleted. (WebCore::ThreadedScrollingTree::removeTestDeferralForReason): Deleted. * page/scrolling/ThreadedScrollingTree.h: * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h: * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm: (WebCore::ScrollingTreeScrollingNodeDelegateMac::handleWheelEvent): (WebCore::ScrollingTreeScrollingNodeDelegateMac::deferWheelEventTestCompletionForReason const): (WebCore::ScrollingTreeScrollingNodeDelegateMac::removeWheelEventTestCompletionDeferralForReason const): (WebCore::ScrollingTreeScrollingNodeDelegateMac::deferTestsForReason const): Deleted. (WebCore::ScrollingTreeScrollingNodeDelegateMac::removeTestDeferralForReason const): Deleted. * platform/Logging.h: * platform/ScrollAnimator.cpp: (WebCore::ScrollAnimator::deferWheelEventTestCompletionForReason const): (WebCore::ScrollAnimator::removeWheelEventTestCompletionDeferralForReason const): (WebCore::ScrollAnimator::deferTestsForReason const): Deleted. (WebCore::ScrollAnimator::removeTestDeferralForReason const): Deleted. * platform/ScrollAnimator.h: (WebCore::ScrollAnimator::ScrollAnimator::setWheelEventTestMonitor): (WebCore::ScrollAnimator::ScrollAnimator::setWheelEventTestTrigger): Deleted. * platform/cocoa/ScrollController.h: (WebCore::ScrollControllerClient::deferWheelEventTestCompletionForReason const): (WebCore::ScrollControllerClient::removeWheelEventTestCompletionDeferralForReason const): (WebCore::ScrollControllerClient::deferTestsForReason const): Deleted. (WebCore::ScrollControllerClient::removeTestDeferralForReason const): Deleted. * platform/cocoa/ScrollController.mm: (WebCore::ScrollController::startSnapRubberbandTimer): (WebCore::ScrollController::stopSnapRubberbandTimer): (WebCore::ScrollController::scheduleStatelessScrollSnap): (WebCore::ScrollController::startDeferringWheelEventTestCompletionDueToScrollSnapping): (WebCore::ScrollController::stopDeferringWheelEventTestCompletionDueToScrollSnapping): (WebCore::ScrollController::startScrollSnapTimer): (WebCore::ScrollController::stopScrollSnapTimer): (WebCore::ScrollController::startDeferringTestsDueToScrollSnapping): Deleted. (WebCore::ScrollController::stopDeferringTestsDueToScrollSnapping): Deleted. * platform/mac/ScrollAnimatorMac.mm: (WebCore::ScrollAnimatorMac::didBeginScrollGesture const): (WebCore::ScrollAnimatorMac::didEndScrollGesture const): (WebCore::ScrollAnimatorMac::sendContentAreaScrolledSoon): (WebCore::ScrollAnimatorMac::sendContentAreaScrolledTimerFired): * rendering/RenderBox.cpp: (WebCore::setupWheelEventMonitor): (WebCore::RenderBox::setScrollLeft): (WebCore::RenderBox::setScrollTop): (WebCore::setupWheelEventTestTrigger): Deleted. * rendering/RenderLayer.cpp: (WebCore::RenderLayer::createScrollbar): * rendering/RenderListBox.cpp: (WebCore::setupWheelEventTestMonitor): (WebCore::RenderListBox::setScrollTop): (WebCore::RenderListBox::createScrollbar): (WebCore::setupWheelEventTestTrigger): Deleted. * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::monitorWheelEvents): (WebCoreTestSupport::setTestCallbackAndStartNotificationTimer): (WebCoreTestSupport::clearWheelEventTestMonitor): (WebCoreTestSupport::clearWheelEventTestTrigger): Deleted. * testing/js/WebCoreTestSupport.h: Source/WebKit: * UIProcess/API/C/WKPage.cpp: (WKPageClearWheelEventTestMonitor): (WKPageClearWheelEventTestTrigger): Deleted. * UIProcess/API/C/WKPage.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::clearWheelEventTestMonitor): (WebKit::WebPageProxy::clearWheelEventTestTrigger): Deleted. * UIProcess/WebPageProxy.h: * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageStartMonitoringScrollOperations): (WKBundlePageRegisterScrollOperationCompletionCallback): * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::createScrollbar): * WebProcess/WebPage/EventDispatcher.cpp: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::clearWheelEventTestMonitor): (WebKit::WebPage::clearWheelEventTestTrigger): Deleted. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: Tools: * DumpRenderTree/mac/DumpRenderTree.mm: (resetWebViewToConsistentStateBeforeTesting): * WebKitTestRunner/TestController.cpp: (WTR::TestController::resetStateToConsistentValues): Canonical link: https://commits.webkit.org/216237@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@250946 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-10-10 00:24:44 +00:00
m_deferCompletionReasons.clear();
m_completionCallback = nullptr;
eventSender.monitorWheelEvents() is very fragile https://bugs.webkit.org/show_bug.cgi?id=197819 <rdar://problem/51319456> Reviewed by Tim Horton. Source/WebCore: Deflake tests using eventSender.monitorWheelEvents() by fixing several causes of flakiness, adding back changes from r257844 that were reverted in r258558. First, have EventSendingController keep track of whether it's seen then "end" event for the scrolling and momentum phases, and pass this down to WheelEventTestMonitor, which now waits until it sees these, which prevents premature triggering which was a common cause of failure before. Second, remove WheelEventTestMonitor's 1/60s timer and instead have WheelEventTestMonitor test for completion in a callout from the end of Page::updateRendering(), which makes it test and fire at a more consistent time. Third, push WheelEventTestMonitor to the ScrollingTree, so that reasons for deferral can be added on the scrolling thread. This fixes an issue where the RunLoop::main().dispatch() used to send the "ScrollingThreadSyncNeeded" reason to the main thread would get delayed, also resulting in a premature trigger. * Modules/applepay/ApplePaySession.cpp: Unified sources! * dom/WindowEventLoop.cpp: Unified sources! * page/EventHandler.cpp: (WebCore::EventHandler::handleWheelEvent): * page/FrameView.cpp: (WebCore::FrameView::scrollOffsetChangedViaPlatformWidgetImpl): * page/Page.cpp: (WebCore::Page::doAfterUpdateRendering): (WebCore::Page::wheelEventTestMonitor const): (WebCore::Page::clearWheelEventTestMonitor): (WebCore::Page::isMonitoringWheelEvents const): (WebCore::Page::ensureWheelEventTestMonitor): * page/Page.h: (WebCore::Page::wheelEventTestMonitor const): Deleted. (WebCore::Page::clearWheelEventTestMonitor): Deleted. (WebCore::Page::isMonitoringWheelEvents const): Deleted. * page/WheelEventTestMonitor.cpp: (WebCore::WheelEventTestMonitor::WheelEventTestMonitor): (WebCore::WheelEventTestMonitor::clearAllTestDeferrals): (WebCore::WheelEventTestMonitor::setTestCallbackAndStartMonitoring): (WebCore::WheelEventTestMonitor::deferForReason): (WebCore::WheelEventTestMonitor::removeDeferralForReason): (WebCore::WheelEventTestMonitor::receivedWheelEvent): (WebCore::WheelEventTestMonitor::scheduleCallbackCheck): (WebCore::WheelEventTestMonitor::checkShouldFireCallbacks): (WebCore::operator<<): (WebCore::WheelEventTestMonitor::setTestCallbackAndStartNotificationTimer): Deleted. (WebCore::WheelEventTestMonitor::triggerTestTimerFired): Deleted. * page/WheelEventTestMonitor.h: (WebCore::WheelEventTestMonitorCompletionDeferrer::WheelEventTestMonitorCompletionDeferrer): (WebCore::WheelEventTestMonitorCompletionDeferrer::~WheelEventTestMonitorCompletionDeferrer): * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated): (WebCore::AsyncScrollingCoordinator::deferWheelEventTestCompletionForReason const): Deleted. (WebCore::AsyncScrollingCoordinator::removeWheelEventTestCompletionDeferralForReason const): Deleted. * page/scrolling/AsyncScrollingCoordinator.h: * page/scrolling/ScrollingCoordinator.h: (WebCore::ScrollingCoordinator::startMonitoringWheelEvents): (WebCore::ScrollingCoordinator::stopMonitoringWheelEvents): * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::handleWheelEvent): * page/scrolling/ScrollingTree.h: (WebCore::ScrollingTree::setWheelEventTestMonitor): (WebCore::ScrollingTree::receivedWheelEvent): * page/scrolling/ThreadedScrollingTree.cpp: (WebCore::ThreadedScrollingTree::scrollingTreeNodeDidScroll): (WebCore::ThreadedScrollingTree::deferWheelEventTestCompletionForReason): Deleted. (WebCore::ThreadedScrollingTree::removeWheelEventTestCompletionDeferralForReason): Deleted. * page/scrolling/ThreadedScrollingTree.h: * page/scrolling/mac/ScrollingCoordinatorMac.h: * page/scrolling/mac/ScrollingCoordinatorMac.mm: (WebCore::ScrollingCoordinatorMac::startMonitoringWheelEvents): (WebCore::ScrollingCoordinatorMac::stopMonitoringWheelEvents): * page/scrolling/mac/ScrollingTreeMac.h: * page/scrolling/mac/ScrollingTreeMac.mm: (ScrollingTreeMac::setWheelEventTestMonitor): (ScrollingTreeMac::receivedWheelEvent): (ScrollingTreeMac::deferWheelEventTestCompletionForReason): (ScrollingTreeMac::removeWheelEventTestCompletionDeferralForReason): * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm: (WebCore::ScrollingTreeScrollingNodeDelegateMac::deferWheelEventTestCompletionForReason const): (WebCore::ScrollingTreeScrollingNodeDelegateMac::removeWheelEventTestCompletionDeferralForReason const): * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::setWheelEventMonitorTestCallbackAndStartMonitoring): (WebCoreTestSupport::setTestCallbackAndStartNotificationTimer): Deleted. * testing/js/WebCoreTestSupport.h: Source/WebKit: Deflake tests using eventSender.monitorWheelEvents() by fixing several causes of flakiness, adding back changes from r257844 that were reverted in r258558. First, have EventSendingController keep track of whether it's seen then "end" event for the scrolling and momentum phases, and pass this down to WheelEventTestMonitor, which now waits until it sees these, which prevents premature triggering which was a common cause of failure before. Second, remove WheelEventTestMonitor's 1/60s timer and instead have WheelEventTestMonitor test for completion in a callout from the end of Page::updateRendering(), which makes it test and fire at a more consistent time. Third, push WheelEventTestMonitor to the ScrollingTree, so that reasons for deferral can be added on the scrolling thread. This fixes an issue where the RunLoop::main().dispatch() used to send the "ScrollingThreadSyncNeeded" reason to the main thread would get delayed, also resulting in a premature trigger. * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageRegisterScrollOperationCompletionCallback): * WebProcess/InjectedBundle/API/c/WKBundlePage.h: Tools: Deflake tests using eventSender.monitorWheelEvents() by fixing several causes of flakiness, adding back changes from r257844 that were reverted in r258558. First, have EventSendingController keep track of whether it's seen then "end" event for the scrolling and momentum phases, and pass this down to WheelEventTestMonitor, which now waits until it sees these, which prevents premature triggering which was a common cause of failure before. Second, remove WheelEventTestMonitor's 1/60s timer and instead have WheelEventTestMonitor test for completion in a callout from the end of Page::updateRendering(), which makes it test and fire at a more consistent time. Third, push WheelEventTestMonitor to the ScrollingTree, so that reasons for deferral can be added on the scrolling thread. This fixes an issue where the RunLoop::main().dispatch() used to send the "ScrollingThreadSyncNeeded" reason to the main thread would get delayed, also resulting in a premature trigger. * DumpRenderTree/mac/EventSendingController.h: * DumpRenderTree/mac/EventSendingController.mm: (-[EventSendingController mouseScrollByX:andY:withWheel:andMomentumPhases:]): (-[EventSendingController monitorWheelEvents]): (-[EventSendingController callAfterScrollingCompletes:]): * DumpRenderTree/win/EventSender.cpp: (mouseScrollBy): * WebKitTestRunner/InjectedBundle/EventSendingController.cpp: (WTR::EventSendingController::mouseScrollByWithWheelAndMomentumPhases): (WTR::EventSendingController::monitorWheelEvents): (WTR::EventSendingController::callAfterScrollingCompletes): * WebKitTestRunner/InjectedBundle/EventSendingController.h: LayoutTests: * platform/mac-wk2/TestExpectations: * platform/win/TestExpectations: * tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-2d-overflow.html: Need to call eventSender.monitorWheelEvents() for each subtest. Canonical link: https://commits.webkit.org/222192@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@258679 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-03-19 04:06:37 +00:00
m_everHadDeferral = false;
m_receivedWheelEndOrCancel = false;
m_receivedMomentumEnd = false;
LOG_WITH_STREAM(WheelEventTestMonitor, stream << " WheelEventTestMonitor::clearAllTestDeferrals: cleared all test state.");
Rename WheelEventTestTrigger and improve naming in related code https://bugs.webkit.org/show_bug.cgi?id=202772 Reviewed by Tim Horton. Change the "test trigger" terminology to "monitor wheel events"; after all, tests call monitorWheelEvents() and callAfterScrollingCompletes(), and this is not triggering a test. Source/WebCore: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * page/FrameView.cpp: (WebCore::FrameView::adjustScrollbarsForLayout): (WebCore::FrameView::setScrollPosition): (WebCore::FrameView::didAddScrollbar): * page/Page.cpp: (WebCore::Page::ensureWheelEventTestMonitor): (WebCore::Page::ensureTestTrigger): Deleted. * page/Page.h: (WebCore::Page::wheelEventTestMonitor const): (WebCore::Page::clearWheelEventTestMonitor): (WebCore::Page::isMonitoringWheelEvents const): (WebCore::Page::testTrigger const): Deleted. (WebCore::Page::clearTrigger): Deleted. (WebCore::Page::expectsWheelEventTriggers const): Deleted. * page/WheelEventTestMonitor.cpp: Added. (WebCore::WheelEventTestMonitor::WheelEventTestMonitor): (WebCore::WheelEventTestMonitor::clearAllTestDeferrals): (WebCore::WheelEventTestMonitor::setTestCallbackAndStartNotificationTimer): (WebCore::WheelEventTestMonitor::deferForReason): (WebCore::WheelEventTestMonitor::removeDeferralForReason): (WebCore::WheelEventTestMonitor::triggerTestTimerFired): (WebCore::operator<<): * page/WheelEventTestMonitor.h: Renamed from Source/WebCore/page/WheelEventTestTrigger.h. * page/WheelEventTestTrigger.cpp: Removed. * page/mac/EventHandlerMac.mm: (WebCore::EventHandler::platformPrepareForWheelEvents): * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated): (WebCore::AsyncScrollingCoordinator::updateIsMonitoringWheelEventsForFrameView): (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll): (WebCore::AsyncScrollingCoordinator::deferWheelEventTestCompletionForReason const): (WebCore::AsyncScrollingCoordinator::removeWheelEventTestCompletionDeferralForReason const): (WebCore::AsyncScrollingCoordinator::updateExpectsWheelEventTestTriggerWithFrameView): Deleted. (WebCore::AsyncScrollingCoordinator::deferTestsForReason const): Deleted. (WebCore::AsyncScrollingCoordinator::removeTestDeferralForReason const): Deleted. * page/scrolling/AsyncScrollingCoordinator.h: * page/scrolling/ScrollingCoordinator.h: (WebCore::ScrollingCoordinator::updateIsMonitoringWheelEventsForFrameView): (WebCore::ScrollingCoordinator::updateExpectsWheelEventTestTriggerWithFrameView): Deleted. * page/scrolling/ScrollingStateScrollingNode.cpp: (WebCore::ScrollingStateScrollingNode::ScrollingStateScrollingNode): (WebCore::ScrollingStateScrollingNode::setPropertyChangedBitsAfterReattach): (WebCore::ScrollingStateScrollingNode::setIsMonitoringWheelEvents): (WebCore::ScrollingStateScrollingNode::dumpProperties const): (WebCore::ScrollingStateScrollingNode::setExpectsWheelEventTestTrigger): Deleted. * page/scrolling/ScrollingStateScrollingNode.h: (WebCore::ScrollingStateScrollingNode::isMonitoringWheelEvents const): (WebCore::ScrollingStateScrollingNode::expectsWheelEventTestTrigger const): Deleted. * page/scrolling/ScrollingTree.h: (WebCore::ScrollingTree::deferWheelEventTestCompletionForReason): (WebCore::ScrollingTree::removeWheelEventTestCompletionDeferralForReason): (WebCore::ScrollingTree::deferTestsForReason): Deleted. (WebCore::ScrollingTree::removeTestDeferralForReason): Deleted. * page/scrolling/ScrollingTreeScrollingNode.cpp: (WebCore::ScrollingTreeScrollingNode::commitStateBeforeChildren): * page/scrolling/ScrollingTreeScrollingNode.h: * page/scrolling/ThreadedScrollingTree.cpp: (WebCore::ThreadedScrollingTree::deferWheelEventTestCompletionForReason): (WebCore::ThreadedScrollingTree::removeWheelEventTestCompletionDeferralForReason): (WebCore::ThreadedScrollingTree::deferTestsForReason): Deleted. (WebCore::ThreadedScrollingTree::removeTestDeferralForReason): Deleted. * page/scrolling/ThreadedScrollingTree.h: * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h: * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm: (WebCore::ScrollingTreeScrollingNodeDelegateMac::handleWheelEvent): (WebCore::ScrollingTreeScrollingNodeDelegateMac::deferWheelEventTestCompletionForReason const): (WebCore::ScrollingTreeScrollingNodeDelegateMac::removeWheelEventTestCompletionDeferralForReason const): (WebCore::ScrollingTreeScrollingNodeDelegateMac::deferTestsForReason const): Deleted. (WebCore::ScrollingTreeScrollingNodeDelegateMac::removeTestDeferralForReason const): Deleted. * platform/Logging.h: * platform/ScrollAnimator.cpp: (WebCore::ScrollAnimator::deferWheelEventTestCompletionForReason const): (WebCore::ScrollAnimator::removeWheelEventTestCompletionDeferralForReason const): (WebCore::ScrollAnimator::deferTestsForReason const): Deleted. (WebCore::ScrollAnimator::removeTestDeferralForReason const): Deleted. * platform/ScrollAnimator.h: (WebCore::ScrollAnimator::ScrollAnimator::setWheelEventTestMonitor): (WebCore::ScrollAnimator::ScrollAnimator::setWheelEventTestTrigger): Deleted. * platform/cocoa/ScrollController.h: (WebCore::ScrollControllerClient::deferWheelEventTestCompletionForReason const): (WebCore::ScrollControllerClient::removeWheelEventTestCompletionDeferralForReason const): (WebCore::ScrollControllerClient::deferTestsForReason const): Deleted. (WebCore::ScrollControllerClient::removeTestDeferralForReason const): Deleted. * platform/cocoa/ScrollController.mm: (WebCore::ScrollController::startSnapRubberbandTimer): (WebCore::ScrollController::stopSnapRubberbandTimer): (WebCore::ScrollController::scheduleStatelessScrollSnap): (WebCore::ScrollController::startDeferringWheelEventTestCompletionDueToScrollSnapping): (WebCore::ScrollController::stopDeferringWheelEventTestCompletionDueToScrollSnapping): (WebCore::ScrollController::startScrollSnapTimer): (WebCore::ScrollController::stopScrollSnapTimer): (WebCore::ScrollController::startDeferringTestsDueToScrollSnapping): Deleted. (WebCore::ScrollController::stopDeferringTestsDueToScrollSnapping): Deleted. * platform/mac/ScrollAnimatorMac.mm: (WebCore::ScrollAnimatorMac::didBeginScrollGesture const): (WebCore::ScrollAnimatorMac::didEndScrollGesture const): (WebCore::ScrollAnimatorMac::sendContentAreaScrolledSoon): (WebCore::ScrollAnimatorMac::sendContentAreaScrolledTimerFired): * rendering/RenderBox.cpp: (WebCore::setupWheelEventMonitor): (WebCore::RenderBox::setScrollLeft): (WebCore::RenderBox::setScrollTop): (WebCore::setupWheelEventTestTrigger): Deleted. * rendering/RenderLayer.cpp: (WebCore::RenderLayer::createScrollbar): * rendering/RenderListBox.cpp: (WebCore::setupWheelEventTestMonitor): (WebCore::RenderListBox::setScrollTop): (WebCore::RenderListBox::createScrollbar): (WebCore::setupWheelEventTestTrigger): Deleted. * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::monitorWheelEvents): (WebCoreTestSupport::setTestCallbackAndStartNotificationTimer): (WebCoreTestSupport::clearWheelEventTestMonitor): (WebCoreTestSupport::clearWheelEventTestTrigger): Deleted. * testing/js/WebCoreTestSupport.h: Source/WebKit: * UIProcess/API/C/WKPage.cpp: (WKPageClearWheelEventTestMonitor): (WKPageClearWheelEventTestTrigger): Deleted. * UIProcess/API/C/WKPage.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::clearWheelEventTestMonitor): (WebKit::WebPageProxy::clearWheelEventTestTrigger): Deleted. * UIProcess/WebPageProxy.h: * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageStartMonitoringScrollOperations): (WKBundlePageRegisterScrollOperationCompletionCallback): * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::createScrollbar): * WebProcess/WebPage/EventDispatcher.cpp: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::clearWheelEventTestMonitor): (WebKit::WebPage::clearWheelEventTestTrigger): Deleted. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: Tools: * DumpRenderTree/mac/DumpRenderTree.mm: (resetWebViewToConsistentStateBeforeTesting): * WebKitTestRunner/TestController.cpp: (WTR::TestController::resetStateToConsistentValues): Canonical link: https://commits.webkit.org/216237@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@250946 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-10-10 00:24:44 +00:00
}
eventSender.monitorWheelEvents() is very fragile https://bugs.webkit.org/show_bug.cgi?id=197819 <rdar://problem/51319456> Reviewed by Tim Horton. Source/WebCore: Deflake tests using eventSender.monitorWheelEvents() by fixing several causes of flakiness, adding back changes from r257844 that were reverted in r258558. First, have EventSendingController keep track of whether it's seen then "end" event for the scrolling and momentum phases, and pass this down to WheelEventTestMonitor, which now waits until it sees these, which prevents premature triggering which was a common cause of failure before. Second, remove WheelEventTestMonitor's 1/60s timer and instead have WheelEventTestMonitor test for completion in a callout from the end of Page::updateRendering(), which makes it test and fire at a more consistent time. Third, push WheelEventTestMonitor to the ScrollingTree, so that reasons for deferral can be added on the scrolling thread. This fixes an issue where the RunLoop::main().dispatch() used to send the "ScrollingThreadSyncNeeded" reason to the main thread would get delayed, also resulting in a premature trigger. * Modules/applepay/ApplePaySession.cpp: Unified sources! * dom/WindowEventLoop.cpp: Unified sources! * page/EventHandler.cpp: (WebCore::EventHandler::handleWheelEvent): * page/FrameView.cpp: (WebCore::FrameView::scrollOffsetChangedViaPlatformWidgetImpl): * page/Page.cpp: (WebCore::Page::doAfterUpdateRendering): (WebCore::Page::wheelEventTestMonitor const): (WebCore::Page::clearWheelEventTestMonitor): (WebCore::Page::isMonitoringWheelEvents const): (WebCore::Page::ensureWheelEventTestMonitor): * page/Page.h: (WebCore::Page::wheelEventTestMonitor const): Deleted. (WebCore::Page::clearWheelEventTestMonitor): Deleted. (WebCore::Page::isMonitoringWheelEvents const): Deleted. * page/WheelEventTestMonitor.cpp: (WebCore::WheelEventTestMonitor::WheelEventTestMonitor): (WebCore::WheelEventTestMonitor::clearAllTestDeferrals): (WebCore::WheelEventTestMonitor::setTestCallbackAndStartMonitoring): (WebCore::WheelEventTestMonitor::deferForReason): (WebCore::WheelEventTestMonitor::removeDeferralForReason): (WebCore::WheelEventTestMonitor::receivedWheelEvent): (WebCore::WheelEventTestMonitor::scheduleCallbackCheck): (WebCore::WheelEventTestMonitor::checkShouldFireCallbacks): (WebCore::operator<<): (WebCore::WheelEventTestMonitor::setTestCallbackAndStartNotificationTimer): Deleted. (WebCore::WheelEventTestMonitor::triggerTestTimerFired): Deleted. * page/WheelEventTestMonitor.h: (WebCore::WheelEventTestMonitorCompletionDeferrer::WheelEventTestMonitorCompletionDeferrer): (WebCore::WheelEventTestMonitorCompletionDeferrer::~WheelEventTestMonitorCompletionDeferrer): * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated): (WebCore::AsyncScrollingCoordinator::deferWheelEventTestCompletionForReason const): Deleted. (WebCore::AsyncScrollingCoordinator::removeWheelEventTestCompletionDeferralForReason const): Deleted. * page/scrolling/AsyncScrollingCoordinator.h: * page/scrolling/ScrollingCoordinator.h: (WebCore::ScrollingCoordinator::startMonitoringWheelEvents): (WebCore::ScrollingCoordinator::stopMonitoringWheelEvents): * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::handleWheelEvent): * page/scrolling/ScrollingTree.h: (WebCore::ScrollingTree::setWheelEventTestMonitor): (WebCore::ScrollingTree::receivedWheelEvent): * page/scrolling/ThreadedScrollingTree.cpp: (WebCore::ThreadedScrollingTree::scrollingTreeNodeDidScroll): (WebCore::ThreadedScrollingTree::deferWheelEventTestCompletionForReason): Deleted. (WebCore::ThreadedScrollingTree::removeWheelEventTestCompletionDeferralForReason): Deleted. * page/scrolling/ThreadedScrollingTree.h: * page/scrolling/mac/ScrollingCoordinatorMac.h: * page/scrolling/mac/ScrollingCoordinatorMac.mm: (WebCore::ScrollingCoordinatorMac::startMonitoringWheelEvents): (WebCore::ScrollingCoordinatorMac::stopMonitoringWheelEvents): * page/scrolling/mac/ScrollingTreeMac.h: * page/scrolling/mac/ScrollingTreeMac.mm: (ScrollingTreeMac::setWheelEventTestMonitor): (ScrollingTreeMac::receivedWheelEvent): (ScrollingTreeMac::deferWheelEventTestCompletionForReason): (ScrollingTreeMac::removeWheelEventTestCompletionDeferralForReason): * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm: (WebCore::ScrollingTreeScrollingNodeDelegateMac::deferWheelEventTestCompletionForReason const): (WebCore::ScrollingTreeScrollingNodeDelegateMac::removeWheelEventTestCompletionDeferralForReason const): * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::setWheelEventMonitorTestCallbackAndStartMonitoring): (WebCoreTestSupport::setTestCallbackAndStartNotificationTimer): Deleted. * testing/js/WebCoreTestSupport.h: Source/WebKit: Deflake tests using eventSender.monitorWheelEvents() by fixing several causes of flakiness, adding back changes from r257844 that were reverted in r258558. First, have EventSendingController keep track of whether it's seen then "end" event for the scrolling and momentum phases, and pass this down to WheelEventTestMonitor, which now waits until it sees these, which prevents premature triggering which was a common cause of failure before. Second, remove WheelEventTestMonitor's 1/60s timer and instead have WheelEventTestMonitor test for completion in a callout from the end of Page::updateRendering(), which makes it test and fire at a more consistent time. Third, push WheelEventTestMonitor to the ScrollingTree, so that reasons for deferral can be added on the scrolling thread. This fixes an issue where the RunLoop::main().dispatch() used to send the "ScrollingThreadSyncNeeded" reason to the main thread would get delayed, also resulting in a premature trigger. * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageRegisterScrollOperationCompletionCallback): * WebProcess/InjectedBundle/API/c/WKBundlePage.h: Tools: Deflake tests using eventSender.monitorWheelEvents() by fixing several causes of flakiness, adding back changes from r257844 that were reverted in r258558. First, have EventSendingController keep track of whether it's seen then "end" event for the scrolling and momentum phases, and pass this down to WheelEventTestMonitor, which now waits until it sees these, which prevents premature triggering which was a common cause of failure before. Second, remove WheelEventTestMonitor's 1/60s timer and instead have WheelEventTestMonitor test for completion in a callout from the end of Page::updateRendering(), which makes it test and fire at a more consistent time. Third, push WheelEventTestMonitor to the ScrollingTree, so that reasons for deferral can be added on the scrolling thread. This fixes an issue where the RunLoop::main().dispatch() used to send the "ScrollingThreadSyncNeeded" reason to the main thread would get delayed, also resulting in a premature trigger. * DumpRenderTree/mac/EventSendingController.h: * DumpRenderTree/mac/EventSendingController.mm: (-[EventSendingController mouseScrollByX:andY:withWheel:andMomentumPhases:]): (-[EventSendingController monitorWheelEvents]): (-[EventSendingController callAfterScrollingCompletes:]): * DumpRenderTree/win/EventSender.cpp: (mouseScrollBy): * WebKitTestRunner/InjectedBundle/EventSendingController.cpp: (WTR::EventSendingController::mouseScrollByWithWheelAndMomentumPhases): (WTR::EventSendingController::monitorWheelEvents): (WTR::EventSendingController::callAfterScrollingCompletes): * WebKitTestRunner/InjectedBundle/EventSendingController.h: LayoutTests: * platform/mac-wk2/TestExpectations: * platform/win/TestExpectations: * tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-2d-overflow.html: Need to call eventSender.monitorWheelEvents() for each subtest. Canonical link: https://commits.webkit.org/222192@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@258679 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-03-19 04:06:37 +00:00
void WheelEventTestMonitor::setTestCallbackAndStartMonitoring(bool expectWheelEndOrCancel, bool expectMomentumEnd, WTF::Function<void()>&& functionCallback)
Rename WheelEventTestTrigger and improve naming in related code https://bugs.webkit.org/show_bug.cgi?id=202772 Reviewed by Tim Horton. Change the "test trigger" terminology to "monitor wheel events"; after all, tests call monitorWheelEvents() and callAfterScrollingCompletes(), and this is not triggering a test. Source/WebCore: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * page/FrameView.cpp: (WebCore::FrameView::adjustScrollbarsForLayout): (WebCore::FrameView::setScrollPosition): (WebCore::FrameView::didAddScrollbar): * page/Page.cpp: (WebCore::Page::ensureWheelEventTestMonitor): (WebCore::Page::ensureTestTrigger): Deleted. * page/Page.h: (WebCore::Page::wheelEventTestMonitor const): (WebCore::Page::clearWheelEventTestMonitor): (WebCore::Page::isMonitoringWheelEvents const): (WebCore::Page::testTrigger const): Deleted. (WebCore::Page::clearTrigger): Deleted. (WebCore::Page::expectsWheelEventTriggers const): Deleted. * page/WheelEventTestMonitor.cpp: Added. (WebCore::WheelEventTestMonitor::WheelEventTestMonitor): (WebCore::WheelEventTestMonitor::clearAllTestDeferrals): (WebCore::WheelEventTestMonitor::setTestCallbackAndStartNotificationTimer): (WebCore::WheelEventTestMonitor::deferForReason): (WebCore::WheelEventTestMonitor::removeDeferralForReason): (WebCore::WheelEventTestMonitor::triggerTestTimerFired): (WebCore::operator<<): * page/WheelEventTestMonitor.h: Renamed from Source/WebCore/page/WheelEventTestTrigger.h. * page/WheelEventTestTrigger.cpp: Removed. * page/mac/EventHandlerMac.mm: (WebCore::EventHandler::platformPrepareForWheelEvents): * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated): (WebCore::AsyncScrollingCoordinator::updateIsMonitoringWheelEventsForFrameView): (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll): (WebCore::AsyncScrollingCoordinator::deferWheelEventTestCompletionForReason const): (WebCore::AsyncScrollingCoordinator::removeWheelEventTestCompletionDeferralForReason const): (WebCore::AsyncScrollingCoordinator::updateExpectsWheelEventTestTriggerWithFrameView): Deleted. (WebCore::AsyncScrollingCoordinator::deferTestsForReason const): Deleted. (WebCore::AsyncScrollingCoordinator::removeTestDeferralForReason const): Deleted. * page/scrolling/AsyncScrollingCoordinator.h: * page/scrolling/ScrollingCoordinator.h: (WebCore::ScrollingCoordinator::updateIsMonitoringWheelEventsForFrameView): (WebCore::ScrollingCoordinator::updateExpectsWheelEventTestTriggerWithFrameView): Deleted. * page/scrolling/ScrollingStateScrollingNode.cpp: (WebCore::ScrollingStateScrollingNode::ScrollingStateScrollingNode): (WebCore::ScrollingStateScrollingNode::setPropertyChangedBitsAfterReattach): (WebCore::ScrollingStateScrollingNode::setIsMonitoringWheelEvents): (WebCore::ScrollingStateScrollingNode::dumpProperties const): (WebCore::ScrollingStateScrollingNode::setExpectsWheelEventTestTrigger): Deleted. * page/scrolling/ScrollingStateScrollingNode.h: (WebCore::ScrollingStateScrollingNode::isMonitoringWheelEvents const): (WebCore::ScrollingStateScrollingNode::expectsWheelEventTestTrigger const): Deleted. * page/scrolling/ScrollingTree.h: (WebCore::ScrollingTree::deferWheelEventTestCompletionForReason): (WebCore::ScrollingTree::removeWheelEventTestCompletionDeferralForReason): (WebCore::ScrollingTree::deferTestsForReason): Deleted. (WebCore::ScrollingTree::removeTestDeferralForReason): Deleted. * page/scrolling/ScrollingTreeScrollingNode.cpp: (WebCore::ScrollingTreeScrollingNode::commitStateBeforeChildren): * page/scrolling/ScrollingTreeScrollingNode.h: * page/scrolling/ThreadedScrollingTree.cpp: (WebCore::ThreadedScrollingTree::deferWheelEventTestCompletionForReason): (WebCore::ThreadedScrollingTree::removeWheelEventTestCompletionDeferralForReason): (WebCore::ThreadedScrollingTree::deferTestsForReason): Deleted. (WebCore::ThreadedScrollingTree::removeTestDeferralForReason): Deleted. * page/scrolling/ThreadedScrollingTree.h: * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h: * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm: (WebCore::ScrollingTreeScrollingNodeDelegateMac::handleWheelEvent): (WebCore::ScrollingTreeScrollingNodeDelegateMac::deferWheelEventTestCompletionForReason const): (WebCore::ScrollingTreeScrollingNodeDelegateMac::removeWheelEventTestCompletionDeferralForReason const): (WebCore::ScrollingTreeScrollingNodeDelegateMac::deferTestsForReason const): Deleted. (WebCore::ScrollingTreeScrollingNodeDelegateMac::removeTestDeferralForReason const): Deleted. * platform/Logging.h: * platform/ScrollAnimator.cpp: (WebCore::ScrollAnimator::deferWheelEventTestCompletionForReason const): (WebCore::ScrollAnimator::removeWheelEventTestCompletionDeferralForReason const): (WebCore::ScrollAnimator::deferTestsForReason const): Deleted. (WebCore::ScrollAnimator::removeTestDeferralForReason const): Deleted. * platform/ScrollAnimator.h: (WebCore::ScrollAnimator::ScrollAnimator::setWheelEventTestMonitor): (WebCore::ScrollAnimator::ScrollAnimator::setWheelEventTestTrigger): Deleted. * platform/cocoa/ScrollController.h: (WebCore::ScrollControllerClient::deferWheelEventTestCompletionForReason const): (WebCore::ScrollControllerClient::removeWheelEventTestCompletionDeferralForReason const): (WebCore::ScrollControllerClient::deferTestsForReason const): Deleted. (WebCore::ScrollControllerClient::removeTestDeferralForReason const): Deleted. * platform/cocoa/ScrollController.mm: (WebCore::ScrollController::startSnapRubberbandTimer): (WebCore::ScrollController::stopSnapRubberbandTimer): (WebCore::ScrollController::scheduleStatelessScrollSnap): (WebCore::ScrollController::startDeferringWheelEventTestCompletionDueToScrollSnapping): (WebCore::ScrollController::stopDeferringWheelEventTestCompletionDueToScrollSnapping): (WebCore::ScrollController::startScrollSnapTimer): (WebCore::ScrollController::stopScrollSnapTimer): (WebCore::ScrollController::startDeferringTestsDueToScrollSnapping): Deleted. (WebCore::ScrollController::stopDeferringTestsDueToScrollSnapping): Deleted. * platform/mac/ScrollAnimatorMac.mm: (WebCore::ScrollAnimatorMac::didBeginScrollGesture const): (WebCore::ScrollAnimatorMac::didEndScrollGesture const): (WebCore::ScrollAnimatorMac::sendContentAreaScrolledSoon): (WebCore::ScrollAnimatorMac::sendContentAreaScrolledTimerFired): * rendering/RenderBox.cpp: (WebCore::setupWheelEventMonitor): (WebCore::RenderBox::setScrollLeft): (WebCore::RenderBox::setScrollTop): (WebCore::setupWheelEventTestTrigger): Deleted. * rendering/RenderLayer.cpp: (WebCore::RenderLayer::createScrollbar): * rendering/RenderListBox.cpp: (WebCore::setupWheelEventTestMonitor): (WebCore::RenderListBox::setScrollTop): (WebCore::RenderListBox::createScrollbar): (WebCore::setupWheelEventTestTrigger): Deleted. * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::monitorWheelEvents): (WebCoreTestSupport::setTestCallbackAndStartNotificationTimer): (WebCoreTestSupport::clearWheelEventTestMonitor): (WebCoreTestSupport::clearWheelEventTestTrigger): Deleted. * testing/js/WebCoreTestSupport.h: Source/WebKit: * UIProcess/API/C/WKPage.cpp: (WKPageClearWheelEventTestMonitor): (WKPageClearWheelEventTestTrigger): Deleted. * UIProcess/API/C/WKPage.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::clearWheelEventTestMonitor): (WebKit::WebPageProxy::clearWheelEventTestTrigger): Deleted. * UIProcess/WebPageProxy.h: * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageStartMonitoringScrollOperations): (WKBundlePageRegisterScrollOperationCompletionCallback): * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::createScrollbar): * WebProcess/WebPage/EventDispatcher.cpp: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::clearWheelEventTestMonitor): (WebKit::WebPage::clearWheelEventTestTrigger): Deleted. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: Tools: * DumpRenderTree/mac/DumpRenderTree.mm: (resetWebViewToConsistentStateBeforeTesting): * WebKitTestRunner/TestController.cpp: (WTR::TestController::resetStateToConsistentValues): Canonical link: https://commits.webkit.org/216237@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@250946 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-10-10 00:24:44 +00:00
{
Use CheckedLock more in WebCore https://bugs.webkit.org/show_bug.cgi?id=226026 Reviewed by Geoffrey Garen. Use CheckedLock more in WebCore to benefit from Clang Thread Safety Analysis. * Modules/indexeddb/IDBObjectStore.cpp: (WebCore::IDBObjectStore::createIndex): (WebCore::IDBObjectStore::index): (WebCore::IDBObjectStore::deleteIndex): (WebCore::IDBObjectStore::rollbackForVersionChangeAbort): (WebCore::IDBObjectStore::visitReferencedIndexes const): (WebCore::IDBObjectStore::renameReferencedIndex): * Modules/indexeddb/IDBObjectStore.h: * Modules/indexeddb/IDBTransaction.cpp: (WebCore::IDBTransaction::objectStore): (WebCore::IDBTransaction::internalAbort): (WebCore::IDBTransaction::createObjectStore): (WebCore::IDBTransaction::renameObjectStore): (WebCore::IDBTransaction::renameIndex): (WebCore::IDBTransaction::deleteObjectStore): (WebCore::IDBTransaction::visitReferencedObjectStores const): * Modules/indexeddb/IDBTransaction.h: * Modules/indexeddb/client/IDBConnectionProxy.cpp: (WebCore::IDBClient::IDBConnectionProxy::openDatabase): (WebCore::IDBClient::IDBConnectionProxy::deleteDatabase): (WebCore::IDBClient::IDBConnectionProxy::completeOpenDBRequest): (WebCore::IDBClient::IDBConnectionProxy::saveOperation): (WebCore::IDBClient::IDBConnectionProxy::completeOperation): (WebCore::IDBClient::IDBConnectionProxy::fireVersionChangeEvent): (WebCore::IDBClient::IDBConnectionProxy::notifyOpenDBRequestBlocked): (WebCore::IDBClient::IDBConnectionProxy::establishTransaction): (WebCore::IDBClient::IDBConnectionProxy::didStartTransaction): (WebCore::IDBClient::IDBConnectionProxy::commitTransaction): (WebCore::IDBClient::IDBConnectionProxy::didCommitTransaction): (WebCore::IDBClient::IDBConnectionProxy::abortTransaction): (WebCore::IDBClient::IDBConnectionProxy::didAbortTransaction): (WebCore::IDBClient::IDBConnectionProxy::didCloseFromServer): (WebCore::IDBClient::IDBConnectionProxy::connectionToServerLost): (WebCore::IDBClient::IDBConnectionProxy::scheduleMainThreadTasks): (WebCore::IDBClient::IDBConnectionProxy::handleMainThreadTasks): (WebCore::IDBClient::IDBConnectionProxy::getAllDatabaseNamesAndVersions): (WebCore::IDBClient::IDBConnectionProxy::didGetAllDatabaseNamesAndVersions): (WebCore::IDBClient::IDBConnectionProxy::registerDatabaseConnection): (WebCore::IDBClient::IDBConnectionProxy::unregisterDatabaseConnection): (WebCore::IDBClient::IDBConnectionProxy::forgetActiveOperations): (WebCore::IDBClient::IDBConnectionProxy::forgetTransaction): (WebCore::IDBClient::IDBConnectionProxy::forgetActivityForCurrentThread): (WebCore::IDBClient::IDBConnectionProxy::setContextSuspended): * Modules/indexeddb/client/IDBConnectionProxy.h: * Modules/mediastream/RTCRtpSFrameTransformer.cpp: (WebCore::RTCRtpSFrameTransformer::setEncryptionKey): (WebCore::RTCRtpSFrameTransformer::decryptFrame): (WebCore::RTCRtpSFrameTransformer::encryptFrame): * Modules/mediastream/RTCRtpSFrameTransformer.h: * Modules/mediastream/RTCRtpScriptTransform.cpp: (WebCore::RTCRtpScriptTransform::setTransformer): (WebCore::RTCRtpScriptTransform::setupTransformer): (WebCore::RTCRtpScriptTransform::clear): * Modules/mediastream/RTCRtpScriptTransform.h: * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.cpp: (WebCore::LibWebRTCDataChannelHandler::setClient): (WebCore::LibWebRTCDataChannelHandler::checkState): (WebCore::LibWebRTCDataChannelHandler::OnMessage): (WebCore::LibWebRTCDataChannelHandler::OnBufferedAmountChange): * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.h: * Modules/mediastream/libwebrtc/LibWebRTCRtpTransformBackend.cpp: (WebCore::LibWebRTCRtpTransformBackend::setInputCallback): (WebCore::LibWebRTCRtpTransformBackend::setOutputCallback): (WebCore::LibWebRTCRtpTransformBackend::processTransformedFrame): (WebCore::LibWebRTCRtpTransformBackend::Transform): * Modules/mediastream/libwebrtc/LibWebRTCRtpTransformBackend.h: * inspector/agents/WebHeapAgent.cpp: (WebCore::SendGarbageCollectionEventsTask::addGarbageCollection): (WebCore::SendGarbageCollectionEventsTask::reset): (WebCore::SendGarbageCollectionEventsTask::timerFired): * page/ResourceUsageThread.cpp: (WebCore::ResourceUsageThread::addObserver): (WebCore::ResourceUsageThread::removeObserver): (WebCore::ResourceUsageThread::waitUntilObservers): (WebCore::ResourceUsageThread::notifyObservers): * page/ResourceUsageThread.h: * page/WheelEventTestMonitor.cpp: (WebCore::WheelEventTestMonitor::clearAllTestDeferrals): (WebCore::WheelEventTestMonitor::setTestCallbackAndStartMonitoring): (WebCore::WheelEventTestMonitor::deferForReason): (WebCore::WheelEventTestMonitor::removeDeferralForReason): (WebCore::WheelEventTestMonitor::receivedWheelEvent): (WebCore::WheelEventTestMonitor::checkShouldFireCallbacks): * page/WheelEventTestMonitor.h: (WebCore::WheelEventTestMonitor::WTF_GUARDED_BY_LOCK): * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::computeWheelProcessingSteps): (WebCore::ScrollingTree::determineWheelEventProcessing): (WebCore::ScrollingTree::handleWheelEvent): (WebCore::ScrollingTree::commitTreeState): (WebCore::ScrollingTree::mainFrameScrollPosition const): (WebCore::ScrollingTree::setMainFrameScrollPosition): (WebCore::ScrollingTree::setGestureState): (WebCore::ScrollingTree::gestureState): (WebCore::ScrollingTree::eventTrackingTypeForPoint): (WebCore::ScrollingTree::isRubberBandInProgressForNode): (WebCore::ScrollingTree::setRubberBandingInProgressForNode): (WebCore::ScrollingTree::isUserScrollInProgressForNode): (WebCore::ScrollingTree::setUserScrollInProgressForNode): (WebCore::ScrollingTree::clearNodesWithUserScrollInProgress): (WebCore::ScrollingTree::isScrollSnapInProgressForNode): (WebCore::ScrollingTree::setNodeScrollSnapInProgress): (WebCore::ScrollingTree::setMainFramePinnedState): (WebCore::ScrollingTree::setMainFrameCanRubberBand): (WebCore::ScrollingTree::mainFrameCanRubberBandInDirection): (WebCore::ScrollingTree::addPendingScrollUpdate): (WebCore::ScrollingTree::takePendingScrollUpdates): (WebCore::ScrollingTree::setScrollPinningBehavior): (WebCore::ScrollingTree::scrollPinningBehavior): (WebCore::ScrollingTree::willWheelEventStartSwipeGesture): (WebCore::ScrollingTree::windowScreenDidChange): (WebCore::ScrollingTree::displayID): (WebCore::ScrollingTree::hasProcessedWheelEventsRecently): (WebCore::ScrollingTree::willProcessWheelEvent): (WebCore::ScrollingTree::nominalFramesPerSecond): (WebCore::ScrollingTree::scrollingTreeAsText): * page/scrolling/ScrollingTree.h: * page/scrolling/ScrollingTreeLatchingController.cpp: (WebCore::ScrollingTreeLatchingController::receivedWheelEvent): (WebCore::ScrollingTreeLatchingController::latchingDataForEvent const): (WebCore::ScrollingTreeLatchingController::latchedNodeID const): (WebCore::ScrollingTreeLatchingController::latchedNodeAndSteps const): (WebCore::ScrollingTreeLatchingController::nodeDidHandleEvent): (WebCore::ScrollingTreeLatchingController::nodeWasRemoved): (WebCore::ScrollingTreeLatchingController::clearLatchedNode): * page/scrolling/ScrollingTreeLatchingController.h: * platform/audio/HRTFDatabaseLoader.cpp: (WebCore::HRTFDatabaseLoader::loadAsynchronously): (WebCore::HRTFDatabaseLoader::waitForLoaderThreadCompletion): * platform/audio/HRTFDatabaseLoader.h: * platform/audio/cocoa/AudioDestinationCocoa.cpp: (WebCore::AudioDestinationCocoa::hasEnoughFrames const): (WebCore::AudioDestinationCocoa::render): (WebCore::AudioDestinationCocoa::renderOnRenderingThead): * platform/audio/cocoa/AudioDestinationCocoa.h: * platform/encryptedmedia/CDMProxy.cpp: (WebCore::CDMProxy::instance const): (WebCore::CDMProxy::setInstance): (WebCore::CDMProxy::startedWaitingForKey const): (WebCore::CDMProxy::stoppedWaitingForKey const): * platform/encryptedmedia/CDMProxy.h: * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp: (WebCore::MediaPlayerPrivateAVFoundation::MediaPlayerPrivateAVFoundation): (WebCore::MediaPlayerPrivateAVFoundation::setDelayCallbacks const): (WebCore::MediaPlayerPrivateAVFoundation::clearMainThreadPendingFlag): (WebCore::MediaPlayerPrivateAVFoundation::scheduleMainThreadNotification): (WebCore::MediaPlayerPrivateAVFoundation::dispatchNotification): * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm: (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::processNewVideoSample): * platform/graphics/cg/IOSurfacePool.cpp: (WebCore::IOSurfacePool::takeSurface): (WebCore::IOSurfacePool::addSurface): (WebCore::IOSurfacePool::setPoolSize): (WebCore::IOSurfacePool::collectionTimerFired): (WebCore::IOSurfacePool::discardAllSurfaces): * platform/graphics/cg/IOSurfacePool.h: (WebCore::IOSurfacePool::WTF_GUARDED_BY_LOCK): * platform/graphics/cg/SubimageCacheWithTimer.cpp: (WebCore::SubimageCacheWithTimer::pruneCacheTimerFired): (WebCore::SubimageCacheWithTimer::subimage): (WebCore::SubimageCacheWithTimer::clearImageAndSubimages): (WebCore::SubimageCacheWithTimer::clearAll): * platform/graphics/cg/SubimageCacheWithTimer.h: * platform/graphics/cocoa/FontCacheCoreText.cpp: (WebCore::FontDatabase::collectionForFamily): (WebCore::FontDatabase::clear): * platform/network/cocoa/WebCoreNSURLSession.mm: (WebCore::WebCoreNSURLSessionDataTaskClient::clearTask): (WebCore::WebCoreNSURLSessionDataTaskClient::dataSent): (WebCore::WebCoreNSURLSessionDataTaskClient::responseReceived): (WebCore::WebCoreNSURLSessionDataTaskClient::shouldCacheResponse): (WebCore::WebCoreNSURLSessionDataTaskClient::dataReceived): (WebCore::WebCoreNSURLSessionDataTaskClient::redirectReceived): (WebCore::WebCoreNSURLSessionDataTaskClient::accessControlCheckFailed): (WebCore::WebCoreNSURLSessionDataTaskClient::loadFailed): (WebCore::WebCoreNSURLSessionDataTaskClient::loadFinished): * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.h: * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm: (-[WebCoreResourceHandleAsOperationQueueDelegate detachHandle]): (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willSendRequest:redirectResponse:]): (-[WebCoreResourceHandleAsOperationQueueDelegate connection:canAuthenticateAgainstProtectionSpace:]): (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willCacheResponse:]): * storage/StorageQuotaManager.cpp: (WebCore::StorageQuotaManager::requestSpaceOnBackgroundThread): (WebCore::StorageQuotaManager::resetQuotaUpdatedBasedOnUsageForTesting): (WebCore::StorageQuotaManager::resetQuotaForTesting): * storage/StorageQuotaManager.h: (WebCore::StorageQuotaManager::WTF_GUARDED_BY_LOCK): * workers/WorkerOrWorkletScriptController.cpp: (WebCore::WorkerOrWorkletScriptController::scheduleExecutionTermination): (WebCore::WorkerOrWorkletScriptController::isTerminatingExecution const): * workers/WorkerOrWorkletScriptController.h: (WebCore::WorkerOrWorkletScriptController::WTF_GUARDED_BY_LOCK): Canonical link: https://commits.webkit.org/237960@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277805 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-20 18:41:33 +00:00
Locker locker { m_lock };
ASSERT(isMainThread());
m_completionCallback = WTFMove(functionCallback);
eventSender.monitorWheelEvents() is very fragile https://bugs.webkit.org/show_bug.cgi?id=197819 <rdar://problem/51319456> Reviewed by Tim Horton. Source/WebCore: Deflake tests using eventSender.monitorWheelEvents() by fixing several causes of flakiness, adding back changes from r257844 that were reverted in r258558. First, have EventSendingController keep track of whether it's seen then "end" event for the scrolling and momentum phases, and pass this down to WheelEventTestMonitor, which now waits until it sees these, which prevents premature triggering which was a common cause of failure before. Second, remove WheelEventTestMonitor's 1/60s timer and instead have WheelEventTestMonitor test for completion in a callout from the end of Page::updateRendering(), which makes it test and fire at a more consistent time. Third, push WheelEventTestMonitor to the ScrollingTree, so that reasons for deferral can be added on the scrolling thread. This fixes an issue where the RunLoop::main().dispatch() used to send the "ScrollingThreadSyncNeeded" reason to the main thread would get delayed, also resulting in a premature trigger. * Modules/applepay/ApplePaySession.cpp: Unified sources! * dom/WindowEventLoop.cpp: Unified sources! * page/EventHandler.cpp: (WebCore::EventHandler::handleWheelEvent): * page/FrameView.cpp: (WebCore::FrameView::scrollOffsetChangedViaPlatformWidgetImpl): * page/Page.cpp: (WebCore::Page::doAfterUpdateRendering): (WebCore::Page::wheelEventTestMonitor const): (WebCore::Page::clearWheelEventTestMonitor): (WebCore::Page::isMonitoringWheelEvents const): (WebCore::Page::ensureWheelEventTestMonitor): * page/Page.h: (WebCore::Page::wheelEventTestMonitor const): Deleted. (WebCore::Page::clearWheelEventTestMonitor): Deleted. (WebCore::Page::isMonitoringWheelEvents const): Deleted. * page/WheelEventTestMonitor.cpp: (WebCore::WheelEventTestMonitor::WheelEventTestMonitor): (WebCore::WheelEventTestMonitor::clearAllTestDeferrals): (WebCore::WheelEventTestMonitor::setTestCallbackAndStartMonitoring): (WebCore::WheelEventTestMonitor::deferForReason): (WebCore::WheelEventTestMonitor::removeDeferralForReason): (WebCore::WheelEventTestMonitor::receivedWheelEvent): (WebCore::WheelEventTestMonitor::scheduleCallbackCheck): (WebCore::WheelEventTestMonitor::checkShouldFireCallbacks): (WebCore::operator<<): (WebCore::WheelEventTestMonitor::setTestCallbackAndStartNotificationTimer): Deleted. (WebCore::WheelEventTestMonitor::triggerTestTimerFired): Deleted. * page/WheelEventTestMonitor.h: (WebCore::WheelEventTestMonitorCompletionDeferrer::WheelEventTestMonitorCompletionDeferrer): (WebCore::WheelEventTestMonitorCompletionDeferrer::~WheelEventTestMonitorCompletionDeferrer): * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated): (WebCore::AsyncScrollingCoordinator::deferWheelEventTestCompletionForReason const): Deleted. (WebCore::AsyncScrollingCoordinator::removeWheelEventTestCompletionDeferralForReason const): Deleted. * page/scrolling/AsyncScrollingCoordinator.h: * page/scrolling/ScrollingCoordinator.h: (WebCore::ScrollingCoordinator::startMonitoringWheelEvents): (WebCore::ScrollingCoordinator::stopMonitoringWheelEvents): * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::handleWheelEvent): * page/scrolling/ScrollingTree.h: (WebCore::ScrollingTree::setWheelEventTestMonitor): (WebCore::ScrollingTree::receivedWheelEvent): * page/scrolling/ThreadedScrollingTree.cpp: (WebCore::ThreadedScrollingTree::scrollingTreeNodeDidScroll): (WebCore::ThreadedScrollingTree::deferWheelEventTestCompletionForReason): Deleted. (WebCore::ThreadedScrollingTree::removeWheelEventTestCompletionDeferralForReason): Deleted. * page/scrolling/ThreadedScrollingTree.h: * page/scrolling/mac/ScrollingCoordinatorMac.h: * page/scrolling/mac/ScrollingCoordinatorMac.mm: (WebCore::ScrollingCoordinatorMac::startMonitoringWheelEvents): (WebCore::ScrollingCoordinatorMac::stopMonitoringWheelEvents): * page/scrolling/mac/ScrollingTreeMac.h: * page/scrolling/mac/ScrollingTreeMac.mm: (ScrollingTreeMac::setWheelEventTestMonitor): (ScrollingTreeMac::receivedWheelEvent): (ScrollingTreeMac::deferWheelEventTestCompletionForReason): (ScrollingTreeMac::removeWheelEventTestCompletionDeferralForReason): * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm: (WebCore::ScrollingTreeScrollingNodeDelegateMac::deferWheelEventTestCompletionForReason const): (WebCore::ScrollingTreeScrollingNodeDelegateMac::removeWheelEventTestCompletionDeferralForReason const): * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::setWheelEventMonitorTestCallbackAndStartMonitoring): (WebCoreTestSupport::setTestCallbackAndStartNotificationTimer): Deleted. * testing/js/WebCoreTestSupport.h: Source/WebKit: Deflake tests using eventSender.monitorWheelEvents() by fixing several causes of flakiness, adding back changes from r257844 that were reverted in r258558. First, have EventSendingController keep track of whether it's seen then "end" event for the scrolling and momentum phases, and pass this down to WheelEventTestMonitor, which now waits until it sees these, which prevents premature triggering which was a common cause of failure before. Second, remove WheelEventTestMonitor's 1/60s timer and instead have WheelEventTestMonitor test for completion in a callout from the end of Page::updateRendering(), which makes it test and fire at a more consistent time. Third, push WheelEventTestMonitor to the ScrollingTree, so that reasons for deferral can be added on the scrolling thread. This fixes an issue where the RunLoop::main().dispatch() used to send the "ScrollingThreadSyncNeeded" reason to the main thread would get delayed, also resulting in a premature trigger. * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageRegisterScrollOperationCompletionCallback): * WebProcess/InjectedBundle/API/c/WKBundlePage.h: Tools: Deflake tests using eventSender.monitorWheelEvents() by fixing several causes of flakiness, adding back changes from r257844 that were reverted in r258558. First, have EventSendingController keep track of whether it's seen then "end" event for the scrolling and momentum phases, and pass this down to WheelEventTestMonitor, which now waits until it sees these, which prevents premature triggering which was a common cause of failure before. Second, remove WheelEventTestMonitor's 1/60s timer and instead have WheelEventTestMonitor test for completion in a callout from the end of Page::updateRendering(), which makes it test and fire at a more consistent time. Third, push WheelEventTestMonitor to the ScrollingTree, so that reasons for deferral can be added on the scrolling thread. This fixes an issue where the RunLoop::main().dispatch() used to send the "ScrollingThreadSyncNeeded" reason to the main thread would get delayed, also resulting in a premature trigger. * DumpRenderTree/mac/EventSendingController.h: * DumpRenderTree/mac/EventSendingController.mm: (-[EventSendingController mouseScrollByX:andY:withWheel:andMomentumPhases:]): (-[EventSendingController monitorWheelEvents]): (-[EventSendingController callAfterScrollingCompletes:]): * DumpRenderTree/win/EventSender.cpp: (mouseScrollBy): * WebKitTestRunner/InjectedBundle/EventSendingController.cpp: (WTR::EventSendingController::mouseScrollByWithWheelAndMomentumPhases): (WTR::EventSendingController::monitorWheelEvents): (WTR::EventSendingController::callAfterScrollingCompletes): * WebKitTestRunner/InjectedBundle/EventSendingController.h: LayoutTests: * platform/mac-wk2/TestExpectations: * platform/win/TestExpectations: * tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-2d-overflow.html: Need to call eventSender.monitorWheelEvents() for each subtest. Canonical link: https://commits.webkit.org/222192@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@258679 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-03-19 04:06:37 +00:00
#if ENABLE(KINETIC_SCROLLING)
m_expectWheelEndOrCancel = expectWheelEndOrCancel;
m_expectMomentumEnd = expectMomentumEnd;
#else
UNUSED_PARAM(expectWheelEndOrCancel);
UNUSED_PARAM(expectMomentumEnd);
#endif
Redundant rendering updates can be scheduled from inside Page::updateRendering() https://bugs.webkit.org/show_bug.cgi?id=216726 Reviewed by Tim Horton. Source/WebCore: The basic model for scheduling rendering updates is that code that needs to trigger an update just calls Page::schedule[Timed]RenderingUpdate(). However, if Page::updateRendering() is already on the stack, and the work to be scheduled will happen later in the current update, we don't have to schedule a new one. To fix this Page::updateRendering() and related functions track which steps remain in the current update, and callers of schedule[Timed]RenderingUpdate() pass the update steps for the work they need to trigger. If the requested steps are included in the remaining steps no new update needs to be scheduled. Note that requesting a step while that step is being executed has to schedule an upate (e.g. requestAnimationFrame inside its own callback has to schedule). At the end of an update, if there are any unfulfilled steps, then we schedule a new update. Add a log channel for EventLoop and and log from various places. In my brief testing, this reduces the number of calls to Page::updateRendering() by 10-25% on some real pages, which could be a significant power saving. * animation/DocumentTimeline.cpp: (WebCore::DocumentTimeline::scheduleAnimationResolution): * display/DisplayLayerController.cpp: (WebCore::Display::LayerController::scheduleRenderingUpdate): * dom/Document.cpp: (WebCore::Document::setNeedsDOMWindowResizeEvent): (WebCore::Document::setNeedsVisualViewportResize): (WebCore::Document::addPendingScrollEventTarget): (WebCore::Document::setNeedsVisualViewportScrollEvent): (WebCore::Document::serviceRequestAnimationFrameCallbacks): (WebCore::Document::intersectionObserversInitialUpdateTimerFired): (WebCore::Document::scheduleRenderingUpdate): (WebCore::Document::scheduleInitialIntersectionObservationUpdate): (WebCore::Document::updateResizeObservations): (WebCore::Document::updateAnimationsAndSendEvents): * dom/Document.h: * dom/ScriptedAnimationController.cpp: (WebCore::ScriptedAnimationController::scheduleAnimation): * page/EventHandler.cpp: (WebCore::EventHandler::scheduleCursorUpdate): * page/FrameView.cpp: (WebCore::FrameView::setViewExposedRect): * page/Page.cpp: (WebCore::Page::updateStyleAfterChangeInEnvironment): (WebCore::Page::scheduleRenderingUpdate): (WebCore::Page::computeUnfulfilledRenderingSteps): (WebCore::Page::triggerRenderingUpdateForTesting): (WebCore::Page::updateRendering): (WebCore::Page::isolatedUpdateRendering): (WebCore::Page::doAfterUpdateRendering): (WebCore::Page::finalizeRenderingUpdate): (WebCore::Page::renderingUpdateCompleted): (WebCore::Page::accessibilitySettingsDidChange): (WebCore::Page::appearanceDidChange): (WebCore::operator<<): * page/Page.h: * page/PageOverlayController.cpp: (WebCore::PageOverlayController::didChangeViewExposedRect): (WebCore::PageOverlayController::notifyFlushRequired): * page/RenderingUpdateScheduler.cpp: (WebCore::RenderingUpdateScheduler::scheduleAnimation): (WebCore::RenderingUpdateScheduler::scheduleRenderingUpdate): (WebCore::RenderingUpdateScheduler::startTimer): (WebCore::RenderingUpdateScheduler::displayRefreshFired): * page/RenderingUpdateScheduler.h: * page/ResizeObserver.cpp: (WebCore::ResizeObserver::observe): * page/WheelEventTestMonitor.cpp: (WebCore::WheelEventTestMonitor::setTestCallbackAndStartMonitoring): (WebCore::WheelEventTestMonitor::scheduleCallbackCheck): * page/mac/ServicesOverlayController.mm: (WebCore::ServicesOverlayController::Highlight::notifyFlushRequired): * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::setEventTrackingRegionsDirty): * page/scrolling/mac/ScrollingCoordinatorMac.mm: (WebCore::ScrollingCoordinatorMac::scheduleTreeStateCommit): * platform/Logging.cpp: (WebCore::initializeLogChannelsIfNecessary): * platform/Logging.h: * rendering/RenderElement.cpp: (WebCore::RenderElement::scheduleRenderingUpdateForImage): * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::notifyFlushRequired): * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::scheduleRenderingUpdate): * rendering/RenderLayerCompositor.h: Source/WebKit: Schedule for layer flush. * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHostTextureMapper.cpp: (WebKit::LayerTreeHost::layerFlushTimerFired): Source/WebKitLegacy/mac: Provide the flags. * WebView/WebView.mm: (-[WebView _scheduleRenderingUpdateForPendingTileCacheRepaint]): Source/WTF: Make it possible to dump Vectors with inline capacity. * wtf/text/TextStream.h: (WTF::operator<<): Canonical link: https://commits.webkit.org/230165@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268075 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-06 21:33:42 +00:00
m_page.scheduleRenderingUpdate(RenderingUpdateStep::WheelEventMonitorCallbacks);
LOG_WITH_STREAM(WheelEventTestMonitor, stream << " WheelEventTestMonitor::setTestCallbackAndStartMonitoring - expect end/cancel " << expectWheelEndOrCancel << ", expect momentum end " << expectMomentumEnd);
Rename WheelEventTestTrigger and improve naming in related code https://bugs.webkit.org/show_bug.cgi?id=202772 Reviewed by Tim Horton. Change the "test trigger" terminology to "monitor wheel events"; after all, tests call monitorWheelEvents() and callAfterScrollingCompletes(), and this is not triggering a test. Source/WebCore: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * page/FrameView.cpp: (WebCore::FrameView::adjustScrollbarsForLayout): (WebCore::FrameView::setScrollPosition): (WebCore::FrameView::didAddScrollbar): * page/Page.cpp: (WebCore::Page::ensureWheelEventTestMonitor): (WebCore::Page::ensureTestTrigger): Deleted. * page/Page.h: (WebCore::Page::wheelEventTestMonitor const): (WebCore::Page::clearWheelEventTestMonitor): (WebCore::Page::isMonitoringWheelEvents const): (WebCore::Page::testTrigger const): Deleted. (WebCore::Page::clearTrigger): Deleted. (WebCore::Page::expectsWheelEventTriggers const): Deleted. * page/WheelEventTestMonitor.cpp: Added. (WebCore::WheelEventTestMonitor::WheelEventTestMonitor): (WebCore::WheelEventTestMonitor::clearAllTestDeferrals): (WebCore::WheelEventTestMonitor::setTestCallbackAndStartNotificationTimer): (WebCore::WheelEventTestMonitor::deferForReason): (WebCore::WheelEventTestMonitor::removeDeferralForReason): (WebCore::WheelEventTestMonitor::triggerTestTimerFired): (WebCore::operator<<): * page/WheelEventTestMonitor.h: Renamed from Source/WebCore/page/WheelEventTestTrigger.h. * page/WheelEventTestTrigger.cpp: Removed. * page/mac/EventHandlerMac.mm: (WebCore::EventHandler::platformPrepareForWheelEvents): * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated): (WebCore::AsyncScrollingCoordinator::updateIsMonitoringWheelEventsForFrameView): (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll): (WebCore::AsyncScrollingCoordinator::deferWheelEventTestCompletionForReason const): (WebCore::AsyncScrollingCoordinator::removeWheelEventTestCompletionDeferralForReason const): (WebCore::AsyncScrollingCoordinator::updateExpectsWheelEventTestTriggerWithFrameView): Deleted. (WebCore::AsyncScrollingCoordinator::deferTestsForReason const): Deleted. (WebCore::AsyncScrollingCoordinator::removeTestDeferralForReason const): Deleted. * page/scrolling/AsyncScrollingCoordinator.h: * page/scrolling/ScrollingCoordinator.h: (WebCore::ScrollingCoordinator::updateIsMonitoringWheelEventsForFrameView): (WebCore::ScrollingCoordinator::updateExpectsWheelEventTestTriggerWithFrameView): Deleted. * page/scrolling/ScrollingStateScrollingNode.cpp: (WebCore::ScrollingStateScrollingNode::ScrollingStateScrollingNode): (WebCore::ScrollingStateScrollingNode::setPropertyChangedBitsAfterReattach): (WebCore::ScrollingStateScrollingNode::setIsMonitoringWheelEvents): (WebCore::ScrollingStateScrollingNode::dumpProperties const): (WebCore::ScrollingStateScrollingNode::setExpectsWheelEventTestTrigger): Deleted. * page/scrolling/ScrollingStateScrollingNode.h: (WebCore::ScrollingStateScrollingNode::isMonitoringWheelEvents const): (WebCore::ScrollingStateScrollingNode::expectsWheelEventTestTrigger const): Deleted. * page/scrolling/ScrollingTree.h: (WebCore::ScrollingTree::deferWheelEventTestCompletionForReason): (WebCore::ScrollingTree::removeWheelEventTestCompletionDeferralForReason): (WebCore::ScrollingTree::deferTestsForReason): Deleted. (WebCore::ScrollingTree::removeTestDeferralForReason): Deleted. * page/scrolling/ScrollingTreeScrollingNode.cpp: (WebCore::ScrollingTreeScrollingNode::commitStateBeforeChildren): * page/scrolling/ScrollingTreeScrollingNode.h: * page/scrolling/ThreadedScrollingTree.cpp: (WebCore::ThreadedScrollingTree::deferWheelEventTestCompletionForReason): (WebCore::ThreadedScrollingTree::removeWheelEventTestCompletionDeferralForReason): (WebCore::ThreadedScrollingTree::deferTestsForReason): Deleted. (WebCore::ThreadedScrollingTree::removeTestDeferralForReason): Deleted. * page/scrolling/ThreadedScrollingTree.h: * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h: * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm: (WebCore::ScrollingTreeScrollingNodeDelegateMac::handleWheelEvent): (WebCore::ScrollingTreeScrollingNodeDelegateMac::deferWheelEventTestCompletionForReason const): (WebCore::ScrollingTreeScrollingNodeDelegateMac::removeWheelEventTestCompletionDeferralForReason const): (WebCore::ScrollingTreeScrollingNodeDelegateMac::deferTestsForReason const): Deleted. (WebCore::ScrollingTreeScrollingNodeDelegateMac::removeTestDeferralForReason const): Deleted. * platform/Logging.h: * platform/ScrollAnimator.cpp: (WebCore::ScrollAnimator::deferWheelEventTestCompletionForReason const): (WebCore::ScrollAnimator::removeWheelEventTestCompletionDeferralForReason const): (WebCore::ScrollAnimator::deferTestsForReason const): Deleted. (WebCore::ScrollAnimator::removeTestDeferralForReason const): Deleted. * platform/ScrollAnimator.h: (WebCore::ScrollAnimator::ScrollAnimator::setWheelEventTestMonitor): (WebCore::ScrollAnimator::ScrollAnimator::setWheelEventTestTrigger): Deleted. * platform/cocoa/ScrollController.h: (WebCore::ScrollControllerClient::deferWheelEventTestCompletionForReason const): (WebCore::ScrollControllerClient::removeWheelEventTestCompletionDeferralForReason const): (WebCore::ScrollControllerClient::deferTestsForReason const): Deleted. (WebCore::ScrollControllerClient::removeTestDeferralForReason const): Deleted. * platform/cocoa/ScrollController.mm: (WebCore::ScrollController::startSnapRubberbandTimer): (WebCore::ScrollController::stopSnapRubberbandTimer): (WebCore::ScrollController::scheduleStatelessScrollSnap): (WebCore::ScrollController::startDeferringWheelEventTestCompletionDueToScrollSnapping): (WebCore::ScrollController::stopDeferringWheelEventTestCompletionDueToScrollSnapping): (WebCore::ScrollController::startScrollSnapTimer): (WebCore::ScrollController::stopScrollSnapTimer): (WebCore::ScrollController::startDeferringTestsDueToScrollSnapping): Deleted. (WebCore::ScrollController::stopDeferringTestsDueToScrollSnapping): Deleted. * platform/mac/ScrollAnimatorMac.mm: (WebCore::ScrollAnimatorMac::didBeginScrollGesture const): (WebCore::ScrollAnimatorMac::didEndScrollGesture const): (WebCore::ScrollAnimatorMac::sendContentAreaScrolledSoon): (WebCore::ScrollAnimatorMac::sendContentAreaScrolledTimerFired): * rendering/RenderBox.cpp: (WebCore::setupWheelEventMonitor): (WebCore::RenderBox::setScrollLeft): (WebCore::RenderBox::setScrollTop): (WebCore::setupWheelEventTestTrigger): Deleted. * rendering/RenderLayer.cpp: (WebCore::RenderLayer::createScrollbar): * rendering/RenderListBox.cpp: (WebCore::setupWheelEventTestMonitor): (WebCore::RenderListBox::setScrollTop): (WebCore::RenderListBox::createScrollbar): (WebCore::setupWheelEventTestTrigger): Deleted. * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::monitorWheelEvents): (WebCoreTestSupport::setTestCallbackAndStartNotificationTimer): (WebCoreTestSupport::clearWheelEventTestMonitor): (WebCoreTestSupport::clearWheelEventTestTrigger): Deleted. * testing/js/WebCoreTestSupport.h: Source/WebKit: * UIProcess/API/C/WKPage.cpp: (WKPageClearWheelEventTestMonitor): (WKPageClearWheelEventTestTrigger): Deleted. * UIProcess/API/C/WKPage.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::clearWheelEventTestMonitor): (WebKit::WebPageProxy::clearWheelEventTestTrigger): Deleted. * UIProcess/WebPageProxy.h: * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageStartMonitoringScrollOperations): (WKBundlePageRegisterScrollOperationCompletionCallback): * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::createScrollbar): * WebProcess/WebPage/EventDispatcher.cpp: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::clearWheelEventTestMonitor): (WebKit::WebPage::clearWheelEventTestTrigger): Deleted. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: Tools: * DumpRenderTree/mac/DumpRenderTree.mm: (resetWebViewToConsistentStateBeforeTesting): * WebKitTestRunner/TestController.cpp: (WTR::TestController::resetStateToConsistentValues): Canonical link: https://commits.webkit.org/216237@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@250946 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-10-10 00:24:44 +00:00
}
void WheelEventTestMonitor::deferForReason(ScrollableAreaIdentifier identifier, DeferReason reason)
{
Use CheckedLock more in WebCore https://bugs.webkit.org/show_bug.cgi?id=226026 Reviewed by Geoffrey Garen. Use CheckedLock more in WebCore to benefit from Clang Thread Safety Analysis. * Modules/indexeddb/IDBObjectStore.cpp: (WebCore::IDBObjectStore::createIndex): (WebCore::IDBObjectStore::index): (WebCore::IDBObjectStore::deleteIndex): (WebCore::IDBObjectStore::rollbackForVersionChangeAbort): (WebCore::IDBObjectStore::visitReferencedIndexes const): (WebCore::IDBObjectStore::renameReferencedIndex): * Modules/indexeddb/IDBObjectStore.h: * Modules/indexeddb/IDBTransaction.cpp: (WebCore::IDBTransaction::objectStore): (WebCore::IDBTransaction::internalAbort): (WebCore::IDBTransaction::createObjectStore): (WebCore::IDBTransaction::renameObjectStore): (WebCore::IDBTransaction::renameIndex): (WebCore::IDBTransaction::deleteObjectStore): (WebCore::IDBTransaction::visitReferencedObjectStores const): * Modules/indexeddb/IDBTransaction.h: * Modules/indexeddb/client/IDBConnectionProxy.cpp: (WebCore::IDBClient::IDBConnectionProxy::openDatabase): (WebCore::IDBClient::IDBConnectionProxy::deleteDatabase): (WebCore::IDBClient::IDBConnectionProxy::completeOpenDBRequest): (WebCore::IDBClient::IDBConnectionProxy::saveOperation): (WebCore::IDBClient::IDBConnectionProxy::completeOperation): (WebCore::IDBClient::IDBConnectionProxy::fireVersionChangeEvent): (WebCore::IDBClient::IDBConnectionProxy::notifyOpenDBRequestBlocked): (WebCore::IDBClient::IDBConnectionProxy::establishTransaction): (WebCore::IDBClient::IDBConnectionProxy::didStartTransaction): (WebCore::IDBClient::IDBConnectionProxy::commitTransaction): (WebCore::IDBClient::IDBConnectionProxy::didCommitTransaction): (WebCore::IDBClient::IDBConnectionProxy::abortTransaction): (WebCore::IDBClient::IDBConnectionProxy::didAbortTransaction): (WebCore::IDBClient::IDBConnectionProxy::didCloseFromServer): (WebCore::IDBClient::IDBConnectionProxy::connectionToServerLost): (WebCore::IDBClient::IDBConnectionProxy::scheduleMainThreadTasks): (WebCore::IDBClient::IDBConnectionProxy::handleMainThreadTasks): (WebCore::IDBClient::IDBConnectionProxy::getAllDatabaseNamesAndVersions): (WebCore::IDBClient::IDBConnectionProxy::didGetAllDatabaseNamesAndVersions): (WebCore::IDBClient::IDBConnectionProxy::registerDatabaseConnection): (WebCore::IDBClient::IDBConnectionProxy::unregisterDatabaseConnection): (WebCore::IDBClient::IDBConnectionProxy::forgetActiveOperations): (WebCore::IDBClient::IDBConnectionProxy::forgetTransaction): (WebCore::IDBClient::IDBConnectionProxy::forgetActivityForCurrentThread): (WebCore::IDBClient::IDBConnectionProxy::setContextSuspended): * Modules/indexeddb/client/IDBConnectionProxy.h: * Modules/mediastream/RTCRtpSFrameTransformer.cpp: (WebCore::RTCRtpSFrameTransformer::setEncryptionKey): (WebCore::RTCRtpSFrameTransformer::decryptFrame): (WebCore::RTCRtpSFrameTransformer::encryptFrame): * Modules/mediastream/RTCRtpSFrameTransformer.h: * Modules/mediastream/RTCRtpScriptTransform.cpp: (WebCore::RTCRtpScriptTransform::setTransformer): (WebCore::RTCRtpScriptTransform::setupTransformer): (WebCore::RTCRtpScriptTransform::clear): * Modules/mediastream/RTCRtpScriptTransform.h: * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.cpp: (WebCore::LibWebRTCDataChannelHandler::setClient): (WebCore::LibWebRTCDataChannelHandler::checkState): (WebCore::LibWebRTCDataChannelHandler::OnMessage): (WebCore::LibWebRTCDataChannelHandler::OnBufferedAmountChange): * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.h: * Modules/mediastream/libwebrtc/LibWebRTCRtpTransformBackend.cpp: (WebCore::LibWebRTCRtpTransformBackend::setInputCallback): (WebCore::LibWebRTCRtpTransformBackend::setOutputCallback): (WebCore::LibWebRTCRtpTransformBackend::processTransformedFrame): (WebCore::LibWebRTCRtpTransformBackend::Transform): * Modules/mediastream/libwebrtc/LibWebRTCRtpTransformBackend.h: * inspector/agents/WebHeapAgent.cpp: (WebCore::SendGarbageCollectionEventsTask::addGarbageCollection): (WebCore::SendGarbageCollectionEventsTask::reset): (WebCore::SendGarbageCollectionEventsTask::timerFired): * page/ResourceUsageThread.cpp: (WebCore::ResourceUsageThread::addObserver): (WebCore::ResourceUsageThread::removeObserver): (WebCore::ResourceUsageThread::waitUntilObservers): (WebCore::ResourceUsageThread::notifyObservers): * page/ResourceUsageThread.h: * page/WheelEventTestMonitor.cpp: (WebCore::WheelEventTestMonitor::clearAllTestDeferrals): (WebCore::WheelEventTestMonitor::setTestCallbackAndStartMonitoring): (WebCore::WheelEventTestMonitor::deferForReason): (WebCore::WheelEventTestMonitor::removeDeferralForReason): (WebCore::WheelEventTestMonitor::receivedWheelEvent): (WebCore::WheelEventTestMonitor::checkShouldFireCallbacks): * page/WheelEventTestMonitor.h: (WebCore::WheelEventTestMonitor::WTF_GUARDED_BY_LOCK): * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::computeWheelProcessingSteps): (WebCore::ScrollingTree::determineWheelEventProcessing): (WebCore::ScrollingTree::handleWheelEvent): (WebCore::ScrollingTree::commitTreeState): (WebCore::ScrollingTree::mainFrameScrollPosition const): (WebCore::ScrollingTree::setMainFrameScrollPosition): (WebCore::ScrollingTree::setGestureState): (WebCore::ScrollingTree::gestureState): (WebCore::ScrollingTree::eventTrackingTypeForPoint): (WebCore::ScrollingTree::isRubberBandInProgressForNode): (WebCore::ScrollingTree::setRubberBandingInProgressForNode): (WebCore::ScrollingTree::isUserScrollInProgressForNode): (WebCore::ScrollingTree::setUserScrollInProgressForNode): (WebCore::ScrollingTree::clearNodesWithUserScrollInProgress): (WebCore::ScrollingTree::isScrollSnapInProgressForNode): (WebCore::ScrollingTree::setNodeScrollSnapInProgress): (WebCore::ScrollingTree::setMainFramePinnedState): (WebCore::ScrollingTree::setMainFrameCanRubberBand): (WebCore::ScrollingTree::mainFrameCanRubberBandInDirection): (WebCore::ScrollingTree::addPendingScrollUpdate): (WebCore::ScrollingTree::takePendingScrollUpdates): (WebCore::ScrollingTree::setScrollPinningBehavior): (WebCore::ScrollingTree::scrollPinningBehavior): (WebCore::ScrollingTree::willWheelEventStartSwipeGesture): (WebCore::ScrollingTree::windowScreenDidChange): (WebCore::ScrollingTree::displayID): (WebCore::ScrollingTree::hasProcessedWheelEventsRecently): (WebCore::ScrollingTree::willProcessWheelEvent): (WebCore::ScrollingTree::nominalFramesPerSecond): (WebCore::ScrollingTree::scrollingTreeAsText): * page/scrolling/ScrollingTree.h: * page/scrolling/ScrollingTreeLatchingController.cpp: (WebCore::ScrollingTreeLatchingController::receivedWheelEvent): (WebCore::ScrollingTreeLatchingController::latchingDataForEvent const): (WebCore::ScrollingTreeLatchingController::latchedNodeID const): (WebCore::ScrollingTreeLatchingController::latchedNodeAndSteps const): (WebCore::ScrollingTreeLatchingController::nodeDidHandleEvent): (WebCore::ScrollingTreeLatchingController::nodeWasRemoved): (WebCore::ScrollingTreeLatchingController::clearLatchedNode): * page/scrolling/ScrollingTreeLatchingController.h: * platform/audio/HRTFDatabaseLoader.cpp: (WebCore::HRTFDatabaseLoader::loadAsynchronously): (WebCore::HRTFDatabaseLoader::waitForLoaderThreadCompletion): * platform/audio/HRTFDatabaseLoader.h: * platform/audio/cocoa/AudioDestinationCocoa.cpp: (WebCore::AudioDestinationCocoa::hasEnoughFrames const): (WebCore::AudioDestinationCocoa::render): (WebCore::AudioDestinationCocoa::renderOnRenderingThead): * platform/audio/cocoa/AudioDestinationCocoa.h: * platform/encryptedmedia/CDMProxy.cpp: (WebCore::CDMProxy::instance const): (WebCore::CDMProxy::setInstance): (WebCore::CDMProxy::startedWaitingForKey const): (WebCore::CDMProxy::stoppedWaitingForKey const): * platform/encryptedmedia/CDMProxy.h: * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp: (WebCore::MediaPlayerPrivateAVFoundation::MediaPlayerPrivateAVFoundation): (WebCore::MediaPlayerPrivateAVFoundation::setDelayCallbacks const): (WebCore::MediaPlayerPrivateAVFoundation::clearMainThreadPendingFlag): (WebCore::MediaPlayerPrivateAVFoundation::scheduleMainThreadNotification): (WebCore::MediaPlayerPrivateAVFoundation::dispatchNotification): * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm: (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::processNewVideoSample): * platform/graphics/cg/IOSurfacePool.cpp: (WebCore::IOSurfacePool::takeSurface): (WebCore::IOSurfacePool::addSurface): (WebCore::IOSurfacePool::setPoolSize): (WebCore::IOSurfacePool::collectionTimerFired): (WebCore::IOSurfacePool::discardAllSurfaces): * platform/graphics/cg/IOSurfacePool.h: (WebCore::IOSurfacePool::WTF_GUARDED_BY_LOCK): * platform/graphics/cg/SubimageCacheWithTimer.cpp: (WebCore::SubimageCacheWithTimer::pruneCacheTimerFired): (WebCore::SubimageCacheWithTimer::subimage): (WebCore::SubimageCacheWithTimer::clearImageAndSubimages): (WebCore::SubimageCacheWithTimer::clearAll): * platform/graphics/cg/SubimageCacheWithTimer.h: * platform/graphics/cocoa/FontCacheCoreText.cpp: (WebCore::FontDatabase::collectionForFamily): (WebCore::FontDatabase::clear): * platform/network/cocoa/WebCoreNSURLSession.mm: (WebCore::WebCoreNSURLSessionDataTaskClient::clearTask): (WebCore::WebCoreNSURLSessionDataTaskClient::dataSent): (WebCore::WebCoreNSURLSessionDataTaskClient::responseReceived): (WebCore::WebCoreNSURLSessionDataTaskClient::shouldCacheResponse): (WebCore::WebCoreNSURLSessionDataTaskClient::dataReceived): (WebCore::WebCoreNSURLSessionDataTaskClient::redirectReceived): (WebCore::WebCoreNSURLSessionDataTaskClient::accessControlCheckFailed): (WebCore::WebCoreNSURLSessionDataTaskClient::loadFailed): (WebCore::WebCoreNSURLSessionDataTaskClient::loadFinished): * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.h: * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm: (-[WebCoreResourceHandleAsOperationQueueDelegate detachHandle]): (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willSendRequest:redirectResponse:]): (-[WebCoreResourceHandleAsOperationQueueDelegate connection:canAuthenticateAgainstProtectionSpace:]): (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willCacheResponse:]): * storage/StorageQuotaManager.cpp: (WebCore::StorageQuotaManager::requestSpaceOnBackgroundThread): (WebCore::StorageQuotaManager::resetQuotaUpdatedBasedOnUsageForTesting): (WebCore::StorageQuotaManager::resetQuotaForTesting): * storage/StorageQuotaManager.h: (WebCore::StorageQuotaManager::WTF_GUARDED_BY_LOCK): * workers/WorkerOrWorkletScriptController.cpp: (WebCore::WorkerOrWorkletScriptController::scheduleExecutionTermination): (WebCore::WorkerOrWorkletScriptController::isTerminatingExecution const): * workers/WorkerOrWorkletScriptController.h: (WebCore::WorkerOrWorkletScriptController::WTF_GUARDED_BY_LOCK): Canonical link: https://commits.webkit.org/237960@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277805 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-20 18:41:33 +00:00
Locker locker { m_lock };
eventSender.monitorWheelEvents() is very fragile https://bugs.webkit.org/show_bug.cgi?id=197819 <rdar://problem/51319456> Reviewed by Tim Horton. Source/WebCore: Deflake tests using eventSender.monitorWheelEvents() by fixing several causes of flakiness, adding back changes from r257844 that were reverted in r258558. First, have EventSendingController keep track of whether it's seen then "end" event for the scrolling and momentum phases, and pass this down to WheelEventTestMonitor, which now waits until it sees these, which prevents premature triggering which was a common cause of failure before. Second, remove WheelEventTestMonitor's 1/60s timer and instead have WheelEventTestMonitor test for completion in a callout from the end of Page::updateRendering(), which makes it test and fire at a more consistent time. Third, push WheelEventTestMonitor to the ScrollingTree, so that reasons for deferral can be added on the scrolling thread. This fixes an issue where the RunLoop::main().dispatch() used to send the "ScrollingThreadSyncNeeded" reason to the main thread would get delayed, also resulting in a premature trigger. * Modules/applepay/ApplePaySession.cpp: Unified sources! * dom/WindowEventLoop.cpp: Unified sources! * page/EventHandler.cpp: (WebCore::EventHandler::handleWheelEvent): * page/FrameView.cpp: (WebCore::FrameView::scrollOffsetChangedViaPlatformWidgetImpl): * page/Page.cpp: (WebCore::Page::doAfterUpdateRendering): (WebCore::Page::wheelEventTestMonitor const): (WebCore::Page::clearWheelEventTestMonitor): (WebCore::Page::isMonitoringWheelEvents const): (WebCore::Page::ensureWheelEventTestMonitor): * page/Page.h: (WebCore::Page::wheelEventTestMonitor const): Deleted. (WebCore::Page::clearWheelEventTestMonitor): Deleted. (WebCore::Page::isMonitoringWheelEvents const): Deleted. * page/WheelEventTestMonitor.cpp: (WebCore::WheelEventTestMonitor::WheelEventTestMonitor): (WebCore::WheelEventTestMonitor::clearAllTestDeferrals): (WebCore::WheelEventTestMonitor::setTestCallbackAndStartMonitoring): (WebCore::WheelEventTestMonitor::deferForReason): (WebCore::WheelEventTestMonitor::removeDeferralForReason): (WebCore::WheelEventTestMonitor::receivedWheelEvent): (WebCore::WheelEventTestMonitor::scheduleCallbackCheck): (WebCore::WheelEventTestMonitor::checkShouldFireCallbacks): (WebCore::operator<<): (WebCore::WheelEventTestMonitor::setTestCallbackAndStartNotificationTimer): Deleted. (WebCore::WheelEventTestMonitor::triggerTestTimerFired): Deleted. * page/WheelEventTestMonitor.h: (WebCore::WheelEventTestMonitorCompletionDeferrer::WheelEventTestMonitorCompletionDeferrer): (WebCore::WheelEventTestMonitorCompletionDeferrer::~WheelEventTestMonitorCompletionDeferrer): * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated): (WebCore::AsyncScrollingCoordinator::deferWheelEventTestCompletionForReason const): Deleted. (WebCore::AsyncScrollingCoordinator::removeWheelEventTestCompletionDeferralForReason const): Deleted. * page/scrolling/AsyncScrollingCoordinator.h: * page/scrolling/ScrollingCoordinator.h: (WebCore::ScrollingCoordinator::startMonitoringWheelEvents): (WebCore::ScrollingCoordinator::stopMonitoringWheelEvents): * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::handleWheelEvent): * page/scrolling/ScrollingTree.h: (WebCore::ScrollingTree::setWheelEventTestMonitor): (WebCore::ScrollingTree::receivedWheelEvent): * page/scrolling/ThreadedScrollingTree.cpp: (WebCore::ThreadedScrollingTree::scrollingTreeNodeDidScroll): (WebCore::ThreadedScrollingTree::deferWheelEventTestCompletionForReason): Deleted. (WebCore::ThreadedScrollingTree::removeWheelEventTestCompletionDeferralForReason): Deleted. * page/scrolling/ThreadedScrollingTree.h: * page/scrolling/mac/ScrollingCoordinatorMac.h: * page/scrolling/mac/ScrollingCoordinatorMac.mm: (WebCore::ScrollingCoordinatorMac::startMonitoringWheelEvents): (WebCore::ScrollingCoordinatorMac::stopMonitoringWheelEvents): * page/scrolling/mac/ScrollingTreeMac.h: * page/scrolling/mac/ScrollingTreeMac.mm: (ScrollingTreeMac::setWheelEventTestMonitor): (ScrollingTreeMac::receivedWheelEvent): (ScrollingTreeMac::deferWheelEventTestCompletionForReason): (ScrollingTreeMac::removeWheelEventTestCompletionDeferralForReason): * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm: (WebCore::ScrollingTreeScrollingNodeDelegateMac::deferWheelEventTestCompletionForReason const): (WebCore::ScrollingTreeScrollingNodeDelegateMac::removeWheelEventTestCompletionDeferralForReason const): * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::setWheelEventMonitorTestCallbackAndStartMonitoring): (WebCoreTestSupport::setTestCallbackAndStartNotificationTimer): Deleted. * testing/js/WebCoreTestSupport.h: Source/WebKit: Deflake tests using eventSender.monitorWheelEvents() by fixing several causes of flakiness, adding back changes from r257844 that were reverted in r258558. First, have EventSendingController keep track of whether it's seen then "end" event for the scrolling and momentum phases, and pass this down to WheelEventTestMonitor, which now waits until it sees these, which prevents premature triggering which was a common cause of failure before. Second, remove WheelEventTestMonitor's 1/60s timer and instead have WheelEventTestMonitor test for completion in a callout from the end of Page::updateRendering(), which makes it test and fire at a more consistent time. Third, push WheelEventTestMonitor to the ScrollingTree, so that reasons for deferral can be added on the scrolling thread. This fixes an issue where the RunLoop::main().dispatch() used to send the "ScrollingThreadSyncNeeded" reason to the main thread would get delayed, also resulting in a premature trigger. * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageRegisterScrollOperationCompletionCallback): * WebProcess/InjectedBundle/API/c/WKBundlePage.h: Tools: Deflake tests using eventSender.monitorWheelEvents() by fixing several causes of flakiness, adding back changes from r257844 that were reverted in r258558. First, have EventSendingController keep track of whether it's seen then "end" event for the scrolling and momentum phases, and pass this down to WheelEventTestMonitor, which now waits until it sees these, which prevents premature triggering which was a common cause of failure before. Second, remove WheelEventTestMonitor's 1/60s timer and instead have WheelEventTestMonitor test for completion in a callout from the end of Page::updateRendering(), which makes it test and fire at a more consistent time. Third, push WheelEventTestMonitor to the ScrollingTree, so that reasons for deferral can be added on the scrolling thread. This fixes an issue where the RunLoop::main().dispatch() used to send the "ScrollingThreadSyncNeeded" reason to the main thread would get delayed, also resulting in a premature trigger. * DumpRenderTree/mac/EventSendingController.h: * DumpRenderTree/mac/EventSendingController.mm: (-[EventSendingController mouseScrollByX:andY:withWheel:andMomentumPhases:]): (-[EventSendingController monitorWheelEvents]): (-[EventSendingController callAfterScrollingCompletes:]): * DumpRenderTree/win/EventSender.cpp: (mouseScrollBy): * WebKitTestRunner/InjectedBundle/EventSendingController.cpp: (WTR::EventSendingController::mouseScrollByWithWheelAndMomentumPhases): (WTR::EventSendingController::monitorWheelEvents): (WTR::EventSendingController::callAfterScrollingCompletes): * WebKitTestRunner/InjectedBundle/EventSendingController.h: LayoutTests: * platform/mac-wk2/TestExpectations: * platform/win/TestExpectations: * tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-2d-overflow.html: Need to call eventSender.monitorWheelEvents() for each subtest. Canonical link: https://commits.webkit.org/222192@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@258679 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-03-19 04:06:37 +00:00
Rename WheelEventTestTrigger and improve naming in related code https://bugs.webkit.org/show_bug.cgi?id=202772 Reviewed by Tim Horton. Change the "test trigger" terminology to "monitor wheel events"; after all, tests call monitorWheelEvents() and callAfterScrollingCompletes(), and this is not triggering a test. Source/WebCore: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * page/FrameView.cpp: (WebCore::FrameView::adjustScrollbarsForLayout): (WebCore::FrameView::setScrollPosition): (WebCore::FrameView::didAddScrollbar): * page/Page.cpp: (WebCore::Page::ensureWheelEventTestMonitor): (WebCore::Page::ensureTestTrigger): Deleted. * page/Page.h: (WebCore::Page::wheelEventTestMonitor const): (WebCore::Page::clearWheelEventTestMonitor): (WebCore::Page::isMonitoringWheelEvents const): (WebCore::Page::testTrigger const): Deleted. (WebCore::Page::clearTrigger): Deleted. (WebCore::Page::expectsWheelEventTriggers const): Deleted. * page/WheelEventTestMonitor.cpp: Added. (WebCore::WheelEventTestMonitor::WheelEventTestMonitor): (WebCore::WheelEventTestMonitor::clearAllTestDeferrals): (WebCore::WheelEventTestMonitor::setTestCallbackAndStartNotificationTimer): (WebCore::WheelEventTestMonitor::deferForReason): (WebCore::WheelEventTestMonitor::removeDeferralForReason): (WebCore::WheelEventTestMonitor::triggerTestTimerFired): (WebCore::operator<<): * page/WheelEventTestMonitor.h: Renamed from Source/WebCore/page/WheelEventTestTrigger.h. * page/WheelEventTestTrigger.cpp: Removed. * page/mac/EventHandlerMac.mm: (WebCore::EventHandler::platformPrepareForWheelEvents): * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated): (WebCore::AsyncScrollingCoordinator::updateIsMonitoringWheelEventsForFrameView): (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll): (WebCore::AsyncScrollingCoordinator::deferWheelEventTestCompletionForReason const): (WebCore::AsyncScrollingCoordinator::removeWheelEventTestCompletionDeferralForReason const): (WebCore::AsyncScrollingCoordinator::updateExpectsWheelEventTestTriggerWithFrameView): Deleted. (WebCore::AsyncScrollingCoordinator::deferTestsForReason const): Deleted. (WebCore::AsyncScrollingCoordinator::removeTestDeferralForReason const): Deleted. * page/scrolling/AsyncScrollingCoordinator.h: * page/scrolling/ScrollingCoordinator.h: (WebCore::ScrollingCoordinator::updateIsMonitoringWheelEventsForFrameView): (WebCore::ScrollingCoordinator::updateExpectsWheelEventTestTriggerWithFrameView): Deleted. * page/scrolling/ScrollingStateScrollingNode.cpp: (WebCore::ScrollingStateScrollingNode::ScrollingStateScrollingNode): (WebCore::ScrollingStateScrollingNode::setPropertyChangedBitsAfterReattach): (WebCore::ScrollingStateScrollingNode::setIsMonitoringWheelEvents): (WebCore::ScrollingStateScrollingNode::dumpProperties const): (WebCore::ScrollingStateScrollingNode::setExpectsWheelEventTestTrigger): Deleted. * page/scrolling/ScrollingStateScrollingNode.h: (WebCore::ScrollingStateScrollingNode::isMonitoringWheelEvents const): (WebCore::ScrollingStateScrollingNode::expectsWheelEventTestTrigger const): Deleted. * page/scrolling/ScrollingTree.h: (WebCore::ScrollingTree::deferWheelEventTestCompletionForReason): (WebCore::ScrollingTree::removeWheelEventTestCompletionDeferralForReason): (WebCore::ScrollingTree::deferTestsForReason): Deleted. (WebCore::ScrollingTree::removeTestDeferralForReason): Deleted. * page/scrolling/ScrollingTreeScrollingNode.cpp: (WebCore::ScrollingTreeScrollingNode::commitStateBeforeChildren): * page/scrolling/ScrollingTreeScrollingNode.h: * page/scrolling/ThreadedScrollingTree.cpp: (WebCore::ThreadedScrollingTree::deferWheelEventTestCompletionForReason): (WebCore::ThreadedScrollingTree::removeWheelEventTestCompletionDeferralForReason): (WebCore::ThreadedScrollingTree::deferTestsForReason): Deleted. (WebCore::ThreadedScrollingTree::removeTestDeferralForReason): Deleted. * page/scrolling/ThreadedScrollingTree.h: * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h: * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm: (WebCore::ScrollingTreeScrollingNodeDelegateMac::handleWheelEvent): (WebCore::ScrollingTreeScrollingNodeDelegateMac::deferWheelEventTestCompletionForReason const): (WebCore::ScrollingTreeScrollingNodeDelegateMac::removeWheelEventTestCompletionDeferralForReason const): (WebCore::ScrollingTreeScrollingNodeDelegateMac::deferTestsForReason const): Deleted. (WebCore::ScrollingTreeScrollingNodeDelegateMac::removeTestDeferralForReason const): Deleted. * platform/Logging.h: * platform/ScrollAnimator.cpp: (WebCore::ScrollAnimator::deferWheelEventTestCompletionForReason const): (WebCore::ScrollAnimator::removeWheelEventTestCompletionDeferralForReason const): (WebCore::ScrollAnimator::deferTestsForReason const): Deleted. (WebCore::ScrollAnimator::removeTestDeferralForReason const): Deleted. * platform/ScrollAnimator.h: (WebCore::ScrollAnimator::ScrollAnimator::setWheelEventTestMonitor): (WebCore::ScrollAnimator::ScrollAnimator::setWheelEventTestTrigger): Deleted. * platform/cocoa/ScrollController.h: (WebCore::ScrollControllerClient::deferWheelEventTestCompletionForReason const): (WebCore::ScrollControllerClient::removeWheelEventTestCompletionDeferralForReason const): (WebCore::ScrollControllerClient::deferTestsForReason const): Deleted. (WebCore::ScrollControllerClient::removeTestDeferralForReason const): Deleted. * platform/cocoa/ScrollController.mm: (WebCore::ScrollController::startSnapRubberbandTimer): (WebCore::ScrollController::stopSnapRubberbandTimer): (WebCore::ScrollController::scheduleStatelessScrollSnap): (WebCore::ScrollController::startDeferringWheelEventTestCompletionDueToScrollSnapping): (WebCore::ScrollController::stopDeferringWheelEventTestCompletionDueToScrollSnapping): (WebCore::ScrollController::startScrollSnapTimer): (WebCore::ScrollController::stopScrollSnapTimer): (WebCore::ScrollController::startDeferringTestsDueToScrollSnapping): Deleted. (WebCore::ScrollController::stopDeferringTestsDueToScrollSnapping): Deleted. * platform/mac/ScrollAnimatorMac.mm: (WebCore::ScrollAnimatorMac::didBeginScrollGesture const): (WebCore::ScrollAnimatorMac::didEndScrollGesture const): (WebCore::ScrollAnimatorMac::sendContentAreaScrolledSoon): (WebCore::ScrollAnimatorMac::sendContentAreaScrolledTimerFired): * rendering/RenderBox.cpp: (WebCore::setupWheelEventMonitor): (WebCore::RenderBox::setScrollLeft): (WebCore::RenderBox::setScrollTop): (WebCore::setupWheelEventTestTrigger): Deleted. * rendering/RenderLayer.cpp: (WebCore::RenderLayer::createScrollbar): * rendering/RenderListBox.cpp: (WebCore::setupWheelEventTestMonitor): (WebCore::RenderListBox::setScrollTop): (WebCore::RenderListBox::createScrollbar): (WebCore::setupWheelEventTestTrigger): Deleted. * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::monitorWheelEvents): (WebCoreTestSupport::setTestCallbackAndStartNotificationTimer): (WebCoreTestSupport::clearWheelEventTestMonitor): (WebCoreTestSupport::clearWheelEventTestTrigger): Deleted. * testing/js/WebCoreTestSupport.h: Source/WebKit: * UIProcess/API/C/WKPage.cpp: (WKPageClearWheelEventTestMonitor): (WKPageClearWheelEventTestTrigger): Deleted. * UIProcess/API/C/WKPage.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::clearWheelEventTestMonitor): (WebKit::WebPageProxy::clearWheelEventTestTrigger): Deleted. * UIProcess/WebPageProxy.h: * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageStartMonitoringScrollOperations): (WKBundlePageRegisterScrollOperationCompletionCallback): * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::createScrollbar): * WebProcess/WebPage/EventDispatcher.cpp: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::clearWheelEventTestMonitor): (WebKit::WebPage::clearWheelEventTestTrigger): Deleted. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: Tools: * DumpRenderTree/mac/DumpRenderTree.mm: (resetWebViewToConsistentStateBeforeTesting): * WebKitTestRunner/TestController.cpp: (WTR::TestController::resetStateToConsistentValues): Canonical link: https://commits.webkit.org/216237@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@250946 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-10-10 00:24:44 +00:00
m_deferCompletionReasons.ensure(identifier, [] {
return OptionSet<DeferReason>();
}).iterator->value.add(reason);
eventSender.monitorWheelEvents() is very fragile https://bugs.webkit.org/show_bug.cgi?id=197819 <rdar://problem/51319456> Reviewed by Tim Horton. Source/WebCore: Deflake tests using eventSender.monitorWheelEvents() by fixing several causes of flakiness, adding back changes from r257844 that were reverted in r258558. First, have EventSendingController keep track of whether it's seen then "end" event for the scrolling and momentum phases, and pass this down to WheelEventTestMonitor, which now waits until it sees these, which prevents premature triggering which was a common cause of failure before. Second, remove WheelEventTestMonitor's 1/60s timer and instead have WheelEventTestMonitor test for completion in a callout from the end of Page::updateRendering(), which makes it test and fire at a more consistent time. Third, push WheelEventTestMonitor to the ScrollingTree, so that reasons for deferral can be added on the scrolling thread. This fixes an issue where the RunLoop::main().dispatch() used to send the "ScrollingThreadSyncNeeded" reason to the main thread would get delayed, also resulting in a premature trigger. * Modules/applepay/ApplePaySession.cpp: Unified sources! * dom/WindowEventLoop.cpp: Unified sources! * page/EventHandler.cpp: (WebCore::EventHandler::handleWheelEvent): * page/FrameView.cpp: (WebCore::FrameView::scrollOffsetChangedViaPlatformWidgetImpl): * page/Page.cpp: (WebCore::Page::doAfterUpdateRendering): (WebCore::Page::wheelEventTestMonitor const): (WebCore::Page::clearWheelEventTestMonitor): (WebCore::Page::isMonitoringWheelEvents const): (WebCore::Page::ensureWheelEventTestMonitor): * page/Page.h: (WebCore::Page::wheelEventTestMonitor const): Deleted. (WebCore::Page::clearWheelEventTestMonitor): Deleted. (WebCore::Page::isMonitoringWheelEvents const): Deleted. * page/WheelEventTestMonitor.cpp: (WebCore::WheelEventTestMonitor::WheelEventTestMonitor): (WebCore::WheelEventTestMonitor::clearAllTestDeferrals): (WebCore::WheelEventTestMonitor::setTestCallbackAndStartMonitoring): (WebCore::WheelEventTestMonitor::deferForReason): (WebCore::WheelEventTestMonitor::removeDeferralForReason): (WebCore::WheelEventTestMonitor::receivedWheelEvent): (WebCore::WheelEventTestMonitor::scheduleCallbackCheck): (WebCore::WheelEventTestMonitor::checkShouldFireCallbacks): (WebCore::operator<<): (WebCore::WheelEventTestMonitor::setTestCallbackAndStartNotificationTimer): Deleted. (WebCore::WheelEventTestMonitor::triggerTestTimerFired): Deleted. * page/WheelEventTestMonitor.h: (WebCore::WheelEventTestMonitorCompletionDeferrer::WheelEventTestMonitorCompletionDeferrer): (WebCore::WheelEventTestMonitorCompletionDeferrer::~WheelEventTestMonitorCompletionDeferrer): * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated): (WebCore::AsyncScrollingCoordinator::deferWheelEventTestCompletionForReason const): Deleted. (WebCore::AsyncScrollingCoordinator::removeWheelEventTestCompletionDeferralForReason const): Deleted. * page/scrolling/AsyncScrollingCoordinator.h: * page/scrolling/ScrollingCoordinator.h: (WebCore::ScrollingCoordinator::startMonitoringWheelEvents): (WebCore::ScrollingCoordinator::stopMonitoringWheelEvents): * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::handleWheelEvent): * page/scrolling/ScrollingTree.h: (WebCore::ScrollingTree::setWheelEventTestMonitor): (WebCore::ScrollingTree::receivedWheelEvent): * page/scrolling/ThreadedScrollingTree.cpp: (WebCore::ThreadedScrollingTree::scrollingTreeNodeDidScroll): (WebCore::ThreadedScrollingTree::deferWheelEventTestCompletionForReason): Deleted. (WebCore::ThreadedScrollingTree::removeWheelEventTestCompletionDeferralForReason): Deleted. * page/scrolling/ThreadedScrollingTree.h: * page/scrolling/mac/ScrollingCoordinatorMac.h: * page/scrolling/mac/ScrollingCoordinatorMac.mm: (WebCore::ScrollingCoordinatorMac::startMonitoringWheelEvents): (WebCore::ScrollingCoordinatorMac::stopMonitoringWheelEvents): * page/scrolling/mac/ScrollingTreeMac.h: * page/scrolling/mac/ScrollingTreeMac.mm: (ScrollingTreeMac::setWheelEventTestMonitor): (ScrollingTreeMac::receivedWheelEvent): (ScrollingTreeMac::deferWheelEventTestCompletionForReason): (ScrollingTreeMac::removeWheelEventTestCompletionDeferralForReason): * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm: (WebCore::ScrollingTreeScrollingNodeDelegateMac::deferWheelEventTestCompletionForReason const): (WebCore::ScrollingTreeScrollingNodeDelegateMac::removeWheelEventTestCompletionDeferralForReason const): * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::setWheelEventMonitorTestCallbackAndStartMonitoring): (WebCoreTestSupport::setTestCallbackAndStartNotificationTimer): Deleted. * testing/js/WebCoreTestSupport.h: Source/WebKit: Deflake tests using eventSender.monitorWheelEvents() by fixing several causes of flakiness, adding back changes from r257844 that were reverted in r258558. First, have EventSendingController keep track of whether it's seen then "end" event for the scrolling and momentum phases, and pass this down to WheelEventTestMonitor, which now waits until it sees these, which prevents premature triggering which was a common cause of failure before. Second, remove WheelEventTestMonitor's 1/60s timer and instead have WheelEventTestMonitor test for completion in a callout from the end of Page::updateRendering(), which makes it test and fire at a more consistent time. Third, push WheelEventTestMonitor to the ScrollingTree, so that reasons for deferral can be added on the scrolling thread. This fixes an issue where the RunLoop::main().dispatch() used to send the "ScrollingThreadSyncNeeded" reason to the main thread would get delayed, also resulting in a premature trigger. * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageRegisterScrollOperationCompletionCallback): * WebProcess/InjectedBundle/API/c/WKBundlePage.h: Tools: Deflake tests using eventSender.monitorWheelEvents() by fixing several causes of flakiness, adding back changes from r257844 that were reverted in r258558. First, have EventSendingController keep track of whether it's seen then "end" event for the scrolling and momentum phases, and pass this down to WheelEventTestMonitor, which now waits until it sees these, which prevents premature triggering which was a common cause of failure before. Second, remove WheelEventTestMonitor's 1/60s timer and instead have WheelEventTestMonitor test for completion in a callout from the end of Page::updateRendering(), which makes it test and fire at a more consistent time. Third, push WheelEventTestMonitor to the ScrollingTree, so that reasons for deferral can be added on the scrolling thread. This fixes an issue where the RunLoop::main().dispatch() used to send the "ScrollingThreadSyncNeeded" reason to the main thread would get delayed, also resulting in a premature trigger. * DumpRenderTree/mac/EventSendingController.h: * DumpRenderTree/mac/EventSendingController.mm: (-[EventSendingController mouseScrollByX:andY:withWheel:andMomentumPhases:]): (-[EventSendingController monitorWheelEvents]): (-[EventSendingController callAfterScrollingCompletes:]): * DumpRenderTree/win/EventSender.cpp: (mouseScrollBy): * WebKitTestRunner/InjectedBundle/EventSendingController.cpp: (WTR::EventSendingController::mouseScrollByWithWheelAndMomentumPhases): (WTR::EventSendingController::monitorWheelEvents): (WTR::EventSendingController::callAfterScrollingCompletes): * WebKitTestRunner/InjectedBundle/EventSendingController.h: LayoutTests: * platform/mac-wk2/TestExpectations: * platform/win/TestExpectations: * tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-2d-overflow.html: Need to call eventSender.monitorWheelEvents() for each subtest. Canonical link: https://commits.webkit.org/222192@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@258679 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-03-19 04:06:37 +00:00
m_everHadDeferral = true;
Rename WheelEventTestTrigger and improve naming in related code https://bugs.webkit.org/show_bug.cgi?id=202772 Reviewed by Tim Horton. Change the "test trigger" terminology to "monitor wheel events"; after all, tests call monitorWheelEvents() and callAfterScrollingCompletes(), and this is not triggering a test. Source/WebCore: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * page/FrameView.cpp: (WebCore::FrameView::adjustScrollbarsForLayout): (WebCore::FrameView::setScrollPosition): (WebCore::FrameView::didAddScrollbar): * page/Page.cpp: (WebCore::Page::ensureWheelEventTestMonitor): (WebCore::Page::ensureTestTrigger): Deleted. * page/Page.h: (WebCore::Page::wheelEventTestMonitor const): (WebCore::Page::clearWheelEventTestMonitor): (WebCore::Page::isMonitoringWheelEvents const): (WebCore::Page::testTrigger const): Deleted. (WebCore::Page::clearTrigger): Deleted. (WebCore::Page::expectsWheelEventTriggers const): Deleted. * page/WheelEventTestMonitor.cpp: Added. (WebCore::WheelEventTestMonitor::WheelEventTestMonitor): (WebCore::WheelEventTestMonitor::clearAllTestDeferrals): (WebCore::WheelEventTestMonitor::setTestCallbackAndStartNotificationTimer): (WebCore::WheelEventTestMonitor::deferForReason): (WebCore::WheelEventTestMonitor::removeDeferralForReason): (WebCore::WheelEventTestMonitor::triggerTestTimerFired): (WebCore::operator<<): * page/WheelEventTestMonitor.h: Renamed from Source/WebCore/page/WheelEventTestTrigger.h. * page/WheelEventTestTrigger.cpp: Removed. * page/mac/EventHandlerMac.mm: (WebCore::EventHandler::platformPrepareForWheelEvents): * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated): (WebCore::AsyncScrollingCoordinator::updateIsMonitoringWheelEventsForFrameView): (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll): (WebCore::AsyncScrollingCoordinator::deferWheelEventTestCompletionForReason const): (WebCore::AsyncScrollingCoordinator::removeWheelEventTestCompletionDeferralForReason const): (WebCore::AsyncScrollingCoordinator::updateExpectsWheelEventTestTriggerWithFrameView): Deleted. (WebCore::AsyncScrollingCoordinator::deferTestsForReason const): Deleted. (WebCore::AsyncScrollingCoordinator::removeTestDeferralForReason const): Deleted. * page/scrolling/AsyncScrollingCoordinator.h: * page/scrolling/ScrollingCoordinator.h: (WebCore::ScrollingCoordinator::updateIsMonitoringWheelEventsForFrameView): (WebCore::ScrollingCoordinator::updateExpectsWheelEventTestTriggerWithFrameView): Deleted. * page/scrolling/ScrollingStateScrollingNode.cpp: (WebCore::ScrollingStateScrollingNode::ScrollingStateScrollingNode): (WebCore::ScrollingStateScrollingNode::setPropertyChangedBitsAfterReattach): (WebCore::ScrollingStateScrollingNode::setIsMonitoringWheelEvents): (WebCore::ScrollingStateScrollingNode::dumpProperties const): (WebCore::ScrollingStateScrollingNode::setExpectsWheelEventTestTrigger): Deleted. * page/scrolling/ScrollingStateScrollingNode.h: (WebCore::ScrollingStateScrollingNode::isMonitoringWheelEvents const): (WebCore::ScrollingStateScrollingNode::expectsWheelEventTestTrigger const): Deleted. * page/scrolling/ScrollingTree.h: (WebCore::ScrollingTree::deferWheelEventTestCompletionForReason): (WebCore::ScrollingTree::removeWheelEventTestCompletionDeferralForReason): (WebCore::ScrollingTree::deferTestsForReason): Deleted. (WebCore::ScrollingTree::removeTestDeferralForReason): Deleted. * page/scrolling/ScrollingTreeScrollingNode.cpp: (WebCore::ScrollingTreeScrollingNode::commitStateBeforeChildren): * page/scrolling/ScrollingTreeScrollingNode.h: * page/scrolling/ThreadedScrollingTree.cpp: (WebCore::ThreadedScrollingTree::deferWheelEventTestCompletionForReason): (WebCore::ThreadedScrollingTree::removeWheelEventTestCompletionDeferralForReason): (WebCore::ThreadedScrollingTree::deferTestsForReason): Deleted. (WebCore::ThreadedScrollingTree::removeTestDeferralForReason): Deleted. * page/scrolling/ThreadedScrollingTree.h: * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h: * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm: (WebCore::ScrollingTreeScrollingNodeDelegateMac::handleWheelEvent): (WebCore::ScrollingTreeScrollingNodeDelegateMac::deferWheelEventTestCompletionForReason const): (WebCore::ScrollingTreeScrollingNodeDelegateMac::removeWheelEventTestCompletionDeferralForReason const): (WebCore::ScrollingTreeScrollingNodeDelegateMac::deferTestsForReason const): Deleted. (WebCore::ScrollingTreeScrollingNodeDelegateMac::removeTestDeferralForReason const): Deleted. * platform/Logging.h: * platform/ScrollAnimator.cpp: (WebCore::ScrollAnimator::deferWheelEventTestCompletionForReason const): (WebCore::ScrollAnimator::removeWheelEventTestCompletionDeferralForReason const): (WebCore::ScrollAnimator::deferTestsForReason const): Deleted. (WebCore::ScrollAnimator::removeTestDeferralForReason const): Deleted. * platform/ScrollAnimator.h: (WebCore::ScrollAnimator::ScrollAnimator::setWheelEventTestMonitor): (WebCore::ScrollAnimator::ScrollAnimator::setWheelEventTestTrigger): Deleted. * platform/cocoa/ScrollController.h: (WebCore::ScrollControllerClient::deferWheelEventTestCompletionForReason const): (WebCore::ScrollControllerClient::removeWheelEventTestCompletionDeferralForReason const): (WebCore::ScrollControllerClient::deferTestsForReason const): Deleted. (WebCore::ScrollControllerClient::removeTestDeferralForReason const): Deleted. * platform/cocoa/ScrollController.mm: (WebCore::ScrollController::startSnapRubberbandTimer): (WebCore::ScrollController::stopSnapRubberbandTimer): (WebCore::ScrollController::scheduleStatelessScrollSnap): (WebCore::ScrollController::startDeferringWheelEventTestCompletionDueToScrollSnapping): (WebCore::ScrollController::stopDeferringWheelEventTestCompletionDueToScrollSnapping): (WebCore::ScrollController::startScrollSnapTimer): (WebCore::ScrollController::stopScrollSnapTimer): (WebCore::ScrollController::startDeferringTestsDueToScrollSnapping): Deleted. (WebCore::ScrollController::stopDeferringTestsDueToScrollSnapping): Deleted. * platform/mac/ScrollAnimatorMac.mm: (WebCore::ScrollAnimatorMac::didBeginScrollGesture const): (WebCore::ScrollAnimatorMac::didEndScrollGesture const): (WebCore::ScrollAnimatorMac::sendContentAreaScrolledSoon): (WebCore::ScrollAnimatorMac::sendContentAreaScrolledTimerFired): * rendering/RenderBox.cpp: (WebCore::setupWheelEventMonitor): (WebCore::RenderBox::setScrollLeft): (WebCore::RenderBox::setScrollTop): (WebCore::setupWheelEventTestTrigger): Deleted. * rendering/RenderLayer.cpp: (WebCore::RenderLayer::createScrollbar): * rendering/RenderListBox.cpp: (WebCore::setupWheelEventTestMonitor): (WebCore::RenderListBox::setScrollTop): (WebCore::RenderListBox::createScrollbar): (WebCore::setupWheelEventTestTrigger): Deleted. * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::monitorWheelEvents): (WebCoreTestSupport::setTestCallbackAndStartNotificationTimer): (WebCoreTestSupport::clearWheelEventTestMonitor): (WebCoreTestSupport::clearWheelEventTestTrigger): Deleted. * testing/js/WebCoreTestSupport.h: Source/WebKit: * UIProcess/API/C/WKPage.cpp: (WKPageClearWheelEventTestMonitor): (WKPageClearWheelEventTestTrigger): Deleted. * UIProcess/API/C/WKPage.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::clearWheelEventTestMonitor): (WebKit::WebPageProxy::clearWheelEventTestTrigger): Deleted. * UIProcess/WebPageProxy.h: * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageStartMonitoringScrollOperations): (WKBundlePageRegisterScrollOperationCompletionCallback): * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::createScrollbar): * WebProcess/WebPage/EventDispatcher.cpp: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::clearWheelEventTestMonitor): (WebKit::WebPage::clearWheelEventTestTrigger): Deleted. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: Tools: * DumpRenderTree/mac/DumpRenderTree.mm: (resetWebViewToConsistentStateBeforeTesting): * WebKitTestRunner/TestController.cpp: (WTR::TestController::resetStateToConsistentValues): Canonical link: https://commits.webkit.org/216237@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@250946 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-10-10 00:24:44 +00:00
LOG_WITH_STREAM(WheelEventTestMonitor, stream << " (=) WheelEventTestMonitor::deferForReason: id=" << identifier << ", reason=" << reason);
}
void WheelEventTestMonitor::removeDeferralForReason(ScrollableAreaIdentifier identifier, DeferReason reason)
{
Use CheckedLock more in WebCore https://bugs.webkit.org/show_bug.cgi?id=226026 Reviewed by Geoffrey Garen. Use CheckedLock more in WebCore to benefit from Clang Thread Safety Analysis. * Modules/indexeddb/IDBObjectStore.cpp: (WebCore::IDBObjectStore::createIndex): (WebCore::IDBObjectStore::index): (WebCore::IDBObjectStore::deleteIndex): (WebCore::IDBObjectStore::rollbackForVersionChangeAbort): (WebCore::IDBObjectStore::visitReferencedIndexes const): (WebCore::IDBObjectStore::renameReferencedIndex): * Modules/indexeddb/IDBObjectStore.h: * Modules/indexeddb/IDBTransaction.cpp: (WebCore::IDBTransaction::objectStore): (WebCore::IDBTransaction::internalAbort): (WebCore::IDBTransaction::createObjectStore): (WebCore::IDBTransaction::renameObjectStore): (WebCore::IDBTransaction::renameIndex): (WebCore::IDBTransaction::deleteObjectStore): (WebCore::IDBTransaction::visitReferencedObjectStores const): * Modules/indexeddb/IDBTransaction.h: * Modules/indexeddb/client/IDBConnectionProxy.cpp: (WebCore::IDBClient::IDBConnectionProxy::openDatabase): (WebCore::IDBClient::IDBConnectionProxy::deleteDatabase): (WebCore::IDBClient::IDBConnectionProxy::completeOpenDBRequest): (WebCore::IDBClient::IDBConnectionProxy::saveOperation): (WebCore::IDBClient::IDBConnectionProxy::completeOperation): (WebCore::IDBClient::IDBConnectionProxy::fireVersionChangeEvent): (WebCore::IDBClient::IDBConnectionProxy::notifyOpenDBRequestBlocked): (WebCore::IDBClient::IDBConnectionProxy::establishTransaction): (WebCore::IDBClient::IDBConnectionProxy::didStartTransaction): (WebCore::IDBClient::IDBConnectionProxy::commitTransaction): (WebCore::IDBClient::IDBConnectionProxy::didCommitTransaction): (WebCore::IDBClient::IDBConnectionProxy::abortTransaction): (WebCore::IDBClient::IDBConnectionProxy::didAbortTransaction): (WebCore::IDBClient::IDBConnectionProxy::didCloseFromServer): (WebCore::IDBClient::IDBConnectionProxy::connectionToServerLost): (WebCore::IDBClient::IDBConnectionProxy::scheduleMainThreadTasks): (WebCore::IDBClient::IDBConnectionProxy::handleMainThreadTasks): (WebCore::IDBClient::IDBConnectionProxy::getAllDatabaseNamesAndVersions): (WebCore::IDBClient::IDBConnectionProxy::didGetAllDatabaseNamesAndVersions): (WebCore::IDBClient::IDBConnectionProxy::registerDatabaseConnection): (WebCore::IDBClient::IDBConnectionProxy::unregisterDatabaseConnection): (WebCore::IDBClient::IDBConnectionProxy::forgetActiveOperations): (WebCore::IDBClient::IDBConnectionProxy::forgetTransaction): (WebCore::IDBClient::IDBConnectionProxy::forgetActivityForCurrentThread): (WebCore::IDBClient::IDBConnectionProxy::setContextSuspended): * Modules/indexeddb/client/IDBConnectionProxy.h: * Modules/mediastream/RTCRtpSFrameTransformer.cpp: (WebCore::RTCRtpSFrameTransformer::setEncryptionKey): (WebCore::RTCRtpSFrameTransformer::decryptFrame): (WebCore::RTCRtpSFrameTransformer::encryptFrame): * Modules/mediastream/RTCRtpSFrameTransformer.h: * Modules/mediastream/RTCRtpScriptTransform.cpp: (WebCore::RTCRtpScriptTransform::setTransformer): (WebCore::RTCRtpScriptTransform::setupTransformer): (WebCore::RTCRtpScriptTransform::clear): * Modules/mediastream/RTCRtpScriptTransform.h: * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.cpp: (WebCore::LibWebRTCDataChannelHandler::setClient): (WebCore::LibWebRTCDataChannelHandler::checkState): (WebCore::LibWebRTCDataChannelHandler::OnMessage): (WebCore::LibWebRTCDataChannelHandler::OnBufferedAmountChange): * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.h: * Modules/mediastream/libwebrtc/LibWebRTCRtpTransformBackend.cpp: (WebCore::LibWebRTCRtpTransformBackend::setInputCallback): (WebCore::LibWebRTCRtpTransformBackend::setOutputCallback): (WebCore::LibWebRTCRtpTransformBackend::processTransformedFrame): (WebCore::LibWebRTCRtpTransformBackend::Transform): * Modules/mediastream/libwebrtc/LibWebRTCRtpTransformBackend.h: * inspector/agents/WebHeapAgent.cpp: (WebCore::SendGarbageCollectionEventsTask::addGarbageCollection): (WebCore::SendGarbageCollectionEventsTask::reset): (WebCore::SendGarbageCollectionEventsTask::timerFired): * page/ResourceUsageThread.cpp: (WebCore::ResourceUsageThread::addObserver): (WebCore::ResourceUsageThread::removeObserver): (WebCore::ResourceUsageThread::waitUntilObservers): (WebCore::ResourceUsageThread::notifyObservers): * page/ResourceUsageThread.h: * page/WheelEventTestMonitor.cpp: (WebCore::WheelEventTestMonitor::clearAllTestDeferrals): (WebCore::WheelEventTestMonitor::setTestCallbackAndStartMonitoring): (WebCore::WheelEventTestMonitor::deferForReason): (WebCore::WheelEventTestMonitor::removeDeferralForReason): (WebCore::WheelEventTestMonitor::receivedWheelEvent): (WebCore::WheelEventTestMonitor::checkShouldFireCallbacks): * page/WheelEventTestMonitor.h: (WebCore::WheelEventTestMonitor::WTF_GUARDED_BY_LOCK): * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::computeWheelProcessingSteps): (WebCore::ScrollingTree::determineWheelEventProcessing): (WebCore::ScrollingTree::handleWheelEvent): (WebCore::ScrollingTree::commitTreeState): (WebCore::ScrollingTree::mainFrameScrollPosition const): (WebCore::ScrollingTree::setMainFrameScrollPosition): (WebCore::ScrollingTree::setGestureState): (WebCore::ScrollingTree::gestureState): (WebCore::ScrollingTree::eventTrackingTypeForPoint): (WebCore::ScrollingTree::isRubberBandInProgressForNode): (WebCore::ScrollingTree::setRubberBandingInProgressForNode): (WebCore::ScrollingTree::isUserScrollInProgressForNode): (WebCore::ScrollingTree::setUserScrollInProgressForNode): (WebCore::ScrollingTree::clearNodesWithUserScrollInProgress): (WebCore::ScrollingTree::isScrollSnapInProgressForNode): (WebCore::ScrollingTree::setNodeScrollSnapInProgress): (WebCore::ScrollingTree::setMainFramePinnedState): (WebCore::ScrollingTree::setMainFrameCanRubberBand): (WebCore::ScrollingTree::mainFrameCanRubberBandInDirection): (WebCore::ScrollingTree::addPendingScrollUpdate): (WebCore::ScrollingTree::takePendingScrollUpdates): (WebCore::ScrollingTree::setScrollPinningBehavior): (WebCore::ScrollingTree::scrollPinningBehavior): (WebCore::ScrollingTree::willWheelEventStartSwipeGesture): (WebCore::ScrollingTree::windowScreenDidChange): (WebCore::ScrollingTree::displayID): (WebCore::ScrollingTree::hasProcessedWheelEventsRecently): (WebCore::ScrollingTree::willProcessWheelEvent): (WebCore::ScrollingTree::nominalFramesPerSecond): (WebCore::ScrollingTree::scrollingTreeAsText): * page/scrolling/ScrollingTree.h: * page/scrolling/ScrollingTreeLatchingController.cpp: (WebCore::ScrollingTreeLatchingController::receivedWheelEvent): (WebCore::ScrollingTreeLatchingController::latchingDataForEvent const): (WebCore::ScrollingTreeLatchingController::latchedNodeID const): (WebCore::ScrollingTreeLatchingController::latchedNodeAndSteps const): (WebCore::ScrollingTreeLatchingController::nodeDidHandleEvent): (WebCore::ScrollingTreeLatchingController::nodeWasRemoved): (WebCore::ScrollingTreeLatchingController::clearLatchedNode): * page/scrolling/ScrollingTreeLatchingController.h: * platform/audio/HRTFDatabaseLoader.cpp: (WebCore::HRTFDatabaseLoader::loadAsynchronously): (WebCore::HRTFDatabaseLoader::waitForLoaderThreadCompletion): * platform/audio/HRTFDatabaseLoader.h: * platform/audio/cocoa/AudioDestinationCocoa.cpp: (WebCore::AudioDestinationCocoa::hasEnoughFrames const): (WebCore::AudioDestinationCocoa::render): (WebCore::AudioDestinationCocoa::renderOnRenderingThead): * platform/audio/cocoa/AudioDestinationCocoa.h: * platform/encryptedmedia/CDMProxy.cpp: (WebCore::CDMProxy::instance const): (WebCore::CDMProxy::setInstance): (WebCore::CDMProxy::startedWaitingForKey const): (WebCore::CDMProxy::stoppedWaitingForKey const): * platform/encryptedmedia/CDMProxy.h: * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp: (WebCore::MediaPlayerPrivateAVFoundation::MediaPlayerPrivateAVFoundation): (WebCore::MediaPlayerPrivateAVFoundation::setDelayCallbacks const): (WebCore::MediaPlayerPrivateAVFoundation::clearMainThreadPendingFlag): (WebCore::MediaPlayerPrivateAVFoundation::scheduleMainThreadNotification): (WebCore::MediaPlayerPrivateAVFoundation::dispatchNotification): * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm: (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::processNewVideoSample): * platform/graphics/cg/IOSurfacePool.cpp: (WebCore::IOSurfacePool::takeSurface): (WebCore::IOSurfacePool::addSurface): (WebCore::IOSurfacePool::setPoolSize): (WebCore::IOSurfacePool::collectionTimerFired): (WebCore::IOSurfacePool::discardAllSurfaces): * platform/graphics/cg/IOSurfacePool.h: (WebCore::IOSurfacePool::WTF_GUARDED_BY_LOCK): * platform/graphics/cg/SubimageCacheWithTimer.cpp: (WebCore::SubimageCacheWithTimer::pruneCacheTimerFired): (WebCore::SubimageCacheWithTimer::subimage): (WebCore::SubimageCacheWithTimer::clearImageAndSubimages): (WebCore::SubimageCacheWithTimer::clearAll): * platform/graphics/cg/SubimageCacheWithTimer.h: * platform/graphics/cocoa/FontCacheCoreText.cpp: (WebCore::FontDatabase::collectionForFamily): (WebCore::FontDatabase::clear): * platform/network/cocoa/WebCoreNSURLSession.mm: (WebCore::WebCoreNSURLSessionDataTaskClient::clearTask): (WebCore::WebCoreNSURLSessionDataTaskClient::dataSent): (WebCore::WebCoreNSURLSessionDataTaskClient::responseReceived): (WebCore::WebCoreNSURLSessionDataTaskClient::shouldCacheResponse): (WebCore::WebCoreNSURLSessionDataTaskClient::dataReceived): (WebCore::WebCoreNSURLSessionDataTaskClient::redirectReceived): (WebCore::WebCoreNSURLSessionDataTaskClient::accessControlCheckFailed): (WebCore::WebCoreNSURLSessionDataTaskClient::loadFailed): (WebCore::WebCoreNSURLSessionDataTaskClient::loadFinished): * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.h: * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm: (-[WebCoreResourceHandleAsOperationQueueDelegate detachHandle]): (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willSendRequest:redirectResponse:]): (-[WebCoreResourceHandleAsOperationQueueDelegate connection:canAuthenticateAgainstProtectionSpace:]): (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willCacheResponse:]): * storage/StorageQuotaManager.cpp: (WebCore::StorageQuotaManager::requestSpaceOnBackgroundThread): (WebCore::StorageQuotaManager::resetQuotaUpdatedBasedOnUsageForTesting): (WebCore::StorageQuotaManager::resetQuotaForTesting): * storage/StorageQuotaManager.h: (WebCore::StorageQuotaManager::WTF_GUARDED_BY_LOCK): * workers/WorkerOrWorkletScriptController.cpp: (WebCore::WorkerOrWorkletScriptController::scheduleExecutionTermination): (WebCore::WorkerOrWorkletScriptController::isTerminatingExecution const): * workers/WorkerOrWorkletScriptController.h: (WebCore::WorkerOrWorkletScriptController::WTF_GUARDED_BY_LOCK): Canonical link: https://commits.webkit.org/237960@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277805 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-20 18:41:33 +00:00
Locker locker { m_lock };
eventSender.monitorWheelEvents() is very fragile https://bugs.webkit.org/show_bug.cgi?id=197819 <rdar://problem/51319456> Reviewed by Tim Horton. Source/WebCore: Deflake tests using eventSender.monitorWheelEvents() by fixing several causes of flakiness, adding back changes from r257844 that were reverted in r258558. First, have EventSendingController keep track of whether it's seen then "end" event for the scrolling and momentum phases, and pass this down to WheelEventTestMonitor, which now waits until it sees these, which prevents premature triggering which was a common cause of failure before. Second, remove WheelEventTestMonitor's 1/60s timer and instead have WheelEventTestMonitor test for completion in a callout from the end of Page::updateRendering(), which makes it test and fire at a more consistent time. Third, push WheelEventTestMonitor to the ScrollingTree, so that reasons for deferral can be added on the scrolling thread. This fixes an issue where the RunLoop::main().dispatch() used to send the "ScrollingThreadSyncNeeded" reason to the main thread would get delayed, also resulting in a premature trigger. * Modules/applepay/ApplePaySession.cpp: Unified sources! * dom/WindowEventLoop.cpp: Unified sources! * page/EventHandler.cpp: (WebCore::EventHandler::handleWheelEvent): * page/FrameView.cpp: (WebCore::FrameView::scrollOffsetChangedViaPlatformWidgetImpl): * page/Page.cpp: (WebCore::Page::doAfterUpdateRendering): (WebCore::Page::wheelEventTestMonitor const): (WebCore::Page::clearWheelEventTestMonitor): (WebCore::Page::isMonitoringWheelEvents const): (WebCore::Page::ensureWheelEventTestMonitor): * page/Page.h: (WebCore::Page::wheelEventTestMonitor const): Deleted. (WebCore::Page::clearWheelEventTestMonitor): Deleted. (WebCore::Page::isMonitoringWheelEvents const): Deleted. * page/WheelEventTestMonitor.cpp: (WebCore::WheelEventTestMonitor::WheelEventTestMonitor): (WebCore::WheelEventTestMonitor::clearAllTestDeferrals): (WebCore::WheelEventTestMonitor::setTestCallbackAndStartMonitoring): (WebCore::WheelEventTestMonitor::deferForReason): (WebCore::WheelEventTestMonitor::removeDeferralForReason): (WebCore::WheelEventTestMonitor::receivedWheelEvent): (WebCore::WheelEventTestMonitor::scheduleCallbackCheck): (WebCore::WheelEventTestMonitor::checkShouldFireCallbacks): (WebCore::operator<<): (WebCore::WheelEventTestMonitor::setTestCallbackAndStartNotificationTimer): Deleted. (WebCore::WheelEventTestMonitor::triggerTestTimerFired): Deleted. * page/WheelEventTestMonitor.h: (WebCore::WheelEventTestMonitorCompletionDeferrer::WheelEventTestMonitorCompletionDeferrer): (WebCore::WheelEventTestMonitorCompletionDeferrer::~WheelEventTestMonitorCompletionDeferrer): * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated): (WebCore::AsyncScrollingCoordinator::deferWheelEventTestCompletionForReason const): Deleted. (WebCore::AsyncScrollingCoordinator::removeWheelEventTestCompletionDeferralForReason const): Deleted. * page/scrolling/AsyncScrollingCoordinator.h: * page/scrolling/ScrollingCoordinator.h: (WebCore::ScrollingCoordinator::startMonitoringWheelEvents): (WebCore::ScrollingCoordinator::stopMonitoringWheelEvents): * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::handleWheelEvent): * page/scrolling/ScrollingTree.h: (WebCore::ScrollingTree::setWheelEventTestMonitor): (WebCore::ScrollingTree::receivedWheelEvent): * page/scrolling/ThreadedScrollingTree.cpp: (WebCore::ThreadedScrollingTree::scrollingTreeNodeDidScroll): (WebCore::ThreadedScrollingTree::deferWheelEventTestCompletionForReason): Deleted. (WebCore::ThreadedScrollingTree::removeWheelEventTestCompletionDeferralForReason): Deleted. * page/scrolling/ThreadedScrollingTree.h: * page/scrolling/mac/ScrollingCoordinatorMac.h: * page/scrolling/mac/ScrollingCoordinatorMac.mm: (WebCore::ScrollingCoordinatorMac::startMonitoringWheelEvents): (WebCore::ScrollingCoordinatorMac::stopMonitoringWheelEvents): * page/scrolling/mac/ScrollingTreeMac.h: * page/scrolling/mac/ScrollingTreeMac.mm: (ScrollingTreeMac::setWheelEventTestMonitor): (ScrollingTreeMac::receivedWheelEvent): (ScrollingTreeMac::deferWheelEventTestCompletionForReason): (ScrollingTreeMac::removeWheelEventTestCompletionDeferralForReason): * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm: (WebCore::ScrollingTreeScrollingNodeDelegateMac::deferWheelEventTestCompletionForReason const): (WebCore::ScrollingTreeScrollingNodeDelegateMac::removeWheelEventTestCompletionDeferralForReason const): * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::setWheelEventMonitorTestCallbackAndStartMonitoring): (WebCoreTestSupport::setTestCallbackAndStartNotificationTimer): Deleted. * testing/js/WebCoreTestSupport.h: Source/WebKit: Deflake tests using eventSender.monitorWheelEvents() by fixing several causes of flakiness, adding back changes from r257844 that were reverted in r258558. First, have EventSendingController keep track of whether it's seen then "end" event for the scrolling and momentum phases, and pass this down to WheelEventTestMonitor, which now waits until it sees these, which prevents premature triggering which was a common cause of failure before. Second, remove WheelEventTestMonitor's 1/60s timer and instead have WheelEventTestMonitor test for completion in a callout from the end of Page::updateRendering(), which makes it test and fire at a more consistent time. Third, push WheelEventTestMonitor to the ScrollingTree, so that reasons for deferral can be added on the scrolling thread. This fixes an issue where the RunLoop::main().dispatch() used to send the "ScrollingThreadSyncNeeded" reason to the main thread would get delayed, also resulting in a premature trigger. * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageRegisterScrollOperationCompletionCallback): * WebProcess/InjectedBundle/API/c/WKBundlePage.h: Tools: Deflake tests using eventSender.monitorWheelEvents() by fixing several causes of flakiness, adding back changes from r257844 that were reverted in r258558. First, have EventSendingController keep track of whether it's seen then "end" event for the scrolling and momentum phases, and pass this down to WheelEventTestMonitor, which now waits until it sees these, which prevents premature triggering which was a common cause of failure before. Second, remove WheelEventTestMonitor's 1/60s timer and instead have WheelEventTestMonitor test for completion in a callout from the end of Page::updateRendering(), which makes it test and fire at a more consistent time. Third, push WheelEventTestMonitor to the ScrollingTree, so that reasons for deferral can be added on the scrolling thread. This fixes an issue where the RunLoop::main().dispatch() used to send the "ScrollingThreadSyncNeeded" reason to the main thread would get delayed, also resulting in a premature trigger. * DumpRenderTree/mac/EventSendingController.h: * DumpRenderTree/mac/EventSendingController.mm: (-[EventSendingController mouseScrollByX:andY:withWheel:andMomentumPhases:]): (-[EventSendingController monitorWheelEvents]): (-[EventSendingController callAfterScrollingCompletes:]): * DumpRenderTree/win/EventSender.cpp: (mouseScrollBy): * WebKitTestRunner/InjectedBundle/EventSendingController.cpp: (WTR::EventSendingController::mouseScrollByWithWheelAndMomentumPhases): (WTR::EventSendingController::monitorWheelEvents): (WTR::EventSendingController::callAfterScrollingCompletes): * WebKitTestRunner/InjectedBundle/EventSendingController.h: LayoutTests: * platform/mac-wk2/TestExpectations: * platform/win/TestExpectations: * tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-2d-overflow.html: Need to call eventSender.monitorWheelEvents() for each subtest. Canonical link: https://commits.webkit.org/222192@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@258679 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-03-19 04:06:37 +00:00
Rename WheelEventTestTrigger and improve naming in related code https://bugs.webkit.org/show_bug.cgi?id=202772 Reviewed by Tim Horton. Change the "test trigger" terminology to "monitor wheel events"; after all, tests call monitorWheelEvents() and callAfterScrollingCompletes(), and this is not triggering a test. Source/WebCore: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * page/FrameView.cpp: (WebCore::FrameView::adjustScrollbarsForLayout): (WebCore::FrameView::setScrollPosition): (WebCore::FrameView::didAddScrollbar): * page/Page.cpp: (WebCore::Page::ensureWheelEventTestMonitor): (WebCore::Page::ensureTestTrigger): Deleted. * page/Page.h: (WebCore::Page::wheelEventTestMonitor const): (WebCore::Page::clearWheelEventTestMonitor): (WebCore::Page::isMonitoringWheelEvents const): (WebCore::Page::testTrigger const): Deleted. (WebCore::Page::clearTrigger): Deleted. (WebCore::Page::expectsWheelEventTriggers const): Deleted. * page/WheelEventTestMonitor.cpp: Added. (WebCore::WheelEventTestMonitor::WheelEventTestMonitor): (WebCore::WheelEventTestMonitor::clearAllTestDeferrals): (WebCore::WheelEventTestMonitor::setTestCallbackAndStartNotificationTimer): (WebCore::WheelEventTestMonitor::deferForReason): (WebCore::WheelEventTestMonitor::removeDeferralForReason): (WebCore::WheelEventTestMonitor::triggerTestTimerFired): (WebCore::operator<<): * page/WheelEventTestMonitor.h: Renamed from Source/WebCore/page/WheelEventTestTrigger.h. * page/WheelEventTestTrigger.cpp: Removed. * page/mac/EventHandlerMac.mm: (WebCore::EventHandler::platformPrepareForWheelEvents): * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated): (WebCore::AsyncScrollingCoordinator::updateIsMonitoringWheelEventsForFrameView): (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll): (WebCore::AsyncScrollingCoordinator::deferWheelEventTestCompletionForReason const): (WebCore::AsyncScrollingCoordinator::removeWheelEventTestCompletionDeferralForReason const): (WebCore::AsyncScrollingCoordinator::updateExpectsWheelEventTestTriggerWithFrameView): Deleted. (WebCore::AsyncScrollingCoordinator::deferTestsForReason const): Deleted. (WebCore::AsyncScrollingCoordinator::removeTestDeferralForReason const): Deleted. * page/scrolling/AsyncScrollingCoordinator.h: * page/scrolling/ScrollingCoordinator.h: (WebCore::ScrollingCoordinator::updateIsMonitoringWheelEventsForFrameView): (WebCore::ScrollingCoordinator::updateExpectsWheelEventTestTriggerWithFrameView): Deleted. * page/scrolling/ScrollingStateScrollingNode.cpp: (WebCore::ScrollingStateScrollingNode::ScrollingStateScrollingNode): (WebCore::ScrollingStateScrollingNode::setPropertyChangedBitsAfterReattach): (WebCore::ScrollingStateScrollingNode::setIsMonitoringWheelEvents): (WebCore::ScrollingStateScrollingNode::dumpProperties const): (WebCore::ScrollingStateScrollingNode::setExpectsWheelEventTestTrigger): Deleted. * page/scrolling/ScrollingStateScrollingNode.h: (WebCore::ScrollingStateScrollingNode::isMonitoringWheelEvents const): (WebCore::ScrollingStateScrollingNode::expectsWheelEventTestTrigger const): Deleted. * page/scrolling/ScrollingTree.h: (WebCore::ScrollingTree::deferWheelEventTestCompletionForReason): (WebCore::ScrollingTree::removeWheelEventTestCompletionDeferralForReason): (WebCore::ScrollingTree::deferTestsForReason): Deleted. (WebCore::ScrollingTree::removeTestDeferralForReason): Deleted. * page/scrolling/ScrollingTreeScrollingNode.cpp: (WebCore::ScrollingTreeScrollingNode::commitStateBeforeChildren): * page/scrolling/ScrollingTreeScrollingNode.h: * page/scrolling/ThreadedScrollingTree.cpp: (WebCore::ThreadedScrollingTree::deferWheelEventTestCompletionForReason): (WebCore::ThreadedScrollingTree::removeWheelEventTestCompletionDeferralForReason): (WebCore::ThreadedScrollingTree::deferTestsForReason): Deleted. (WebCore::ThreadedScrollingTree::removeTestDeferralForReason): Deleted. * page/scrolling/ThreadedScrollingTree.h: * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h: * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm: (WebCore::ScrollingTreeScrollingNodeDelegateMac::handleWheelEvent): (WebCore::ScrollingTreeScrollingNodeDelegateMac::deferWheelEventTestCompletionForReason const): (WebCore::ScrollingTreeScrollingNodeDelegateMac::removeWheelEventTestCompletionDeferralForReason const): (WebCore::ScrollingTreeScrollingNodeDelegateMac::deferTestsForReason const): Deleted. (WebCore::ScrollingTreeScrollingNodeDelegateMac::removeTestDeferralForReason const): Deleted. * platform/Logging.h: * platform/ScrollAnimator.cpp: (WebCore::ScrollAnimator::deferWheelEventTestCompletionForReason const): (WebCore::ScrollAnimator::removeWheelEventTestCompletionDeferralForReason const): (WebCore::ScrollAnimator::deferTestsForReason const): Deleted. (WebCore::ScrollAnimator::removeTestDeferralForReason const): Deleted. * platform/ScrollAnimator.h: (WebCore::ScrollAnimator::ScrollAnimator::setWheelEventTestMonitor): (WebCore::ScrollAnimator::ScrollAnimator::setWheelEventTestTrigger): Deleted. * platform/cocoa/ScrollController.h: (WebCore::ScrollControllerClient::deferWheelEventTestCompletionForReason const): (WebCore::ScrollControllerClient::removeWheelEventTestCompletionDeferralForReason const): (WebCore::ScrollControllerClient::deferTestsForReason const): Deleted. (WebCore::ScrollControllerClient::removeTestDeferralForReason const): Deleted. * platform/cocoa/ScrollController.mm: (WebCore::ScrollController::startSnapRubberbandTimer): (WebCore::ScrollController::stopSnapRubberbandTimer): (WebCore::ScrollController::scheduleStatelessScrollSnap): (WebCore::ScrollController::startDeferringWheelEventTestCompletionDueToScrollSnapping): (WebCore::ScrollController::stopDeferringWheelEventTestCompletionDueToScrollSnapping): (WebCore::ScrollController::startScrollSnapTimer): (WebCore::ScrollController::stopScrollSnapTimer): (WebCore::ScrollController::startDeferringTestsDueToScrollSnapping): Deleted. (WebCore::ScrollController::stopDeferringTestsDueToScrollSnapping): Deleted. * platform/mac/ScrollAnimatorMac.mm: (WebCore::ScrollAnimatorMac::didBeginScrollGesture const): (WebCore::ScrollAnimatorMac::didEndScrollGesture const): (WebCore::ScrollAnimatorMac::sendContentAreaScrolledSoon): (WebCore::ScrollAnimatorMac::sendContentAreaScrolledTimerFired): * rendering/RenderBox.cpp: (WebCore::setupWheelEventMonitor): (WebCore::RenderBox::setScrollLeft): (WebCore::RenderBox::setScrollTop): (WebCore::setupWheelEventTestTrigger): Deleted. * rendering/RenderLayer.cpp: (WebCore::RenderLayer::createScrollbar): * rendering/RenderListBox.cpp: (WebCore::setupWheelEventTestMonitor): (WebCore::RenderListBox::setScrollTop): (WebCore::RenderListBox::createScrollbar): (WebCore::setupWheelEventTestTrigger): Deleted. * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::monitorWheelEvents): (WebCoreTestSupport::setTestCallbackAndStartNotificationTimer): (WebCoreTestSupport::clearWheelEventTestMonitor): (WebCoreTestSupport::clearWheelEventTestTrigger): Deleted. * testing/js/WebCoreTestSupport.h: Source/WebKit: * UIProcess/API/C/WKPage.cpp: (WKPageClearWheelEventTestMonitor): (WKPageClearWheelEventTestTrigger): Deleted. * UIProcess/API/C/WKPage.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::clearWheelEventTestMonitor): (WebKit::WebPageProxy::clearWheelEventTestTrigger): Deleted. * UIProcess/WebPageProxy.h: * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageStartMonitoringScrollOperations): (WKBundlePageRegisterScrollOperationCompletionCallback): * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::createScrollbar): * WebProcess/WebPage/EventDispatcher.cpp: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::clearWheelEventTestMonitor): (WebKit::WebPage::clearWheelEventTestTrigger): Deleted. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: Tools: * DumpRenderTree/mac/DumpRenderTree.mm: (resetWebViewToConsistentStateBeforeTesting): * WebKitTestRunner/TestController.cpp: (WTR::TestController::resetStateToConsistentValues): Canonical link: https://commits.webkit.org/216237@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@250946 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-10-10 00:24:44 +00:00
auto it = m_deferCompletionReasons.find(identifier);
Simplify some callsites of WheelEventTestMonitor https://bugs.webkit.org/show_bug.cgi?id=219416 Reviewed by Daniel Bates. Migrate towards more usage of WheelEventTestMonitorCompletionDeferrer, using a pattern where we WTFMove() one into a completion handler to pair the defer/undefer pairs, rather than having manual deferral/undeferral. To make this work, WheelEventTestMonitorCompletionDeferrer gains a move constructor, that nullifies the m_monitor in the source to prevent double firing. Remove the WheelEventTestMonitor::RequestedScrollPosition deferral, since that code path is now synchronous. * page/EventHandler.cpp: (WebCore::EventHandler::handleWheelEventInternal): * page/FrameView.cpp: (WebCore::FrameView::scrollOffsetChangedViaPlatformWidgetImpl): * page/WheelEventTestMonitor.cpp: (WebCore::WheelEventTestMonitor::removeDeferralForReason): * page/WheelEventTestMonitor.h: (WebCore::WheelEventTestMonitorCompletionDeferrer::WheelEventTestMonitorCompletionDeferrer): * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::requestScrollPositionUpdate): (WebCore::AsyncScrollingCoordinator::synchronizeStateFromScrollingTree): (WebCore::AsyncScrollingCoordinator::applyPendingScrollUpdates): (WebCore::AsyncScrollingCoordinator::applyScrollUpdate): (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll): (WebCore::AsyncScrollingCoordinator::noteScrollingThreadSyncCompleteForNode): Deleted. * page/scrolling/AsyncScrollingCoordinator.h: * page/scrolling/ScrollingTree.h: (WebCore::ScrollingTree::wheelEventTestMonitor): * page/scrolling/ThreadedScrollingTree.cpp: (WebCore::ThreadedScrollingTree::scrollingTreeNodeDidScroll): (WebCore::ThreadedScrollingTree::setActiveScrollSnapIndices): (WebCore::ThreadedScrollingTree::scrollingTreeNodeRequestsScroll): Deleted. * page/scrolling/ThreadedScrollingTree.h: * page/scrolling/mac/ScrollingCoordinatorMac.mm: (WebCore::ScrollingCoordinatorMac::wheelEventWasProcessedByMainThread): * page/scrolling/mac/ScrollingTreeMac.h: * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm: (WebCore::ScrollingTreeScrollingNodeDelegateMac::handleWheelEvent): Canonical link: https://commits.webkit.org/232029@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@270338 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-12-02 03:25:42 +00:00
if (it == m_deferCompletionReasons.end()) {
LOG_WITH_STREAM(WheelEventTestMonitor, stream << " (=) WheelEventTestMonitor::removeDeferralForReason: failed to find defer for id=" << identifier << ", reason=" << reason);
Rename WheelEventTestTrigger and improve naming in related code https://bugs.webkit.org/show_bug.cgi?id=202772 Reviewed by Tim Horton. Change the "test trigger" terminology to "monitor wheel events"; after all, tests call monitorWheelEvents() and callAfterScrollingCompletes(), and this is not triggering a test. Source/WebCore: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * page/FrameView.cpp: (WebCore::FrameView::adjustScrollbarsForLayout): (WebCore::FrameView::setScrollPosition): (WebCore::FrameView::didAddScrollbar): * page/Page.cpp: (WebCore::Page::ensureWheelEventTestMonitor): (WebCore::Page::ensureTestTrigger): Deleted. * page/Page.h: (WebCore::Page::wheelEventTestMonitor const): (WebCore::Page::clearWheelEventTestMonitor): (WebCore::Page::isMonitoringWheelEvents const): (WebCore::Page::testTrigger const): Deleted. (WebCore::Page::clearTrigger): Deleted. (WebCore::Page::expectsWheelEventTriggers const): Deleted. * page/WheelEventTestMonitor.cpp: Added. (WebCore::WheelEventTestMonitor::WheelEventTestMonitor): (WebCore::WheelEventTestMonitor::clearAllTestDeferrals): (WebCore::WheelEventTestMonitor::setTestCallbackAndStartNotificationTimer): (WebCore::WheelEventTestMonitor::deferForReason): (WebCore::WheelEventTestMonitor::removeDeferralForReason): (WebCore::WheelEventTestMonitor::triggerTestTimerFired): (WebCore::operator<<): * page/WheelEventTestMonitor.h: Renamed from Source/WebCore/page/WheelEventTestTrigger.h. * page/WheelEventTestTrigger.cpp: Removed. * page/mac/EventHandlerMac.mm: (WebCore::EventHandler::platformPrepareForWheelEvents): * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated): (WebCore::AsyncScrollingCoordinator::updateIsMonitoringWheelEventsForFrameView): (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll): (WebCore::AsyncScrollingCoordinator::deferWheelEventTestCompletionForReason const): (WebCore::AsyncScrollingCoordinator::removeWheelEventTestCompletionDeferralForReason const): (WebCore::AsyncScrollingCoordinator::updateExpectsWheelEventTestTriggerWithFrameView): Deleted. (WebCore::AsyncScrollingCoordinator::deferTestsForReason const): Deleted. (WebCore::AsyncScrollingCoordinator::removeTestDeferralForReason const): Deleted. * page/scrolling/AsyncScrollingCoordinator.h: * page/scrolling/ScrollingCoordinator.h: (WebCore::ScrollingCoordinator::updateIsMonitoringWheelEventsForFrameView): (WebCore::ScrollingCoordinator::updateExpectsWheelEventTestTriggerWithFrameView): Deleted. * page/scrolling/ScrollingStateScrollingNode.cpp: (WebCore::ScrollingStateScrollingNode::ScrollingStateScrollingNode): (WebCore::ScrollingStateScrollingNode::setPropertyChangedBitsAfterReattach): (WebCore::ScrollingStateScrollingNode::setIsMonitoringWheelEvents): (WebCore::ScrollingStateScrollingNode::dumpProperties const): (WebCore::ScrollingStateScrollingNode::setExpectsWheelEventTestTrigger): Deleted. * page/scrolling/ScrollingStateScrollingNode.h: (WebCore::ScrollingStateScrollingNode::isMonitoringWheelEvents const): (WebCore::ScrollingStateScrollingNode::expectsWheelEventTestTrigger const): Deleted. * page/scrolling/ScrollingTree.h: (WebCore::ScrollingTree::deferWheelEventTestCompletionForReason): (WebCore::ScrollingTree::removeWheelEventTestCompletionDeferralForReason): (WebCore::ScrollingTree::deferTestsForReason): Deleted. (WebCore::ScrollingTree::removeTestDeferralForReason): Deleted. * page/scrolling/ScrollingTreeScrollingNode.cpp: (WebCore::ScrollingTreeScrollingNode::commitStateBeforeChildren): * page/scrolling/ScrollingTreeScrollingNode.h: * page/scrolling/ThreadedScrollingTree.cpp: (WebCore::ThreadedScrollingTree::deferWheelEventTestCompletionForReason): (WebCore::ThreadedScrollingTree::removeWheelEventTestCompletionDeferralForReason): (WebCore::ThreadedScrollingTree::deferTestsForReason): Deleted. (WebCore::ThreadedScrollingTree::removeTestDeferralForReason): Deleted. * page/scrolling/ThreadedScrollingTree.h: * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h: * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm: (WebCore::ScrollingTreeScrollingNodeDelegateMac::handleWheelEvent): (WebCore::ScrollingTreeScrollingNodeDelegateMac::deferWheelEventTestCompletionForReason const): (WebCore::ScrollingTreeScrollingNodeDelegateMac::removeWheelEventTestCompletionDeferralForReason const): (WebCore::ScrollingTreeScrollingNodeDelegateMac::deferTestsForReason const): Deleted. (WebCore::ScrollingTreeScrollingNodeDelegateMac::removeTestDeferralForReason const): Deleted. * platform/Logging.h: * platform/ScrollAnimator.cpp: (WebCore::ScrollAnimator::deferWheelEventTestCompletionForReason const): (WebCore::ScrollAnimator::removeWheelEventTestCompletionDeferralForReason const): (WebCore::ScrollAnimator::deferTestsForReason const): Deleted. (WebCore::ScrollAnimator::removeTestDeferralForReason const): Deleted. * platform/ScrollAnimator.h: (WebCore::ScrollAnimator::ScrollAnimator::setWheelEventTestMonitor): (WebCore::ScrollAnimator::ScrollAnimator::setWheelEventTestTrigger): Deleted. * platform/cocoa/ScrollController.h: (WebCore::ScrollControllerClient::deferWheelEventTestCompletionForReason const): (WebCore::ScrollControllerClient::removeWheelEventTestCompletionDeferralForReason const): (WebCore::ScrollControllerClient::deferTestsForReason const): Deleted. (WebCore::ScrollControllerClient::removeTestDeferralForReason const): Deleted. * platform/cocoa/ScrollController.mm: (WebCore::ScrollController::startSnapRubberbandTimer): (WebCore::ScrollController::stopSnapRubberbandTimer): (WebCore::ScrollController::scheduleStatelessScrollSnap): (WebCore::ScrollController::startDeferringWheelEventTestCompletionDueToScrollSnapping): (WebCore::ScrollController::stopDeferringWheelEventTestCompletionDueToScrollSnapping): (WebCore::ScrollController::startScrollSnapTimer): (WebCore::ScrollController::stopScrollSnapTimer): (WebCore::ScrollController::startDeferringTestsDueToScrollSnapping): Deleted. (WebCore::ScrollController::stopDeferringTestsDueToScrollSnapping): Deleted. * platform/mac/ScrollAnimatorMac.mm: (WebCore::ScrollAnimatorMac::didBeginScrollGesture const): (WebCore::ScrollAnimatorMac::didEndScrollGesture const): (WebCore::ScrollAnimatorMac::sendContentAreaScrolledSoon): (WebCore::ScrollAnimatorMac::sendContentAreaScrolledTimerFired): * rendering/RenderBox.cpp: (WebCore::setupWheelEventMonitor): (WebCore::RenderBox::setScrollLeft): (WebCore::RenderBox::setScrollTop): (WebCore::setupWheelEventTestTrigger): Deleted. * rendering/RenderLayer.cpp: (WebCore::RenderLayer::createScrollbar): * rendering/RenderListBox.cpp: (WebCore::setupWheelEventTestMonitor): (WebCore::RenderListBox::setScrollTop): (WebCore::RenderListBox::createScrollbar): (WebCore::setupWheelEventTestTrigger): Deleted. * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::monitorWheelEvents): (WebCoreTestSupport::setTestCallbackAndStartNotificationTimer): (WebCoreTestSupport::clearWheelEventTestMonitor): (WebCoreTestSupport::clearWheelEventTestTrigger): Deleted. * testing/js/WebCoreTestSupport.h: Source/WebKit: * UIProcess/API/C/WKPage.cpp: (WKPageClearWheelEventTestMonitor): (WKPageClearWheelEventTestTrigger): Deleted. * UIProcess/API/C/WKPage.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::clearWheelEventTestMonitor): (WebKit::WebPageProxy::clearWheelEventTestTrigger): Deleted. * UIProcess/WebPageProxy.h: * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageStartMonitoringScrollOperations): (WKBundlePageRegisterScrollOperationCompletionCallback): * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::createScrollbar): * WebProcess/WebPage/EventDispatcher.cpp: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::clearWheelEventTestMonitor): (WebKit::WebPage::clearWheelEventTestTrigger): Deleted. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: Tools: * DumpRenderTree/mac/DumpRenderTree.mm: (resetWebViewToConsistentStateBeforeTesting): * WebKitTestRunner/TestController.cpp: (WTR::TestController::resetStateToConsistentValues): Canonical link: https://commits.webkit.org/216237@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@250946 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-10-10 00:24:44 +00:00
return;
Simplify some callsites of WheelEventTestMonitor https://bugs.webkit.org/show_bug.cgi?id=219416 Reviewed by Daniel Bates. Migrate towards more usage of WheelEventTestMonitorCompletionDeferrer, using a pattern where we WTFMove() one into a completion handler to pair the defer/undefer pairs, rather than having manual deferral/undeferral. To make this work, WheelEventTestMonitorCompletionDeferrer gains a move constructor, that nullifies the m_monitor in the source to prevent double firing. Remove the WheelEventTestMonitor::RequestedScrollPosition deferral, since that code path is now synchronous. * page/EventHandler.cpp: (WebCore::EventHandler::handleWheelEventInternal): * page/FrameView.cpp: (WebCore::FrameView::scrollOffsetChangedViaPlatformWidgetImpl): * page/WheelEventTestMonitor.cpp: (WebCore::WheelEventTestMonitor::removeDeferralForReason): * page/WheelEventTestMonitor.h: (WebCore::WheelEventTestMonitorCompletionDeferrer::WheelEventTestMonitorCompletionDeferrer): * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::requestScrollPositionUpdate): (WebCore::AsyncScrollingCoordinator::synchronizeStateFromScrollingTree): (WebCore::AsyncScrollingCoordinator::applyPendingScrollUpdates): (WebCore::AsyncScrollingCoordinator::applyScrollUpdate): (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll): (WebCore::AsyncScrollingCoordinator::noteScrollingThreadSyncCompleteForNode): Deleted. * page/scrolling/AsyncScrollingCoordinator.h: * page/scrolling/ScrollingTree.h: (WebCore::ScrollingTree::wheelEventTestMonitor): * page/scrolling/ThreadedScrollingTree.cpp: (WebCore::ThreadedScrollingTree::scrollingTreeNodeDidScroll): (WebCore::ThreadedScrollingTree::setActiveScrollSnapIndices): (WebCore::ThreadedScrollingTree::scrollingTreeNodeRequestsScroll): Deleted. * page/scrolling/ThreadedScrollingTree.h: * page/scrolling/mac/ScrollingCoordinatorMac.mm: (WebCore::ScrollingCoordinatorMac::wheelEventWasProcessedByMainThread): * page/scrolling/mac/ScrollingTreeMac.h: * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm: (WebCore::ScrollingTreeScrollingNodeDelegateMac::handleWheelEvent): Canonical link: https://commits.webkit.org/232029@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@270338 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-12-02 03:25:42 +00:00
}
Rename WheelEventTestTrigger and improve naming in related code https://bugs.webkit.org/show_bug.cgi?id=202772 Reviewed by Tim Horton. Change the "test trigger" terminology to "monitor wheel events"; after all, tests call monitorWheelEvents() and callAfterScrollingCompletes(), and this is not triggering a test. Source/WebCore: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * page/FrameView.cpp: (WebCore::FrameView::adjustScrollbarsForLayout): (WebCore::FrameView::setScrollPosition): (WebCore::FrameView::didAddScrollbar): * page/Page.cpp: (WebCore::Page::ensureWheelEventTestMonitor): (WebCore::Page::ensureTestTrigger): Deleted. * page/Page.h: (WebCore::Page::wheelEventTestMonitor const): (WebCore::Page::clearWheelEventTestMonitor): (WebCore::Page::isMonitoringWheelEvents const): (WebCore::Page::testTrigger const): Deleted. (WebCore::Page::clearTrigger): Deleted. (WebCore::Page::expectsWheelEventTriggers const): Deleted. * page/WheelEventTestMonitor.cpp: Added. (WebCore::WheelEventTestMonitor::WheelEventTestMonitor): (WebCore::WheelEventTestMonitor::clearAllTestDeferrals): (WebCore::WheelEventTestMonitor::setTestCallbackAndStartNotificationTimer): (WebCore::WheelEventTestMonitor::deferForReason): (WebCore::WheelEventTestMonitor::removeDeferralForReason): (WebCore::WheelEventTestMonitor::triggerTestTimerFired): (WebCore::operator<<): * page/WheelEventTestMonitor.h: Renamed from Source/WebCore/page/WheelEventTestTrigger.h. * page/WheelEventTestTrigger.cpp: Removed. * page/mac/EventHandlerMac.mm: (WebCore::EventHandler::platformPrepareForWheelEvents): * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated): (WebCore::AsyncScrollingCoordinator::updateIsMonitoringWheelEventsForFrameView): (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll): (WebCore::AsyncScrollingCoordinator::deferWheelEventTestCompletionForReason const): (WebCore::AsyncScrollingCoordinator::removeWheelEventTestCompletionDeferralForReason const): (WebCore::AsyncScrollingCoordinator::updateExpectsWheelEventTestTriggerWithFrameView): Deleted. (WebCore::AsyncScrollingCoordinator::deferTestsForReason const): Deleted. (WebCore::AsyncScrollingCoordinator::removeTestDeferralForReason const): Deleted. * page/scrolling/AsyncScrollingCoordinator.h: * page/scrolling/ScrollingCoordinator.h: (WebCore::ScrollingCoordinator::updateIsMonitoringWheelEventsForFrameView): (WebCore::ScrollingCoordinator::updateExpectsWheelEventTestTriggerWithFrameView): Deleted. * page/scrolling/ScrollingStateScrollingNode.cpp: (WebCore::ScrollingStateScrollingNode::ScrollingStateScrollingNode): (WebCore::ScrollingStateScrollingNode::setPropertyChangedBitsAfterReattach): (WebCore::ScrollingStateScrollingNode::setIsMonitoringWheelEvents): (WebCore::ScrollingStateScrollingNode::dumpProperties const): (WebCore::ScrollingStateScrollingNode::setExpectsWheelEventTestTrigger): Deleted. * page/scrolling/ScrollingStateScrollingNode.h: (WebCore::ScrollingStateScrollingNode::isMonitoringWheelEvents const): (WebCore::ScrollingStateScrollingNode::expectsWheelEventTestTrigger const): Deleted. * page/scrolling/ScrollingTree.h: (WebCore::ScrollingTree::deferWheelEventTestCompletionForReason): (WebCore::ScrollingTree::removeWheelEventTestCompletionDeferralForReason): (WebCore::ScrollingTree::deferTestsForReason): Deleted. (WebCore::ScrollingTree::removeTestDeferralForReason): Deleted. * page/scrolling/ScrollingTreeScrollingNode.cpp: (WebCore::ScrollingTreeScrollingNode::commitStateBeforeChildren): * page/scrolling/ScrollingTreeScrollingNode.h: * page/scrolling/ThreadedScrollingTree.cpp: (WebCore::ThreadedScrollingTree::deferWheelEventTestCompletionForReason): (WebCore::ThreadedScrollingTree::removeWheelEventTestCompletionDeferralForReason): (WebCore::ThreadedScrollingTree::deferTestsForReason): Deleted. (WebCore::ThreadedScrollingTree::removeTestDeferralForReason): Deleted. * page/scrolling/ThreadedScrollingTree.h: * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h: * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm: (WebCore::ScrollingTreeScrollingNodeDelegateMac::handleWheelEvent): (WebCore::ScrollingTreeScrollingNodeDelegateMac::deferWheelEventTestCompletionForReason const): (WebCore::ScrollingTreeScrollingNodeDelegateMac::removeWheelEventTestCompletionDeferralForReason const): (WebCore::ScrollingTreeScrollingNodeDelegateMac::deferTestsForReason const): Deleted. (WebCore::ScrollingTreeScrollingNodeDelegateMac::removeTestDeferralForReason const): Deleted. * platform/Logging.h: * platform/ScrollAnimator.cpp: (WebCore::ScrollAnimator::deferWheelEventTestCompletionForReason const): (WebCore::ScrollAnimator::removeWheelEventTestCompletionDeferralForReason const): (WebCore::ScrollAnimator::deferTestsForReason const): Deleted. (WebCore::ScrollAnimator::removeTestDeferralForReason const): Deleted. * platform/ScrollAnimator.h: (WebCore::ScrollAnimator::ScrollAnimator::setWheelEventTestMonitor): (WebCore::ScrollAnimator::ScrollAnimator::setWheelEventTestTrigger): Deleted. * platform/cocoa/ScrollController.h: (WebCore::ScrollControllerClient::deferWheelEventTestCompletionForReason const): (WebCore::ScrollControllerClient::removeWheelEventTestCompletionDeferralForReason const): (WebCore::ScrollControllerClient::deferTestsForReason const): Deleted. (WebCore::ScrollControllerClient::removeTestDeferralForReason const): Deleted. * platform/cocoa/ScrollController.mm: (WebCore::ScrollController::startSnapRubberbandTimer): (WebCore::ScrollController::stopSnapRubberbandTimer): (WebCore::ScrollController::scheduleStatelessScrollSnap): (WebCore::ScrollController::startDeferringWheelEventTestCompletionDueToScrollSnapping): (WebCore::ScrollController::stopDeferringWheelEventTestCompletionDueToScrollSnapping): (WebCore::ScrollController::startScrollSnapTimer): (WebCore::ScrollController::stopScrollSnapTimer): (WebCore::ScrollController::startDeferringTestsDueToScrollSnapping): Deleted. (WebCore::ScrollController::stopDeferringTestsDueToScrollSnapping): Deleted. * platform/mac/ScrollAnimatorMac.mm: (WebCore::ScrollAnimatorMac::didBeginScrollGesture const): (WebCore::ScrollAnimatorMac::didEndScrollGesture const): (WebCore::ScrollAnimatorMac::sendContentAreaScrolledSoon): (WebCore::ScrollAnimatorMac::sendContentAreaScrolledTimerFired): * rendering/RenderBox.cpp: (WebCore::setupWheelEventMonitor): (WebCore::RenderBox::setScrollLeft): (WebCore::RenderBox::setScrollTop): (WebCore::setupWheelEventTestTrigger): Deleted. * rendering/RenderLayer.cpp: (WebCore::RenderLayer::createScrollbar): * rendering/RenderListBox.cpp: (WebCore::setupWheelEventTestMonitor): (WebCore::RenderListBox::setScrollTop): (WebCore::RenderListBox::createScrollbar): (WebCore::setupWheelEventTestTrigger): Deleted. * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::monitorWheelEvents): (WebCoreTestSupport::setTestCallbackAndStartNotificationTimer): (WebCoreTestSupport::clearWheelEventTestMonitor): (WebCoreTestSupport::clearWheelEventTestTrigger): Deleted. * testing/js/WebCoreTestSupport.h: Source/WebKit: * UIProcess/API/C/WKPage.cpp: (WKPageClearWheelEventTestMonitor): (WKPageClearWheelEventTestTrigger): Deleted. * UIProcess/API/C/WKPage.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::clearWheelEventTestMonitor): (WebKit::WebPageProxy::clearWheelEventTestTrigger): Deleted. * UIProcess/WebPageProxy.h: * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageStartMonitoringScrollOperations): (WKBundlePageRegisterScrollOperationCompletionCallback): * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::createScrollbar): * WebProcess/WebPage/EventDispatcher.cpp: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::clearWheelEventTestMonitor): (WebKit::WebPage::clearWheelEventTestTrigger): Deleted. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: Tools: * DumpRenderTree/mac/DumpRenderTree.mm: (resetWebViewToConsistentStateBeforeTesting): * WebKitTestRunner/TestController.cpp: (WTR::TestController::resetStateToConsistentValues): Canonical link: https://commits.webkit.org/216237@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@250946 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-10-10 00:24:44 +00:00
LOG_WITH_STREAM(WheelEventTestMonitor, stream << " (=) WheelEventTestMonitor::removeDeferralForReason: id=" << identifier << ", reason=" << reason);
it->value.remove(reason);
if (it->value.isEmpty())
m_deferCompletionReasons.remove(it);
eventSender.monitorWheelEvents() is very fragile https://bugs.webkit.org/show_bug.cgi?id=197819 <rdar://problem/51319456> Reviewed by Tim Horton. Source/WebCore: Deflake tests using eventSender.monitorWheelEvents() by fixing several causes of flakiness, adding back changes from r257844 that were reverted in r258558. First, have EventSendingController keep track of whether it's seen then "end" event for the scrolling and momentum phases, and pass this down to WheelEventTestMonitor, which now waits until it sees these, which prevents premature triggering which was a common cause of failure before. Second, remove WheelEventTestMonitor's 1/60s timer and instead have WheelEventTestMonitor test for completion in a callout from the end of Page::updateRendering(), which makes it test and fire at a more consistent time. Third, push WheelEventTestMonitor to the ScrollingTree, so that reasons for deferral can be added on the scrolling thread. This fixes an issue where the RunLoop::main().dispatch() used to send the "ScrollingThreadSyncNeeded" reason to the main thread would get delayed, also resulting in a premature trigger. * Modules/applepay/ApplePaySession.cpp: Unified sources! * dom/WindowEventLoop.cpp: Unified sources! * page/EventHandler.cpp: (WebCore::EventHandler::handleWheelEvent): * page/FrameView.cpp: (WebCore::FrameView::scrollOffsetChangedViaPlatformWidgetImpl): * page/Page.cpp: (WebCore::Page::doAfterUpdateRendering): (WebCore::Page::wheelEventTestMonitor const): (WebCore::Page::clearWheelEventTestMonitor): (WebCore::Page::isMonitoringWheelEvents const): (WebCore::Page::ensureWheelEventTestMonitor): * page/Page.h: (WebCore::Page::wheelEventTestMonitor const): Deleted. (WebCore::Page::clearWheelEventTestMonitor): Deleted. (WebCore::Page::isMonitoringWheelEvents const): Deleted. * page/WheelEventTestMonitor.cpp: (WebCore::WheelEventTestMonitor::WheelEventTestMonitor): (WebCore::WheelEventTestMonitor::clearAllTestDeferrals): (WebCore::WheelEventTestMonitor::setTestCallbackAndStartMonitoring): (WebCore::WheelEventTestMonitor::deferForReason): (WebCore::WheelEventTestMonitor::removeDeferralForReason): (WebCore::WheelEventTestMonitor::receivedWheelEvent): (WebCore::WheelEventTestMonitor::scheduleCallbackCheck): (WebCore::WheelEventTestMonitor::checkShouldFireCallbacks): (WebCore::operator<<): (WebCore::WheelEventTestMonitor::setTestCallbackAndStartNotificationTimer): Deleted. (WebCore::WheelEventTestMonitor::triggerTestTimerFired): Deleted. * page/WheelEventTestMonitor.h: (WebCore::WheelEventTestMonitorCompletionDeferrer::WheelEventTestMonitorCompletionDeferrer): (WebCore::WheelEventTestMonitorCompletionDeferrer::~WheelEventTestMonitorCompletionDeferrer): * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated): (WebCore::AsyncScrollingCoordinator::deferWheelEventTestCompletionForReason const): Deleted. (WebCore::AsyncScrollingCoordinator::removeWheelEventTestCompletionDeferralForReason const): Deleted. * page/scrolling/AsyncScrollingCoordinator.h: * page/scrolling/ScrollingCoordinator.h: (WebCore::ScrollingCoordinator::startMonitoringWheelEvents): (WebCore::ScrollingCoordinator::stopMonitoringWheelEvents): * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::handleWheelEvent): * page/scrolling/ScrollingTree.h: (WebCore::ScrollingTree::setWheelEventTestMonitor): (WebCore::ScrollingTree::receivedWheelEvent): * page/scrolling/ThreadedScrollingTree.cpp: (WebCore::ThreadedScrollingTree::scrollingTreeNodeDidScroll): (WebCore::ThreadedScrollingTree::deferWheelEventTestCompletionForReason): Deleted. (WebCore::ThreadedScrollingTree::removeWheelEventTestCompletionDeferralForReason): Deleted. * page/scrolling/ThreadedScrollingTree.h: * page/scrolling/mac/ScrollingCoordinatorMac.h: * page/scrolling/mac/ScrollingCoordinatorMac.mm: (WebCore::ScrollingCoordinatorMac::startMonitoringWheelEvents): (WebCore::ScrollingCoordinatorMac::stopMonitoringWheelEvents): * page/scrolling/mac/ScrollingTreeMac.h: * page/scrolling/mac/ScrollingTreeMac.mm: (ScrollingTreeMac::setWheelEventTestMonitor): (ScrollingTreeMac::receivedWheelEvent): (ScrollingTreeMac::deferWheelEventTestCompletionForReason): (ScrollingTreeMac::removeWheelEventTestCompletionDeferralForReason): * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm: (WebCore::ScrollingTreeScrollingNodeDelegateMac::deferWheelEventTestCompletionForReason const): (WebCore::ScrollingTreeScrollingNodeDelegateMac::removeWheelEventTestCompletionDeferralForReason const): * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::setWheelEventMonitorTestCallbackAndStartMonitoring): (WebCoreTestSupport::setTestCallbackAndStartNotificationTimer): Deleted. * testing/js/WebCoreTestSupport.h: Source/WebKit: Deflake tests using eventSender.monitorWheelEvents() by fixing several causes of flakiness, adding back changes from r257844 that were reverted in r258558. First, have EventSendingController keep track of whether it's seen then "end" event for the scrolling and momentum phases, and pass this down to WheelEventTestMonitor, which now waits until it sees these, which prevents premature triggering which was a common cause of failure before. Second, remove WheelEventTestMonitor's 1/60s timer and instead have WheelEventTestMonitor test for completion in a callout from the end of Page::updateRendering(), which makes it test and fire at a more consistent time. Third, push WheelEventTestMonitor to the ScrollingTree, so that reasons for deferral can be added on the scrolling thread. This fixes an issue where the RunLoop::main().dispatch() used to send the "ScrollingThreadSyncNeeded" reason to the main thread would get delayed, also resulting in a premature trigger. * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageRegisterScrollOperationCompletionCallback): * WebProcess/InjectedBundle/API/c/WKBundlePage.h: Tools: Deflake tests using eventSender.monitorWheelEvents() by fixing several causes of flakiness, adding back changes from r257844 that were reverted in r258558. First, have EventSendingController keep track of whether it's seen then "end" event for the scrolling and momentum phases, and pass this down to WheelEventTestMonitor, which now waits until it sees these, which prevents premature triggering which was a common cause of failure before. Second, remove WheelEventTestMonitor's 1/60s timer and instead have WheelEventTestMonitor test for completion in a callout from the end of Page::updateRendering(), which makes it test and fire at a more consistent time. Third, push WheelEventTestMonitor to the ScrollingTree, so that reasons for deferral can be added on the scrolling thread. This fixes an issue where the RunLoop::main().dispatch() used to send the "ScrollingThreadSyncNeeded" reason to the main thread would get delayed, also resulting in a premature trigger. * DumpRenderTree/mac/EventSendingController.h: * DumpRenderTree/mac/EventSendingController.mm: (-[EventSendingController mouseScrollByX:andY:withWheel:andMomentumPhases:]): (-[EventSendingController monitorWheelEvents]): (-[EventSendingController callAfterScrollingCompletes:]): * DumpRenderTree/win/EventSender.cpp: (mouseScrollBy): * WebKitTestRunner/InjectedBundle/EventSendingController.cpp: (WTR::EventSendingController::mouseScrollByWithWheelAndMomentumPhases): (WTR::EventSendingController::monitorWheelEvents): (WTR::EventSendingController::callAfterScrollingCompletes): * WebKitTestRunner/InjectedBundle/EventSendingController.h: LayoutTests: * platform/mac-wk2/TestExpectations: * platform/win/TestExpectations: * tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-2d-overflow.html: Need to call eventSender.monitorWheelEvents() for each subtest. Canonical link: https://commits.webkit.org/222192@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@258679 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-03-19 04:06:37 +00:00
scheduleCallbackCheck();
Rename WheelEventTestTrigger and improve naming in related code https://bugs.webkit.org/show_bug.cgi?id=202772 Reviewed by Tim Horton. Change the "test trigger" terminology to "monitor wheel events"; after all, tests call monitorWheelEvents() and callAfterScrollingCompletes(), and this is not triggering a test. Source/WebCore: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * page/FrameView.cpp: (WebCore::FrameView::adjustScrollbarsForLayout): (WebCore::FrameView::setScrollPosition): (WebCore::FrameView::didAddScrollbar): * page/Page.cpp: (WebCore::Page::ensureWheelEventTestMonitor): (WebCore::Page::ensureTestTrigger): Deleted. * page/Page.h: (WebCore::Page::wheelEventTestMonitor const): (WebCore::Page::clearWheelEventTestMonitor): (WebCore::Page::isMonitoringWheelEvents const): (WebCore::Page::testTrigger const): Deleted. (WebCore::Page::clearTrigger): Deleted. (WebCore::Page::expectsWheelEventTriggers const): Deleted. * page/WheelEventTestMonitor.cpp: Added. (WebCore::WheelEventTestMonitor::WheelEventTestMonitor): (WebCore::WheelEventTestMonitor::clearAllTestDeferrals): (WebCore::WheelEventTestMonitor::setTestCallbackAndStartNotificationTimer): (WebCore::WheelEventTestMonitor::deferForReason): (WebCore::WheelEventTestMonitor::removeDeferralForReason): (WebCore::WheelEventTestMonitor::triggerTestTimerFired): (WebCore::operator<<): * page/WheelEventTestMonitor.h: Renamed from Source/WebCore/page/WheelEventTestTrigger.h. * page/WheelEventTestTrigger.cpp: Removed. * page/mac/EventHandlerMac.mm: (WebCore::EventHandler::platformPrepareForWheelEvents): * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated): (WebCore::AsyncScrollingCoordinator::updateIsMonitoringWheelEventsForFrameView): (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll): (WebCore::AsyncScrollingCoordinator::deferWheelEventTestCompletionForReason const): (WebCore::AsyncScrollingCoordinator::removeWheelEventTestCompletionDeferralForReason const): (WebCore::AsyncScrollingCoordinator::updateExpectsWheelEventTestTriggerWithFrameView): Deleted. (WebCore::AsyncScrollingCoordinator::deferTestsForReason const): Deleted. (WebCore::AsyncScrollingCoordinator::removeTestDeferralForReason const): Deleted. * page/scrolling/AsyncScrollingCoordinator.h: * page/scrolling/ScrollingCoordinator.h: (WebCore::ScrollingCoordinator::updateIsMonitoringWheelEventsForFrameView): (WebCore::ScrollingCoordinator::updateExpectsWheelEventTestTriggerWithFrameView): Deleted. * page/scrolling/ScrollingStateScrollingNode.cpp: (WebCore::ScrollingStateScrollingNode::ScrollingStateScrollingNode): (WebCore::ScrollingStateScrollingNode::setPropertyChangedBitsAfterReattach): (WebCore::ScrollingStateScrollingNode::setIsMonitoringWheelEvents): (WebCore::ScrollingStateScrollingNode::dumpProperties const): (WebCore::ScrollingStateScrollingNode::setExpectsWheelEventTestTrigger): Deleted. * page/scrolling/ScrollingStateScrollingNode.h: (WebCore::ScrollingStateScrollingNode::isMonitoringWheelEvents const): (WebCore::ScrollingStateScrollingNode::expectsWheelEventTestTrigger const): Deleted. * page/scrolling/ScrollingTree.h: (WebCore::ScrollingTree::deferWheelEventTestCompletionForReason): (WebCore::ScrollingTree::removeWheelEventTestCompletionDeferralForReason): (WebCore::ScrollingTree::deferTestsForReason): Deleted. (WebCore::ScrollingTree::removeTestDeferralForReason): Deleted. * page/scrolling/ScrollingTreeScrollingNode.cpp: (WebCore::ScrollingTreeScrollingNode::commitStateBeforeChildren): * page/scrolling/ScrollingTreeScrollingNode.h: * page/scrolling/ThreadedScrollingTree.cpp: (WebCore::ThreadedScrollingTree::deferWheelEventTestCompletionForReason): (WebCore::ThreadedScrollingTree::removeWheelEventTestCompletionDeferralForReason): (WebCore::ThreadedScrollingTree::deferTestsForReason): Deleted. (WebCore::ThreadedScrollingTree::removeTestDeferralForReason): Deleted. * page/scrolling/ThreadedScrollingTree.h: * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h: * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm: (WebCore::ScrollingTreeScrollingNodeDelegateMac::handleWheelEvent): (WebCore::ScrollingTreeScrollingNodeDelegateMac::deferWheelEventTestCompletionForReason const): (WebCore::ScrollingTreeScrollingNodeDelegateMac::removeWheelEventTestCompletionDeferralForReason const): (WebCore::ScrollingTreeScrollingNodeDelegateMac::deferTestsForReason const): Deleted. (WebCore::ScrollingTreeScrollingNodeDelegateMac::removeTestDeferralForReason const): Deleted. * platform/Logging.h: * platform/ScrollAnimator.cpp: (WebCore::ScrollAnimator::deferWheelEventTestCompletionForReason const): (WebCore::ScrollAnimator::removeWheelEventTestCompletionDeferralForReason const): (WebCore::ScrollAnimator::deferTestsForReason const): Deleted. (WebCore::ScrollAnimator::removeTestDeferralForReason const): Deleted. * platform/ScrollAnimator.h: (WebCore::ScrollAnimator::ScrollAnimator::setWheelEventTestMonitor): (WebCore::ScrollAnimator::ScrollAnimator::setWheelEventTestTrigger): Deleted. * platform/cocoa/ScrollController.h: (WebCore::ScrollControllerClient::deferWheelEventTestCompletionForReason const): (WebCore::ScrollControllerClient::removeWheelEventTestCompletionDeferralForReason const): (WebCore::ScrollControllerClient::deferTestsForReason const): Deleted. (WebCore::ScrollControllerClient::removeTestDeferralForReason const): Deleted. * platform/cocoa/ScrollController.mm: (WebCore::ScrollController::startSnapRubberbandTimer): (WebCore::ScrollController::stopSnapRubberbandTimer): (WebCore::ScrollController::scheduleStatelessScrollSnap): (WebCore::ScrollController::startDeferringWheelEventTestCompletionDueToScrollSnapping): (WebCore::ScrollController::stopDeferringWheelEventTestCompletionDueToScrollSnapping): (WebCore::ScrollController::startScrollSnapTimer): (WebCore::ScrollController::stopScrollSnapTimer): (WebCore::ScrollController::startDeferringTestsDueToScrollSnapping): Deleted. (WebCore::ScrollController::stopDeferringTestsDueToScrollSnapping): Deleted. * platform/mac/ScrollAnimatorMac.mm: (WebCore::ScrollAnimatorMac::didBeginScrollGesture const): (WebCore::ScrollAnimatorMac::didEndScrollGesture const): (WebCore::ScrollAnimatorMac::sendContentAreaScrolledSoon): (WebCore::ScrollAnimatorMac::sendContentAreaScrolledTimerFired): * rendering/RenderBox.cpp: (WebCore::setupWheelEventMonitor): (WebCore::RenderBox::setScrollLeft): (WebCore::RenderBox::setScrollTop): (WebCore::setupWheelEventTestTrigger): Deleted. * rendering/RenderLayer.cpp: (WebCore::RenderLayer::createScrollbar): * rendering/RenderListBox.cpp: (WebCore::setupWheelEventTestMonitor): (WebCore::RenderListBox::setScrollTop): (WebCore::RenderListBox::createScrollbar): (WebCore::setupWheelEventTestTrigger): Deleted. * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::monitorWheelEvents): (WebCoreTestSupport::setTestCallbackAndStartNotificationTimer): (WebCoreTestSupport::clearWheelEventTestMonitor): (WebCoreTestSupport::clearWheelEventTestTrigger): Deleted. * testing/js/WebCoreTestSupport.h: Source/WebKit: * UIProcess/API/C/WKPage.cpp: (WKPageClearWheelEventTestMonitor): (WKPageClearWheelEventTestTrigger): Deleted. * UIProcess/API/C/WKPage.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::clearWheelEventTestMonitor): (WebKit::WebPageProxy::clearWheelEventTestTrigger): Deleted. * UIProcess/WebPageProxy.h: * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageStartMonitoringScrollOperations): (WKBundlePageRegisterScrollOperationCompletionCallback): * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::createScrollbar): * WebProcess/WebPage/EventDispatcher.cpp: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::clearWheelEventTestMonitor): (WebKit::WebPage::clearWheelEventTestTrigger): Deleted. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: Tools: * DumpRenderTree/mac/DumpRenderTree.mm: (resetWebViewToConsistentStateBeforeTesting): * WebKitTestRunner/TestController.cpp: (WTR::TestController::resetStateToConsistentValues): Canonical link: https://commits.webkit.org/216237@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@250946 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-10-10 00:24:44 +00:00
}
eventSender.monitorWheelEvents() is very fragile https://bugs.webkit.org/show_bug.cgi?id=197819 <rdar://problem/51319456> Reviewed by Tim Horton. Source/WebCore: Deflake tests using eventSender.monitorWheelEvents() by fixing several causes of flakiness, adding back changes from r257844 that were reverted in r258558. First, have EventSendingController keep track of whether it's seen then "end" event for the scrolling and momentum phases, and pass this down to WheelEventTestMonitor, which now waits until it sees these, which prevents premature triggering which was a common cause of failure before. Second, remove WheelEventTestMonitor's 1/60s timer and instead have WheelEventTestMonitor test for completion in a callout from the end of Page::updateRendering(), which makes it test and fire at a more consistent time. Third, push WheelEventTestMonitor to the ScrollingTree, so that reasons for deferral can be added on the scrolling thread. This fixes an issue where the RunLoop::main().dispatch() used to send the "ScrollingThreadSyncNeeded" reason to the main thread would get delayed, also resulting in a premature trigger. * Modules/applepay/ApplePaySession.cpp: Unified sources! * dom/WindowEventLoop.cpp: Unified sources! * page/EventHandler.cpp: (WebCore::EventHandler::handleWheelEvent): * page/FrameView.cpp: (WebCore::FrameView::scrollOffsetChangedViaPlatformWidgetImpl): * page/Page.cpp: (WebCore::Page::doAfterUpdateRendering): (WebCore::Page::wheelEventTestMonitor const): (WebCore::Page::clearWheelEventTestMonitor): (WebCore::Page::isMonitoringWheelEvents const): (WebCore::Page::ensureWheelEventTestMonitor): * page/Page.h: (WebCore::Page::wheelEventTestMonitor const): Deleted. (WebCore::Page::clearWheelEventTestMonitor): Deleted. (WebCore::Page::isMonitoringWheelEvents const): Deleted. * page/WheelEventTestMonitor.cpp: (WebCore::WheelEventTestMonitor::WheelEventTestMonitor): (WebCore::WheelEventTestMonitor::clearAllTestDeferrals): (WebCore::WheelEventTestMonitor::setTestCallbackAndStartMonitoring): (WebCore::WheelEventTestMonitor::deferForReason): (WebCore::WheelEventTestMonitor::removeDeferralForReason): (WebCore::WheelEventTestMonitor::receivedWheelEvent): (WebCore::WheelEventTestMonitor::scheduleCallbackCheck): (WebCore::WheelEventTestMonitor::checkShouldFireCallbacks): (WebCore::operator<<): (WebCore::WheelEventTestMonitor::setTestCallbackAndStartNotificationTimer): Deleted. (WebCore::WheelEventTestMonitor::triggerTestTimerFired): Deleted. * page/WheelEventTestMonitor.h: (WebCore::WheelEventTestMonitorCompletionDeferrer::WheelEventTestMonitorCompletionDeferrer): (WebCore::WheelEventTestMonitorCompletionDeferrer::~WheelEventTestMonitorCompletionDeferrer): * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated): (WebCore::AsyncScrollingCoordinator::deferWheelEventTestCompletionForReason const): Deleted. (WebCore::AsyncScrollingCoordinator::removeWheelEventTestCompletionDeferralForReason const): Deleted. * page/scrolling/AsyncScrollingCoordinator.h: * page/scrolling/ScrollingCoordinator.h: (WebCore::ScrollingCoordinator::startMonitoringWheelEvents): (WebCore::ScrollingCoordinator::stopMonitoringWheelEvents): * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::handleWheelEvent): * page/scrolling/ScrollingTree.h: (WebCore::ScrollingTree::setWheelEventTestMonitor): (WebCore::ScrollingTree::receivedWheelEvent): * page/scrolling/ThreadedScrollingTree.cpp: (WebCore::ThreadedScrollingTree::scrollingTreeNodeDidScroll): (WebCore::ThreadedScrollingTree::deferWheelEventTestCompletionForReason): Deleted. (WebCore::ThreadedScrollingTree::removeWheelEventTestCompletionDeferralForReason): Deleted. * page/scrolling/ThreadedScrollingTree.h: * page/scrolling/mac/ScrollingCoordinatorMac.h: * page/scrolling/mac/ScrollingCoordinatorMac.mm: (WebCore::ScrollingCoordinatorMac::startMonitoringWheelEvents): (WebCore::ScrollingCoordinatorMac::stopMonitoringWheelEvents): * page/scrolling/mac/ScrollingTreeMac.h: * page/scrolling/mac/ScrollingTreeMac.mm: (ScrollingTreeMac::setWheelEventTestMonitor): (ScrollingTreeMac::receivedWheelEvent): (ScrollingTreeMac::deferWheelEventTestCompletionForReason): (ScrollingTreeMac::removeWheelEventTestCompletionDeferralForReason): * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm: (WebCore::ScrollingTreeScrollingNodeDelegateMac::deferWheelEventTestCompletionForReason const): (WebCore::ScrollingTreeScrollingNodeDelegateMac::removeWheelEventTestCompletionDeferralForReason const): * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::setWheelEventMonitorTestCallbackAndStartMonitoring): (WebCoreTestSupport::setTestCallbackAndStartNotificationTimer): Deleted. * testing/js/WebCoreTestSupport.h: Source/WebKit: Deflake tests using eventSender.monitorWheelEvents() by fixing several causes of flakiness, adding back changes from r257844 that were reverted in r258558. First, have EventSendingController keep track of whether it's seen then "end" event for the scrolling and momentum phases, and pass this down to WheelEventTestMonitor, which now waits until it sees these, which prevents premature triggering which was a common cause of failure before. Second, remove WheelEventTestMonitor's 1/60s timer and instead have WheelEventTestMonitor test for completion in a callout from the end of Page::updateRendering(), which makes it test and fire at a more consistent time. Third, push WheelEventTestMonitor to the ScrollingTree, so that reasons for deferral can be added on the scrolling thread. This fixes an issue where the RunLoop::main().dispatch() used to send the "ScrollingThreadSyncNeeded" reason to the main thread would get delayed, also resulting in a premature trigger. * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageRegisterScrollOperationCompletionCallback): * WebProcess/InjectedBundle/API/c/WKBundlePage.h: Tools: Deflake tests using eventSender.monitorWheelEvents() by fixing several causes of flakiness, adding back changes from r257844 that were reverted in r258558. First, have EventSendingController keep track of whether it's seen then "end" event for the scrolling and momentum phases, and pass this down to WheelEventTestMonitor, which now waits until it sees these, which prevents premature triggering which was a common cause of failure before. Second, remove WheelEventTestMonitor's 1/60s timer and instead have WheelEventTestMonitor test for completion in a callout from the end of Page::updateRendering(), which makes it test and fire at a more consistent time. Third, push WheelEventTestMonitor to the ScrollingTree, so that reasons for deferral can be added on the scrolling thread. This fixes an issue where the RunLoop::main().dispatch() used to send the "ScrollingThreadSyncNeeded" reason to the main thread would get delayed, also resulting in a premature trigger. * DumpRenderTree/mac/EventSendingController.h: * DumpRenderTree/mac/EventSendingController.mm: (-[EventSendingController mouseScrollByX:andY:withWheel:andMomentumPhases:]): (-[EventSendingController monitorWheelEvents]): (-[EventSendingController callAfterScrollingCompletes:]): * DumpRenderTree/win/EventSender.cpp: (mouseScrollBy): * WebKitTestRunner/InjectedBundle/EventSendingController.cpp: (WTR::EventSendingController::mouseScrollByWithWheelAndMomentumPhases): (WTR::EventSendingController::monitorWheelEvents): (WTR::EventSendingController::callAfterScrollingCompletes): * WebKitTestRunner/InjectedBundle/EventSendingController.h: LayoutTests: * platform/mac-wk2/TestExpectations: * platform/win/TestExpectations: * tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-2d-overflow.html: Need to call eventSender.monitorWheelEvents() for each subtest. Canonical link: https://commits.webkit.org/222192@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@258679 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-03-19 04:06:37 +00:00
void WheelEventTestMonitor::receivedWheelEvent(const PlatformWheelEvent& event)
Rename WheelEventTestTrigger and improve naming in related code https://bugs.webkit.org/show_bug.cgi?id=202772 Reviewed by Tim Horton. Change the "test trigger" terminology to "monitor wheel events"; after all, tests call monitorWheelEvents() and callAfterScrollingCompletes(), and this is not triggering a test. Source/WebCore: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * page/FrameView.cpp: (WebCore::FrameView::adjustScrollbarsForLayout): (WebCore::FrameView::setScrollPosition): (WebCore::FrameView::didAddScrollbar): * page/Page.cpp: (WebCore::Page::ensureWheelEventTestMonitor): (WebCore::Page::ensureTestTrigger): Deleted. * page/Page.h: (WebCore::Page::wheelEventTestMonitor const): (WebCore::Page::clearWheelEventTestMonitor): (WebCore::Page::isMonitoringWheelEvents const): (WebCore::Page::testTrigger const): Deleted. (WebCore::Page::clearTrigger): Deleted. (WebCore::Page::expectsWheelEventTriggers const): Deleted. * page/WheelEventTestMonitor.cpp: Added. (WebCore::WheelEventTestMonitor::WheelEventTestMonitor): (WebCore::WheelEventTestMonitor::clearAllTestDeferrals): (WebCore::WheelEventTestMonitor::setTestCallbackAndStartNotificationTimer): (WebCore::WheelEventTestMonitor::deferForReason): (WebCore::WheelEventTestMonitor::removeDeferralForReason): (WebCore::WheelEventTestMonitor::triggerTestTimerFired): (WebCore::operator<<): * page/WheelEventTestMonitor.h: Renamed from Source/WebCore/page/WheelEventTestTrigger.h. * page/WheelEventTestTrigger.cpp: Removed. * page/mac/EventHandlerMac.mm: (WebCore::EventHandler::platformPrepareForWheelEvents): * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated): (WebCore::AsyncScrollingCoordinator::updateIsMonitoringWheelEventsForFrameView): (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll): (WebCore::AsyncScrollingCoordinator::deferWheelEventTestCompletionForReason const): (WebCore::AsyncScrollingCoordinator::removeWheelEventTestCompletionDeferralForReason const): (WebCore::AsyncScrollingCoordinator::updateExpectsWheelEventTestTriggerWithFrameView): Deleted. (WebCore::AsyncScrollingCoordinator::deferTestsForReason const): Deleted. (WebCore::AsyncScrollingCoordinator::removeTestDeferralForReason const): Deleted. * page/scrolling/AsyncScrollingCoordinator.h: * page/scrolling/ScrollingCoordinator.h: (WebCore::ScrollingCoordinator::updateIsMonitoringWheelEventsForFrameView): (WebCore::ScrollingCoordinator::updateExpectsWheelEventTestTriggerWithFrameView): Deleted. * page/scrolling/ScrollingStateScrollingNode.cpp: (WebCore::ScrollingStateScrollingNode::ScrollingStateScrollingNode): (WebCore::ScrollingStateScrollingNode::setPropertyChangedBitsAfterReattach): (WebCore::ScrollingStateScrollingNode::setIsMonitoringWheelEvents): (WebCore::ScrollingStateScrollingNode::dumpProperties const): (WebCore::ScrollingStateScrollingNode::setExpectsWheelEventTestTrigger): Deleted. * page/scrolling/ScrollingStateScrollingNode.h: (WebCore::ScrollingStateScrollingNode::isMonitoringWheelEvents const): (WebCore::ScrollingStateScrollingNode::expectsWheelEventTestTrigger const): Deleted. * page/scrolling/ScrollingTree.h: (WebCore::ScrollingTree::deferWheelEventTestCompletionForReason): (WebCore::ScrollingTree::removeWheelEventTestCompletionDeferralForReason): (WebCore::ScrollingTree::deferTestsForReason): Deleted. (WebCore::ScrollingTree::removeTestDeferralForReason): Deleted. * page/scrolling/ScrollingTreeScrollingNode.cpp: (WebCore::ScrollingTreeScrollingNode::commitStateBeforeChildren): * page/scrolling/ScrollingTreeScrollingNode.h: * page/scrolling/ThreadedScrollingTree.cpp: (WebCore::ThreadedScrollingTree::deferWheelEventTestCompletionForReason): (WebCore::ThreadedScrollingTree::removeWheelEventTestCompletionDeferralForReason): (WebCore::ThreadedScrollingTree::deferTestsForReason): Deleted. (WebCore::ThreadedScrollingTree::removeTestDeferralForReason): Deleted. * page/scrolling/ThreadedScrollingTree.h: * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h: * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm: (WebCore::ScrollingTreeScrollingNodeDelegateMac::handleWheelEvent): (WebCore::ScrollingTreeScrollingNodeDelegateMac::deferWheelEventTestCompletionForReason const): (WebCore::ScrollingTreeScrollingNodeDelegateMac::removeWheelEventTestCompletionDeferralForReason const): (WebCore::ScrollingTreeScrollingNodeDelegateMac::deferTestsForReason const): Deleted. (WebCore::ScrollingTreeScrollingNodeDelegateMac::removeTestDeferralForReason const): Deleted. * platform/Logging.h: * platform/ScrollAnimator.cpp: (WebCore::ScrollAnimator::deferWheelEventTestCompletionForReason const): (WebCore::ScrollAnimator::removeWheelEventTestCompletionDeferralForReason const): (WebCore::ScrollAnimator::deferTestsForReason const): Deleted. (WebCore::ScrollAnimator::removeTestDeferralForReason const): Deleted. * platform/ScrollAnimator.h: (WebCore::ScrollAnimator::ScrollAnimator::setWheelEventTestMonitor): (WebCore::ScrollAnimator::ScrollAnimator::setWheelEventTestTrigger): Deleted. * platform/cocoa/ScrollController.h: (WebCore::ScrollControllerClient::deferWheelEventTestCompletionForReason const): (WebCore::ScrollControllerClient::removeWheelEventTestCompletionDeferralForReason const): (WebCore::ScrollControllerClient::deferTestsForReason const): Deleted. (WebCore::ScrollControllerClient::removeTestDeferralForReason const): Deleted. * platform/cocoa/ScrollController.mm: (WebCore::ScrollController::startSnapRubberbandTimer): (WebCore::ScrollController::stopSnapRubberbandTimer): (WebCore::ScrollController::scheduleStatelessScrollSnap): (WebCore::ScrollController::startDeferringWheelEventTestCompletionDueToScrollSnapping): (WebCore::ScrollController::stopDeferringWheelEventTestCompletionDueToScrollSnapping): (WebCore::ScrollController::startScrollSnapTimer): (WebCore::ScrollController::stopScrollSnapTimer): (WebCore::ScrollController::startDeferringTestsDueToScrollSnapping): Deleted. (WebCore::ScrollController::stopDeferringTestsDueToScrollSnapping): Deleted. * platform/mac/ScrollAnimatorMac.mm: (WebCore::ScrollAnimatorMac::didBeginScrollGesture const): (WebCore::ScrollAnimatorMac::didEndScrollGesture const): (WebCore::ScrollAnimatorMac::sendContentAreaScrolledSoon): (WebCore::ScrollAnimatorMac::sendContentAreaScrolledTimerFired): * rendering/RenderBox.cpp: (WebCore::setupWheelEventMonitor): (WebCore::RenderBox::setScrollLeft): (WebCore::RenderBox::setScrollTop): (WebCore::setupWheelEventTestTrigger): Deleted. * rendering/RenderLayer.cpp: (WebCore::RenderLayer::createScrollbar): * rendering/RenderListBox.cpp: (WebCore::setupWheelEventTestMonitor): (WebCore::RenderListBox::setScrollTop): (WebCore::RenderListBox::createScrollbar): (WebCore::setupWheelEventTestTrigger): Deleted. * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::monitorWheelEvents): (WebCoreTestSupport::setTestCallbackAndStartNotificationTimer): (WebCoreTestSupport::clearWheelEventTestMonitor): (WebCoreTestSupport::clearWheelEventTestTrigger): Deleted. * testing/js/WebCoreTestSupport.h: Source/WebKit: * UIProcess/API/C/WKPage.cpp: (WKPageClearWheelEventTestMonitor): (WKPageClearWheelEventTestTrigger): Deleted. * UIProcess/API/C/WKPage.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::clearWheelEventTestMonitor): (WebKit::WebPageProxy::clearWheelEventTestTrigger): Deleted. * UIProcess/WebPageProxy.h: * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageStartMonitoringScrollOperations): (WKBundlePageRegisterScrollOperationCompletionCallback): * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::createScrollbar): * WebProcess/WebPage/EventDispatcher.cpp: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::clearWheelEventTestMonitor): (WebKit::WebPage::clearWheelEventTestTrigger): Deleted. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: Tools: * DumpRenderTree/mac/DumpRenderTree.mm: (resetWebViewToConsistentStateBeforeTesting): * WebKitTestRunner/TestController.cpp: (WTR::TestController::resetStateToConsistentValues): Canonical link: https://commits.webkit.org/216237@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@250946 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-10-10 00:24:44 +00:00
{
eventSender.monitorWheelEvents() is very fragile https://bugs.webkit.org/show_bug.cgi?id=197819 <rdar://problem/51319456> Reviewed by Tim Horton. Source/WebCore: Deflake tests using eventSender.monitorWheelEvents() by fixing several causes of flakiness, adding back changes from r257844 that were reverted in r258558. First, have EventSendingController keep track of whether it's seen then "end" event for the scrolling and momentum phases, and pass this down to WheelEventTestMonitor, which now waits until it sees these, which prevents premature triggering which was a common cause of failure before. Second, remove WheelEventTestMonitor's 1/60s timer and instead have WheelEventTestMonitor test for completion in a callout from the end of Page::updateRendering(), which makes it test and fire at a more consistent time. Third, push WheelEventTestMonitor to the ScrollingTree, so that reasons for deferral can be added on the scrolling thread. This fixes an issue where the RunLoop::main().dispatch() used to send the "ScrollingThreadSyncNeeded" reason to the main thread would get delayed, also resulting in a premature trigger. * Modules/applepay/ApplePaySession.cpp: Unified sources! * dom/WindowEventLoop.cpp: Unified sources! * page/EventHandler.cpp: (WebCore::EventHandler::handleWheelEvent): * page/FrameView.cpp: (WebCore::FrameView::scrollOffsetChangedViaPlatformWidgetImpl): * page/Page.cpp: (WebCore::Page::doAfterUpdateRendering): (WebCore::Page::wheelEventTestMonitor const): (WebCore::Page::clearWheelEventTestMonitor): (WebCore::Page::isMonitoringWheelEvents const): (WebCore::Page::ensureWheelEventTestMonitor): * page/Page.h: (WebCore::Page::wheelEventTestMonitor const): Deleted. (WebCore::Page::clearWheelEventTestMonitor): Deleted. (WebCore::Page::isMonitoringWheelEvents const): Deleted. * page/WheelEventTestMonitor.cpp: (WebCore::WheelEventTestMonitor::WheelEventTestMonitor): (WebCore::WheelEventTestMonitor::clearAllTestDeferrals): (WebCore::WheelEventTestMonitor::setTestCallbackAndStartMonitoring): (WebCore::WheelEventTestMonitor::deferForReason): (WebCore::WheelEventTestMonitor::removeDeferralForReason): (WebCore::WheelEventTestMonitor::receivedWheelEvent): (WebCore::WheelEventTestMonitor::scheduleCallbackCheck): (WebCore::WheelEventTestMonitor::checkShouldFireCallbacks): (WebCore::operator<<): (WebCore::WheelEventTestMonitor::setTestCallbackAndStartNotificationTimer): Deleted. (WebCore::WheelEventTestMonitor::triggerTestTimerFired): Deleted. * page/WheelEventTestMonitor.h: (WebCore::WheelEventTestMonitorCompletionDeferrer::WheelEventTestMonitorCompletionDeferrer): (WebCore::WheelEventTestMonitorCompletionDeferrer::~WheelEventTestMonitorCompletionDeferrer): * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated): (WebCore::AsyncScrollingCoordinator::deferWheelEventTestCompletionForReason const): Deleted. (WebCore::AsyncScrollingCoordinator::removeWheelEventTestCompletionDeferralForReason const): Deleted. * page/scrolling/AsyncScrollingCoordinator.h: * page/scrolling/ScrollingCoordinator.h: (WebCore::ScrollingCoordinator::startMonitoringWheelEvents): (WebCore::ScrollingCoordinator::stopMonitoringWheelEvents): * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::handleWheelEvent): * page/scrolling/ScrollingTree.h: (WebCore::ScrollingTree::setWheelEventTestMonitor): (WebCore::ScrollingTree::receivedWheelEvent): * page/scrolling/ThreadedScrollingTree.cpp: (WebCore::ThreadedScrollingTree::scrollingTreeNodeDidScroll): (WebCore::ThreadedScrollingTree::deferWheelEventTestCompletionForReason): Deleted. (WebCore::ThreadedScrollingTree::removeWheelEventTestCompletionDeferralForReason): Deleted. * page/scrolling/ThreadedScrollingTree.h: * page/scrolling/mac/ScrollingCoordinatorMac.h: * page/scrolling/mac/ScrollingCoordinatorMac.mm: (WebCore::ScrollingCoordinatorMac::startMonitoringWheelEvents): (WebCore::ScrollingCoordinatorMac::stopMonitoringWheelEvents): * page/scrolling/mac/ScrollingTreeMac.h: * page/scrolling/mac/ScrollingTreeMac.mm: (ScrollingTreeMac::setWheelEventTestMonitor): (ScrollingTreeMac::receivedWheelEvent): (ScrollingTreeMac::deferWheelEventTestCompletionForReason): (ScrollingTreeMac::removeWheelEventTestCompletionDeferralForReason): * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm: (WebCore::ScrollingTreeScrollingNodeDelegateMac::deferWheelEventTestCompletionForReason const): (WebCore::ScrollingTreeScrollingNodeDelegateMac::removeWheelEventTestCompletionDeferralForReason const): * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::setWheelEventMonitorTestCallbackAndStartMonitoring): (WebCoreTestSupport::setTestCallbackAndStartNotificationTimer): Deleted. * testing/js/WebCoreTestSupport.h: Source/WebKit: Deflake tests using eventSender.monitorWheelEvents() by fixing several causes of flakiness, adding back changes from r257844 that were reverted in r258558. First, have EventSendingController keep track of whether it's seen then "end" event for the scrolling and momentum phases, and pass this down to WheelEventTestMonitor, which now waits until it sees these, which prevents premature triggering which was a common cause of failure before. Second, remove WheelEventTestMonitor's 1/60s timer and instead have WheelEventTestMonitor test for completion in a callout from the end of Page::updateRendering(), which makes it test and fire at a more consistent time. Third, push WheelEventTestMonitor to the ScrollingTree, so that reasons for deferral can be added on the scrolling thread. This fixes an issue where the RunLoop::main().dispatch() used to send the "ScrollingThreadSyncNeeded" reason to the main thread would get delayed, also resulting in a premature trigger. * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageRegisterScrollOperationCompletionCallback): * WebProcess/InjectedBundle/API/c/WKBundlePage.h: Tools: Deflake tests using eventSender.monitorWheelEvents() by fixing several causes of flakiness, adding back changes from r257844 that were reverted in r258558. First, have EventSendingController keep track of whether it's seen then "end" event for the scrolling and momentum phases, and pass this down to WheelEventTestMonitor, which now waits until it sees these, which prevents premature triggering which was a common cause of failure before. Second, remove WheelEventTestMonitor's 1/60s timer and instead have WheelEventTestMonitor test for completion in a callout from the end of Page::updateRendering(), which makes it test and fire at a more consistent time. Third, push WheelEventTestMonitor to the ScrollingTree, so that reasons for deferral can be added on the scrolling thread. This fixes an issue where the RunLoop::main().dispatch() used to send the "ScrollingThreadSyncNeeded" reason to the main thread would get delayed, also resulting in a premature trigger. * DumpRenderTree/mac/EventSendingController.h: * DumpRenderTree/mac/EventSendingController.mm: (-[EventSendingController mouseScrollByX:andY:withWheel:andMomentumPhases:]): (-[EventSendingController monitorWheelEvents]): (-[EventSendingController callAfterScrollingCompletes:]): * DumpRenderTree/win/EventSender.cpp: (mouseScrollBy): * WebKitTestRunner/InjectedBundle/EventSendingController.cpp: (WTR::EventSendingController::mouseScrollByWithWheelAndMomentumPhases): (WTR::EventSendingController::monitorWheelEvents): (WTR::EventSendingController::callAfterScrollingCompletes): * WebKitTestRunner/InjectedBundle/EventSendingController.h: LayoutTests: * platform/mac-wk2/TestExpectations: * platform/win/TestExpectations: * tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-2d-overflow.html: Need to call eventSender.monitorWheelEvents() for each subtest. Canonical link: https://commits.webkit.org/222192@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@258679 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-03-19 04:06:37 +00:00
#if ENABLE(KINETIC_SCROLLING)
Use CheckedLock more in WebCore https://bugs.webkit.org/show_bug.cgi?id=226026 Reviewed by Geoffrey Garen. Use CheckedLock more in WebCore to benefit from Clang Thread Safety Analysis. * Modules/indexeddb/IDBObjectStore.cpp: (WebCore::IDBObjectStore::createIndex): (WebCore::IDBObjectStore::index): (WebCore::IDBObjectStore::deleteIndex): (WebCore::IDBObjectStore::rollbackForVersionChangeAbort): (WebCore::IDBObjectStore::visitReferencedIndexes const): (WebCore::IDBObjectStore::renameReferencedIndex): * Modules/indexeddb/IDBObjectStore.h: * Modules/indexeddb/IDBTransaction.cpp: (WebCore::IDBTransaction::objectStore): (WebCore::IDBTransaction::internalAbort): (WebCore::IDBTransaction::createObjectStore): (WebCore::IDBTransaction::renameObjectStore): (WebCore::IDBTransaction::renameIndex): (WebCore::IDBTransaction::deleteObjectStore): (WebCore::IDBTransaction::visitReferencedObjectStores const): * Modules/indexeddb/IDBTransaction.h: * Modules/indexeddb/client/IDBConnectionProxy.cpp: (WebCore::IDBClient::IDBConnectionProxy::openDatabase): (WebCore::IDBClient::IDBConnectionProxy::deleteDatabase): (WebCore::IDBClient::IDBConnectionProxy::completeOpenDBRequest): (WebCore::IDBClient::IDBConnectionProxy::saveOperation): (WebCore::IDBClient::IDBConnectionProxy::completeOperation): (WebCore::IDBClient::IDBConnectionProxy::fireVersionChangeEvent): (WebCore::IDBClient::IDBConnectionProxy::notifyOpenDBRequestBlocked): (WebCore::IDBClient::IDBConnectionProxy::establishTransaction): (WebCore::IDBClient::IDBConnectionProxy::didStartTransaction): (WebCore::IDBClient::IDBConnectionProxy::commitTransaction): (WebCore::IDBClient::IDBConnectionProxy::didCommitTransaction): (WebCore::IDBClient::IDBConnectionProxy::abortTransaction): (WebCore::IDBClient::IDBConnectionProxy::didAbortTransaction): (WebCore::IDBClient::IDBConnectionProxy::didCloseFromServer): (WebCore::IDBClient::IDBConnectionProxy::connectionToServerLost): (WebCore::IDBClient::IDBConnectionProxy::scheduleMainThreadTasks): (WebCore::IDBClient::IDBConnectionProxy::handleMainThreadTasks): (WebCore::IDBClient::IDBConnectionProxy::getAllDatabaseNamesAndVersions): (WebCore::IDBClient::IDBConnectionProxy::didGetAllDatabaseNamesAndVersions): (WebCore::IDBClient::IDBConnectionProxy::registerDatabaseConnection): (WebCore::IDBClient::IDBConnectionProxy::unregisterDatabaseConnection): (WebCore::IDBClient::IDBConnectionProxy::forgetActiveOperations): (WebCore::IDBClient::IDBConnectionProxy::forgetTransaction): (WebCore::IDBClient::IDBConnectionProxy::forgetActivityForCurrentThread): (WebCore::IDBClient::IDBConnectionProxy::setContextSuspended): * Modules/indexeddb/client/IDBConnectionProxy.h: * Modules/mediastream/RTCRtpSFrameTransformer.cpp: (WebCore::RTCRtpSFrameTransformer::setEncryptionKey): (WebCore::RTCRtpSFrameTransformer::decryptFrame): (WebCore::RTCRtpSFrameTransformer::encryptFrame): * Modules/mediastream/RTCRtpSFrameTransformer.h: * Modules/mediastream/RTCRtpScriptTransform.cpp: (WebCore::RTCRtpScriptTransform::setTransformer): (WebCore::RTCRtpScriptTransform::setupTransformer): (WebCore::RTCRtpScriptTransform::clear): * Modules/mediastream/RTCRtpScriptTransform.h: * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.cpp: (WebCore::LibWebRTCDataChannelHandler::setClient): (WebCore::LibWebRTCDataChannelHandler::checkState): (WebCore::LibWebRTCDataChannelHandler::OnMessage): (WebCore::LibWebRTCDataChannelHandler::OnBufferedAmountChange): * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.h: * Modules/mediastream/libwebrtc/LibWebRTCRtpTransformBackend.cpp: (WebCore::LibWebRTCRtpTransformBackend::setInputCallback): (WebCore::LibWebRTCRtpTransformBackend::setOutputCallback): (WebCore::LibWebRTCRtpTransformBackend::processTransformedFrame): (WebCore::LibWebRTCRtpTransformBackend::Transform): * Modules/mediastream/libwebrtc/LibWebRTCRtpTransformBackend.h: * inspector/agents/WebHeapAgent.cpp: (WebCore::SendGarbageCollectionEventsTask::addGarbageCollection): (WebCore::SendGarbageCollectionEventsTask::reset): (WebCore::SendGarbageCollectionEventsTask::timerFired): * page/ResourceUsageThread.cpp: (WebCore::ResourceUsageThread::addObserver): (WebCore::ResourceUsageThread::removeObserver): (WebCore::ResourceUsageThread::waitUntilObservers): (WebCore::ResourceUsageThread::notifyObservers): * page/ResourceUsageThread.h: * page/WheelEventTestMonitor.cpp: (WebCore::WheelEventTestMonitor::clearAllTestDeferrals): (WebCore::WheelEventTestMonitor::setTestCallbackAndStartMonitoring): (WebCore::WheelEventTestMonitor::deferForReason): (WebCore::WheelEventTestMonitor::removeDeferralForReason): (WebCore::WheelEventTestMonitor::receivedWheelEvent): (WebCore::WheelEventTestMonitor::checkShouldFireCallbacks): * page/WheelEventTestMonitor.h: (WebCore::WheelEventTestMonitor::WTF_GUARDED_BY_LOCK): * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::computeWheelProcessingSteps): (WebCore::ScrollingTree::determineWheelEventProcessing): (WebCore::ScrollingTree::handleWheelEvent): (WebCore::ScrollingTree::commitTreeState): (WebCore::ScrollingTree::mainFrameScrollPosition const): (WebCore::ScrollingTree::setMainFrameScrollPosition): (WebCore::ScrollingTree::setGestureState): (WebCore::ScrollingTree::gestureState): (WebCore::ScrollingTree::eventTrackingTypeForPoint): (WebCore::ScrollingTree::isRubberBandInProgressForNode): (WebCore::ScrollingTree::setRubberBandingInProgressForNode): (WebCore::ScrollingTree::isUserScrollInProgressForNode): (WebCore::ScrollingTree::setUserScrollInProgressForNode): (WebCore::ScrollingTree::clearNodesWithUserScrollInProgress): (WebCore::ScrollingTree::isScrollSnapInProgressForNode): (WebCore::ScrollingTree::setNodeScrollSnapInProgress): (WebCore::ScrollingTree::setMainFramePinnedState): (WebCore::ScrollingTree::setMainFrameCanRubberBand): (WebCore::ScrollingTree::mainFrameCanRubberBandInDirection): (WebCore::ScrollingTree::addPendingScrollUpdate): (WebCore::ScrollingTree::takePendingScrollUpdates): (WebCore::ScrollingTree::setScrollPinningBehavior): (WebCore::ScrollingTree::scrollPinningBehavior): (WebCore::ScrollingTree::willWheelEventStartSwipeGesture): (WebCore::ScrollingTree::windowScreenDidChange): (WebCore::ScrollingTree::displayID): (WebCore::ScrollingTree::hasProcessedWheelEventsRecently): (WebCore::ScrollingTree::willProcessWheelEvent): (WebCore::ScrollingTree::nominalFramesPerSecond): (WebCore::ScrollingTree::scrollingTreeAsText): * page/scrolling/ScrollingTree.h: * page/scrolling/ScrollingTreeLatchingController.cpp: (WebCore::ScrollingTreeLatchingController::receivedWheelEvent): (WebCore::ScrollingTreeLatchingController::latchingDataForEvent const): (WebCore::ScrollingTreeLatchingController::latchedNodeID const): (WebCore::ScrollingTreeLatchingController::latchedNodeAndSteps const): (WebCore::ScrollingTreeLatchingController::nodeDidHandleEvent): (WebCore::ScrollingTreeLatchingController::nodeWasRemoved): (WebCore::ScrollingTreeLatchingController::clearLatchedNode): * page/scrolling/ScrollingTreeLatchingController.h: * platform/audio/HRTFDatabaseLoader.cpp: (WebCore::HRTFDatabaseLoader::loadAsynchronously): (WebCore::HRTFDatabaseLoader::waitForLoaderThreadCompletion): * platform/audio/HRTFDatabaseLoader.h: * platform/audio/cocoa/AudioDestinationCocoa.cpp: (WebCore::AudioDestinationCocoa::hasEnoughFrames const): (WebCore::AudioDestinationCocoa::render): (WebCore::AudioDestinationCocoa::renderOnRenderingThead): * platform/audio/cocoa/AudioDestinationCocoa.h: * platform/encryptedmedia/CDMProxy.cpp: (WebCore::CDMProxy::instance const): (WebCore::CDMProxy::setInstance): (WebCore::CDMProxy::startedWaitingForKey const): (WebCore::CDMProxy::stoppedWaitingForKey const): * platform/encryptedmedia/CDMProxy.h: * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp: (WebCore::MediaPlayerPrivateAVFoundation::MediaPlayerPrivateAVFoundation): (WebCore::MediaPlayerPrivateAVFoundation::setDelayCallbacks const): (WebCore::MediaPlayerPrivateAVFoundation::clearMainThreadPendingFlag): (WebCore::MediaPlayerPrivateAVFoundation::scheduleMainThreadNotification): (WebCore::MediaPlayerPrivateAVFoundation::dispatchNotification): * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm: (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::processNewVideoSample): * platform/graphics/cg/IOSurfacePool.cpp: (WebCore::IOSurfacePool::takeSurface): (WebCore::IOSurfacePool::addSurface): (WebCore::IOSurfacePool::setPoolSize): (WebCore::IOSurfacePool::collectionTimerFired): (WebCore::IOSurfacePool::discardAllSurfaces): * platform/graphics/cg/IOSurfacePool.h: (WebCore::IOSurfacePool::WTF_GUARDED_BY_LOCK): * platform/graphics/cg/SubimageCacheWithTimer.cpp: (WebCore::SubimageCacheWithTimer::pruneCacheTimerFired): (WebCore::SubimageCacheWithTimer::subimage): (WebCore::SubimageCacheWithTimer::clearImageAndSubimages): (WebCore::SubimageCacheWithTimer::clearAll): * platform/graphics/cg/SubimageCacheWithTimer.h: * platform/graphics/cocoa/FontCacheCoreText.cpp: (WebCore::FontDatabase::collectionForFamily): (WebCore::FontDatabase::clear): * platform/network/cocoa/WebCoreNSURLSession.mm: (WebCore::WebCoreNSURLSessionDataTaskClient::clearTask): (WebCore::WebCoreNSURLSessionDataTaskClient::dataSent): (WebCore::WebCoreNSURLSessionDataTaskClient::responseReceived): (WebCore::WebCoreNSURLSessionDataTaskClient::shouldCacheResponse): (WebCore::WebCoreNSURLSessionDataTaskClient::dataReceived): (WebCore::WebCoreNSURLSessionDataTaskClient::redirectReceived): (WebCore::WebCoreNSURLSessionDataTaskClient::accessControlCheckFailed): (WebCore::WebCoreNSURLSessionDataTaskClient::loadFailed): (WebCore::WebCoreNSURLSessionDataTaskClient::loadFinished): * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.h: * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm: (-[WebCoreResourceHandleAsOperationQueueDelegate detachHandle]): (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willSendRequest:redirectResponse:]): (-[WebCoreResourceHandleAsOperationQueueDelegate connection:canAuthenticateAgainstProtectionSpace:]): (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willCacheResponse:]): * storage/StorageQuotaManager.cpp: (WebCore::StorageQuotaManager::requestSpaceOnBackgroundThread): (WebCore::StorageQuotaManager::resetQuotaUpdatedBasedOnUsageForTesting): (WebCore::StorageQuotaManager::resetQuotaForTesting): * storage/StorageQuotaManager.h: (WebCore::StorageQuotaManager::WTF_GUARDED_BY_LOCK): * workers/WorkerOrWorkletScriptController.cpp: (WebCore::WorkerOrWorkletScriptController::scheduleExecutionTermination): (WebCore::WorkerOrWorkletScriptController::isTerminatingExecution const): * workers/WorkerOrWorkletScriptController.h: (WebCore::WorkerOrWorkletScriptController::WTF_GUARDED_BY_LOCK): Canonical link: https://commits.webkit.org/237960@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277805 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-20 18:41:33 +00:00
Locker locker { m_lock };
Make PlatformWheelEventPhase an enum class https://bugs.webkit.org/show_bug.cgi?id=218772 Reviewed by Tim Horton. Change PlatformWheelEventPhase to be an enum class. Changed code that maps between NSEventPhase and PlatformWheelEventPhase to not treat NSEventPhase as a set of bits, since it only ever contains one of the bits. Source/WebCore: * dom/WheelEvent.h: * page/EventHandler.cpp: (WebCore::handleWheelEventPhaseInScrollableArea): (WebCore::handleWheelEventInAppropriateEnclosingBox): * page/WheelEventTestMonitor.cpp: (WebCore::WheelEventTestMonitor::receivedWheelEvent): * page/mac/EventHandlerMac.mm: (WebCore::findEnclosingScrollableContainer): (WebCore::EventHandler::recordWheelEventForDeltaFilter): (WebCore::EventHandler::processWheelEventForScrollSnap): * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::willWheelEventStartSwipeGesture): * page/scrolling/ScrollingTreeGestureState.cpp: (WebCore::ScrollingTreeGestureState::handleGestureCancel): (WebCore::ScrollingTreeGestureState::nodeDidHandleEvent): * page/scrolling/ScrollingTreeScrollingNode.cpp: (WebCore::ScrollingTreeScrollingNode::canHandleWheelEvent const): * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm: (WebCore::ScrollingTreeScrollingNodeDelegateMac::handleWheelEvent): * platform/PlatformWheelEvent.cpp: (WebCore::operator<<): * platform/PlatformWheelEvent.h: (WebCore::PlatformWheelEvent::useLatchedEventElement const): (WebCore::PlatformWheelEvent::isGestureStart const): (WebCore::PlatformWheelEvent::isGestureContinuation const): (WebCore::PlatformWheelEvent::shouldResetLatching const): (WebCore::PlatformWheelEvent::isNonGestureEvent const): (WebCore::PlatformWheelEvent::isEndOfMomentumScroll const): (WebCore::PlatformWheelEvent::isGestureBegin const): (WebCore::PlatformWheelEvent::isGestureCancel const): (WebCore::PlatformWheelEvent::isEndOfNonMomentumScroll const): (WebCore::PlatformWheelEvent::isTransitioningToMomentumScroll const): * platform/ScrollAnimator.cpp: (WebCore::ScrollAnimator::handleWheelEvent): * platform/cocoa/ScrollController.mm: (WebCore::ScrollController::handleWheelEvent): (WebCore::toWheelEventStatus): * platform/mac/PlatformEventFactoryMac.mm: (WebCore::phaseFromNSEventPhase): (WebCore::momentumPhaseForEvent): (WebCore::phaseForEvent): * platform/mac/ScrollAnimatorMac.mm: (WebCore::ScrollAnimatorMac::handleWheelEventPhase): (WebCore::newGestureIsStarting): (WebCore::gestureShouldBeginSnap): Source/WebKit: * UIProcess/RemoteLayerTree/mac/ScrollerPairMac.mm: (WebKit::ScrollerPairMac::handleWheelEvent): * WebProcess/WebPage/EventDispatcher.cpp: (WebKit::EventDispatcher::wheelEvent): Source/WebKitLegacy/mac: * DOM/WebDOMOperations.mm: (toNSEventPhase): Canonical link: https://commits.webkit.org/231442@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@269659 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-11-11 00:28:59 +00:00
if (event.phase() == PlatformWheelEventPhase::Ended || event.phase() == PlatformWheelEventPhase::Cancelled)
eventSender.monitorWheelEvents() is very fragile https://bugs.webkit.org/show_bug.cgi?id=197819 <rdar://problem/51319456> Reviewed by Tim Horton. Source/WebCore: Deflake tests using eventSender.monitorWheelEvents() by fixing several causes of flakiness, adding back changes from r257844 that were reverted in r258558. First, have EventSendingController keep track of whether it's seen then "end" event for the scrolling and momentum phases, and pass this down to WheelEventTestMonitor, which now waits until it sees these, which prevents premature triggering which was a common cause of failure before. Second, remove WheelEventTestMonitor's 1/60s timer and instead have WheelEventTestMonitor test for completion in a callout from the end of Page::updateRendering(), which makes it test and fire at a more consistent time. Third, push WheelEventTestMonitor to the ScrollingTree, so that reasons for deferral can be added on the scrolling thread. This fixes an issue where the RunLoop::main().dispatch() used to send the "ScrollingThreadSyncNeeded" reason to the main thread would get delayed, also resulting in a premature trigger. * Modules/applepay/ApplePaySession.cpp: Unified sources! * dom/WindowEventLoop.cpp: Unified sources! * page/EventHandler.cpp: (WebCore::EventHandler::handleWheelEvent): * page/FrameView.cpp: (WebCore::FrameView::scrollOffsetChangedViaPlatformWidgetImpl): * page/Page.cpp: (WebCore::Page::doAfterUpdateRendering): (WebCore::Page::wheelEventTestMonitor const): (WebCore::Page::clearWheelEventTestMonitor): (WebCore::Page::isMonitoringWheelEvents const): (WebCore::Page::ensureWheelEventTestMonitor): * page/Page.h: (WebCore::Page::wheelEventTestMonitor const): Deleted. (WebCore::Page::clearWheelEventTestMonitor): Deleted. (WebCore::Page::isMonitoringWheelEvents const): Deleted. * page/WheelEventTestMonitor.cpp: (WebCore::WheelEventTestMonitor::WheelEventTestMonitor): (WebCore::WheelEventTestMonitor::clearAllTestDeferrals): (WebCore::WheelEventTestMonitor::setTestCallbackAndStartMonitoring): (WebCore::WheelEventTestMonitor::deferForReason): (WebCore::WheelEventTestMonitor::removeDeferralForReason): (WebCore::WheelEventTestMonitor::receivedWheelEvent): (WebCore::WheelEventTestMonitor::scheduleCallbackCheck): (WebCore::WheelEventTestMonitor::checkShouldFireCallbacks): (WebCore::operator<<): (WebCore::WheelEventTestMonitor::setTestCallbackAndStartNotificationTimer): Deleted. (WebCore::WheelEventTestMonitor::triggerTestTimerFired): Deleted. * page/WheelEventTestMonitor.h: (WebCore::WheelEventTestMonitorCompletionDeferrer::WheelEventTestMonitorCompletionDeferrer): (WebCore::WheelEventTestMonitorCompletionDeferrer::~WheelEventTestMonitorCompletionDeferrer): * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated): (WebCore::AsyncScrollingCoordinator::deferWheelEventTestCompletionForReason const): Deleted. (WebCore::AsyncScrollingCoordinator::removeWheelEventTestCompletionDeferralForReason const): Deleted. * page/scrolling/AsyncScrollingCoordinator.h: * page/scrolling/ScrollingCoordinator.h: (WebCore::ScrollingCoordinator::startMonitoringWheelEvents): (WebCore::ScrollingCoordinator::stopMonitoringWheelEvents): * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::handleWheelEvent): * page/scrolling/ScrollingTree.h: (WebCore::ScrollingTree::setWheelEventTestMonitor): (WebCore::ScrollingTree::receivedWheelEvent): * page/scrolling/ThreadedScrollingTree.cpp: (WebCore::ThreadedScrollingTree::scrollingTreeNodeDidScroll): (WebCore::ThreadedScrollingTree::deferWheelEventTestCompletionForReason): Deleted. (WebCore::ThreadedScrollingTree::removeWheelEventTestCompletionDeferralForReason): Deleted. * page/scrolling/ThreadedScrollingTree.h: * page/scrolling/mac/ScrollingCoordinatorMac.h: * page/scrolling/mac/ScrollingCoordinatorMac.mm: (WebCore::ScrollingCoordinatorMac::startMonitoringWheelEvents): (WebCore::ScrollingCoordinatorMac::stopMonitoringWheelEvents): * page/scrolling/mac/ScrollingTreeMac.h: * page/scrolling/mac/ScrollingTreeMac.mm: (ScrollingTreeMac::setWheelEventTestMonitor): (ScrollingTreeMac::receivedWheelEvent): (ScrollingTreeMac::deferWheelEventTestCompletionForReason): (ScrollingTreeMac::removeWheelEventTestCompletionDeferralForReason): * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm: (WebCore::ScrollingTreeScrollingNodeDelegateMac::deferWheelEventTestCompletionForReason const): (WebCore::ScrollingTreeScrollingNodeDelegateMac::removeWheelEventTestCompletionDeferralForReason const): * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::setWheelEventMonitorTestCallbackAndStartMonitoring): (WebCoreTestSupport::setTestCallbackAndStartNotificationTimer): Deleted. * testing/js/WebCoreTestSupport.h: Source/WebKit: Deflake tests using eventSender.monitorWheelEvents() by fixing several causes of flakiness, adding back changes from r257844 that were reverted in r258558. First, have EventSendingController keep track of whether it's seen then "end" event for the scrolling and momentum phases, and pass this down to WheelEventTestMonitor, which now waits until it sees these, which prevents premature triggering which was a common cause of failure before. Second, remove WheelEventTestMonitor's 1/60s timer and instead have WheelEventTestMonitor test for completion in a callout from the end of Page::updateRendering(), which makes it test and fire at a more consistent time. Third, push WheelEventTestMonitor to the ScrollingTree, so that reasons for deferral can be added on the scrolling thread. This fixes an issue where the RunLoop::main().dispatch() used to send the "ScrollingThreadSyncNeeded" reason to the main thread would get delayed, also resulting in a premature trigger. * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageRegisterScrollOperationCompletionCallback): * WebProcess/InjectedBundle/API/c/WKBundlePage.h: Tools: Deflake tests using eventSender.monitorWheelEvents() by fixing several causes of flakiness, adding back changes from r257844 that were reverted in r258558. First, have EventSendingController keep track of whether it's seen then "end" event for the scrolling and momentum phases, and pass this down to WheelEventTestMonitor, which now waits until it sees these, which prevents premature triggering which was a common cause of failure before. Second, remove WheelEventTestMonitor's 1/60s timer and instead have WheelEventTestMonitor test for completion in a callout from the end of Page::updateRendering(), which makes it test and fire at a more consistent time. Third, push WheelEventTestMonitor to the ScrollingTree, so that reasons for deferral can be added on the scrolling thread. This fixes an issue where the RunLoop::main().dispatch() used to send the "ScrollingThreadSyncNeeded" reason to the main thread would get delayed, also resulting in a premature trigger. * DumpRenderTree/mac/EventSendingController.h: * DumpRenderTree/mac/EventSendingController.mm: (-[EventSendingController mouseScrollByX:andY:withWheel:andMomentumPhases:]): (-[EventSendingController monitorWheelEvents]): (-[EventSendingController callAfterScrollingCompletes:]): * DumpRenderTree/win/EventSender.cpp: (mouseScrollBy): * WebKitTestRunner/InjectedBundle/EventSendingController.cpp: (WTR::EventSendingController::mouseScrollByWithWheelAndMomentumPhases): (WTR::EventSendingController::monitorWheelEvents): (WTR::EventSendingController::callAfterScrollingCompletes): * WebKitTestRunner/InjectedBundle/EventSendingController.h: LayoutTests: * platform/mac-wk2/TestExpectations: * platform/win/TestExpectations: * tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-2d-overflow.html: Need to call eventSender.monitorWheelEvents() for each subtest. Canonical link: https://commits.webkit.org/222192@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@258679 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-03-19 04:06:37 +00:00
m_receivedWheelEndOrCancel = true;
Make PlatformWheelEventPhase an enum class https://bugs.webkit.org/show_bug.cgi?id=218772 Reviewed by Tim Horton. Change PlatformWheelEventPhase to be an enum class. Changed code that maps between NSEventPhase and PlatformWheelEventPhase to not treat NSEventPhase as a set of bits, since it only ever contains one of the bits. Source/WebCore: * dom/WheelEvent.h: * page/EventHandler.cpp: (WebCore::handleWheelEventPhaseInScrollableArea): (WebCore::handleWheelEventInAppropriateEnclosingBox): * page/WheelEventTestMonitor.cpp: (WebCore::WheelEventTestMonitor::receivedWheelEvent): * page/mac/EventHandlerMac.mm: (WebCore::findEnclosingScrollableContainer): (WebCore::EventHandler::recordWheelEventForDeltaFilter): (WebCore::EventHandler::processWheelEventForScrollSnap): * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::willWheelEventStartSwipeGesture): * page/scrolling/ScrollingTreeGestureState.cpp: (WebCore::ScrollingTreeGestureState::handleGestureCancel): (WebCore::ScrollingTreeGestureState::nodeDidHandleEvent): * page/scrolling/ScrollingTreeScrollingNode.cpp: (WebCore::ScrollingTreeScrollingNode::canHandleWheelEvent const): * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm: (WebCore::ScrollingTreeScrollingNodeDelegateMac::handleWheelEvent): * platform/PlatformWheelEvent.cpp: (WebCore::operator<<): * platform/PlatformWheelEvent.h: (WebCore::PlatformWheelEvent::useLatchedEventElement const): (WebCore::PlatformWheelEvent::isGestureStart const): (WebCore::PlatformWheelEvent::isGestureContinuation const): (WebCore::PlatformWheelEvent::shouldResetLatching const): (WebCore::PlatformWheelEvent::isNonGestureEvent const): (WebCore::PlatformWheelEvent::isEndOfMomentumScroll const): (WebCore::PlatformWheelEvent::isGestureBegin const): (WebCore::PlatformWheelEvent::isGestureCancel const): (WebCore::PlatformWheelEvent::isEndOfNonMomentumScroll const): (WebCore::PlatformWheelEvent::isTransitioningToMomentumScroll const): * platform/ScrollAnimator.cpp: (WebCore::ScrollAnimator::handleWheelEvent): * platform/cocoa/ScrollController.mm: (WebCore::ScrollController::handleWheelEvent): (WebCore::toWheelEventStatus): * platform/mac/PlatformEventFactoryMac.mm: (WebCore::phaseFromNSEventPhase): (WebCore::momentumPhaseForEvent): (WebCore::phaseForEvent): * platform/mac/ScrollAnimatorMac.mm: (WebCore::ScrollAnimatorMac::handleWheelEventPhase): (WebCore::newGestureIsStarting): (WebCore::gestureShouldBeginSnap): Source/WebKit: * UIProcess/RemoteLayerTree/mac/ScrollerPairMac.mm: (WebKit::ScrollerPairMac::handleWheelEvent): * WebProcess/WebPage/EventDispatcher.cpp: (WebKit::EventDispatcher::wheelEvent): Source/WebKitLegacy/mac: * DOM/WebDOMOperations.mm: (toNSEventPhase): Canonical link: https://commits.webkit.org/231442@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@269659 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-11-11 00:28:59 +00:00
if (event.momentumPhase() == PlatformWheelEventPhase::Ended)
eventSender.monitorWheelEvents() is very fragile https://bugs.webkit.org/show_bug.cgi?id=197819 <rdar://problem/51319456> Reviewed by Tim Horton. Source/WebCore: Deflake tests using eventSender.monitorWheelEvents() by fixing several causes of flakiness, adding back changes from r257844 that were reverted in r258558. First, have EventSendingController keep track of whether it's seen then "end" event for the scrolling and momentum phases, and pass this down to WheelEventTestMonitor, which now waits until it sees these, which prevents premature triggering which was a common cause of failure before. Second, remove WheelEventTestMonitor's 1/60s timer and instead have WheelEventTestMonitor test for completion in a callout from the end of Page::updateRendering(), which makes it test and fire at a more consistent time. Third, push WheelEventTestMonitor to the ScrollingTree, so that reasons for deferral can be added on the scrolling thread. This fixes an issue where the RunLoop::main().dispatch() used to send the "ScrollingThreadSyncNeeded" reason to the main thread would get delayed, also resulting in a premature trigger. * Modules/applepay/ApplePaySession.cpp: Unified sources! * dom/WindowEventLoop.cpp: Unified sources! * page/EventHandler.cpp: (WebCore::EventHandler::handleWheelEvent): * page/FrameView.cpp: (WebCore::FrameView::scrollOffsetChangedViaPlatformWidgetImpl): * page/Page.cpp: (WebCore::Page::doAfterUpdateRendering): (WebCore::Page::wheelEventTestMonitor const): (WebCore::Page::clearWheelEventTestMonitor): (WebCore::Page::isMonitoringWheelEvents const): (WebCore::Page::ensureWheelEventTestMonitor): * page/Page.h: (WebCore::Page::wheelEventTestMonitor const): Deleted. (WebCore::Page::clearWheelEventTestMonitor): Deleted. (WebCore::Page::isMonitoringWheelEvents const): Deleted. * page/WheelEventTestMonitor.cpp: (WebCore::WheelEventTestMonitor::WheelEventTestMonitor): (WebCore::WheelEventTestMonitor::clearAllTestDeferrals): (WebCore::WheelEventTestMonitor::setTestCallbackAndStartMonitoring): (WebCore::WheelEventTestMonitor::deferForReason): (WebCore::WheelEventTestMonitor::removeDeferralForReason): (WebCore::WheelEventTestMonitor::receivedWheelEvent): (WebCore::WheelEventTestMonitor::scheduleCallbackCheck): (WebCore::WheelEventTestMonitor::checkShouldFireCallbacks): (WebCore::operator<<): (WebCore::WheelEventTestMonitor::setTestCallbackAndStartNotificationTimer): Deleted. (WebCore::WheelEventTestMonitor::triggerTestTimerFired): Deleted. * page/WheelEventTestMonitor.h: (WebCore::WheelEventTestMonitorCompletionDeferrer::WheelEventTestMonitorCompletionDeferrer): (WebCore::WheelEventTestMonitorCompletionDeferrer::~WheelEventTestMonitorCompletionDeferrer): * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated): (WebCore::AsyncScrollingCoordinator::deferWheelEventTestCompletionForReason const): Deleted. (WebCore::AsyncScrollingCoordinator::removeWheelEventTestCompletionDeferralForReason const): Deleted. * page/scrolling/AsyncScrollingCoordinator.h: * page/scrolling/ScrollingCoordinator.h: (WebCore::ScrollingCoordinator::startMonitoringWheelEvents): (WebCore::ScrollingCoordinator::stopMonitoringWheelEvents): * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::handleWheelEvent): * page/scrolling/ScrollingTree.h: (WebCore::ScrollingTree::setWheelEventTestMonitor): (WebCore::ScrollingTree::receivedWheelEvent): * page/scrolling/ThreadedScrollingTree.cpp: (WebCore::ThreadedScrollingTree::scrollingTreeNodeDidScroll): (WebCore::ThreadedScrollingTree::deferWheelEventTestCompletionForReason): Deleted. (WebCore::ThreadedScrollingTree::removeWheelEventTestCompletionDeferralForReason): Deleted. * page/scrolling/ThreadedScrollingTree.h: * page/scrolling/mac/ScrollingCoordinatorMac.h: * page/scrolling/mac/ScrollingCoordinatorMac.mm: (WebCore::ScrollingCoordinatorMac::startMonitoringWheelEvents): (WebCore::ScrollingCoordinatorMac::stopMonitoringWheelEvents): * page/scrolling/mac/ScrollingTreeMac.h: * page/scrolling/mac/ScrollingTreeMac.mm: (ScrollingTreeMac::setWheelEventTestMonitor): (ScrollingTreeMac::receivedWheelEvent): (ScrollingTreeMac::deferWheelEventTestCompletionForReason): (ScrollingTreeMac::removeWheelEventTestCompletionDeferralForReason): * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm: (WebCore::ScrollingTreeScrollingNodeDelegateMac::deferWheelEventTestCompletionForReason const): (WebCore::ScrollingTreeScrollingNodeDelegateMac::removeWheelEventTestCompletionDeferralForReason const): * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::setWheelEventMonitorTestCallbackAndStartMonitoring): (WebCoreTestSupport::setTestCallbackAndStartNotificationTimer): Deleted. * testing/js/WebCoreTestSupport.h: Source/WebKit: Deflake tests using eventSender.monitorWheelEvents() by fixing several causes of flakiness, adding back changes from r257844 that were reverted in r258558. First, have EventSendingController keep track of whether it's seen then "end" event for the scrolling and momentum phases, and pass this down to WheelEventTestMonitor, which now waits until it sees these, which prevents premature triggering which was a common cause of failure before. Second, remove WheelEventTestMonitor's 1/60s timer and instead have WheelEventTestMonitor test for completion in a callout from the end of Page::updateRendering(), which makes it test and fire at a more consistent time. Third, push WheelEventTestMonitor to the ScrollingTree, so that reasons for deferral can be added on the scrolling thread. This fixes an issue where the RunLoop::main().dispatch() used to send the "ScrollingThreadSyncNeeded" reason to the main thread would get delayed, also resulting in a premature trigger. * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageRegisterScrollOperationCompletionCallback): * WebProcess/InjectedBundle/API/c/WKBundlePage.h: Tools: Deflake tests using eventSender.monitorWheelEvents() by fixing several causes of flakiness, adding back changes from r257844 that were reverted in r258558. First, have EventSendingController keep track of whether it's seen then "end" event for the scrolling and momentum phases, and pass this down to WheelEventTestMonitor, which now waits until it sees these, which prevents premature triggering which was a common cause of failure before. Second, remove WheelEventTestMonitor's 1/60s timer and instead have WheelEventTestMonitor test for completion in a callout from the end of Page::updateRendering(), which makes it test and fire at a more consistent time. Third, push WheelEventTestMonitor to the ScrollingTree, so that reasons for deferral can be added on the scrolling thread. This fixes an issue where the RunLoop::main().dispatch() used to send the "ScrollingThreadSyncNeeded" reason to the main thread would get delayed, also resulting in a premature trigger. * DumpRenderTree/mac/EventSendingController.h: * DumpRenderTree/mac/EventSendingController.mm: (-[EventSendingController mouseScrollByX:andY:withWheel:andMomentumPhases:]): (-[EventSendingController monitorWheelEvents]): (-[EventSendingController callAfterScrollingCompletes:]): * DumpRenderTree/win/EventSender.cpp: (mouseScrollBy): * WebKitTestRunner/InjectedBundle/EventSendingController.cpp: (WTR::EventSendingController::mouseScrollByWithWheelAndMomentumPhases): (WTR::EventSendingController::monitorWheelEvents): (WTR::EventSendingController::callAfterScrollingCompletes): * WebKitTestRunner/InjectedBundle/EventSendingController.h: LayoutTests: * platform/mac-wk2/TestExpectations: * platform/win/TestExpectations: * tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-2d-overflow.html: Need to call eventSender.monitorWheelEvents() for each subtest. Canonical link: https://commits.webkit.org/222192@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@258679 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-03-19 04:06:37 +00:00
m_receivedMomentumEnd = true;
#endif
}
void WheelEventTestMonitor::scheduleCallbackCheck()
{
Introduce ensureOnMainThread() https://bugs.webkit.org/show_bug.cgi?id=223105 Reviewed by Darin Adler. Introduce ensureOnMainThread(), similarly to the recently added ensureOnMainThreadRunLoop(). It runs the task synchronously when on the main thread, otherwise dispatches the task to the main thread. Source/WebCore: * accessibility/AccessibilityObjectInterface.h: (WebCore::Accessibility::performFunctionOnMainThread): (WebCore::Accessibility::retrieveValueFromMainThread): (WebCore::Accessibility::retrieveAutoreleasedValueFromMainThread): * dom/MessagePort.cpp: (WebCore::MessagePort::close): * dom/messageports/MessagePortChannelProviderImpl.cpp: (WebCore::MessagePortChannelProviderImpl::createNewMessagePortChannel): (WebCore::MessagePortChannelProviderImpl::entangleLocalPortInThisProcessToRemote): (WebCore::MessagePortChannelProviderImpl::messagePortDisentangled): (WebCore::MessagePortChannelProviderImpl::messagePortClosed): (WebCore::MessagePortChannelProviderImpl::postMessageToRemote): (WebCore::MessagePortChannelProviderImpl::takeAllMessagesForPort): (WebCore::MessagePortChannelProviderImpl::checkRemotePortForActivity): (WebCore::MessagePortChannelProviderImpl::performActionOnMainThread): Deleted. * dom/messageports/MessagePortChannelProviderImpl.h: * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::enqueueTaskForDispatcher): * page/WheelEventTestMonitor.cpp: (WebCore::WheelEventTestMonitor::scheduleCallbackCheck): * platform/GenericTaskQueue.cpp: (WebCore::TaskDispatcher<Timer>::postTask): * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (ensureOnMainThread): Deleted. * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm: (-[WebRootSampleBufferBoundsChangeListener observeValueForKeyPath:ofObject:change:context:]): * platform/graphics/cocoa/FontCacheCoreText.cpp: (WebCore::invalidateFontCache): * platform/graphics/cocoa/WebCoreDecompressionSession.mm: (WebCore::WebCoreDecompressionSession::maybeBecomeReadyForMoreMediaData): * platform/mediastream/CaptureDeviceManager.cpp: (WebCore::CaptureDeviceManager::deviceChanged): * platform/mediastream/RealtimeOutgoingVideoSource.cpp: (WebCore::RealtimeOutgoingVideoSource::applyRotation): * platform/mediastream/mac/CoreAudioCaptureSource.cpp: (WebCore::CoreAudioCaptureSourceFactory::beginInterruption): (WebCore::CoreAudioCaptureSourceFactory::endInterruption): (WebCore::CoreAudioCaptureSourceFactory::scheduleReconfiguration): * platform/network/cocoa/WebCoreNSURLSession.mm: (-[WebCoreNSURLSessionDataTask resource:receivedRedirect:request:completionHandler:]): * platform/network/curl/CurlRequest.cpp: (WebCore::CurlRequest::runOnMainThread): Source/WebKitLegacy: * Storage/StorageTracker.cpp: (WebKit::StorageTracker::setOriginDetails): Source/WTF: * wtf/MainThread.cpp: (WTF::ensureOnMainThread): * wtf/MainThread.h: * wtf/ThreadSafeRefCounted.h: (WTF::ThreadSafeRefCounted::deref const): * wtf/text/cf/StringImplCF.cpp: (WTF::StringWrapperCFAllocator::deallocate): * wtf/unix/MemoryPressureHandlerUnix.cpp: (WTF::MemoryPressureHandler::triggerMemoryPressureEvent): Canonical link: https://commits.webkit.org/235212@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@274324 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-03-12 04:48:22 +00:00
ensureOnMainThread([weakPage = makeWeakPtr(m_page)] {
eventSender.monitorWheelEvents() is very fragile https://bugs.webkit.org/show_bug.cgi?id=197819 <rdar://problem/51319456> Reviewed by Tim Horton. Source/WebCore: Deflake tests using eventSender.monitorWheelEvents() by fixing several causes of flakiness, adding back changes from r257844 that were reverted in r258558. First, have EventSendingController keep track of whether it's seen then "end" event for the scrolling and momentum phases, and pass this down to WheelEventTestMonitor, which now waits until it sees these, which prevents premature triggering which was a common cause of failure before. Second, remove WheelEventTestMonitor's 1/60s timer and instead have WheelEventTestMonitor test for completion in a callout from the end of Page::updateRendering(), which makes it test and fire at a more consistent time. Third, push WheelEventTestMonitor to the ScrollingTree, so that reasons for deferral can be added on the scrolling thread. This fixes an issue where the RunLoop::main().dispatch() used to send the "ScrollingThreadSyncNeeded" reason to the main thread would get delayed, also resulting in a premature trigger. * Modules/applepay/ApplePaySession.cpp: Unified sources! * dom/WindowEventLoop.cpp: Unified sources! * page/EventHandler.cpp: (WebCore::EventHandler::handleWheelEvent): * page/FrameView.cpp: (WebCore::FrameView::scrollOffsetChangedViaPlatformWidgetImpl): * page/Page.cpp: (WebCore::Page::doAfterUpdateRendering): (WebCore::Page::wheelEventTestMonitor const): (WebCore::Page::clearWheelEventTestMonitor): (WebCore::Page::isMonitoringWheelEvents const): (WebCore::Page::ensureWheelEventTestMonitor): * page/Page.h: (WebCore::Page::wheelEventTestMonitor const): Deleted. (WebCore::Page::clearWheelEventTestMonitor): Deleted. (WebCore::Page::isMonitoringWheelEvents const): Deleted. * page/WheelEventTestMonitor.cpp: (WebCore::WheelEventTestMonitor::WheelEventTestMonitor): (WebCore::WheelEventTestMonitor::clearAllTestDeferrals): (WebCore::WheelEventTestMonitor::setTestCallbackAndStartMonitoring): (WebCore::WheelEventTestMonitor::deferForReason): (WebCore::WheelEventTestMonitor::removeDeferralForReason): (WebCore::WheelEventTestMonitor::receivedWheelEvent): (WebCore::WheelEventTestMonitor::scheduleCallbackCheck): (WebCore::WheelEventTestMonitor::checkShouldFireCallbacks): (WebCore::operator<<): (WebCore::WheelEventTestMonitor::setTestCallbackAndStartNotificationTimer): Deleted. (WebCore::WheelEventTestMonitor::triggerTestTimerFired): Deleted. * page/WheelEventTestMonitor.h: (WebCore::WheelEventTestMonitorCompletionDeferrer::WheelEventTestMonitorCompletionDeferrer): (WebCore::WheelEventTestMonitorCompletionDeferrer::~WheelEventTestMonitorCompletionDeferrer): * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated): (WebCore::AsyncScrollingCoordinator::deferWheelEventTestCompletionForReason const): Deleted. (WebCore::AsyncScrollingCoordinator::removeWheelEventTestCompletionDeferralForReason const): Deleted. * page/scrolling/AsyncScrollingCoordinator.h: * page/scrolling/ScrollingCoordinator.h: (WebCore::ScrollingCoordinator::startMonitoringWheelEvents): (WebCore::ScrollingCoordinator::stopMonitoringWheelEvents): * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::handleWheelEvent): * page/scrolling/ScrollingTree.h: (WebCore::ScrollingTree::setWheelEventTestMonitor): (WebCore::ScrollingTree::receivedWheelEvent): * page/scrolling/ThreadedScrollingTree.cpp: (WebCore::ThreadedScrollingTree::scrollingTreeNodeDidScroll): (WebCore::ThreadedScrollingTree::deferWheelEventTestCompletionForReason): Deleted. (WebCore::ThreadedScrollingTree::removeWheelEventTestCompletionDeferralForReason): Deleted. * page/scrolling/ThreadedScrollingTree.h: * page/scrolling/mac/ScrollingCoordinatorMac.h: * page/scrolling/mac/ScrollingCoordinatorMac.mm: (WebCore::ScrollingCoordinatorMac::startMonitoringWheelEvents): (WebCore::ScrollingCoordinatorMac::stopMonitoringWheelEvents): * page/scrolling/mac/ScrollingTreeMac.h: * page/scrolling/mac/ScrollingTreeMac.mm: (ScrollingTreeMac::setWheelEventTestMonitor): (ScrollingTreeMac::receivedWheelEvent): (ScrollingTreeMac::deferWheelEventTestCompletionForReason): (ScrollingTreeMac::removeWheelEventTestCompletionDeferralForReason): * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm: (WebCore::ScrollingTreeScrollingNodeDelegateMac::deferWheelEventTestCompletionForReason const): (WebCore::ScrollingTreeScrollingNodeDelegateMac::removeWheelEventTestCompletionDeferralForReason const): * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::setWheelEventMonitorTestCallbackAndStartMonitoring): (WebCoreTestSupport::setTestCallbackAndStartNotificationTimer): Deleted. * testing/js/WebCoreTestSupport.h: Source/WebKit: Deflake tests using eventSender.monitorWheelEvents() by fixing several causes of flakiness, adding back changes from r257844 that were reverted in r258558. First, have EventSendingController keep track of whether it's seen then "end" event for the scrolling and momentum phases, and pass this down to WheelEventTestMonitor, which now waits until it sees these, which prevents premature triggering which was a common cause of failure before. Second, remove WheelEventTestMonitor's 1/60s timer and instead have WheelEventTestMonitor test for completion in a callout from the end of Page::updateRendering(), which makes it test and fire at a more consistent time. Third, push WheelEventTestMonitor to the ScrollingTree, so that reasons for deferral can be added on the scrolling thread. This fixes an issue where the RunLoop::main().dispatch() used to send the "ScrollingThreadSyncNeeded" reason to the main thread would get delayed, also resulting in a premature trigger. * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageRegisterScrollOperationCompletionCallback): * WebProcess/InjectedBundle/API/c/WKBundlePage.h: Tools: Deflake tests using eventSender.monitorWheelEvents() by fixing several causes of flakiness, adding back changes from r257844 that were reverted in r258558. First, have EventSendingController keep track of whether it's seen then "end" event for the scrolling and momentum phases, and pass this down to WheelEventTestMonitor, which now waits until it sees these, which prevents premature triggering which was a common cause of failure before. Second, remove WheelEventTestMonitor's 1/60s timer and instead have WheelEventTestMonitor test for completion in a callout from the end of Page::updateRendering(), which makes it test and fire at a more consistent time. Third, push WheelEventTestMonitor to the ScrollingTree, so that reasons for deferral can be added on the scrolling thread. This fixes an issue where the RunLoop::main().dispatch() used to send the "ScrollingThreadSyncNeeded" reason to the main thread would get delayed, also resulting in a premature trigger. * DumpRenderTree/mac/EventSendingController.h: * DumpRenderTree/mac/EventSendingController.mm: (-[EventSendingController mouseScrollByX:andY:withWheel:andMomentumPhases:]): (-[EventSendingController monitorWheelEvents]): (-[EventSendingController callAfterScrollingCompletes:]): * DumpRenderTree/win/EventSender.cpp: (mouseScrollBy): * WebKitTestRunner/InjectedBundle/EventSendingController.cpp: (WTR::EventSendingController::mouseScrollByWithWheelAndMomentumPhases): (WTR::EventSendingController::monitorWheelEvents): (WTR::EventSendingController::callAfterScrollingCompletes): * WebKitTestRunner/InjectedBundle/EventSendingController.h: LayoutTests: * platform/mac-wk2/TestExpectations: * platform/win/TestExpectations: * tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-2d-overflow.html: Need to call eventSender.monitorWheelEvents() for each subtest. Canonical link: https://commits.webkit.org/222192@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@258679 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-03-19 04:06:37 +00:00
if (weakPage)
Redundant rendering updates can be scheduled from inside Page::updateRendering() https://bugs.webkit.org/show_bug.cgi?id=216726 Reviewed by Tim Horton. Source/WebCore: The basic model for scheduling rendering updates is that code that needs to trigger an update just calls Page::schedule[Timed]RenderingUpdate(). However, if Page::updateRendering() is already on the stack, and the work to be scheduled will happen later in the current update, we don't have to schedule a new one. To fix this Page::updateRendering() and related functions track which steps remain in the current update, and callers of schedule[Timed]RenderingUpdate() pass the update steps for the work they need to trigger. If the requested steps are included in the remaining steps no new update needs to be scheduled. Note that requesting a step while that step is being executed has to schedule an upate (e.g. requestAnimationFrame inside its own callback has to schedule). At the end of an update, if there are any unfulfilled steps, then we schedule a new update. Add a log channel for EventLoop and and log from various places. In my brief testing, this reduces the number of calls to Page::updateRendering() by 10-25% on some real pages, which could be a significant power saving. * animation/DocumentTimeline.cpp: (WebCore::DocumentTimeline::scheduleAnimationResolution): * display/DisplayLayerController.cpp: (WebCore::Display::LayerController::scheduleRenderingUpdate): * dom/Document.cpp: (WebCore::Document::setNeedsDOMWindowResizeEvent): (WebCore::Document::setNeedsVisualViewportResize): (WebCore::Document::addPendingScrollEventTarget): (WebCore::Document::setNeedsVisualViewportScrollEvent): (WebCore::Document::serviceRequestAnimationFrameCallbacks): (WebCore::Document::intersectionObserversInitialUpdateTimerFired): (WebCore::Document::scheduleRenderingUpdate): (WebCore::Document::scheduleInitialIntersectionObservationUpdate): (WebCore::Document::updateResizeObservations): (WebCore::Document::updateAnimationsAndSendEvents): * dom/Document.h: * dom/ScriptedAnimationController.cpp: (WebCore::ScriptedAnimationController::scheduleAnimation): * page/EventHandler.cpp: (WebCore::EventHandler::scheduleCursorUpdate): * page/FrameView.cpp: (WebCore::FrameView::setViewExposedRect): * page/Page.cpp: (WebCore::Page::updateStyleAfterChangeInEnvironment): (WebCore::Page::scheduleRenderingUpdate): (WebCore::Page::computeUnfulfilledRenderingSteps): (WebCore::Page::triggerRenderingUpdateForTesting): (WebCore::Page::updateRendering): (WebCore::Page::isolatedUpdateRendering): (WebCore::Page::doAfterUpdateRendering): (WebCore::Page::finalizeRenderingUpdate): (WebCore::Page::renderingUpdateCompleted): (WebCore::Page::accessibilitySettingsDidChange): (WebCore::Page::appearanceDidChange): (WebCore::operator<<): * page/Page.h: * page/PageOverlayController.cpp: (WebCore::PageOverlayController::didChangeViewExposedRect): (WebCore::PageOverlayController::notifyFlushRequired): * page/RenderingUpdateScheduler.cpp: (WebCore::RenderingUpdateScheduler::scheduleAnimation): (WebCore::RenderingUpdateScheduler::scheduleRenderingUpdate): (WebCore::RenderingUpdateScheduler::startTimer): (WebCore::RenderingUpdateScheduler::displayRefreshFired): * page/RenderingUpdateScheduler.h: * page/ResizeObserver.cpp: (WebCore::ResizeObserver::observe): * page/WheelEventTestMonitor.cpp: (WebCore::WheelEventTestMonitor::setTestCallbackAndStartMonitoring): (WebCore::WheelEventTestMonitor::scheduleCallbackCheck): * page/mac/ServicesOverlayController.mm: (WebCore::ServicesOverlayController::Highlight::notifyFlushRequired): * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::setEventTrackingRegionsDirty): * page/scrolling/mac/ScrollingCoordinatorMac.mm: (WebCore::ScrollingCoordinatorMac::scheduleTreeStateCommit): * platform/Logging.cpp: (WebCore::initializeLogChannelsIfNecessary): * platform/Logging.h: * rendering/RenderElement.cpp: (WebCore::RenderElement::scheduleRenderingUpdateForImage): * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::notifyFlushRequired): * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::scheduleRenderingUpdate): * rendering/RenderLayerCompositor.h: Source/WebKit: Schedule for layer flush. * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHostTextureMapper.cpp: (WebKit::LayerTreeHost::layerFlushTimerFired): Source/WebKitLegacy/mac: Provide the flags. * WebView/WebView.mm: (-[WebView _scheduleRenderingUpdateForPendingTileCacheRepaint]): Source/WTF: Make it possible to dump Vectors with inline capacity. * wtf/text/TextStream.h: (WTF::operator<<): Canonical link: https://commits.webkit.org/230165@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268075 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-06 21:33:42 +00:00
weakPage->scheduleRenderingUpdate(RenderingUpdateStep::WheelEventMonitorCallbacks);
eventSender.monitorWheelEvents() is very fragile https://bugs.webkit.org/show_bug.cgi?id=197819 <rdar://problem/51319456> Reviewed by Tim Horton. Source/WebCore: Deflake tests using eventSender.monitorWheelEvents() by fixing several causes of flakiness, adding back changes from r257844 that were reverted in r258558. First, have EventSendingController keep track of whether it's seen then "end" event for the scrolling and momentum phases, and pass this down to WheelEventTestMonitor, which now waits until it sees these, which prevents premature triggering which was a common cause of failure before. Second, remove WheelEventTestMonitor's 1/60s timer and instead have WheelEventTestMonitor test for completion in a callout from the end of Page::updateRendering(), which makes it test and fire at a more consistent time. Third, push WheelEventTestMonitor to the ScrollingTree, so that reasons for deferral can be added on the scrolling thread. This fixes an issue where the RunLoop::main().dispatch() used to send the "ScrollingThreadSyncNeeded" reason to the main thread would get delayed, also resulting in a premature trigger. * Modules/applepay/ApplePaySession.cpp: Unified sources! * dom/WindowEventLoop.cpp: Unified sources! * page/EventHandler.cpp: (WebCore::EventHandler::handleWheelEvent): * page/FrameView.cpp: (WebCore::FrameView::scrollOffsetChangedViaPlatformWidgetImpl): * page/Page.cpp: (WebCore::Page::doAfterUpdateRendering): (WebCore::Page::wheelEventTestMonitor const): (WebCore::Page::clearWheelEventTestMonitor): (WebCore::Page::isMonitoringWheelEvents const): (WebCore::Page::ensureWheelEventTestMonitor): * page/Page.h: (WebCore::Page::wheelEventTestMonitor const): Deleted. (WebCore::Page::clearWheelEventTestMonitor): Deleted. (WebCore::Page::isMonitoringWheelEvents const): Deleted. * page/WheelEventTestMonitor.cpp: (WebCore::WheelEventTestMonitor::WheelEventTestMonitor): (WebCore::WheelEventTestMonitor::clearAllTestDeferrals): (WebCore::WheelEventTestMonitor::setTestCallbackAndStartMonitoring): (WebCore::WheelEventTestMonitor::deferForReason): (WebCore::WheelEventTestMonitor::removeDeferralForReason): (WebCore::WheelEventTestMonitor::receivedWheelEvent): (WebCore::WheelEventTestMonitor::scheduleCallbackCheck): (WebCore::WheelEventTestMonitor::checkShouldFireCallbacks): (WebCore::operator<<): (WebCore::WheelEventTestMonitor::setTestCallbackAndStartNotificationTimer): Deleted. (WebCore::WheelEventTestMonitor::triggerTestTimerFired): Deleted. * page/WheelEventTestMonitor.h: (WebCore::WheelEventTestMonitorCompletionDeferrer::WheelEventTestMonitorCompletionDeferrer): (WebCore::WheelEventTestMonitorCompletionDeferrer::~WheelEventTestMonitorCompletionDeferrer): * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated): (WebCore::AsyncScrollingCoordinator::deferWheelEventTestCompletionForReason const): Deleted. (WebCore::AsyncScrollingCoordinator::removeWheelEventTestCompletionDeferralForReason const): Deleted. * page/scrolling/AsyncScrollingCoordinator.h: * page/scrolling/ScrollingCoordinator.h: (WebCore::ScrollingCoordinator::startMonitoringWheelEvents): (WebCore::ScrollingCoordinator::stopMonitoringWheelEvents): * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::handleWheelEvent): * page/scrolling/ScrollingTree.h: (WebCore::ScrollingTree::setWheelEventTestMonitor): (WebCore::ScrollingTree::receivedWheelEvent): * page/scrolling/ThreadedScrollingTree.cpp: (WebCore::ThreadedScrollingTree::scrollingTreeNodeDidScroll): (WebCore::ThreadedScrollingTree::deferWheelEventTestCompletionForReason): Deleted. (WebCore::ThreadedScrollingTree::removeWheelEventTestCompletionDeferralForReason): Deleted. * page/scrolling/ThreadedScrollingTree.h: * page/scrolling/mac/ScrollingCoordinatorMac.h: * page/scrolling/mac/ScrollingCoordinatorMac.mm: (WebCore::ScrollingCoordinatorMac::startMonitoringWheelEvents): (WebCore::ScrollingCoordinatorMac::stopMonitoringWheelEvents): * page/scrolling/mac/ScrollingTreeMac.h: * page/scrolling/mac/ScrollingTreeMac.mm: (ScrollingTreeMac::setWheelEventTestMonitor): (ScrollingTreeMac::receivedWheelEvent): (ScrollingTreeMac::deferWheelEventTestCompletionForReason): (ScrollingTreeMac::removeWheelEventTestCompletionDeferralForReason): * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm: (WebCore::ScrollingTreeScrollingNodeDelegateMac::deferWheelEventTestCompletionForReason const): (WebCore::ScrollingTreeScrollingNodeDelegateMac::removeWheelEventTestCompletionDeferralForReason const): * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::setWheelEventMonitorTestCallbackAndStartMonitoring): (WebCoreTestSupport::setTestCallbackAndStartNotificationTimer): Deleted. * testing/js/WebCoreTestSupport.h: Source/WebKit: Deflake tests using eventSender.monitorWheelEvents() by fixing several causes of flakiness, adding back changes from r257844 that were reverted in r258558. First, have EventSendingController keep track of whether it's seen then "end" event for the scrolling and momentum phases, and pass this down to WheelEventTestMonitor, which now waits until it sees these, which prevents premature triggering which was a common cause of failure before. Second, remove WheelEventTestMonitor's 1/60s timer and instead have WheelEventTestMonitor test for completion in a callout from the end of Page::updateRendering(), which makes it test and fire at a more consistent time. Third, push WheelEventTestMonitor to the ScrollingTree, so that reasons for deferral can be added on the scrolling thread. This fixes an issue where the RunLoop::main().dispatch() used to send the "ScrollingThreadSyncNeeded" reason to the main thread would get delayed, also resulting in a premature trigger. * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageRegisterScrollOperationCompletionCallback): * WebProcess/InjectedBundle/API/c/WKBundlePage.h: Tools: Deflake tests using eventSender.monitorWheelEvents() by fixing several causes of flakiness, adding back changes from r257844 that were reverted in r258558. First, have EventSendingController keep track of whether it's seen then "end" event for the scrolling and momentum phases, and pass this down to WheelEventTestMonitor, which now waits until it sees these, which prevents premature triggering which was a common cause of failure before. Second, remove WheelEventTestMonitor's 1/60s timer and instead have WheelEventTestMonitor test for completion in a callout from the end of Page::updateRendering(), which makes it test and fire at a more consistent time. Third, push WheelEventTestMonitor to the ScrollingTree, so that reasons for deferral can be added on the scrolling thread. This fixes an issue where the RunLoop::main().dispatch() used to send the "ScrollingThreadSyncNeeded" reason to the main thread would get delayed, also resulting in a premature trigger. * DumpRenderTree/mac/EventSendingController.h: * DumpRenderTree/mac/EventSendingController.mm: (-[EventSendingController mouseScrollByX:andY:withWheel:andMomentumPhases:]): (-[EventSendingController monitorWheelEvents]): (-[EventSendingController callAfterScrollingCompletes:]): * DumpRenderTree/win/EventSender.cpp: (mouseScrollBy): * WebKitTestRunner/InjectedBundle/EventSendingController.cpp: (WTR::EventSendingController::mouseScrollByWithWheelAndMomentumPhases): (WTR::EventSendingController::monitorWheelEvents): (WTR::EventSendingController::callAfterScrollingCompletes): * WebKitTestRunner/InjectedBundle/EventSendingController.h: LayoutTests: * platform/mac-wk2/TestExpectations: * platform/win/TestExpectations: * tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-2d-overflow.html: Need to call eventSender.monitorWheelEvents() for each subtest. Canonical link: https://commits.webkit.org/222192@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@258679 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-03-19 04:06:37 +00:00
});
}
void WheelEventTestMonitor::checkShouldFireCallbacks()
{
ASSERT(isMainThread());
{
Use CheckedLock more in WebCore https://bugs.webkit.org/show_bug.cgi?id=226026 Reviewed by Geoffrey Garen. Use CheckedLock more in WebCore to benefit from Clang Thread Safety Analysis. * Modules/indexeddb/IDBObjectStore.cpp: (WebCore::IDBObjectStore::createIndex): (WebCore::IDBObjectStore::index): (WebCore::IDBObjectStore::deleteIndex): (WebCore::IDBObjectStore::rollbackForVersionChangeAbort): (WebCore::IDBObjectStore::visitReferencedIndexes const): (WebCore::IDBObjectStore::renameReferencedIndex): * Modules/indexeddb/IDBObjectStore.h: * Modules/indexeddb/IDBTransaction.cpp: (WebCore::IDBTransaction::objectStore): (WebCore::IDBTransaction::internalAbort): (WebCore::IDBTransaction::createObjectStore): (WebCore::IDBTransaction::renameObjectStore): (WebCore::IDBTransaction::renameIndex): (WebCore::IDBTransaction::deleteObjectStore): (WebCore::IDBTransaction::visitReferencedObjectStores const): * Modules/indexeddb/IDBTransaction.h: * Modules/indexeddb/client/IDBConnectionProxy.cpp: (WebCore::IDBClient::IDBConnectionProxy::openDatabase): (WebCore::IDBClient::IDBConnectionProxy::deleteDatabase): (WebCore::IDBClient::IDBConnectionProxy::completeOpenDBRequest): (WebCore::IDBClient::IDBConnectionProxy::saveOperation): (WebCore::IDBClient::IDBConnectionProxy::completeOperation): (WebCore::IDBClient::IDBConnectionProxy::fireVersionChangeEvent): (WebCore::IDBClient::IDBConnectionProxy::notifyOpenDBRequestBlocked): (WebCore::IDBClient::IDBConnectionProxy::establishTransaction): (WebCore::IDBClient::IDBConnectionProxy::didStartTransaction): (WebCore::IDBClient::IDBConnectionProxy::commitTransaction): (WebCore::IDBClient::IDBConnectionProxy::didCommitTransaction): (WebCore::IDBClient::IDBConnectionProxy::abortTransaction): (WebCore::IDBClient::IDBConnectionProxy::didAbortTransaction): (WebCore::IDBClient::IDBConnectionProxy::didCloseFromServer): (WebCore::IDBClient::IDBConnectionProxy::connectionToServerLost): (WebCore::IDBClient::IDBConnectionProxy::scheduleMainThreadTasks): (WebCore::IDBClient::IDBConnectionProxy::handleMainThreadTasks): (WebCore::IDBClient::IDBConnectionProxy::getAllDatabaseNamesAndVersions): (WebCore::IDBClient::IDBConnectionProxy::didGetAllDatabaseNamesAndVersions): (WebCore::IDBClient::IDBConnectionProxy::registerDatabaseConnection): (WebCore::IDBClient::IDBConnectionProxy::unregisterDatabaseConnection): (WebCore::IDBClient::IDBConnectionProxy::forgetActiveOperations): (WebCore::IDBClient::IDBConnectionProxy::forgetTransaction): (WebCore::IDBClient::IDBConnectionProxy::forgetActivityForCurrentThread): (WebCore::IDBClient::IDBConnectionProxy::setContextSuspended): * Modules/indexeddb/client/IDBConnectionProxy.h: * Modules/mediastream/RTCRtpSFrameTransformer.cpp: (WebCore::RTCRtpSFrameTransformer::setEncryptionKey): (WebCore::RTCRtpSFrameTransformer::decryptFrame): (WebCore::RTCRtpSFrameTransformer::encryptFrame): * Modules/mediastream/RTCRtpSFrameTransformer.h: * Modules/mediastream/RTCRtpScriptTransform.cpp: (WebCore::RTCRtpScriptTransform::setTransformer): (WebCore::RTCRtpScriptTransform::setupTransformer): (WebCore::RTCRtpScriptTransform::clear): * Modules/mediastream/RTCRtpScriptTransform.h: * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.cpp: (WebCore::LibWebRTCDataChannelHandler::setClient): (WebCore::LibWebRTCDataChannelHandler::checkState): (WebCore::LibWebRTCDataChannelHandler::OnMessage): (WebCore::LibWebRTCDataChannelHandler::OnBufferedAmountChange): * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.h: * Modules/mediastream/libwebrtc/LibWebRTCRtpTransformBackend.cpp: (WebCore::LibWebRTCRtpTransformBackend::setInputCallback): (WebCore::LibWebRTCRtpTransformBackend::setOutputCallback): (WebCore::LibWebRTCRtpTransformBackend::processTransformedFrame): (WebCore::LibWebRTCRtpTransformBackend::Transform): * Modules/mediastream/libwebrtc/LibWebRTCRtpTransformBackend.h: * inspector/agents/WebHeapAgent.cpp: (WebCore::SendGarbageCollectionEventsTask::addGarbageCollection): (WebCore::SendGarbageCollectionEventsTask::reset): (WebCore::SendGarbageCollectionEventsTask::timerFired): * page/ResourceUsageThread.cpp: (WebCore::ResourceUsageThread::addObserver): (WebCore::ResourceUsageThread::removeObserver): (WebCore::ResourceUsageThread::waitUntilObservers): (WebCore::ResourceUsageThread::notifyObservers): * page/ResourceUsageThread.h: * page/WheelEventTestMonitor.cpp: (WebCore::WheelEventTestMonitor::clearAllTestDeferrals): (WebCore::WheelEventTestMonitor::setTestCallbackAndStartMonitoring): (WebCore::WheelEventTestMonitor::deferForReason): (WebCore::WheelEventTestMonitor::removeDeferralForReason): (WebCore::WheelEventTestMonitor::receivedWheelEvent): (WebCore::WheelEventTestMonitor::checkShouldFireCallbacks): * page/WheelEventTestMonitor.h: (WebCore::WheelEventTestMonitor::WTF_GUARDED_BY_LOCK): * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::computeWheelProcessingSteps): (WebCore::ScrollingTree::determineWheelEventProcessing): (WebCore::ScrollingTree::handleWheelEvent): (WebCore::ScrollingTree::commitTreeState): (WebCore::ScrollingTree::mainFrameScrollPosition const): (WebCore::ScrollingTree::setMainFrameScrollPosition): (WebCore::ScrollingTree::setGestureState): (WebCore::ScrollingTree::gestureState): (WebCore::ScrollingTree::eventTrackingTypeForPoint): (WebCore::ScrollingTree::isRubberBandInProgressForNode): (WebCore::ScrollingTree::setRubberBandingInProgressForNode): (WebCore::ScrollingTree::isUserScrollInProgressForNode): (WebCore::ScrollingTree::setUserScrollInProgressForNode): (WebCore::ScrollingTree::clearNodesWithUserScrollInProgress): (WebCore::ScrollingTree::isScrollSnapInProgressForNode): (WebCore::ScrollingTree::setNodeScrollSnapInProgress): (WebCore::ScrollingTree::setMainFramePinnedState): (WebCore::ScrollingTree::setMainFrameCanRubberBand): (WebCore::ScrollingTree::mainFrameCanRubberBandInDirection): (WebCore::ScrollingTree::addPendingScrollUpdate): (WebCore::ScrollingTree::takePendingScrollUpdates): (WebCore::ScrollingTree::setScrollPinningBehavior): (WebCore::ScrollingTree::scrollPinningBehavior): (WebCore::ScrollingTree::willWheelEventStartSwipeGesture): (WebCore::ScrollingTree::windowScreenDidChange): (WebCore::ScrollingTree::displayID): (WebCore::ScrollingTree::hasProcessedWheelEventsRecently): (WebCore::ScrollingTree::willProcessWheelEvent): (WebCore::ScrollingTree::nominalFramesPerSecond): (WebCore::ScrollingTree::scrollingTreeAsText): * page/scrolling/ScrollingTree.h: * page/scrolling/ScrollingTreeLatchingController.cpp: (WebCore::ScrollingTreeLatchingController::receivedWheelEvent): (WebCore::ScrollingTreeLatchingController::latchingDataForEvent const): (WebCore::ScrollingTreeLatchingController::latchedNodeID const): (WebCore::ScrollingTreeLatchingController::latchedNodeAndSteps const): (WebCore::ScrollingTreeLatchingController::nodeDidHandleEvent): (WebCore::ScrollingTreeLatchingController::nodeWasRemoved): (WebCore::ScrollingTreeLatchingController::clearLatchedNode): * page/scrolling/ScrollingTreeLatchingController.h: * platform/audio/HRTFDatabaseLoader.cpp: (WebCore::HRTFDatabaseLoader::loadAsynchronously): (WebCore::HRTFDatabaseLoader::waitForLoaderThreadCompletion): * platform/audio/HRTFDatabaseLoader.h: * platform/audio/cocoa/AudioDestinationCocoa.cpp: (WebCore::AudioDestinationCocoa::hasEnoughFrames const): (WebCore::AudioDestinationCocoa::render): (WebCore::AudioDestinationCocoa::renderOnRenderingThead): * platform/audio/cocoa/AudioDestinationCocoa.h: * platform/encryptedmedia/CDMProxy.cpp: (WebCore::CDMProxy::instance const): (WebCore::CDMProxy::setInstance): (WebCore::CDMProxy::startedWaitingForKey const): (WebCore::CDMProxy::stoppedWaitingForKey const): * platform/encryptedmedia/CDMProxy.h: * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp: (WebCore::MediaPlayerPrivateAVFoundation::MediaPlayerPrivateAVFoundation): (WebCore::MediaPlayerPrivateAVFoundation::setDelayCallbacks const): (WebCore::MediaPlayerPrivateAVFoundation::clearMainThreadPendingFlag): (WebCore::MediaPlayerPrivateAVFoundation::scheduleMainThreadNotification): (WebCore::MediaPlayerPrivateAVFoundation::dispatchNotification): * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm: (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::processNewVideoSample): * platform/graphics/cg/IOSurfacePool.cpp: (WebCore::IOSurfacePool::takeSurface): (WebCore::IOSurfacePool::addSurface): (WebCore::IOSurfacePool::setPoolSize): (WebCore::IOSurfacePool::collectionTimerFired): (WebCore::IOSurfacePool::discardAllSurfaces): * platform/graphics/cg/IOSurfacePool.h: (WebCore::IOSurfacePool::WTF_GUARDED_BY_LOCK): * platform/graphics/cg/SubimageCacheWithTimer.cpp: (WebCore::SubimageCacheWithTimer::pruneCacheTimerFired): (WebCore::SubimageCacheWithTimer::subimage): (WebCore::SubimageCacheWithTimer::clearImageAndSubimages): (WebCore::SubimageCacheWithTimer::clearAll): * platform/graphics/cg/SubimageCacheWithTimer.h: * platform/graphics/cocoa/FontCacheCoreText.cpp: (WebCore::FontDatabase::collectionForFamily): (WebCore::FontDatabase::clear): * platform/network/cocoa/WebCoreNSURLSession.mm: (WebCore::WebCoreNSURLSessionDataTaskClient::clearTask): (WebCore::WebCoreNSURLSessionDataTaskClient::dataSent): (WebCore::WebCoreNSURLSessionDataTaskClient::responseReceived): (WebCore::WebCoreNSURLSessionDataTaskClient::shouldCacheResponse): (WebCore::WebCoreNSURLSessionDataTaskClient::dataReceived): (WebCore::WebCoreNSURLSessionDataTaskClient::redirectReceived): (WebCore::WebCoreNSURLSessionDataTaskClient::accessControlCheckFailed): (WebCore::WebCoreNSURLSessionDataTaskClient::loadFailed): (WebCore::WebCoreNSURLSessionDataTaskClient::loadFinished): * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.h: * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm: (-[WebCoreResourceHandleAsOperationQueueDelegate detachHandle]): (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willSendRequest:redirectResponse:]): (-[WebCoreResourceHandleAsOperationQueueDelegate connection:canAuthenticateAgainstProtectionSpace:]): (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willCacheResponse:]): * storage/StorageQuotaManager.cpp: (WebCore::StorageQuotaManager::requestSpaceOnBackgroundThread): (WebCore::StorageQuotaManager::resetQuotaUpdatedBasedOnUsageForTesting): (WebCore::StorageQuotaManager::resetQuotaForTesting): * storage/StorageQuotaManager.h: (WebCore::StorageQuotaManager::WTF_GUARDED_BY_LOCK): * workers/WorkerOrWorkletScriptController.cpp: (WebCore::WorkerOrWorkletScriptController::scheduleExecutionTermination): (WebCore::WorkerOrWorkletScriptController::isTerminatingExecution const): * workers/WorkerOrWorkletScriptController.h: (WebCore::WorkerOrWorkletScriptController::WTF_GUARDED_BY_LOCK): Canonical link: https://commits.webkit.org/237960@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277805 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-20 18:41:33 +00:00
Locker locker { m_lock };
eventSender.monitorWheelEvents() is very fragile https://bugs.webkit.org/show_bug.cgi?id=197819 <rdar://problem/51319456> Reviewed by Tim Horton. Source/WebCore: Deflake tests using eventSender.monitorWheelEvents() by fixing several causes of flakiness, adding back changes from r257844 that were reverted in r258558. First, have EventSendingController keep track of whether it's seen then "end" event for the scrolling and momentum phases, and pass this down to WheelEventTestMonitor, which now waits until it sees these, which prevents premature triggering which was a common cause of failure before. Second, remove WheelEventTestMonitor's 1/60s timer and instead have WheelEventTestMonitor test for completion in a callout from the end of Page::updateRendering(), which makes it test and fire at a more consistent time. Third, push WheelEventTestMonitor to the ScrollingTree, so that reasons for deferral can be added on the scrolling thread. This fixes an issue where the RunLoop::main().dispatch() used to send the "ScrollingThreadSyncNeeded" reason to the main thread would get delayed, also resulting in a premature trigger. * Modules/applepay/ApplePaySession.cpp: Unified sources! * dom/WindowEventLoop.cpp: Unified sources! * page/EventHandler.cpp: (WebCore::EventHandler::handleWheelEvent): * page/FrameView.cpp: (WebCore::FrameView::scrollOffsetChangedViaPlatformWidgetImpl): * page/Page.cpp: (WebCore::Page::doAfterUpdateRendering): (WebCore::Page::wheelEventTestMonitor const): (WebCore::Page::clearWheelEventTestMonitor): (WebCore::Page::isMonitoringWheelEvents const): (WebCore::Page::ensureWheelEventTestMonitor): * page/Page.h: (WebCore::Page::wheelEventTestMonitor const): Deleted. (WebCore::Page::clearWheelEventTestMonitor): Deleted. (WebCore::Page::isMonitoringWheelEvents const): Deleted. * page/WheelEventTestMonitor.cpp: (WebCore::WheelEventTestMonitor::WheelEventTestMonitor): (WebCore::WheelEventTestMonitor::clearAllTestDeferrals): (WebCore::WheelEventTestMonitor::setTestCallbackAndStartMonitoring): (WebCore::WheelEventTestMonitor::deferForReason): (WebCore::WheelEventTestMonitor::removeDeferralForReason): (WebCore::WheelEventTestMonitor::receivedWheelEvent): (WebCore::WheelEventTestMonitor::scheduleCallbackCheck): (WebCore::WheelEventTestMonitor::checkShouldFireCallbacks): (WebCore::operator<<): (WebCore::WheelEventTestMonitor::setTestCallbackAndStartNotificationTimer): Deleted. (WebCore::WheelEventTestMonitor::triggerTestTimerFired): Deleted. * page/WheelEventTestMonitor.h: (WebCore::WheelEventTestMonitorCompletionDeferrer::WheelEventTestMonitorCompletionDeferrer): (WebCore::WheelEventTestMonitorCompletionDeferrer::~WheelEventTestMonitorCompletionDeferrer): * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated): (WebCore::AsyncScrollingCoordinator::deferWheelEventTestCompletionForReason const): Deleted. (WebCore::AsyncScrollingCoordinator::removeWheelEventTestCompletionDeferralForReason const): Deleted. * page/scrolling/AsyncScrollingCoordinator.h: * page/scrolling/ScrollingCoordinator.h: (WebCore::ScrollingCoordinator::startMonitoringWheelEvents): (WebCore::ScrollingCoordinator::stopMonitoringWheelEvents): * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::handleWheelEvent): * page/scrolling/ScrollingTree.h: (WebCore::ScrollingTree::setWheelEventTestMonitor): (WebCore::ScrollingTree::receivedWheelEvent): * page/scrolling/ThreadedScrollingTree.cpp: (WebCore::ThreadedScrollingTree::scrollingTreeNodeDidScroll): (WebCore::ThreadedScrollingTree::deferWheelEventTestCompletionForReason): Deleted. (WebCore::ThreadedScrollingTree::removeWheelEventTestCompletionDeferralForReason): Deleted. * page/scrolling/ThreadedScrollingTree.h: * page/scrolling/mac/ScrollingCoordinatorMac.h: * page/scrolling/mac/ScrollingCoordinatorMac.mm: (WebCore::ScrollingCoordinatorMac::startMonitoringWheelEvents): (WebCore::ScrollingCoordinatorMac::stopMonitoringWheelEvents): * page/scrolling/mac/ScrollingTreeMac.h: * page/scrolling/mac/ScrollingTreeMac.mm: (ScrollingTreeMac::setWheelEventTestMonitor): (ScrollingTreeMac::receivedWheelEvent): (ScrollingTreeMac::deferWheelEventTestCompletionForReason): (ScrollingTreeMac::removeWheelEventTestCompletionDeferralForReason): * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm: (WebCore::ScrollingTreeScrollingNodeDelegateMac::deferWheelEventTestCompletionForReason const): (WebCore::ScrollingTreeScrollingNodeDelegateMac::removeWheelEventTestCompletionDeferralForReason const): * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::setWheelEventMonitorTestCallbackAndStartMonitoring): (WebCoreTestSupport::setTestCallbackAndStartNotificationTimer): Deleted. * testing/js/WebCoreTestSupport.h: Source/WebKit: Deflake tests using eventSender.monitorWheelEvents() by fixing several causes of flakiness, adding back changes from r257844 that were reverted in r258558. First, have EventSendingController keep track of whether it's seen then "end" event for the scrolling and momentum phases, and pass this down to WheelEventTestMonitor, which now waits until it sees these, which prevents premature triggering which was a common cause of failure before. Second, remove WheelEventTestMonitor's 1/60s timer and instead have WheelEventTestMonitor test for completion in a callout from the end of Page::updateRendering(), which makes it test and fire at a more consistent time. Third, push WheelEventTestMonitor to the ScrollingTree, so that reasons for deferral can be added on the scrolling thread. This fixes an issue where the RunLoop::main().dispatch() used to send the "ScrollingThreadSyncNeeded" reason to the main thread would get delayed, also resulting in a premature trigger. * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageRegisterScrollOperationCompletionCallback): * WebProcess/InjectedBundle/API/c/WKBundlePage.h: Tools: Deflake tests using eventSender.monitorWheelEvents() by fixing several causes of flakiness, adding back changes from r257844 that were reverted in r258558. First, have EventSendingController keep track of whether it's seen then "end" event for the scrolling and momentum phases, and pass this down to WheelEventTestMonitor, which now waits until it sees these, which prevents premature triggering which was a common cause of failure before. Second, remove WheelEventTestMonitor's 1/60s timer and instead have WheelEventTestMonitor test for completion in a callout from the end of Page::updateRendering(), which makes it test and fire at a more consistent time. Third, push WheelEventTestMonitor to the ScrollingTree, so that reasons for deferral can be added on the scrolling thread. This fixes an issue where the RunLoop::main().dispatch() used to send the "ScrollingThreadSyncNeeded" reason to the main thread would get delayed, also resulting in a premature trigger. * DumpRenderTree/mac/EventSendingController.h: * DumpRenderTree/mac/EventSendingController.mm: (-[EventSendingController mouseScrollByX:andY:withWheel:andMomentumPhases:]): (-[EventSendingController monitorWheelEvents]): (-[EventSendingController callAfterScrollingCompletes:]): * DumpRenderTree/win/EventSender.cpp: (mouseScrollBy): * WebKitTestRunner/InjectedBundle/EventSendingController.cpp: (WTR::EventSendingController::mouseScrollByWithWheelAndMomentumPhases): (WTR::EventSendingController::monitorWheelEvents): (WTR::EventSendingController::callAfterScrollingCompletes): * WebKitTestRunner/InjectedBundle/EventSendingController.h: LayoutTests: * platform/mac-wk2/TestExpectations: * platform/win/TestExpectations: * tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-2d-overflow.html: Need to call eventSender.monitorWheelEvents() for each subtest. Canonical link: https://commits.webkit.org/222192@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@258679 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-03-19 04:06:37 +00:00
if (!m_deferCompletionReasons.isEmpty()) {
LOG_WITH_STREAM(WheelEventTestMonitor, stream << " WheelEventTestMonitor::checkShouldFireCallbacks - scrolling still active, reasons " << m_deferCompletionReasons);
return;
}
if (!m_everHadDeferral) {
LOG_WITH_STREAM(WheelEventTestMonitor, stream << " WheelEventTestMonitor::checkShouldFireCallbacks - have not yet seen any deferral reasons");
return;
}
if (m_expectWheelEndOrCancel && !m_receivedWheelEndOrCancel) {
LOG_WITH_STREAM(WheelEventTestMonitor, stream << " WheelEventTestMonitor::checkShouldFireCallbacks - have not seen end of of wheel phase");
return;
}
if (m_expectMomentumEnd && !m_receivedMomentumEnd) {
LOG_WITH_STREAM(WheelEventTestMonitor, stream << " WheelEventTestMonitor::checkShouldFireCallbacks - have not seen end of of momentum phase");
return;
}
}
Rename WheelEventTestTrigger and improve naming in related code https://bugs.webkit.org/show_bug.cgi?id=202772 Reviewed by Tim Horton. Change the "test trigger" terminology to "monitor wheel events"; after all, tests call monitorWheelEvents() and callAfterScrollingCompletes(), and this is not triggering a test. Source/WebCore: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * page/FrameView.cpp: (WebCore::FrameView::adjustScrollbarsForLayout): (WebCore::FrameView::setScrollPosition): (WebCore::FrameView::didAddScrollbar): * page/Page.cpp: (WebCore::Page::ensureWheelEventTestMonitor): (WebCore::Page::ensureTestTrigger): Deleted. * page/Page.h: (WebCore::Page::wheelEventTestMonitor const): (WebCore::Page::clearWheelEventTestMonitor): (WebCore::Page::isMonitoringWheelEvents const): (WebCore::Page::testTrigger const): Deleted. (WebCore::Page::clearTrigger): Deleted. (WebCore::Page::expectsWheelEventTriggers const): Deleted. * page/WheelEventTestMonitor.cpp: Added. (WebCore::WheelEventTestMonitor::WheelEventTestMonitor): (WebCore::WheelEventTestMonitor::clearAllTestDeferrals): (WebCore::WheelEventTestMonitor::setTestCallbackAndStartNotificationTimer): (WebCore::WheelEventTestMonitor::deferForReason): (WebCore::WheelEventTestMonitor::removeDeferralForReason): (WebCore::WheelEventTestMonitor::triggerTestTimerFired): (WebCore::operator<<): * page/WheelEventTestMonitor.h: Renamed from Source/WebCore/page/WheelEventTestTrigger.h. * page/WheelEventTestTrigger.cpp: Removed. * page/mac/EventHandlerMac.mm: (WebCore::EventHandler::platformPrepareForWheelEvents): * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated): (WebCore::AsyncScrollingCoordinator::updateIsMonitoringWheelEventsForFrameView): (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll): (WebCore::AsyncScrollingCoordinator::deferWheelEventTestCompletionForReason const): (WebCore::AsyncScrollingCoordinator::removeWheelEventTestCompletionDeferralForReason const): (WebCore::AsyncScrollingCoordinator::updateExpectsWheelEventTestTriggerWithFrameView): Deleted. (WebCore::AsyncScrollingCoordinator::deferTestsForReason const): Deleted. (WebCore::AsyncScrollingCoordinator::removeTestDeferralForReason const): Deleted. * page/scrolling/AsyncScrollingCoordinator.h: * page/scrolling/ScrollingCoordinator.h: (WebCore::ScrollingCoordinator::updateIsMonitoringWheelEventsForFrameView): (WebCore::ScrollingCoordinator::updateExpectsWheelEventTestTriggerWithFrameView): Deleted. * page/scrolling/ScrollingStateScrollingNode.cpp: (WebCore::ScrollingStateScrollingNode::ScrollingStateScrollingNode): (WebCore::ScrollingStateScrollingNode::setPropertyChangedBitsAfterReattach): (WebCore::ScrollingStateScrollingNode::setIsMonitoringWheelEvents): (WebCore::ScrollingStateScrollingNode::dumpProperties const): (WebCore::ScrollingStateScrollingNode::setExpectsWheelEventTestTrigger): Deleted. * page/scrolling/ScrollingStateScrollingNode.h: (WebCore::ScrollingStateScrollingNode::isMonitoringWheelEvents const): (WebCore::ScrollingStateScrollingNode::expectsWheelEventTestTrigger const): Deleted. * page/scrolling/ScrollingTree.h: (WebCore::ScrollingTree::deferWheelEventTestCompletionForReason): (WebCore::ScrollingTree::removeWheelEventTestCompletionDeferralForReason): (WebCore::ScrollingTree::deferTestsForReason): Deleted. (WebCore::ScrollingTree::removeTestDeferralForReason): Deleted. * page/scrolling/ScrollingTreeScrollingNode.cpp: (WebCore::ScrollingTreeScrollingNode::commitStateBeforeChildren): * page/scrolling/ScrollingTreeScrollingNode.h: * page/scrolling/ThreadedScrollingTree.cpp: (WebCore::ThreadedScrollingTree::deferWheelEventTestCompletionForReason): (WebCore::ThreadedScrollingTree::removeWheelEventTestCompletionDeferralForReason): (WebCore::ThreadedScrollingTree::deferTestsForReason): Deleted. (WebCore::ThreadedScrollingTree::removeTestDeferralForReason): Deleted. * page/scrolling/ThreadedScrollingTree.h: * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h: * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm: (WebCore::ScrollingTreeScrollingNodeDelegateMac::handleWheelEvent): (WebCore::ScrollingTreeScrollingNodeDelegateMac::deferWheelEventTestCompletionForReason const): (WebCore::ScrollingTreeScrollingNodeDelegateMac::removeWheelEventTestCompletionDeferralForReason const): (WebCore::ScrollingTreeScrollingNodeDelegateMac::deferTestsForReason const): Deleted. (WebCore::ScrollingTreeScrollingNodeDelegateMac::removeTestDeferralForReason const): Deleted. * platform/Logging.h: * platform/ScrollAnimator.cpp: (WebCore::ScrollAnimator::deferWheelEventTestCompletionForReason const): (WebCore::ScrollAnimator::removeWheelEventTestCompletionDeferralForReason const): (WebCore::ScrollAnimator::deferTestsForReason const): Deleted. (WebCore::ScrollAnimator::removeTestDeferralForReason const): Deleted. * platform/ScrollAnimator.h: (WebCore::ScrollAnimator::ScrollAnimator::setWheelEventTestMonitor): (WebCore::ScrollAnimator::ScrollAnimator::setWheelEventTestTrigger): Deleted. * platform/cocoa/ScrollController.h: (WebCore::ScrollControllerClient::deferWheelEventTestCompletionForReason const): (WebCore::ScrollControllerClient::removeWheelEventTestCompletionDeferralForReason const): (WebCore::ScrollControllerClient::deferTestsForReason const): Deleted. (WebCore::ScrollControllerClient::removeTestDeferralForReason const): Deleted. * platform/cocoa/ScrollController.mm: (WebCore::ScrollController::startSnapRubberbandTimer): (WebCore::ScrollController::stopSnapRubberbandTimer): (WebCore::ScrollController::scheduleStatelessScrollSnap): (WebCore::ScrollController::startDeferringWheelEventTestCompletionDueToScrollSnapping): (WebCore::ScrollController::stopDeferringWheelEventTestCompletionDueToScrollSnapping): (WebCore::ScrollController::startScrollSnapTimer): (WebCore::ScrollController::stopScrollSnapTimer): (WebCore::ScrollController::startDeferringTestsDueToScrollSnapping): Deleted. (WebCore::ScrollController::stopDeferringTestsDueToScrollSnapping): Deleted. * platform/mac/ScrollAnimatorMac.mm: (WebCore::ScrollAnimatorMac::didBeginScrollGesture const): (WebCore::ScrollAnimatorMac::didEndScrollGesture const): (WebCore::ScrollAnimatorMac::sendContentAreaScrolledSoon): (WebCore::ScrollAnimatorMac::sendContentAreaScrolledTimerFired): * rendering/RenderBox.cpp: (WebCore::setupWheelEventMonitor): (WebCore::RenderBox::setScrollLeft): (WebCore::RenderBox::setScrollTop): (WebCore::setupWheelEventTestTrigger): Deleted. * rendering/RenderLayer.cpp: (WebCore::RenderLayer::createScrollbar): * rendering/RenderListBox.cpp: (WebCore::setupWheelEventTestMonitor): (WebCore::RenderListBox::setScrollTop): (WebCore::RenderListBox::createScrollbar): (WebCore::setupWheelEventTestTrigger): Deleted. * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::monitorWheelEvents): (WebCoreTestSupport::setTestCallbackAndStartNotificationTimer): (WebCoreTestSupport::clearWheelEventTestMonitor): (WebCoreTestSupport::clearWheelEventTestTrigger): Deleted. * testing/js/WebCoreTestSupport.h: Source/WebKit: * UIProcess/API/C/WKPage.cpp: (WKPageClearWheelEventTestMonitor): (WKPageClearWheelEventTestTrigger): Deleted. * UIProcess/API/C/WKPage.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::clearWheelEventTestMonitor): (WebKit::WebPageProxy::clearWheelEventTestTrigger): Deleted. * UIProcess/WebPageProxy.h: * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageStartMonitoringScrollOperations): (WKBundlePageRegisterScrollOperationCompletionCallback): * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::createScrollbar): * WebProcess/WebPage/EventDispatcher.cpp: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::clearWheelEventTestMonitor): (WebKit::WebPage::clearWheelEventTestTrigger): Deleted. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: Tools: * DumpRenderTree/mac/DumpRenderTree.mm: (resetWebViewToConsistentStateBeforeTesting): * WebKitTestRunner/TestController.cpp: (WTR::TestController::resetStateToConsistentValues): Canonical link: https://commits.webkit.org/216237@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@250946 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-10-10 00:24:44 +00:00
eventSender.monitorWheelEvents() is very fragile https://bugs.webkit.org/show_bug.cgi?id=197819 <rdar://problem/51319456> Reviewed by Tim Horton. Source/WebCore: Deflake tests using eventSender.monitorWheelEvents() by fixing several causes of flakiness, adding back changes from r257844 that were reverted in r258558. First, have EventSendingController keep track of whether it's seen then "end" event for the scrolling and momentum phases, and pass this down to WheelEventTestMonitor, which now waits until it sees these, which prevents premature triggering which was a common cause of failure before. Second, remove WheelEventTestMonitor's 1/60s timer and instead have WheelEventTestMonitor test for completion in a callout from the end of Page::updateRendering(), which makes it test and fire at a more consistent time. Third, push WheelEventTestMonitor to the ScrollingTree, so that reasons for deferral can be added on the scrolling thread. This fixes an issue where the RunLoop::main().dispatch() used to send the "ScrollingThreadSyncNeeded" reason to the main thread would get delayed, also resulting in a premature trigger. * Modules/applepay/ApplePaySession.cpp: Unified sources! * dom/WindowEventLoop.cpp: Unified sources! * page/EventHandler.cpp: (WebCore::EventHandler::handleWheelEvent): * page/FrameView.cpp: (WebCore::FrameView::scrollOffsetChangedViaPlatformWidgetImpl): * page/Page.cpp: (WebCore::Page::doAfterUpdateRendering): (WebCore::Page::wheelEventTestMonitor const): (WebCore::Page::clearWheelEventTestMonitor): (WebCore::Page::isMonitoringWheelEvents const): (WebCore::Page::ensureWheelEventTestMonitor): * page/Page.h: (WebCore::Page::wheelEventTestMonitor const): Deleted. (WebCore::Page::clearWheelEventTestMonitor): Deleted. (WebCore::Page::isMonitoringWheelEvents const): Deleted. * page/WheelEventTestMonitor.cpp: (WebCore::WheelEventTestMonitor::WheelEventTestMonitor): (WebCore::WheelEventTestMonitor::clearAllTestDeferrals): (WebCore::WheelEventTestMonitor::setTestCallbackAndStartMonitoring): (WebCore::WheelEventTestMonitor::deferForReason): (WebCore::WheelEventTestMonitor::removeDeferralForReason): (WebCore::WheelEventTestMonitor::receivedWheelEvent): (WebCore::WheelEventTestMonitor::scheduleCallbackCheck): (WebCore::WheelEventTestMonitor::checkShouldFireCallbacks): (WebCore::operator<<): (WebCore::WheelEventTestMonitor::setTestCallbackAndStartNotificationTimer): Deleted. (WebCore::WheelEventTestMonitor::triggerTestTimerFired): Deleted. * page/WheelEventTestMonitor.h: (WebCore::WheelEventTestMonitorCompletionDeferrer::WheelEventTestMonitorCompletionDeferrer): (WebCore::WheelEventTestMonitorCompletionDeferrer::~WheelEventTestMonitorCompletionDeferrer): * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated): (WebCore::AsyncScrollingCoordinator::deferWheelEventTestCompletionForReason const): Deleted. (WebCore::AsyncScrollingCoordinator::removeWheelEventTestCompletionDeferralForReason const): Deleted. * page/scrolling/AsyncScrollingCoordinator.h: * page/scrolling/ScrollingCoordinator.h: (WebCore::ScrollingCoordinator::startMonitoringWheelEvents): (WebCore::ScrollingCoordinator::stopMonitoringWheelEvents): * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::handleWheelEvent): * page/scrolling/ScrollingTree.h: (WebCore::ScrollingTree::setWheelEventTestMonitor): (WebCore::ScrollingTree::receivedWheelEvent): * page/scrolling/ThreadedScrollingTree.cpp: (WebCore::ThreadedScrollingTree::scrollingTreeNodeDidScroll): (WebCore::ThreadedScrollingTree::deferWheelEventTestCompletionForReason): Deleted. (WebCore::ThreadedScrollingTree::removeWheelEventTestCompletionDeferralForReason): Deleted. * page/scrolling/ThreadedScrollingTree.h: * page/scrolling/mac/ScrollingCoordinatorMac.h: * page/scrolling/mac/ScrollingCoordinatorMac.mm: (WebCore::ScrollingCoordinatorMac::startMonitoringWheelEvents): (WebCore::ScrollingCoordinatorMac::stopMonitoringWheelEvents): * page/scrolling/mac/ScrollingTreeMac.h: * page/scrolling/mac/ScrollingTreeMac.mm: (ScrollingTreeMac::setWheelEventTestMonitor): (ScrollingTreeMac::receivedWheelEvent): (ScrollingTreeMac::deferWheelEventTestCompletionForReason): (ScrollingTreeMac::removeWheelEventTestCompletionDeferralForReason): * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm: (WebCore::ScrollingTreeScrollingNodeDelegateMac::deferWheelEventTestCompletionForReason const): (WebCore::ScrollingTreeScrollingNodeDelegateMac::removeWheelEventTestCompletionDeferralForReason const): * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::setWheelEventMonitorTestCallbackAndStartMonitoring): (WebCoreTestSupport::setTestCallbackAndStartNotificationTimer): Deleted. * testing/js/WebCoreTestSupport.h: Source/WebKit: Deflake tests using eventSender.monitorWheelEvents() by fixing several causes of flakiness, adding back changes from r257844 that were reverted in r258558. First, have EventSendingController keep track of whether it's seen then "end" event for the scrolling and momentum phases, and pass this down to WheelEventTestMonitor, which now waits until it sees these, which prevents premature triggering which was a common cause of failure before. Second, remove WheelEventTestMonitor's 1/60s timer and instead have WheelEventTestMonitor test for completion in a callout from the end of Page::updateRendering(), which makes it test and fire at a more consistent time. Third, push WheelEventTestMonitor to the ScrollingTree, so that reasons for deferral can be added on the scrolling thread. This fixes an issue where the RunLoop::main().dispatch() used to send the "ScrollingThreadSyncNeeded" reason to the main thread would get delayed, also resulting in a premature trigger. * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageRegisterScrollOperationCompletionCallback): * WebProcess/InjectedBundle/API/c/WKBundlePage.h: Tools: Deflake tests using eventSender.monitorWheelEvents() by fixing several causes of flakiness, adding back changes from r257844 that were reverted in r258558. First, have EventSendingController keep track of whether it's seen then "end" event for the scrolling and momentum phases, and pass this down to WheelEventTestMonitor, which now waits until it sees these, which prevents premature triggering which was a common cause of failure before. Second, remove WheelEventTestMonitor's 1/60s timer and instead have WheelEventTestMonitor test for completion in a callout from the end of Page::updateRendering(), which makes it test and fire at a more consistent time. Third, push WheelEventTestMonitor to the ScrollingTree, so that reasons for deferral can be added on the scrolling thread. This fixes an issue where the RunLoop::main().dispatch() used to send the "ScrollingThreadSyncNeeded" reason to the main thread would get delayed, also resulting in a premature trigger. * DumpRenderTree/mac/EventSendingController.h: * DumpRenderTree/mac/EventSendingController.mm: (-[EventSendingController mouseScrollByX:andY:withWheel:andMomentumPhases:]): (-[EventSendingController monitorWheelEvents]): (-[EventSendingController callAfterScrollingCompletes:]): * DumpRenderTree/win/EventSender.cpp: (mouseScrollBy): * WebKitTestRunner/InjectedBundle/EventSendingController.cpp: (WTR::EventSendingController::mouseScrollByWithWheelAndMomentumPhases): (WTR::EventSendingController::monitorWheelEvents): (WTR::EventSendingController::callAfterScrollingCompletes): * WebKitTestRunner/InjectedBundle/EventSendingController.h: LayoutTests: * platform/mac-wk2/TestExpectations: * platform/win/TestExpectations: * tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-2d-overflow.html: Need to call eventSender.monitorWheelEvents() for each subtest. Canonical link: https://commits.webkit.org/222192@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@258679 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-03-19 04:06:37 +00:00
if (auto functionCallback = WTFMove(m_completionCallback)) {
LOG_WITH_STREAM(WheelEventTestMonitor, stream << " WheelEventTestMonitor::checkShouldFireCallbacks: scrolling is idle, FIRING TEST");
Rename WheelEventTestTrigger and improve naming in related code https://bugs.webkit.org/show_bug.cgi?id=202772 Reviewed by Tim Horton. Change the "test trigger" terminology to "monitor wheel events"; after all, tests call monitorWheelEvents() and callAfterScrollingCompletes(), and this is not triggering a test. Source/WebCore: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * page/FrameView.cpp: (WebCore::FrameView::adjustScrollbarsForLayout): (WebCore::FrameView::setScrollPosition): (WebCore::FrameView::didAddScrollbar): * page/Page.cpp: (WebCore::Page::ensureWheelEventTestMonitor): (WebCore::Page::ensureTestTrigger): Deleted. * page/Page.h: (WebCore::Page::wheelEventTestMonitor const): (WebCore::Page::clearWheelEventTestMonitor): (WebCore::Page::isMonitoringWheelEvents const): (WebCore::Page::testTrigger const): Deleted. (WebCore::Page::clearTrigger): Deleted. (WebCore::Page::expectsWheelEventTriggers const): Deleted. * page/WheelEventTestMonitor.cpp: Added. (WebCore::WheelEventTestMonitor::WheelEventTestMonitor): (WebCore::WheelEventTestMonitor::clearAllTestDeferrals): (WebCore::WheelEventTestMonitor::setTestCallbackAndStartNotificationTimer): (WebCore::WheelEventTestMonitor::deferForReason): (WebCore::WheelEventTestMonitor::removeDeferralForReason): (WebCore::WheelEventTestMonitor::triggerTestTimerFired): (WebCore::operator<<): * page/WheelEventTestMonitor.h: Renamed from Source/WebCore/page/WheelEventTestTrigger.h. * page/WheelEventTestTrigger.cpp: Removed. * page/mac/EventHandlerMac.mm: (WebCore::EventHandler::platformPrepareForWheelEvents): * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated): (WebCore::AsyncScrollingCoordinator::updateIsMonitoringWheelEventsForFrameView): (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll): (WebCore::AsyncScrollingCoordinator::deferWheelEventTestCompletionForReason const): (WebCore::AsyncScrollingCoordinator::removeWheelEventTestCompletionDeferralForReason const): (WebCore::AsyncScrollingCoordinator::updateExpectsWheelEventTestTriggerWithFrameView): Deleted. (WebCore::AsyncScrollingCoordinator::deferTestsForReason const): Deleted. (WebCore::AsyncScrollingCoordinator::removeTestDeferralForReason const): Deleted. * page/scrolling/AsyncScrollingCoordinator.h: * page/scrolling/ScrollingCoordinator.h: (WebCore::ScrollingCoordinator::updateIsMonitoringWheelEventsForFrameView): (WebCore::ScrollingCoordinator::updateExpectsWheelEventTestTriggerWithFrameView): Deleted. * page/scrolling/ScrollingStateScrollingNode.cpp: (WebCore::ScrollingStateScrollingNode::ScrollingStateScrollingNode): (WebCore::ScrollingStateScrollingNode::setPropertyChangedBitsAfterReattach): (WebCore::ScrollingStateScrollingNode::setIsMonitoringWheelEvents): (WebCore::ScrollingStateScrollingNode::dumpProperties const): (WebCore::ScrollingStateScrollingNode::setExpectsWheelEventTestTrigger): Deleted. * page/scrolling/ScrollingStateScrollingNode.h: (WebCore::ScrollingStateScrollingNode::isMonitoringWheelEvents const): (WebCore::ScrollingStateScrollingNode::expectsWheelEventTestTrigger const): Deleted. * page/scrolling/ScrollingTree.h: (WebCore::ScrollingTree::deferWheelEventTestCompletionForReason): (WebCore::ScrollingTree::removeWheelEventTestCompletionDeferralForReason): (WebCore::ScrollingTree::deferTestsForReason): Deleted. (WebCore::ScrollingTree::removeTestDeferralForReason): Deleted. * page/scrolling/ScrollingTreeScrollingNode.cpp: (WebCore::ScrollingTreeScrollingNode::commitStateBeforeChildren): * page/scrolling/ScrollingTreeScrollingNode.h: * page/scrolling/ThreadedScrollingTree.cpp: (WebCore::ThreadedScrollingTree::deferWheelEventTestCompletionForReason): (WebCore::ThreadedScrollingTree::removeWheelEventTestCompletionDeferralForReason): (WebCore::ThreadedScrollingTree::deferTestsForReason): Deleted. (WebCore::ThreadedScrollingTree::removeTestDeferralForReason): Deleted. * page/scrolling/ThreadedScrollingTree.h: * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h: * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm: (WebCore::ScrollingTreeScrollingNodeDelegateMac::handleWheelEvent): (WebCore::ScrollingTreeScrollingNodeDelegateMac::deferWheelEventTestCompletionForReason const): (WebCore::ScrollingTreeScrollingNodeDelegateMac::removeWheelEventTestCompletionDeferralForReason const): (WebCore::ScrollingTreeScrollingNodeDelegateMac::deferTestsForReason const): Deleted. (WebCore::ScrollingTreeScrollingNodeDelegateMac::removeTestDeferralForReason const): Deleted. * platform/Logging.h: * platform/ScrollAnimator.cpp: (WebCore::ScrollAnimator::deferWheelEventTestCompletionForReason const): (WebCore::ScrollAnimator::removeWheelEventTestCompletionDeferralForReason const): (WebCore::ScrollAnimator::deferTestsForReason const): Deleted. (WebCore::ScrollAnimator::removeTestDeferralForReason const): Deleted. * platform/ScrollAnimator.h: (WebCore::ScrollAnimator::ScrollAnimator::setWheelEventTestMonitor): (WebCore::ScrollAnimator::ScrollAnimator::setWheelEventTestTrigger): Deleted. * platform/cocoa/ScrollController.h: (WebCore::ScrollControllerClient::deferWheelEventTestCompletionForReason const): (WebCore::ScrollControllerClient::removeWheelEventTestCompletionDeferralForReason const): (WebCore::ScrollControllerClient::deferTestsForReason const): Deleted. (WebCore::ScrollControllerClient::removeTestDeferralForReason const): Deleted. * platform/cocoa/ScrollController.mm: (WebCore::ScrollController::startSnapRubberbandTimer): (WebCore::ScrollController::stopSnapRubberbandTimer): (WebCore::ScrollController::scheduleStatelessScrollSnap): (WebCore::ScrollController::startDeferringWheelEventTestCompletionDueToScrollSnapping): (WebCore::ScrollController::stopDeferringWheelEventTestCompletionDueToScrollSnapping): (WebCore::ScrollController::startScrollSnapTimer): (WebCore::ScrollController::stopScrollSnapTimer): (WebCore::ScrollController::startDeferringTestsDueToScrollSnapping): Deleted. (WebCore::ScrollController::stopDeferringTestsDueToScrollSnapping): Deleted. * platform/mac/ScrollAnimatorMac.mm: (WebCore::ScrollAnimatorMac::didBeginScrollGesture const): (WebCore::ScrollAnimatorMac::didEndScrollGesture const): (WebCore::ScrollAnimatorMac::sendContentAreaScrolledSoon): (WebCore::ScrollAnimatorMac::sendContentAreaScrolledTimerFired): * rendering/RenderBox.cpp: (WebCore::setupWheelEventMonitor): (WebCore::RenderBox::setScrollLeft): (WebCore::RenderBox::setScrollTop): (WebCore::setupWheelEventTestTrigger): Deleted. * rendering/RenderLayer.cpp: (WebCore::RenderLayer::createScrollbar): * rendering/RenderListBox.cpp: (WebCore::setupWheelEventTestMonitor): (WebCore::RenderListBox::setScrollTop): (WebCore::RenderListBox::createScrollbar): (WebCore::setupWheelEventTestTrigger): Deleted. * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::monitorWheelEvents): (WebCoreTestSupport::setTestCallbackAndStartNotificationTimer): (WebCoreTestSupport::clearWheelEventTestMonitor): (WebCoreTestSupport::clearWheelEventTestTrigger): Deleted. * testing/js/WebCoreTestSupport.h: Source/WebKit: * UIProcess/API/C/WKPage.cpp: (WKPageClearWheelEventTestMonitor): (WKPageClearWheelEventTestTrigger): Deleted. * UIProcess/API/C/WKPage.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::clearWheelEventTestMonitor): (WebKit::WebPageProxy::clearWheelEventTestTrigger): Deleted. * UIProcess/WebPageProxy.h: * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageStartMonitoringScrollOperations): (WKBundlePageRegisterScrollOperationCompletionCallback): * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::createScrollbar): * WebProcess/WebPage/EventDispatcher.cpp: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::clearWheelEventTestMonitor): (WebKit::WebPage::clearWheelEventTestTrigger): Deleted. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: Tools: * DumpRenderTree/mac/DumpRenderTree.mm: (resetWebViewToConsistentStateBeforeTesting): * WebKitTestRunner/TestController.cpp: (WTR::TestController::resetStateToConsistentValues): Canonical link: https://commits.webkit.org/216237@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@250946 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-10-10 00:24:44 +00:00
functionCallback();
eventSender.monitorWheelEvents() is very fragile https://bugs.webkit.org/show_bug.cgi?id=197819 <rdar://problem/51319456> Reviewed by Tim Horton. Source/WebCore: Deflake tests using eventSender.monitorWheelEvents() by fixing several causes of flakiness, adding back changes from r257844 that were reverted in r258558. First, have EventSendingController keep track of whether it's seen then "end" event for the scrolling and momentum phases, and pass this down to WheelEventTestMonitor, which now waits until it sees these, which prevents premature triggering which was a common cause of failure before. Second, remove WheelEventTestMonitor's 1/60s timer and instead have WheelEventTestMonitor test for completion in a callout from the end of Page::updateRendering(), which makes it test and fire at a more consistent time. Third, push WheelEventTestMonitor to the ScrollingTree, so that reasons for deferral can be added on the scrolling thread. This fixes an issue where the RunLoop::main().dispatch() used to send the "ScrollingThreadSyncNeeded" reason to the main thread would get delayed, also resulting in a premature trigger. * Modules/applepay/ApplePaySession.cpp: Unified sources! * dom/WindowEventLoop.cpp: Unified sources! * page/EventHandler.cpp: (WebCore::EventHandler::handleWheelEvent): * page/FrameView.cpp: (WebCore::FrameView::scrollOffsetChangedViaPlatformWidgetImpl): * page/Page.cpp: (WebCore::Page::doAfterUpdateRendering): (WebCore::Page::wheelEventTestMonitor const): (WebCore::Page::clearWheelEventTestMonitor): (WebCore::Page::isMonitoringWheelEvents const): (WebCore::Page::ensureWheelEventTestMonitor): * page/Page.h: (WebCore::Page::wheelEventTestMonitor const): Deleted. (WebCore::Page::clearWheelEventTestMonitor): Deleted. (WebCore::Page::isMonitoringWheelEvents const): Deleted. * page/WheelEventTestMonitor.cpp: (WebCore::WheelEventTestMonitor::WheelEventTestMonitor): (WebCore::WheelEventTestMonitor::clearAllTestDeferrals): (WebCore::WheelEventTestMonitor::setTestCallbackAndStartMonitoring): (WebCore::WheelEventTestMonitor::deferForReason): (WebCore::WheelEventTestMonitor::removeDeferralForReason): (WebCore::WheelEventTestMonitor::receivedWheelEvent): (WebCore::WheelEventTestMonitor::scheduleCallbackCheck): (WebCore::WheelEventTestMonitor::checkShouldFireCallbacks): (WebCore::operator<<): (WebCore::WheelEventTestMonitor::setTestCallbackAndStartNotificationTimer): Deleted. (WebCore::WheelEventTestMonitor::triggerTestTimerFired): Deleted. * page/WheelEventTestMonitor.h: (WebCore::WheelEventTestMonitorCompletionDeferrer::WheelEventTestMonitorCompletionDeferrer): (WebCore::WheelEventTestMonitorCompletionDeferrer::~WheelEventTestMonitorCompletionDeferrer): * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated): (WebCore::AsyncScrollingCoordinator::deferWheelEventTestCompletionForReason const): Deleted. (WebCore::AsyncScrollingCoordinator::removeWheelEventTestCompletionDeferralForReason const): Deleted. * page/scrolling/AsyncScrollingCoordinator.h: * page/scrolling/ScrollingCoordinator.h: (WebCore::ScrollingCoordinator::startMonitoringWheelEvents): (WebCore::ScrollingCoordinator::stopMonitoringWheelEvents): * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::handleWheelEvent): * page/scrolling/ScrollingTree.h: (WebCore::ScrollingTree::setWheelEventTestMonitor): (WebCore::ScrollingTree::receivedWheelEvent): * page/scrolling/ThreadedScrollingTree.cpp: (WebCore::ThreadedScrollingTree::scrollingTreeNodeDidScroll): (WebCore::ThreadedScrollingTree::deferWheelEventTestCompletionForReason): Deleted. (WebCore::ThreadedScrollingTree::removeWheelEventTestCompletionDeferralForReason): Deleted. * page/scrolling/ThreadedScrollingTree.h: * page/scrolling/mac/ScrollingCoordinatorMac.h: * page/scrolling/mac/ScrollingCoordinatorMac.mm: (WebCore::ScrollingCoordinatorMac::startMonitoringWheelEvents): (WebCore::ScrollingCoordinatorMac::stopMonitoringWheelEvents): * page/scrolling/mac/ScrollingTreeMac.h: * page/scrolling/mac/ScrollingTreeMac.mm: (ScrollingTreeMac::setWheelEventTestMonitor): (ScrollingTreeMac::receivedWheelEvent): (ScrollingTreeMac::deferWheelEventTestCompletionForReason): (ScrollingTreeMac::removeWheelEventTestCompletionDeferralForReason): * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm: (WebCore::ScrollingTreeScrollingNodeDelegateMac::deferWheelEventTestCompletionForReason const): (WebCore::ScrollingTreeScrollingNodeDelegateMac::removeWheelEventTestCompletionDeferralForReason const): * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::setWheelEventMonitorTestCallbackAndStartMonitoring): (WebCoreTestSupport::setTestCallbackAndStartNotificationTimer): Deleted. * testing/js/WebCoreTestSupport.h: Source/WebKit: Deflake tests using eventSender.monitorWheelEvents() by fixing several causes of flakiness, adding back changes from r257844 that were reverted in r258558. First, have EventSendingController keep track of whether it's seen then "end" event for the scrolling and momentum phases, and pass this down to WheelEventTestMonitor, which now waits until it sees these, which prevents premature triggering which was a common cause of failure before. Second, remove WheelEventTestMonitor's 1/60s timer and instead have WheelEventTestMonitor test for completion in a callout from the end of Page::updateRendering(), which makes it test and fire at a more consistent time. Third, push WheelEventTestMonitor to the ScrollingTree, so that reasons for deferral can be added on the scrolling thread. This fixes an issue where the RunLoop::main().dispatch() used to send the "ScrollingThreadSyncNeeded" reason to the main thread would get delayed, also resulting in a premature trigger. * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageRegisterScrollOperationCompletionCallback): * WebProcess/InjectedBundle/API/c/WKBundlePage.h: Tools: Deflake tests using eventSender.monitorWheelEvents() by fixing several causes of flakiness, adding back changes from r257844 that were reverted in r258558. First, have EventSendingController keep track of whether it's seen then "end" event for the scrolling and momentum phases, and pass this down to WheelEventTestMonitor, which now waits until it sees these, which prevents premature triggering which was a common cause of failure before. Second, remove WheelEventTestMonitor's 1/60s timer and instead have WheelEventTestMonitor test for completion in a callout from the end of Page::updateRendering(), which makes it test and fire at a more consistent time. Third, push WheelEventTestMonitor to the ScrollingTree, so that reasons for deferral can be added on the scrolling thread. This fixes an issue where the RunLoop::main().dispatch() used to send the "ScrollingThreadSyncNeeded" reason to the main thread would get delayed, also resulting in a premature trigger. * DumpRenderTree/mac/EventSendingController.h: * DumpRenderTree/mac/EventSendingController.mm: (-[EventSendingController mouseScrollByX:andY:withWheel:andMomentumPhases:]): (-[EventSendingController monitorWheelEvents]): (-[EventSendingController callAfterScrollingCompletes:]): * DumpRenderTree/win/EventSender.cpp: (mouseScrollBy): * WebKitTestRunner/InjectedBundle/EventSendingController.cpp: (WTR::EventSendingController::mouseScrollByWithWheelAndMomentumPhases): (WTR::EventSendingController::monitorWheelEvents): (WTR::EventSendingController::callAfterScrollingCompletes): * WebKitTestRunner/InjectedBundle/EventSendingController.h: LayoutTests: * platform/mac-wk2/TestExpectations: * platform/win/TestExpectations: * tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-2d-overflow.html: Need to call eventSender.monitorWheelEvents() for each subtest. Canonical link: https://commits.webkit.org/222192@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@258679 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-03-19 04:06:37 +00:00
} else
LOG_WITH_STREAM(WheelEventTestMonitor, stream << " WheelEventTestMonitor::checkShouldFireCallbacks - no callback");
Rename WheelEventTestTrigger and improve naming in related code https://bugs.webkit.org/show_bug.cgi?id=202772 Reviewed by Tim Horton. Change the "test trigger" terminology to "monitor wheel events"; after all, tests call monitorWheelEvents() and callAfterScrollingCompletes(), and this is not triggering a test. Source/WebCore: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * page/FrameView.cpp: (WebCore::FrameView::adjustScrollbarsForLayout): (WebCore::FrameView::setScrollPosition): (WebCore::FrameView::didAddScrollbar): * page/Page.cpp: (WebCore::Page::ensureWheelEventTestMonitor): (WebCore::Page::ensureTestTrigger): Deleted. * page/Page.h: (WebCore::Page::wheelEventTestMonitor const): (WebCore::Page::clearWheelEventTestMonitor): (WebCore::Page::isMonitoringWheelEvents const): (WebCore::Page::testTrigger const): Deleted. (WebCore::Page::clearTrigger): Deleted. (WebCore::Page::expectsWheelEventTriggers const): Deleted. * page/WheelEventTestMonitor.cpp: Added. (WebCore::WheelEventTestMonitor::WheelEventTestMonitor): (WebCore::WheelEventTestMonitor::clearAllTestDeferrals): (WebCore::WheelEventTestMonitor::setTestCallbackAndStartNotificationTimer): (WebCore::WheelEventTestMonitor::deferForReason): (WebCore::WheelEventTestMonitor::removeDeferralForReason): (WebCore::WheelEventTestMonitor::triggerTestTimerFired): (WebCore::operator<<): * page/WheelEventTestMonitor.h: Renamed from Source/WebCore/page/WheelEventTestTrigger.h. * page/WheelEventTestTrigger.cpp: Removed. * page/mac/EventHandlerMac.mm: (WebCore::EventHandler::platformPrepareForWheelEvents): * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated): (WebCore::AsyncScrollingCoordinator::updateIsMonitoringWheelEventsForFrameView): (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll): (WebCore::AsyncScrollingCoordinator::deferWheelEventTestCompletionForReason const): (WebCore::AsyncScrollingCoordinator::removeWheelEventTestCompletionDeferralForReason const): (WebCore::AsyncScrollingCoordinator::updateExpectsWheelEventTestTriggerWithFrameView): Deleted. (WebCore::AsyncScrollingCoordinator::deferTestsForReason const): Deleted. (WebCore::AsyncScrollingCoordinator::removeTestDeferralForReason const): Deleted. * page/scrolling/AsyncScrollingCoordinator.h: * page/scrolling/ScrollingCoordinator.h: (WebCore::ScrollingCoordinator::updateIsMonitoringWheelEventsForFrameView): (WebCore::ScrollingCoordinator::updateExpectsWheelEventTestTriggerWithFrameView): Deleted. * page/scrolling/ScrollingStateScrollingNode.cpp: (WebCore::ScrollingStateScrollingNode::ScrollingStateScrollingNode): (WebCore::ScrollingStateScrollingNode::setPropertyChangedBitsAfterReattach): (WebCore::ScrollingStateScrollingNode::setIsMonitoringWheelEvents): (WebCore::ScrollingStateScrollingNode::dumpProperties const): (WebCore::ScrollingStateScrollingNode::setExpectsWheelEventTestTrigger): Deleted. * page/scrolling/ScrollingStateScrollingNode.h: (WebCore::ScrollingStateScrollingNode::isMonitoringWheelEvents const): (WebCore::ScrollingStateScrollingNode::expectsWheelEventTestTrigger const): Deleted. * page/scrolling/ScrollingTree.h: (WebCore::ScrollingTree::deferWheelEventTestCompletionForReason): (WebCore::ScrollingTree::removeWheelEventTestCompletionDeferralForReason): (WebCore::ScrollingTree::deferTestsForReason): Deleted. (WebCore::ScrollingTree::removeTestDeferralForReason): Deleted. * page/scrolling/ScrollingTreeScrollingNode.cpp: (WebCore::ScrollingTreeScrollingNode::commitStateBeforeChildren): * page/scrolling/ScrollingTreeScrollingNode.h: * page/scrolling/ThreadedScrollingTree.cpp: (WebCore::ThreadedScrollingTree::deferWheelEventTestCompletionForReason): (WebCore::ThreadedScrollingTree::removeWheelEventTestCompletionDeferralForReason): (WebCore::ThreadedScrollingTree::deferTestsForReason): Deleted. (WebCore::ThreadedScrollingTree::removeTestDeferralForReason): Deleted. * page/scrolling/ThreadedScrollingTree.h: * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h: * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm: (WebCore::ScrollingTreeScrollingNodeDelegateMac::handleWheelEvent): (WebCore::ScrollingTreeScrollingNodeDelegateMac::deferWheelEventTestCompletionForReason const): (WebCore::ScrollingTreeScrollingNodeDelegateMac::removeWheelEventTestCompletionDeferralForReason const): (WebCore::ScrollingTreeScrollingNodeDelegateMac::deferTestsForReason const): Deleted. (WebCore::ScrollingTreeScrollingNodeDelegateMac::removeTestDeferralForReason const): Deleted. * platform/Logging.h: * platform/ScrollAnimator.cpp: (WebCore::ScrollAnimator::deferWheelEventTestCompletionForReason const): (WebCore::ScrollAnimator::removeWheelEventTestCompletionDeferralForReason const): (WebCore::ScrollAnimator::deferTestsForReason const): Deleted. (WebCore::ScrollAnimator::removeTestDeferralForReason const): Deleted. * platform/ScrollAnimator.h: (WebCore::ScrollAnimator::ScrollAnimator::setWheelEventTestMonitor): (WebCore::ScrollAnimator::ScrollAnimator::setWheelEventTestTrigger): Deleted. * platform/cocoa/ScrollController.h: (WebCore::ScrollControllerClient::deferWheelEventTestCompletionForReason const): (WebCore::ScrollControllerClient::removeWheelEventTestCompletionDeferralForReason const): (WebCore::ScrollControllerClient::deferTestsForReason const): Deleted. (WebCore::ScrollControllerClient::removeTestDeferralForReason const): Deleted. * platform/cocoa/ScrollController.mm: (WebCore::ScrollController::startSnapRubberbandTimer): (WebCore::ScrollController::stopSnapRubberbandTimer): (WebCore::ScrollController::scheduleStatelessScrollSnap): (WebCore::ScrollController::startDeferringWheelEventTestCompletionDueToScrollSnapping): (WebCore::ScrollController::stopDeferringWheelEventTestCompletionDueToScrollSnapping): (WebCore::ScrollController::startScrollSnapTimer): (WebCore::ScrollController::stopScrollSnapTimer): (WebCore::ScrollController::startDeferringTestsDueToScrollSnapping): Deleted. (WebCore::ScrollController::stopDeferringTestsDueToScrollSnapping): Deleted. * platform/mac/ScrollAnimatorMac.mm: (WebCore::ScrollAnimatorMac::didBeginScrollGesture const): (WebCore::ScrollAnimatorMac::didEndScrollGesture const): (WebCore::ScrollAnimatorMac::sendContentAreaScrolledSoon): (WebCore::ScrollAnimatorMac::sendContentAreaScrolledTimerFired): * rendering/RenderBox.cpp: (WebCore::setupWheelEventMonitor): (WebCore::RenderBox::setScrollLeft): (WebCore::RenderBox::setScrollTop): (WebCore::setupWheelEventTestTrigger): Deleted. * rendering/RenderLayer.cpp: (WebCore::RenderLayer::createScrollbar): * rendering/RenderListBox.cpp: (WebCore::setupWheelEventTestMonitor): (WebCore::RenderListBox::setScrollTop): (WebCore::RenderListBox::createScrollbar): (WebCore::setupWheelEventTestTrigger): Deleted. * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::monitorWheelEvents): (WebCoreTestSupport::setTestCallbackAndStartNotificationTimer): (WebCoreTestSupport::clearWheelEventTestMonitor): (WebCoreTestSupport::clearWheelEventTestTrigger): Deleted. * testing/js/WebCoreTestSupport.h: Source/WebKit: * UIProcess/API/C/WKPage.cpp: (WKPageClearWheelEventTestMonitor): (WKPageClearWheelEventTestTrigger): Deleted. * UIProcess/API/C/WKPage.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::clearWheelEventTestMonitor): (WebKit::WebPageProxy::clearWheelEventTestTrigger): Deleted. * UIProcess/WebPageProxy.h: * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageStartMonitoringScrollOperations): (WKBundlePageRegisterScrollOperationCompletionCallback): * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::createScrollbar): * WebProcess/WebPage/EventDispatcher.cpp: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::clearWheelEventTestMonitor): (WebKit::WebPage::clearWheelEventTestTrigger): Deleted. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: Tools: * DumpRenderTree/mac/DumpRenderTree.mm: (resetWebViewToConsistentStateBeforeTesting): * WebKitTestRunner/TestController.cpp: (WTR::TestController::resetStateToConsistentValues): Canonical link: https://commits.webkit.org/216237@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@250946 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-10-10 00:24:44 +00:00
}
TextStream& operator<<(TextStream& ts, WheelEventTestMonitor::DeferReason reason)
{
switch (reason) {
[ Mojave+ ] Layout Test compositing/fixed-with-main-thread-scrolling.html is a flaky timeout https://bugs.webkit.org/show_bug.cgi?id=198757 Reviewed by Tim Horton. Source/WebCore: WheelEventTestMonitor depends on "deferral reasons" getting added and removed, such that there is always at least one reason active until scrolling quiesces. WheelEventTestMonitor made the incorrect assumption that every call into ScrollingTreeScrollingNodeDelegateMac::handleWheelEvent() would result in a scroll change making it to the main thread, so it would defer "ScrollingThreadSyncNeeded" there, and rely on AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll() to remove that deferral reason. That assumption is wrong, because wheel events may coalesce, or have no impact on scroll position if already scrolled to the max/min extent (e.g. when rubber banding). Fix by adding a new "HandlingWheelEvent" deferral reason for the duration that the scrolling thread is processing an wheel event, and then having ScrollingThreadSyncNeeded just represent the phase where any resulting scroll is being sent to the UI process. These phases should always overlap. This required moving isMonitoringWheelEvents() from the root scrolling node to the ScrollingTree. * page/WheelEventTestMonitor.cpp: (WebCore::operator<<): * page/WheelEventTestMonitor.h: * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll): * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::commitTreeState): * page/scrolling/ScrollingTree.h: (WebCore::ScrollingTree::isMonitoringWheelEvents const): * page/scrolling/ScrollingTreeScrollingNode.cpp: (WebCore::ScrollingTreeScrollingNode::commitStateBeforeChildren): * page/scrolling/ScrollingTreeScrollingNode.h: * page/scrolling/ThreadedScrollingTree.cpp: (WebCore::ThreadedScrollingTree::scrollingTreeNodeDidScroll): * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm: (WebCore::ScrollingTreeScrollingNodeDelegateMac::handleWheelEvent): (WebCore::ScrollingTreeScrollingNodeDelegateMac::deferWheelEventTestCompletionForReason const): (WebCore::ScrollingTreeScrollingNodeDelegateMac::removeWheelEventTestCompletionDeferralForReason const): LayoutTests: Remove expectation for compositing/fixed-with-main-thread-scrolling.html. * platform/mac-wk2/TestExpectations: Canonical link: https://commits.webkit.org/216528@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@251262 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-10-17 22:15:09 +00:00
case WheelEventTestMonitor::HandlingWheelEvent: ts << "handling wheel event"; break;
eventSender.monitorWheelEvents() is very fragile https://bugs.webkit.org/show_bug.cgi?id=197819 <rdar://problem/51319456> Reviewed by Tim Horton. Source/WebCore: Deflake tests using eventSender.monitorWheelEvents() by fixing several causes of flakiness, adding back changes from r257844 that were reverted in r258558. First, have EventSendingController keep track of whether it's seen then "end" event for the scrolling and momentum phases, and pass this down to WheelEventTestMonitor, which now waits until it sees these, which prevents premature triggering which was a common cause of failure before. Second, remove WheelEventTestMonitor's 1/60s timer and instead have WheelEventTestMonitor test for completion in a callout from the end of Page::updateRendering(), which makes it test and fire at a more consistent time. Third, push WheelEventTestMonitor to the ScrollingTree, so that reasons for deferral can be added on the scrolling thread. This fixes an issue where the RunLoop::main().dispatch() used to send the "ScrollingThreadSyncNeeded" reason to the main thread would get delayed, also resulting in a premature trigger. * Modules/applepay/ApplePaySession.cpp: Unified sources! * dom/WindowEventLoop.cpp: Unified sources! * page/EventHandler.cpp: (WebCore::EventHandler::handleWheelEvent): * page/FrameView.cpp: (WebCore::FrameView::scrollOffsetChangedViaPlatformWidgetImpl): * page/Page.cpp: (WebCore::Page::doAfterUpdateRendering): (WebCore::Page::wheelEventTestMonitor const): (WebCore::Page::clearWheelEventTestMonitor): (WebCore::Page::isMonitoringWheelEvents const): (WebCore::Page::ensureWheelEventTestMonitor): * page/Page.h: (WebCore::Page::wheelEventTestMonitor const): Deleted. (WebCore::Page::clearWheelEventTestMonitor): Deleted. (WebCore::Page::isMonitoringWheelEvents const): Deleted. * page/WheelEventTestMonitor.cpp: (WebCore::WheelEventTestMonitor::WheelEventTestMonitor): (WebCore::WheelEventTestMonitor::clearAllTestDeferrals): (WebCore::WheelEventTestMonitor::setTestCallbackAndStartMonitoring): (WebCore::WheelEventTestMonitor::deferForReason): (WebCore::WheelEventTestMonitor::removeDeferralForReason): (WebCore::WheelEventTestMonitor::receivedWheelEvent): (WebCore::WheelEventTestMonitor::scheduleCallbackCheck): (WebCore::WheelEventTestMonitor::checkShouldFireCallbacks): (WebCore::operator<<): (WebCore::WheelEventTestMonitor::setTestCallbackAndStartNotificationTimer): Deleted. (WebCore::WheelEventTestMonitor::triggerTestTimerFired): Deleted. * page/WheelEventTestMonitor.h: (WebCore::WheelEventTestMonitorCompletionDeferrer::WheelEventTestMonitorCompletionDeferrer): (WebCore::WheelEventTestMonitorCompletionDeferrer::~WheelEventTestMonitorCompletionDeferrer): * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated): (WebCore::AsyncScrollingCoordinator::deferWheelEventTestCompletionForReason const): Deleted. (WebCore::AsyncScrollingCoordinator::removeWheelEventTestCompletionDeferralForReason const): Deleted. * page/scrolling/AsyncScrollingCoordinator.h: * page/scrolling/ScrollingCoordinator.h: (WebCore::ScrollingCoordinator::startMonitoringWheelEvents): (WebCore::ScrollingCoordinator::stopMonitoringWheelEvents): * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::handleWheelEvent): * page/scrolling/ScrollingTree.h: (WebCore::ScrollingTree::setWheelEventTestMonitor): (WebCore::ScrollingTree::receivedWheelEvent): * page/scrolling/ThreadedScrollingTree.cpp: (WebCore::ThreadedScrollingTree::scrollingTreeNodeDidScroll): (WebCore::ThreadedScrollingTree::deferWheelEventTestCompletionForReason): Deleted. (WebCore::ThreadedScrollingTree::removeWheelEventTestCompletionDeferralForReason): Deleted. * page/scrolling/ThreadedScrollingTree.h: * page/scrolling/mac/ScrollingCoordinatorMac.h: * page/scrolling/mac/ScrollingCoordinatorMac.mm: (WebCore::ScrollingCoordinatorMac::startMonitoringWheelEvents): (WebCore::ScrollingCoordinatorMac::stopMonitoringWheelEvents): * page/scrolling/mac/ScrollingTreeMac.h: * page/scrolling/mac/ScrollingTreeMac.mm: (ScrollingTreeMac::setWheelEventTestMonitor): (ScrollingTreeMac::receivedWheelEvent): (ScrollingTreeMac::deferWheelEventTestCompletionForReason): (ScrollingTreeMac::removeWheelEventTestCompletionDeferralForReason): * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm: (WebCore::ScrollingTreeScrollingNodeDelegateMac::deferWheelEventTestCompletionForReason const): (WebCore::ScrollingTreeScrollingNodeDelegateMac::removeWheelEventTestCompletionDeferralForReason const): * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::setWheelEventMonitorTestCallbackAndStartMonitoring): (WebCoreTestSupport::setTestCallbackAndStartNotificationTimer): Deleted. * testing/js/WebCoreTestSupport.h: Source/WebKit: Deflake tests using eventSender.monitorWheelEvents() by fixing several causes of flakiness, adding back changes from r257844 that were reverted in r258558. First, have EventSendingController keep track of whether it's seen then "end" event for the scrolling and momentum phases, and pass this down to WheelEventTestMonitor, which now waits until it sees these, which prevents premature triggering which was a common cause of failure before. Second, remove WheelEventTestMonitor's 1/60s timer and instead have WheelEventTestMonitor test for completion in a callout from the end of Page::updateRendering(), which makes it test and fire at a more consistent time. Third, push WheelEventTestMonitor to the ScrollingTree, so that reasons for deferral can be added on the scrolling thread. This fixes an issue where the RunLoop::main().dispatch() used to send the "ScrollingThreadSyncNeeded" reason to the main thread would get delayed, also resulting in a premature trigger. * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageRegisterScrollOperationCompletionCallback): * WebProcess/InjectedBundle/API/c/WKBundlePage.h: Tools: Deflake tests using eventSender.monitorWheelEvents() by fixing several causes of flakiness, adding back changes from r257844 that were reverted in r258558. First, have EventSendingController keep track of whether it's seen then "end" event for the scrolling and momentum phases, and pass this down to WheelEventTestMonitor, which now waits until it sees these, which prevents premature triggering which was a common cause of failure before. Second, remove WheelEventTestMonitor's 1/60s timer and instead have WheelEventTestMonitor test for completion in a callout from the end of Page::updateRendering(), which makes it test and fire at a more consistent time. Third, push WheelEventTestMonitor to the ScrollingTree, so that reasons for deferral can be added on the scrolling thread. This fixes an issue where the RunLoop::main().dispatch() used to send the "ScrollingThreadSyncNeeded" reason to the main thread would get delayed, also resulting in a premature trigger. * DumpRenderTree/mac/EventSendingController.h: * DumpRenderTree/mac/EventSendingController.mm: (-[EventSendingController mouseScrollByX:andY:withWheel:andMomentumPhases:]): (-[EventSendingController monitorWheelEvents]): (-[EventSendingController callAfterScrollingCompletes:]): * DumpRenderTree/win/EventSender.cpp: (mouseScrollBy): * WebKitTestRunner/InjectedBundle/EventSendingController.cpp: (WTR::EventSendingController::mouseScrollByWithWheelAndMomentumPhases): (WTR::EventSendingController::monitorWheelEvents): (WTR::EventSendingController::callAfterScrollingCompletes): * WebKitTestRunner/InjectedBundle/EventSendingController.h: LayoutTests: * platform/mac-wk2/TestExpectations: * platform/win/TestExpectations: * tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-2d-overflow.html: Need to call eventSender.monitorWheelEvents() for each subtest. Canonical link: https://commits.webkit.org/222192@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@258679 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-03-19 04:06:37 +00:00
case WheelEventTestMonitor::HandlingWheelEventOnMainThread: ts << "handling wheel event on main thread"; break;
Only the first wheel event in a gesture should be cancelable https://bugs.webkit.org/show_bug.cgi?id=218764 <rdar://problem/71248946> Reviewed by Tim Horton. Source/WebCore: Implement the WebKit2 version of r270312, where only the first wheel event in a gesture is cancelable. When scrolling over an element with handlers, we do event handling on the main thread, so we can take the compute value of EventHandler's Optional<WheelScrollGestureState> from the first event and send it back to the scrolling thread. However, the scrolling thread needs to block until this first event comes back from the main thread. To achieve this, EventDispatcher::wheelEvent() now dispaches main thread scrolls from the scrolling thread (not the dispatcher thread), and waits on m_waitingForBeganEventCondition with a 50ms timeout for that first event to come back. In the normal case, main thread handling dispatches the event back to the scrolling thread for scrolling via handleWheelEventAfterMainThread(), and then calls wheelEventWasProcessedByMainThread() to signal the condition. If for some reason handleWheelEventAfterMainThread() doesn't get called (e.g. nothing was scrollable), then wheelEventWasProcessedByMainThread() still gets called to signal. If m_waitingForBeganEventCondition times out, then the scrolling thread falls back to non-blocking behaviour (as if the first event was not canceled). Finally, when we know the gesture will become non-blocking, we transition to running the scroll from the scrolling thread, which requires that we set up latching, hence the changes in ScrollingTreeLatchingController. Tested by existing tests in fast/events/wheel. * page/EventHandler.cpp: (WebCore::EventHandler::wheelEventWasProcessedByMainThread): (WebCore::EventHandler::handleWheelEventInScrollableArea): * page/WheelEventTestMonitor.cpp: (WebCore::operator<<): * page/WheelEventTestMonitor.h: * page/mac/EventHandlerMac.mm: (WebCore::EventHandler::processWheelEventForScrolling): * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::determineWheelEventProcessing): (WebCore::ScrollingTree::setGestureState): (WebCore::ScrollingTree::gestureState): * page/scrolling/ScrollingTree.h: (WebCore::ScrollingTree::willSendEventToMainThread): (WebCore::ScrollingTree::waitForEventToBeProcessedByMainThread): * page/scrolling/ScrollingTreeLatchingController.cpp: (WebCore::ScrollingTreeLatchingController::receivedWheelEvent): (WebCore::ScrollingTreeLatchingController::nodeDidHandleEvent): * page/scrolling/ScrollingTreeLatchingController.h: * page/scrolling/ThreadedScrollingTree.cpp: (WebCore::ThreadedScrollingTree::handleWheelEventAfterMainThread): (WebCore::ThreadedScrollingTree::wheelEventWasProcessedByMainThread): (WebCore::ThreadedScrollingTree::willSendEventToMainThread): (WebCore::ThreadedScrollingTree::waitForEventToBeProcessedByMainThread): * page/scrolling/ThreadedScrollingTree.h: * page/scrolling/mac/ScrollingCoordinatorMac.mm: (WebCore::ScrollingCoordinatorMac::handleWheelEventForScrolling): Need to track deferral for WheelEventTestMonitor. (WebCore::ScrollingCoordinatorMac::wheelEventWasProcessedByMainThread): This is now synchronous to the scrolling thread so no need for the deferrer. (WebCore::nextDeferIdentifier): Deleted. * page/scrolling/nicosia/ScrollingCoordinatorNicosia.cpp: (WebCore::ScrollingCoordinatorNicosia::wheelEventWasProcessedByMainThread): * platform/cocoa/ScrollController.mm: (WebCore::ScrollController::handleWheelEvent): Source/WebKit: In EventDispatcher::wheelEvent(), all wheel events now bounce through the scrolling thread, even those destined for main thread scrolling. This allows the scrolling thread to wait on a condition for the event to come back to the scrolling thread via handleWheelEventAfterMainThread(), since we have to know whether content called preventDefault() on the first event before sending subsequent events. * WebProcess/WebPage/EventDispatcher.cpp: (WebKit::EventDispatcher::wheelEvent): LayoutTests: * fast/scrolling/mac/rubberband-overflow-in-wheel-region-root-jiggle.html: Make more robust. * platform/mac-wk2/fast/events/wheel/wheel-events-become-non-cancelable-expected.txt: Test now passes in WK2. Canonical link: https://commits.webkit.org/232108@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@270425 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-12-04 07:10:03 +00:00
case WheelEventTestMonitor::PostMainThreadWheelEventHandling: ts << "post-main thread event handling"; break;
Rename WheelEventTestTrigger and improve naming in related code https://bugs.webkit.org/show_bug.cgi?id=202772 Reviewed by Tim Horton. Change the "test trigger" terminology to "monitor wheel events"; after all, tests call monitorWheelEvents() and callAfterScrollingCompletes(), and this is not triggering a test. Source/WebCore: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * page/FrameView.cpp: (WebCore::FrameView::adjustScrollbarsForLayout): (WebCore::FrameView::setScrollPosition): (WebCore::FrameView::didAddScrollbar): * page/Page.cpp: (WebCore::Page::ensureWheelEventTestMonitor): (WebCore::Page::ensureTestTrigger): Deleted. * page/Page.h: (WebCore::Page::wheelEventTestMonitor const): (WebCore::Page::clearWheelEventTestMonitor): (WebCore::Page::isMonitoringWheelEvents const): (WebCore::Page::testTrigger const): Deleted. (WebCore::Page::clearTrigger): Deleted. (WebCore::Page::expectsWheelEventTriggers const): Deleted. * page/WheelEventTestMonitor.cpp: Added. (WebCore::WheelEventTestMonitor::WheelEventTestMonitor): (WebCore::WheelEventTestMonitor::clearAllTestDeferrals): (WebCore::WheelEventTestMonitor::setTestCallbackAndStartNotificationTimer): (WebCore::WheelEventTestMonitor::deferForReason): (WebCore::WheelEventTestMonitor::removeDeferralForReason): (WebCore::WheelEventTestMonitor::triggerTestTimerFired): (WebCore::operator<<): * page/WheelEventTestMonitor.h: Renamed from Source/WebCore/page/WheelEventTestTrigger.h. * page/WheelEventTestTrigger.cpp: Removed. * page/mac/EventHandlerMac.mm: (WebCore::EventHandler::platformPrepareForWheelEvents): * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated): (WebCore::AsyncScrollingCoordinator::updateIsMonitoringWheelEventsForFrameView): (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll): (WebCore::AsyncScrollingCoordinator::deferWheelEventTestCompletionForReason const): (WebCore::AsyncScrollingCoordinator::removeWheelEventTestCompletionDeferralForReason const): (WebCore::AsyncScrollingCoordinator::updateExpectsWheelEventTestTriggerWithFrameView): Deleted. (WebCore::AsyncScrollingCoordinator::deferTestsForReason const): Deleted. (WebCore::AsyncScrollingCoordinator::removeTestDeferralForReason const): Deleted. * page/scrolling/AsyncScrollingCoordinator.h: * page/scrolling/ScrollingCoordinator.h: (WebCore::ScrollingCoordinator::updateIsMonitoringWheelEventsForFrameView): (WebCore::ScrollingCoordinator::updateExpectsWheelEventTestTriggerWithFrameView): Deleted. * page/scrolling/ScrollingStateScrollingNode.cpp: (WebCore::ScrollingStateScrollingNode::ScrollingStateScrollingNode): (WebCore::ScrollingStateScrollingNode::setPropertyChangedBitsAfterReattach): (WebCore::ScrollingStateScrollingNode::setIsMonitoringWheelEvents): (WebCore::ScrollingStateScrollingNode::dumpProperties const): (WebCore::ScrollingStateScrollingNode::setExpectsWheelEventTestTrigger): Deleted. * page/scrolling/ScrollingStateScrollingNode.h: (WebCore::ScrollingStateScrollingNode::isMonitoringWheelEvents const): (WebCore::ScrollingStateScrollingNode::expectsWheelEventTestTrigger const): Deleted. * page/scrolling/ScrollingTree.h: (WebCore::ScrollingTree::deferWheelEventTestCompletionForReason): (WebCore::ScrollingTree::removeWheelEventTestCompletionDeferralForReason): (WebCore::ScrollingTree::deferTestsForReason): Deleted. (WebCore::ScrollingTree::removeTestDeferralForReason): Deleted. * page/scrolling/ScrollingTreeScrollingNode.cpp: (WebCore::ScrollingTreeScrollingNode::commitStateBeforeChildren): * page/scrolling/ScrollingTreeScrollingNode.h: * page/scrolling/ThreadedScrollingTree.cpp: (WebCore::ThreadedScrollingTree::deferWheelEventTestCompletionForReason): (WebCore::ThreadedScrollingTree::removeWheelEventTestCompletionDeferralForReason): (WebCore::ThreadedScrollingTree::deferTestsForReason): Deleted. (WebCore::ThreadedScrollingTree::removeTestDeferralForReason): Deleted. * page/scrolling/ThreadedScrollingTree.h: * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h: * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm: (WebCore::ScrollingTreeScrollingNodeDelegateMac::handleWheelEvent): (WebCore::ScrollingTreeScrollingNodeDelegateMac::deferWheelEventTestCompletionForReason const): (WebCore::ScrollingTreeScrollingNodeDelegateMac::removeWheelEventTestCompletionDeferralForReason const): (WebCore::ScrollingTreeScrollingNodeDelegateMac::deferTestsForReason const): Deleted. (WebCore::ScrollingTreeScrollingNodeDelegateMac::removeTestDeferralForReason const): Deleted. * platform/Logging.h: * platform/ScrollAnimator.cpp: (WebCore::ScrollAnimator::deferWheelEventTestCompletionForReason const): (WebCore::ScrollAnimator::removeWheelEventTestCompletionDeferralForReason const): (WebCore::ScrollAnimator::deferTestsForReason const): Deleted. (WebCore::ScrollAnimator::removeTestDeferralForReason const): Deleted. * platform/ScrollAnimator.h: (WebCore::ScrollAnimator::ScrollAnimator::setWheelEventTestMonitor): (WebCore::ScrollAnimator::ScrollAnimator::setWheelEventTestTrigger): Deleted. * platform/cocoa/ScrollController.h: (WebCore::ScrollControllerClient::deferWheelEventTestCompletionForReason const): (WebCore::ScrollControllerClient::removeWheelEventTestCompletionDeferralForReason const): (WebCore::ScrollControllerClient::deferTestsForReason const): Deleted. (WebCore::ScrollControllerClient::removeTestDeferralForReason const): Deleted. * platform/cocoa/ScrollController.mm: (WebCore::ScrollController::startSnapRubberbandTimer): (WebCore::ScrollController::stopSnapRubberbandTimer): (WebCore::ScrollController::scheduleStatelessScrollSnap): (WebCore::ScrollController::startDeferringWheelEventTestCompletionDueToScrollSnapping): (WebCore::ScrollController::stopDeferringWheelEventTestCompletionDueToScrollSnapping): (WebCore::ScrollController::startScrollSnapTimer): (WebCore::ScrollController::stopScrollSnapTimer): (WebCore::ScrollController::startDeferringTestsDueToScrollSnapping): Deleted. (WebCore::ScrollController::stopDeferringTestsDueToScrollSnapping): Deleted. * platform/mac/ScrollAnimatorMac.mm: (WebCore::ScrollAnimatorMac::didBeginScrollGesture const): (WebCore::ScrollAnimatorMac::didEndScrollGesture const): (WebCore::ScrollAnimatorMac::sendContentAreaScrolledSoon): (WebCore::ScrollAnimatorMac::sendContentAreaScrolledTimerFired): * rendering/RenderBox.cpp: (WebCore::setupWheelEventMonitor): (WebCore::RenderBox::setScrollLeft): (WebCore::RenderBox::setScrollTop): (WebCore::setupWheelEventTestTrigger): Deleted. * rendering/RenderLayer.cpp: (WebCore::RenderLayer::createScrollbar): * rendering/RenderListBox.cpp: (WebCore::setupWheelEventTestMonitor): (WebCore::RenderListBox::setScrollTop): (WebCore::RenderListBox::createScrollbar): (WebCore::setupWheelEventTestTrigger): Deleted. * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::monitorWheelEvents): (WebCoreTestSupport::setTestCallbackAndStartNotificationTimer): (WebCoreTestSupport::clearWheelEventTestMonitor): (WebCoreTestSupport::clearWheelEventTestTrigger): Deleted. * testing/js/WebCoreTestSupport.h: Source/WebKit: * UIProcess/API/C/WKPage.cpp: (WKPageClearWheelEventTestMonitor): (WKPageClearWheelEventTestTrigger): Deleted. * UIProcess/API/C/WKPage.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::clearWheelEventTestMonitor): (WebKit::WebPageProxy::clearWheelEventTestTrigger): Deleted. * UIProcess/WebPageProxy.h: * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageStartMonitoringScrollOperations): (WKBundlePageRegisterScrollOperationCompletionCallback): * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::createScrollbar): * WebProcess/WebPage/EventDispatcher.cpp: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::clearWheelEventTestMonitor): (WebKit::WebPage::clearWheelEventTestTrigger): Deleted. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: Tools: * DumpRenderTree/mac/DumpRenderTree.mm: (resetWebViewToConsistentStateBeforeTesting): * WebKitTestRunner/TestController.cpp: (WTR::TestController::resetStateToConsistentValues): Canonical link: https://commits.webkit.org/216237@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@250946 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-10-10 00:24:44 +00:00
case WheelEventTestMonitor::RubberbandInProgress: ts << "rubberbanding"; break;
case WheelEventTestMonitor::ScrollSnapInProgress: ts << "scroll-snapping"; break;
case WheelEventTestMonitor::ScrollingThreadSyncNeeded: ts << "scrolling thread sync needed"; break;
case WheelEventTestMonitor::ContentScrollInProgress: ts << "content scrolling"; break;
case WheelEventTestMonitor::RequestedScrollPosition: ts << "requested scroll position"; break;
Rename WheelEventTestTrigger and improve naming in related code https://bugs.webkit.org/show_bug.cgi?id=202772 Reviewed by Tim Horton. Change the "test trigger" terminology to "monitor wheel events"; after all, tests call monitorWheelEvents() and callAfterScrollingCompletes(), and this is not triggering a test. Source/WebCore: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * page/FrameView.cpp: (WebCore::FrameView::adjustScrollbarsForLayout): (WebCore::FrameView::setScrollPosition): (WebCore::FrameView::didAddScrollbar): * page/Page.cpp: (WebCore::Page::ensureWheelEventTestMonitor): (WebCore::Page::ensureTestTrigger): Deleted. * page/Page.h: (WebCore::Page::wheelEventTestMonitor const): (WebCore::Page::clearWheelEventTestMonitor): (WebCore::Page::isMonitoringWheelEvents const): (WebCore::Page::testTrigger const): Deleted. (WebCore::Page::clearTrigger): Deleted. (WebCore::Page::expectsWheelEventTriggers const): Deleted. * page/WheelEventTestMonitor.cpp: Added. (WebCore::WheelEventTestMonitor::WheelEventTestMonitor): (WebCore::WheelEventTestMonitor::clearAllTestDeferrals): (WebCore::WheelEventTestMonitor::setTestCallbackAndStartNotificationTimer): (WebCore::WheelEventTestMonitor::deferForReason): (WebCore::WheelEventTestMonitor::removeDeferralForReason): (WebCore::WheelEventTestMonitor::triggerTestTimerFired): (WebCore::operator<<): * page/WheelEventTestMonitor.h: Renamed from Source/WebCore/page/WheelEventTestTrigger.h. * page/WheelEventTestTrigger.cpp: Removed. * page/mac/EventHandlerMac.mm: (WebCore::EventHandler::platformPrepareForWheelEvents): * page/scrolling/AsyncScrollingCoordinator.cpp: (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated): (WebCore::AsyncScrollingCoordinator::updateIsMonitoringWheelEventsForFrameView): (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll): (WebCore::AsyncScrollingCoordinator::deferWheelEventTestCompletionForReason const): (WebCore::AsyncScrollingCoordinator::removeWheelEventTestCompletionDeferralForReason const): (WebCore::AsyncScrollingCoordinator::updateExpectsWheelEventTestTriggerWithFrameView): Deleted. (WebCore::AsyncScrollingCoordinator::deferTestsForReason const): Deleted. (WebCore::AsyncScrollingCoordinator::removeTestDeferralForReason const): Deleted. * page/scrolling/AsyncScrollingCoordinator.h: * page/scrolling/ScrollingCoordinator.h: (WebCore::ScrollingCoordinator::updateIsMonitoringWheelEventsForFrameView): (WebCore::ScrollingCoordinator::updateExpectsWheelEventTestTriggerWithFrameView): Deleted. * page/scrolling/ScrollingStateScrollingNode.cpp: (WebCore::ScrollingStateScrollingNode::ScrollingStateScrollingNode): (WebCore::ScrollingStateScrollingNode::setPropertyChangedBitsAfterReattach): (WebCore::ScrollingStateScrollingNode::setIsMonitoringWheelEvents): (WebCore::ScrollingStateScrollingNode::dumpProperties const): (WebCore::ScrollingStateScrollingNode::setExpectsWheelEventTestTrigger): Deleted. * page/scrolling/ScrollingStateScrollingNode.h: (WebCore::ScrollingStateScrollingNode::isMonitoringWheelEvents const): (WebCore::ScrollingStateScrollingNode::expectsWheelEventTestTrigger const): Deleted. * page/scrolling/ScrollingTree.h: (WebCore::ScrollingTree::deferWheelEventTestCompletionForReason): (WebCore::ScrollingTree::removeWheelEventTestCompletionDeferralForReason): (WebCore::ScrollingTree::deferTestsForReason): Deleted. (WebCore::ScrollingTree::removeTestDeferralForReason): Deleted. * page/scrolling/ScrollingTreeScrollingNode.cpp: (WebCore::ScrollingTreeScrollingNode::commitStateBeforeChildren): * page/scrolling/ScrollingTreeScrollingNode.h: * page/scrolling/ThreadedScrollingTree.cpp: (WebCore::ThreadedScrollingTree::deferWheelEventTestCompletionForReason): (WebCore::ThreadedScrollingTree::removeWheelEventTestCompletionDeferralForReason): (WebCore::ThreadedScrollingTree::deferTestsForReason): Deleted. (WebCore::ThreadedScrollingTree::removeTestDeferralForReason): Deleted. * page/scrolling/ThreadedScrollingTree.h: * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h: * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm: (WebCore::ScrollingTreeScrollingNodeDelegateMac::handleWheelEvent): (WebCore::ScrollingTreeScrollingNodeDelegateMac::deferWheelEventTestCompletionForReason const): (WebCore::ScrollingTreeScrollingNodeDelegateMac::removeWheelEventTestCompletionDeferralForReason const): (WebCore::ScrollingTreeScrollingNodeDelegateMac::deferTestsForReason const): Deleted. (WebCore::ScrollingTreeScrollingNodeDelegateMac::removeTestDeferralForReason const): Deleted. * platform/Logging.h: * platform/ScrollAnimator.cpp: (WebCore::ScrollAnimator::deferWheelEventTestCompletionForReason const): (WebCore::ScrollAnimator::removeWheelEventTestCompletionDeferralForReason const): (WebCore::ScrollAnimator::deferTestsForReason const): Deleted. (WebCore::ScrollAnimator::removeTestDeferralForReason const): Deleted. * platform/ScrollAnimator.h: (WebCore::ScrollAnimator::ScrollAnimator::setWheelEventTestMonitor): (WebCore::ScrollAnimator::ScrollAnimator::setWheelEventTestTrigger): Deleted. * platform/cocoa/ScrollController.h: (WebCore::ScrollControllerClient::deferWheelEventTestCompletionForReason const): (WebCore::ScrollControllerClient::removeWheelEventTestCompletionDeferralForReason const): (WebCore::ScrollControllerClient::deferTestsForReason const): Deleted. (WebCore::ScrollControllerClient::removeTestDeferralForReason const): Deleted. * platform/cocoa/ScrollController.mm: (WebCore::ScrollController::startSnapRubberbandTimer): (WebCore::ScrollController::stopSnapRubberbandTimer): (WebCore::ScrollController::scheduleStatelessScrollSnap): (WebCore::ScrollController::startDeferringWheelEventTestCompletionDueToScrollSnapping): (WebCore::ScrollController::stopDeferringWheelEventTestCompletionDueToScrollSnapping): (WebCore::ScrollController::startScrollSnapTimer): (WebCore::ScrollController::stopScrollSnapTimer): (WebCore::ScrollController::startDeferringTestsDueToScrollSnapping): Deleted. (WebCore::ScrollController::stopDeferringTestsDueToScrollSnapping): Deleted. * platform/mac/ScrollAnimatorMac.mm: (WebCore::ScrollAnimatorMac::didBeginScrollGesture const): (WebCore::ScrollAnimatorMac::didEndScrollGesture const): (WebCore::ScrollAnimatorMac::sendContentAreaScrolledSoon): (WebCore::ScrollAnimatorMac::sendContentAreaScrolledTimerFired): * rendering/RenderBox.cpp: (WebCore::setupWheelEventMonitor): (WebCore::RenderBox::setScrollLeft): (WebCore::RenderBox::setScrollTop): (WebCore::setupWheelEventTestTrigger): Deleted. * rendering/RenderLayer.cpp: (WebCore::RenderLayer::createScrollbar): * rendering/RenderListBox.cpp: (WebCore::setupWheelEventTestMonitor): (WebCore::RenderListBox::setScrollTop): (WebCore::RenderListBox::createScrollbar): (WebCore::setupWheelEventTestTrigger): Deleted. * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::monitorWheelEvents): (WebCoreTestSupport::setTestCallbackAndStartNotificationTimer): (WebCoreTestSupport::clearWheelEventTestMonitor): (WebCoreTestSupport::clearWheelEventTestTrigger): Deleted. * testing/js/WebCoreTestSupport.h: Source/WebKit: * UIProcess/API/C/WKPage.cpp: (WKPageClearWheelEventTestMonitor): (WKPageClearWheelEventTestTrigger): Deleted. * UIProcess/API/C/WKPage.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::clearWheelEventTestMonitor): (WebKit::WebPageProxy::clearWheelEventTestTrigger): Deleted. * UIProcess/WebPageProxy.h: * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePageStartMonitoringScrollOperations): (WKBundlePageRegisterScrollOperationCompletionCallback): * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::createScrollbar): * WebProcess/WebPage/EventDispatcher.cpp: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::clearWheelEventTestMonitor): (WebKit::WebPage::clearWheelEventTestTrigger): Deleted. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: Tools: * DumpRenderTree/mac/DumpRenderTree.mm: (resetWebViewToConsistentStateBeforeTesting): * WebKitTestRunner/TestController.cpp: (WTR::TestController::resetStateToConsistentValues): Canonical link: https://commits.webkit.org/216237@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@250946 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-10-10 00:24:44 +00:00
}
return ts;
}
TextStream& operator<<(TextStream& ts, const WheelEventTestMonitor::ScrollableAreaReasonMap& reasonMap)
{
for (const auto& regionReasonsPair : reasonMap)
ts << " scroll region: " << regionReasonsPair.key << " reasons: " << regionReasonsPair.value;
return ts;
}
} // namespace WebCore