⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 286035 in webkit


Ignore:
Timestamp:
Nov 18, 2021, 3:20:09 PM (5 years ago)
Author:
Simon Fraser
Message:

Teach WheelEventTestMonitor about scroll animations
https://bugs.webkit.org/show_bug.cgi?id=233296

Reviewed by Tim Horton.

There was no way for a test to wait for a scroll animation to finish, so enhance
WheelEventTestMonitor to know about scroll animations.

ScrollAnimationInProgress should probably subsume the RubberbandInProgress and
ScrollSnapInProgress reasons, but those are left alone for now.

  • page/WheelEventTestMonitor.cpp:

(WebCore::operator<<):

  • page/WheelEventTestMonitor.h:
  • platform/ScrollingEffectsController.cpp:

(WebCore::ScrollingEffectsController::startScrollSnapAnimation):
(WebCore::ScrollingEffectsController::stopScrollSnapAnimation):
(WebCore::ScrollingEffectsController::scrollAnimationWillStart):
(WebCore::ScrollingEffectsController::scrollAnimationDidEnd):
(WebCore::ScrollingEffectsController::startDeferringWheelEventTestCompletion):
(WebCore::ScrollingEffectsController::stopDeferringWheelEventTestCompletion):

  • platform/ScrollingEffectsController.h:
  • platform/mac/ScrollingEffectsController.mm:

(WebCore::ScrollingEffectsController::scheduleStatelessScrollSnap):
(WebCore::ScrollingEffectsController::startDeferringWheelEventTestCompletionDueToScrollSnapping): Deleted.
(WebCore::ScrollingEffectsController::stopDeferringWheelEventTestCompletionDueToScrollSnapping): Deleted.

Location:
trunk/Source/WebCore
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r286027 r286035  
     12021-11-18  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Teach WheelEventTestMonitor about scroll animations
     4        https://bugs.webkit.org/show_bug.cgi?id=233296
     5
     6        Reviewed by Tim Horton.
     7
     8        There was no way for a test to wait for a scroll animation to finish, so enhance
     9        WheelEventTestMonitor to know about scroll animations.
     10
     11        ScrollAnimationInProgress should probably subsume the RubberbandInProgress and
     12        ScrollSnapInProgress reasons, but those are left alone for now.
     13
     14        * page/WheelEventTestMonitor.cpp:
     15        (WebCore::operator<<):
     16        * page/WheelEventTestMonitor.h:
     17        * platform/ScrollingEffectsController.cpp:
     18        (WebCore::ScrollingEffectsController::startScrollSnapAnimation):
     19        (WebCore::ScrollingEffectsController::stopScrollSnapAnimation):
     20        (WebCore::ScrollingEffectsController::scrollAnimationWillStart):
     21        (WebCore::ScrollingEffectsController::scrollAnimationDidEnd):
     22        (WebCore::ScrollingEffectsController::startDeferringWheelEventTestCompletion):
     23        (WebCore::ScrollingEffectsController::stopDeferringWheelEventTestCompletion):
     24        * platform/ScrollingEffectsController.h:
     25        * platform/mac/ScrollingEffectsController.mm:
     26        (WebCore::ScrollingEffectsController::scheduleStatelessScrollSnap):
     27        (WebCore::ScrollingEffectsController::startDeferringWheelEventTestCompletionDueToScrollSnapping): Deleted.
     28        (WebCore::ScrollingEffectsController::stopDeferringWheelEventTestCompletionDueToScrollSnapping): Deleted.
     29
    1302021-11-18  Chris Dumez  <cdumez@apple.com>
    231
  • trunk/Source/WebCore/page/WheelEventTestMonitor.cpp

    r284857 r286035  
    175175    case WheelEventTestMonitor::RubberbandInProgress: ts << "rubberbanding"; break;
    176176    case WheelEventTestMonitor::ScrollSnapInProgress: ts << "scroll-snapping"; break;
     177    case WheelEventTestMonitor::ScrollAnimationInProgress: ts << "scroll animation"; break;
    177178    case WheelEventTestMonitor::ScrollingThreadSyncNeeded: ts << "scrolling thread sync needed"; break;
    178179    case WheelEventTestMonitor::ContentScrollInProgress: ts << "content scrolling"; break;
  • trunk/Source/WebCore/page/WheelEventTestMonitor.h

    r284857 r286035  
    5454        RubberbandInProgress                = 1 << 3,
    5555        ScrollSnapInProgress                = 1 << 4,
    56         ScrollingThreadSyncNeeded           = 1 << 5,
    57         ContentScrollInProgress             = 1 << 6,
    58         RequestedScrollPosition             = 1 << 7,
     56        ScrollAnimationInProgress           = 1 << 5,
     57        ScrollingThreadSyncNeeded           = 1 << 6,
     58        ContentScrollInProgress             = 1 << 7,
     59        RequestedScrollPosition             = 1 << 8,
    5960    };
    6061    typedef const void* ScrollableAreaIdentifier;
  • trunk/Source/WebCore/platform/ScrollingEffectsController.cpp

    r285787 r286035  
    3535#include "ScrollExtents.h"
    3636#include "ScrollableArea.h"
    37 #include "WheelEventTestMonitor.h"
    3837#include <wtf/text/TextStream.h>
    3938
     
    447446    LOG_WITH_STREAM(ScrollSnap, stream << "ScrollingEffectsController " << this << " startScrollSnapAnimation (main thread " << isMainThread() << ")");
    448447
    449 #if PLATFORM(MAC)
    450     startDeferringWheelEventTestCompletionDueToScrollSnapping();
    451 #endif
     448    startDeferringWheelEventTestCompletion(WheelEventTestMonitor::ScrollSnapInProgress);
    452449    m_client.willStartScrollSnapAnimation();
    453450    setIsAnimatingScrollSnap(true);
     
    461458    LOG_WITH_STREAM(ScrollSnap, stream << "ScrollingEffectsController " << this << " stopScrollSnapAnimation (main thread " << isMainThread() << ")");
    462459
    463 #if PLATFORM(MAC)
    464     stopDeferringWheelEventTestCompletionDueToScrollSnapping();
    465 #endif
     460    stopDeferringWheelEventTestCompletion(WheelEventTestMonitor::ScrollSnapInProgress);
    466461    m_client.didStopScrollSnapAnimation();
    467462
     
    498493#endif
    499494
     495    startDeferringWheelEventTestCompletion(WheelEventTestMonitor::ScrollAnimationInProgress);
    500496    startOrStopAnimationCallbacks();
    501497}
     
    520516    m_client.didStopAnimatedScroll();
    521517    startOrStopAnimationCallbacks();
     518    stopDeferringWheelEventTestCompletion(WheelEventTestMonitor::ScrollAnimationInProgress);
    522519}
    523520
     
    525522{
    526523    return m_client.scrollExtents();
     524}
     525
     526void ScrollingEffectsController::startDeferringWheelEventTestCompletion(WheelEventTestMonitor::DeferReason reason)
     527{
     528    m_client.deferWheelEventTestCompletionForReason(reinterpret_cast<WheelEventTestMonitor::ScrollableAreaIdentifier>(this), reason);
     529}
     530
     531void ScrollingEffectsController::stopDeferringWheelEventTestCompletion(WheelEventTestMonitor::DeferReason reason)
     532{
     533    m_client.removeWheelEventTestCompletionDeferralForReason(reinterpret_cast<WheelEventTestMonitor::ScrollableAreaIdentifier>(this), reason);
    527534}
    528535
  • trunk/Source/WebCore/platform/ScrollingEffectsController.h

    r285953 r286035  
    202202    void statelessSnapTransitionTimerFired();
    203203    void scheduleStatelessScrollSnap();
    204     void startDeferringWheelEventTestCompletionDueToScrollSnapping();
    205     void stopDeferringWheelEventTestCompletionDueToScrollSnapping();
    206204
    207205    bool modifyScrollDeltaForStretching(const PlatformWheelEvent&, FloatSize&, bool isHorizontallyStretched, bool isVerticallyStretched);
     
    225223
    226224    bool momentumScrollingAnimatorEnabled() const { return m_momentumScrollingAnimatorEnabled; }
     225
     226    void startDeferringWheelEventTestCompletion(WheelEventTestMonitor::DeferReason);
     227    void stopDeferringWheelEventTestCompletion(WheelEventTestMonitor::DeferReason);
    227228
    228229    // ScrollAnimationClient
  • trunk/Source/WebCore/platform/mac/ScrollingEffectsController.mm

    r285964 r286035  
    3232#import "ScrollExtents.h"
    3333#import "WheelEventDeltaFilter.h"
    34 #import "WheelEventTestMonitor.h"
    3534#import <pal/spi/mac/NSScrollViewSPI.h>
    3635#import <sys/sysctl.h>
     
    681680    });
    682681    m_statelessSnapTransitionTimer->startOneShot(statelessScrollSnapDelay);
    683     startDeferringWheelEventTestCompletionDueToScrollSnapping();
     682    startDeferringWheelEventTestCompletion(WheelEventTestMonitor::ScrollSnapInProgress);
    684683}
    685684
     
    693692    if (m_scrollSnapState->transitionToSnapAnimationState(m_client.scrollExtents(), m_client.pageScaleFactor(), m_client.scrollOffset()))
    694693        startScrollSnapAnimation();
    695 }
    696 
    697 void ScrollingEffectsController::startDeferringWheelEventTestCompletionDueToScrollSnapping()
    698 {
    699     m_client.deferWheelEventTestCompletionForReason(reinterpret_cast<WheelEventTestMonitor::ScrollableAreaIdentifier>(this), WheelEventTestMonitor::ScrollSnapInProgress);
    700 }
    701 
    702 void ScrollingEffectsController::stopDeferringWheelEventTestCompletionDueToScrollSnapping()
    703 {
    704     m_client.removeWheelEventTestCompletionDeferralForReason(reinterpret_cast<WheelEventTestMonitor::ScrollableAreaIdentifier>(this), WheelEventTestMonitor::ScrollSnapInProgress);
    705694}
    706695
Note: See TracChangeset for help on using the changeset viewer.