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

Changeset 286793 in webkit


Ignore:
Timestamp:
Dec 9, 2021, 11:53:55 AM (5 years ago)
Author:
Alan Coon
Message:

Apply patch. rdar://problem/86235842

Location:
branches/safari-612-branch/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-612-branch/Source/WebCore/ChangeLog

    r286692 r286793  
     12021-12-09  Alan Coon  <alancoon@apple.com>
     2
     3        Apply patch. rdar://problem/86235842
     4
     5    2021-12-09  Simon Fraser  <simon.fraser@apple.com>
     6
     7            rdar://86235842 ([root] J316c: Rubber-banding is more stuttery with the momentum generator enabled)
     8
     9            Reviewed by Tim Horton.
     10
     11            Branch-only patch (this timer does not exist on trunk).
     12
     13            To avoid raciness between displayDidRefresh callbacks and the rubberbanding timer, offset
     14            the timer by 1/4 frame. After the first frame, we reset its fire interval back to the
     15            nominal frame rate.
     16
     17            stopAnimationCallback() sets m_isAnimationTimerInOffsetPhase to false to avoid any chance
     18            of restarting a stopped timer in the callback.
     19
     20            * page/scrolling/ScrollingTree.h:
     21            * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h:
     22            * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm:
     23            (WebCore::ScrollingTreeScrollingNodeDelegateMac::startAnimationCallback):
     24            (WebCore::ScrollingTreeScrollingNodeDelegateMac::stopAnimationCallback):
     25            (WebCore::ScrollingTreeScrollingNodeDelegateMac::scrollControllerAnimationTimerFired):
     26
    1272021-12-03  Alan Coon  <alancoon@apple.com>
    228
  • branches/safari-612-branch/Source/WebCore/page/scrolling/ScrollingTree.h

    r286692 r286793  
    224224    void windowScreenDidChange(PlatformDisplayID, std::optional<FramesPerSecond> nominalFramesPerSecond);
    225225    PlatformDisplayID displayID();
    226    
     226
     227    std::optional<FramesPerSecond> nominalFramesPerSecond();
     228
    227229    bool hasProcessedWheelEventsRecently();
    228230    WEBCORE_EXPORT void willProcessWheelEvent();
     
    258260    std::optional<WheelScrollGestureState> gestureState();
    259261
    260     std::optional<FramesPerSecond> nominalFramesPerSecond();
    261 
    262262    void applyLayerPositionsInternal() WTF_REQUIRES_LOCK(m_treeLock);
    263263    void removeAllNodes() WTF_REQUIRES_LOCK(m_treeLock);
  • branches/safari-612-branch/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h

    r286692 r286793  
    111111
    112112    std::unique_ptr<RunLoop::Timer<ScrollingTreeScrollingNodeDelegateMac>> m_scrollControllerAnimationTimer;
     113    bool m_isAnimationTimerInOffsetPhase { false };
    113114
    114115    bool m_inMomentumPhase { false };
  • branches/safari-612-branch/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm

    r286692 r286793  
    2929#if ENABLE(ASYNC_SCROLLING) && PLATFORM(MAC)
    3030
     31#import "AnimationFrameRate.h"
    3132#import "Logging.h"
    3233#import "ScrollingStateScrollingNode.h"
     
    230231        return;
    231232
    232     m_scrollControllerAnimationTimer->startRepeating(1_s / 60.);
     233    // We offset the timer by a 1/4 frame to avoid it racing with displayDidRefresh callbacks (rdar://86235842).
     234    auto framesPerSecond = scrollingTree().nominalFramesPerSecond().value_or(FullSpeedFramesPerSecond);
     235    auto firstInterval = (1_s / framesPerSecond) / 4;
     236    m_isAnimationTimerInOffsetPhase = true;
     237    m_scrollControllerAnimationTimer->startRepeating(firstInterval);
    233238}
    234239
    235240void ScrollingTreeScrollingNodeDelegateMac::stopAnimationCallback(ScrollController&)
    236241{
     242    m_isAnimationTimerInOffsetPhase = false;
    237243    if (m_scrollControllerAnimationTimer)
    238244        m_scrollControllerAnimationTimer->stop();
     
    241247void ScrollingTreeScrollingNodeDelegateMac::scrollControllerAnimationTimerFired()
    242248{
     249    if (m_scrollControllerAnimationTimer && m_isAnimationTimerInOffsetPhase) {
     250        auto framesPerSecond = scrollingTree().nominalFramesPerSecond().value_or(FullSpeedFramesPerSecond);
     251        m_scrollControllerAnimationTimer->startRepeating(1_s / framesPerSecond);
     252        m_isAnimationTimerInOffsetPhase = false;
     253    }
     254
    243255    m_scrollController.animationCallback(MonotonicTime::now());
    244256}
Note: See TracChangeset for help on using the changeset viewer.