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

Changeset 276159 in webkit


Ignore:
Timestamp:
Apr 16, 2021, 12:28:28 PM (5 years ago)
Author:
commit-queue@webkit.org
Message:

Unreviewed, reverting r273733.
https://bugs.webkit.org/show_bug.cgi?id=224686

Broke mouse wheel scrolling speed

Reverted changeset:

"Eliminate ScrollAnimatorGeneric::m_smoothAnimation"
https://bugs.webkit.org/show_bug.cgi?id=222588
https://trac.webkit.org/changeset/273733

Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r276154 r276159  
     12021-04-16  Commit Queue  <commit-queue@webkit.org>
     2
     3        Unreviewed, reverting r273733.
     4        https://bugs.webkit.org/show_bug.cgi?id=224686
     5
     6        Broke mouse wheel scrolling speed
     7
     8        Reverted changeset:
     9
     10        "Eliminate ScrollAnimatorGeneric::m_smoothAnimation"
     11        https://bugs.webkit.org/show_bug.cgi?id=222588
     12        https://trac.webkit.org/changeset/273733
     13
    1142021-04-16  Alex Christensen  <achristensen@webkit.org>
    215
  • trunk/Source/WebCore/platform/ScrollAnimator.cpp

    r275388 r276159  
    5858    , m_scrollController(*this)
    5959#endif
    60     , m_scrollAnimation(makeUnique<ScrollAnimationSmooth>(
     60    , m_animationProgrammaticScroll(makeUnique<ScrollAnimationSmooth>(
    6161        [this]() -> ScrollExtents {
    6262            return { m_scrollableArea.minimumScrollPosition(), m_scrollableArea.maximumScrollPosition(), m_scrollableArea.visibleSize() };
     
    100100#endif
    101101
    102 #if ENABLE(SMOOTH_SCROLLING) && !PLATFORM(IOS_FAMILY)
    103     if (m_scrollableArea.scrollAnimatorEnabled()) {
    104         m_scrollAnimation->setCurrentPosition(m_currentPosition);
    105         return m_scrollAnimation->scroll(orientation, granularity, step, multiplier);
    106     }
    107 #endif
    108 
    109102    return scrollToPositionWithoutAnimation(positionFromStep(orientation, step, multiplier));
    110103}
     
    125118        return false;
    126119
    127     m_scrollAnimation->setCurrentPosition(adjustedPosition);
    128120    m_currentPosition = adjustedPosition;
    129121    notifyPositionChanged(adjustedPosition - currentPosition);
     
    143135        return false;
    144136
    145     m_scrollAnimation->setCurrentPosition(m_currentPosition);
    146     m_scrollAnimation->scroll(newPosition);
     137    m_animationProgrammaticScroll->setCurrentPosition(m_currentPosition);
     138    m_animationProgrammaticScroll->scroll(newPosition);
    147139    scrollableArea().setScrollBehaviorStatus(ScrollBehaviorStatus::InNonNativeAnimation);
    148140    return true;
     
    347339{
    348340#if !USE(REQUEST_ANIMATION_FRAME_TIMER)
    349     m_scrollAnimation->stop();
     341    m_animationProgrammaticScroll->stop();
    350342#endif
    351343}
     
    353345void ScrollAnimator::willEndLiveResize()
    354346{
    355     m_scrollAnimation->updateVisibleLengths();
     347    m_animationProgrammaticScroll->updateVisibleLengths();
    356348}
    357349
    358350void ScrollAnimator::didAddVerticalScrollbar(Scrollbar*)
    359351{
    360     m_scrollAnimation->updateVisibleLengths();
     352    m_animationProgrammaticScroll->updateVisibleLengths();
    361353}
    362354
    363355void ScrollAnimator::didAddHorizontalScrollbar(Scrollbar*)
    364356{
    365     m_scrollAnimation->updateVisibleLengths();
     357    m_animationProgrammaticScroll->updateVisibleLengths();
    366358}
    367359
  • trunk/Source/WebCore/platform/ScrollAnimator.h

    r275388 r276159  
    183183    FloatPoint m_currentPosition;
    184184
    185     std::unique_ptr<ScrollAnimation> m_scrollAnimation;
     185    std::unique_ptr<ScrollAnimation> m_animationProgrammaticScroll;
    186186};
    187187
  • trunk/Source/WebCore/platform/generic/ScrollAnimatorGeneric.cpp

    r273733 r276159  
    5656        },
    5757        [this](FloatPoint&& position) {
    58             m_scrollAnimation->setCurrentPosition(position);
     58#if ENABLE(SMOOTH_SCROLLING)
     59            if (m_smoothAnimation)
     60                m_smoothAnimation->setCurrentPosition(position);
     61#endif
    5962            updatePosition(WTFMove(position));
    6063        });
     64
     65#if ENABLE(SMOOTH_SCROLLING)
     66    if (scrollableArea.scrollAnimatorEnabled())
     67        ensureSmoothScrollingAnimation();
     68#endif
    6169}
    6270
    6371ScrollAnimatorGeneric::~ScrollAnimatorGeneric() = default;
     72
     73#if ENABLE(SMOOTH_SCROLLING)
     74void ScrollAnimatorGeneric::ensureSmoothScrollingAnimation()
     75{
     76    if (m_smoothAnimation) {
     77        if (!m_smoothAnimation->isActive())
     78            m_smoothAnimation->setCurrentPosition(m_currentPosition);
     79        return;
     80    }
     81
     82    m_smoothAnimation = makeUnique<ScrollAnimationSmooth>(
     83        [this]() -> ScrollExtents {
     84            return { m_scrollableArea.minimumScrollPosition(), m_scrollableArea.maximumScrollPosition(), m_scrollableArea.visibleSize() };
     85        },
     86        m_currentPosition,
     87        [this](FloatPoint&& position) {
     88            updatePosition(WTFMove(position));
     89        },
     90        [this] {
     91            m_scrollableArea.setScrollBehaviorStatus(ScrollBehaviorStatus::NotInAnimation);
     92        });
     93}
     94#endif
     95
     96#if ENABLE(SMOOTH_SCROLLING)
     97bool ScrollAnimatorGeneric::scroll(ScrollbarOrientation orientation, ScrollGranularity granularity, float step, float multiplier, ScrollBehavior behavior)
     98{
     99    if (!m_scrollableArea.scrollAnimatorEnabled())
     100        return ScrollAnimator::scroll(orientation, granularity, step, multiplier, behavior);
     101
     102    // This method doesn't do directional snapping, but our base class does. It will call into
     103    // ScrollAnimatorGeneric::scroll again with the snapped positions and ScrollBehavior::Default.
     104    if (behavior == ScrollBehavior::DoDirectionalSnapping)
     105        return ScrollAnimator::scroll(orientation, granularity, step, multiplier, behavior);
     106
     107    ensureSmoothScrollingAnimation();
     108    return m_smoothAnimation->scroll(orientation, granularity, step, multiplier);
     109}
     110#endif
    64111
    65112bool ScrollAnimatorGeneric::scrollToPositionWithoutAnimation(const FloatPoint& position, ScrollClamping clamping)
     
    67114    m_kineticAnimation->stop();
    68115    m_kineticAnimation->clearScrollHistory();
     116
     117#if ENABLE(SMOOTH_SCROLLING)
     118    if (m_smoothAnimation)
     119        m_smoothAnimation->setCurrentPosition(position);
     120#endif
     121
    69122    return ScrollAnimator::scrollToPositionWithoutAnimation(position, clamping);
    70123}
     
    91144}
    92145
     146void ScrollAnimatorGeneric::willEndLiveResize()
     147{
     148#if ENABLE(SMOOTH_SCROLLING)
     149    if (m_smoothAnimation)
     150        m_smoothAnimation->updateVisibleLengths();
     151#endif
     152}
     153
    93154void ScrollAnimatorGeneric::updatePosition(FloatPoint&& position)
    94155{
     
    101162void ScrollAnimatorGeneric::didAddVerticalScrollbar(Scrollbar* scrollbar)
    102163{
    103     ScrollAnimator::didAddVerticalScrollbar(scrollbar);
    104 
     164#if ENABLE(SMOOTH_SCROLLING)
     165    if (m_smoothAnimation)
     166        m_smoothAnimation->updateVisibleLengths();
     167#endif
    105168    if (!scrollbar->isOverlayScrollbar())
    106169        return;
     
    114177void ScrollAnimatorGeneric::didAddHorizontalScrollbar(Scrollbar* scrollbar)
    115178{
    116     ScrollAnimator::didAddHorizontalScrollbar(scrollbar);
    117 
     179#if ENABLE(SMOOTH_SCROLLING)
     180    if (m_smoothAnimation)
     181        m_smoothAnimation->updateVisibleLengths();
     182#endif
    118183    if (!scrollbar->isOverlayScrollbar())
    119184        return;
  • trunk/Source/WebCore/platform/generic/ScrollAnimatorGeneric.h

    r273733 r276159  
    4545
    4646private:
     47#if ENABLE(SMOOTH_SCROLLING)
     48    bool scroll(ScrollbarOrientation, ScrollGranularity, float step, float multiplier, ScrollBehavior) override;
     49#endif
    4750    bool scrollToPositionWithoutAnimation(const FloatPoint&, ScrollClamping) override;
     51    void willEndLiveResize() override;
    4852
    4953    bool handleWheelEvent(const PlatformWheelEvent&) override;
     
    6973    void updateOverlayScrollbarsOpacity();
    7074
     75#if ENABLE(SMOOTH_SCROLLING)
     76    void ensureSmoothScrollingAnimation();
     77
     78    std::unique_ptr<ScrollAnimation> m_smoothAnimation;
     79#endif
    7180    std::unique_ptr<ScrollAnimationKinetic> m_kineticAnimation;
    7281    Scrollbar* m_horizontalOverlayScrollbar { nullptr };
Note: See TracChangeset for help on using the changeset viewer.