Changeset 276159 in webkit
- Timestamp:
- Apr 16, 2021, 12:28:28 PM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
-
ChangeLog (modified) (1 diff)
-
platform/ScrollAnimator.cpp (modified) (6 diffs)
-
platform/ScrollAnimator.h (modified) (1 diff)
-
platform/generic/ScrollAnimatorGeneric.cpp (modified) (5 diffs)
-
platform/generic/ScrollAnimatorGeneric.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r276154 r276159 1 2021-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 1 14 2021-04-16 Alex Christensen <achristensen@webkit.org> 2 15 -
trunk/Source/WebCore/platform/ScrollAnimator.cpp
r275388 r276159 58 58 , m_scrollController(*this) 59 59 #endif 60 , m_ scrollAnimation(makeUnique<ScrollAnimationSmooth>(60 , m_animationProgrammaticScroll(makeUnique<ScrollAnimationSmooth>( 61 61 [this]() -> ScrollExtents { 62 62 return { m_scrollableArea.minimumScrollPosition(), m_scrollableArea.maximumScrollPosition(), m_scrollableArea.visibleSize() }; … … 100 100 #endif 101 101 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 #endif108 109 102 return scrollToPositionWithoutAnimation(positionFromStep(orientation, step, multiplier)); 110 103 } … … 125 118 return false; 126 119 127 m_scrollAnimation->setCurrentPosition(adjustedPosition);128 120 m_currentPosition = adjustedPosition; 129 121 notifyPositionChanged(adjustedPosition - currentPosition); … … 143 135 return false; 144 136 145 m_ scrollAnimation->setCurrentPosition(m_currentPosition);146 m_ scrollAnimation->scroll(newPosition);137 m_animationProgrammaticScroll->setCurrentPosition(m_currentPosition); 138 m_animationProgrammaticScroll->scroll(newPosition); 147 139 scrollableArea().setScrollBehaviorStatus(ScrollBehaviorStatus::InNonNativeAnimation); 148 140 return true; … … 347 339 { 348 340 #if !USE(REQUEST_ANIMATION_FRAME_TIMER) 349 m_ scrollAnimation->stop();341 m_animationProgrammaticScroll->stop(); 350 342 #endif 351 343 } … … 353 345 void ScrollAnimator::willEndLiveResize() 354 346 { 355 m_ scrollAnimation->updateVisibleLengths();347 m_animationProgrammaticScroll->updateVisibleLengths(); 356 348 } 357 349 358 350 void ScrollAnimator::didAddVerticalScrollbar(Scrollbar*) 359 351 { 360 m_ scrollAnimation->updateVisibleLengths();352 m_animationProgrammaticScroll->updateVisibleLengths(); 361 353 } 362 354 363 355 void ScrollAnimator::didAddHorizontalScrollbar(Scrollbar*) 364 356 { 365 m_ scrollAnimation->updateVisibleLengths();357 m_animationProgrammaticScroll->updateVisibleLengths(); 366 358 } 367 359 -
trunk/Source/WebCore/platform/ScrollAnimator.h
r275388 r276159 183 183 FloatPoint m_currentPosition; 184 184 185 std::unique_ptr<ScrollAnimation> m_ scrollAnimation;185 std::unique_ptr<ScrollAnimation> m_animationProgrammaticScroll; 186 186 }; 187 187 -
trunk/Source/WebCore/platform/generic/ScrollAnimatorGeneric.cpp
r273733 r276159 56 56 }, 57 57 [this](FloatPoint&& position) { 58 m_scrollAnimation->setCurrentPosition(position); 58 #if ENABLE(SMOOTH_SCROLLING) 59 if (m_smoothAnimation) 60 m_smoothAnimation->setCurrentPosition(position); 61 #endif 59 62 updatePosition(WTFMove(position)); 60 63 }); 64 65 #if ENABLE(SMOOTH_SCROLLING) 66 if (scrollableArea.scrollAnimatorEnabled()) 67 ensureSmoothScrollingAnimation(); 68 #endif 61 69 } 62 70 63 71 ScrollAnimatorGeneric::~ScrollAnimatorGeneric() = default; 72 73 #if ENABLE(SMOOTH_SCROLLING) 74 void 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) 97 bool 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 64 111 65 112 bool ScrollAnimatorGeneric::scrollToPositionWithoutAnimation(const FloatPoint& position, ScrollClamping clamping) … … 67 114 m_kineticAnimation->stop(); 68 115 m_kineticAnimation->clearScrollHistory(); 116 117 #if ENABLE(SMOOTH_SCROLLING) 118 if (m_smoothAnimation) 119 m_smoothAnimation->setCurrentPosition(position); 120 #endif 121 69 122 return ScrollAnimator::scrollToPositionWithoutAnimation(position, clamping); 70 123 } … … 91 144 } 92 145 146 void ScrollAnimatorGeneric::willEndLiveResize() 147 { 148 #if ENABLE(SMOOTH_SCROLLING) 149 if (m_smoothAnimation) 150 m_smoothAnimation->updateVisibleLengths(); 151 #endif 152 } 153 93 154 void ScrollAnimatorGeneric::updatePosition(FloatPoint&& position) 94 155 { … … 101 162 void ScrollAnimatorGeneric::didAddVerticalScrollbar(Scrollbar* scrollbar) 102 163 { 103 ScrollAnimator::didAddVerticalScrollbar(scrollbar); 104 164 #if ENABLE(SMOOTH_SCROLLING) 165 if (m_smoothAnimation) 166 m_smoothAnimation->updateVisibleLengths(); 167 #endif 105 168 if (!scrollbar->isOverlayScrollbar()) 106 169 return; … … 114 177 void ScrollAnimatorGeneric::didAddHorizontalScrollbar(Scrollbar* scrollbar) 115 178 { 116 ScrollAnimator::didAddHorizontalScrollbar(scrollbar); 117 179 #if ENABLE(SMOOTH_SCROLLING) 180 if (m_smoothAnimation) 181 m_smoothAnimation->updateVisibleLengths(); 182 #endif 118 183 if (!scrollbar->isOverlayScrollbar()) 119 184 return; -
trunk/Source/WebCore/platform/generic/ScrollAnimatorGeneric.h
r273733 r276159 45 45 46 46 private: 47 #if ENABLE(SMOOTH_SCROLLING) 48 bool scroll(ScrollbarOrientation, ScrollGranularity, float step, float multiplier, ScrollBehavior) override; 49 #endif 47 50 bool scrollToPositionWithoutAnimation(const FloatPoint&, ScrollClamping) override; 51 void willEndLiveResize() override; 48 52 49 53 bool handleWheelEvent(const PlatformWheelEvent&) override; … … 69 73 void updateOverlayScrollbarsOpacity(); 70 74 75 #if ENABLE(SMOOTH_SCROLLING) 76 void ensureSmoothScrollingAnimation(); 77 78 std::unique_ptr<ScrollAnimation> m_smoothAnimation; 79 #endif 71 80 std::unique_ptr<ScrollAnimationKinetic> m_kineticAnimation; 72 81 Scrollbar* m_horizontalOverlayScrollbar { nullptr };
Note:
See TracChangeset
for help on using the changeset viewer.