Changeset 277350 in webkit
- Timestamp:
- May 11, 2021, 7:45:51 PM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 10 edited
-
ChangeLog (modified) (1 diff)
-
page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h (modified) (4 diffs)
-
page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm (modified) (1 diff)
-
platform/ScrollAnimator.cpp (modified) (2 diffs)
-
platform/ScrollAnimator.h (modified) (3 diffs)
-
platform/ScrollController.cpp (modified) (3 diffs)
-
platform/ScrollController.h (modified) (8 diffs)
-
platform/ScrollSnapAnimatorState.cpp (modified) (2 diffs)
-
platform/ScrollSnapAnimatorState.h (modified) (1 diff)
-
platform/mac/ScrollController.mm (modified) (19 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r277347 r277350 1 2021-05-11 Simon Fraser <simon.fraser@apple.com> 2 3 Display-frequency animations in ScrollController should be externally driven 4 https://bugs.webkit.org/show_bug.cgi?id=225663 5 6 Reviewed by Tim Horton. 7 8 Display-frequency animations (i.e. those driven by 1/60_s timers) should ultimately 9 be driven by Page::updateRendering(), since their output should be synchronized with 10 rendering updates. 11 12 As the first step, remove m_snapRubberbandTimer and m_scrollSnapTimer from 13 ScrollController and have it expose functions that tell its client to start and stop 14 the animation, and a per-frame callback. Give ScrollAnimator a 1/60_s timer 15 to drive this, temporarily. 16 17 * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h: 18 * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm: 19 (WebCore::ScrollingTreeScrollingNodeDelegateMac::startAnimationCallback): 20 (WebCore::ScrollingTreeScrollingNodeDelegateMac::stopAnimationCallback): 21 (WebCore::ScrollingTreeScrollingNodeDelegateMac::scrollControllerAnimationTimerFired): 22 * platform/ScrollAnimator.cpp: 23 (WebCore::ScrollAnimator::ScrollAnimator): 24 (WebCore::ScrollAnimator::startAnimationCallback): 25 (WebCore::ScrollAnimator::stopAnimationCallback): 26 (WebCore::ScrollAnimator::scrollControllerAnimationTimerFired): 27 * platform/ScrollAnimator.h: 28 * platform/ScrollController.cpp: 29 (WebCore::ScrollController::animationCallback): 30 (WebCore::ScrollController::startOrStopAnimationCallbacks): 31 (WebCore::ScrollController::setIsAnimatingRubberBand): 32 (WebCore::ScrollController::setIsAnimatingScrollSnap): 33 (WebCore::ScrollController::updateScrollSnapAnimatingState): 34 (WebCore::ScrollController::updateRubberBandAnimatingState): 35 * platform/ScrollController.h: 36 * platform/ScrollSnapAnimatorState.cpp: 37 (WebCore::ScrollSnapAnimatorState::currentAnimatedScrollOffset const): 38 * platform/ScrollSnapAnimatorState.h: 39 * platform/mac/ScrollController.mm: 40 (WebCore::ScrollController::stopAllTimers): 41 (WebCore::ScrollController::handleWheelEvent): 42 (WebCore::ScrollController::updateRubberBandAnimatingState): 43 (WebCore::ScrollController::isScrollSnapInProgress const): 44 (WebCore::ScrollController::stopRubberbanding): 45 (WebCore::ScrollController::startRubberbandAnimation): 46 (WebCore::ScrollController::stopSnapRubberbandAnimation): 47 (WebCore::ScrollController::snapRubberBand): 48 (WebCore::ScrollController::isRubberBandInProgressInternal const): 49 (WebCore::ScrollController::scheduleStatelessScrollSnap): 50 (WebCore::ScrollController::statelessSnapTransitionTimerFired): 51 (WebCore::ScrollController::processWheelEventForScrollSnap): 52 (WebCore::ScrollController::startScrollSnapAnimation): 53 (WebCore::ScrollController::stopScrollSnapAnimation): 54 (WebCore::ScrollController::updateScrollSnapAnimatingState): 55 (WebCore::ScrollController::snapRubberBandTimerFired): Deleted. 56 (WebCore::ScrollController::startSnapRubberbandTimer): Deleted. 57 (WebCore::ScrollController::stopSnapRubberbandTimer): Deleted. 58 (WebCore::ScrollController::startScrollSnapTimer): Deleted. 59 (WebCore::ScrollController::stopScrollSnapTimer): Deleted. 60 (WebCore::ScrollController::scrollSnapTimerFired): Deleted. 61 1 62 2021-05-11 Geoffrey Garen <ggaren@apple.com> 2 63 -
trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h
r271937 r277350 31 31 32 32 #include "ScrollController.h" 33 #include <wtf/RunLoop.h> 33 34 34 35 OBJC_CLASS NSScrollerImp; … … 74 75 // ScrollControllerClient. 75 76 std::unique_ptr<ScrollControllerTimer> createTimer(Function<void()>&&) final; 77 void startAnimationCallback(ScrollController&) final; 78 void stopAnimationCallback(ScrollController&) final; 79 76 80 bool allowsHorizontalStretching(const PlatformWheelEvent&) const final; 77 81 bool allowsVerticalStretching(const PlatformWheelEvent&) const final; … … 89 93 90 94 bool scrollPositionIsNotRubberbandingEdge(const FloatPoint&) const; 95 void scrollControllerAnimationTimerFired(); 91 96 92 97 #if ENABLE(CSS_SCROLL_SNAP) … … 103 108 104 109 ScrollController m_scrollController; 105 106 bool m_inMomentumPhase { false };107 110 108 111 RetainPtr<NSScrollerImp> m_verticalScrollerImp; 109 112 RetainPtr<NSScrollerImp> m_horizontalScrollerImp; 113 114 std::unique_ptr<RunLoop::Timer<ScrollingTreeScrollingNodeDelegateMac>> m_scrollControllerAnimationTimer; 115 116 bool m_inMomentumPhase { false }; 110 117 }; 111 118 -
trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm
r277083 r277350 226 226 } 227 227 228 void ScrollingTreeScrollingNodeDelegateMac::startAnimationCallback(ScrollController&) 229 { 230 if (!m_scrollControllerAnimationTimer) 231 m_scrollControllerAnimationTimer = WTF::makeUnique<RunLoop::Timer<ScrollingTreeScrollingNodeDelegateMac>>(RunLoop::current(), this, &ScrollingTreeScrollingNodeDelegateMac::scrollControllerAnimationTimerFired); 232 233 if (m_scrollControllerAnimationTimer->isActive()) 234 return; 235 236 m_scrollControllerAnimationTimer->startRepeating(1_s / 60.); 237 } 238 239 void ScrollingTreeScrollingNodeDelegateMac::stopAnimationCallback(ScrollController&) 240 { 241 if (m_scrollControllerAnimationTimer) 242 m_scrollControllerAnimationTimer->stop(); 243 } 244 245 void ScrollingTreeScrollingNodeDelegateMac::scrollControllerAnimationTimerFired() 246 { 247 m_scrollController.animationCallback(MonotonicTime::now()); 248 } 249 228 250 bool ScrollingTreeScrollingNodeDelegateMac::allowsHorizontalStretching(const PlatformWheelEvent& wheelEvent) const 229 251 { -
trunk/Source/WebCore/platform/ScrollAnimator.cpp
r276353 r277350 57 57 #if ENABLE(CSS_SCROLL_SNAP) || ENABLE(RUBBER_BANDING) 58 58 , m_scrollController(*this) 59 , m_scrollControllerAnimationTimer(*this, &ScrollAnimator::scrollControllerAnimationTimerFired) 59 60 #endif 60 61 , m_scrollAnimation(makeUnique<ScrollAnimationSmooth>( … … 334 335 }); 335 336 } 337 338 void ScrollAnimator::startAnimationCallback(ScrollController&) 339 { 340 if (m_scrollControllerAnimationTimer.isActive()) 341 return; 342 343 m_scrollControllerAnimationTimer.startRepeating(1_s / 60.); 344 } 345 346 void ScrollAnimator::stopAnimationCallback(ScrollController&) 347 { 348 m_scrollControllerAnimationTimer.stop(); 349 } 350 351 void ScrollAnimator::scrollControllerAnimationTimerFired() 352 { 353 m_scrollController.animationCallback(MonotonicTime::now()); 354 } 336 355 #endif 337 356 -
trunk/Source/WebCore/platform/ScrollAnimator.h
r276353 r277350 35 35 #include "PlatformWheelEvent.h" 36 36 #include "ScrollTypes.h" 37 #include "Timer.h" 37 38 #include "WheelEventTestMonitor.h" 38 39 #include <wtf/FastMalloc.h> … … 147 148 #if ENABLE(CSS_SCROLL_SNAP) || ENABLE(RUBBER_BANDING) 148 149 std::unique_ptr<ScrollControllerTimer> createTimer(Function<void()>&&) final; 150 151 void startAnimationCallback(ScrollController&) final; 152 void stopAnimationCallback(ScrollController&) final; 153 154 void scrollControllerAnimationTimerFired(); 149 155 #endif 150 156 … … 181 187 #if ENABLE(CSS_SCROLL_SNAP) || ENABLE(RUBBER_BANDING) 182 188 ScrollController m_scrollController; 189 Timer m_scrollControllerAnimationTimer; 183 190 #endif 184 191 FloatPoint m_currentPosition; -
trunk/Source/WebCore/platform/ScrollController.cpp
r277083 r277350 31 31 #include "PlatformWheelEvent.h" 32 32 #include "WheelEventTestMonitor.h" 33 #include <wtf/text/TextStream.h> 33 34 34 35 #if ENABLE(CSS_SCROLL_SNAP) … … 44 45 : m_client(client) 45 46 { 47 } 48 49 void ScrollController::animationCallback(MonotonicTime currentTime) 50 { 51 LOG_WITH_STREAM(Scrolling, stream << "ScrollController " << this << " animationCallback: isAnimatingRubberBand " << m_isAnimatingRubberBand << " isAnimatingScrollSnap " << m_isAnimatingScrollSnap); 52 53 updateScrollSnapAnimatingState(currentTime); 54 updateRubberBandAnimatingState(currentTime); 55 } 56 57 void ScrollController::startOrStopAnimationCallbacks() 58 { 59 bool needsCallbacks = m_isAnimatingRubberBand || m_isAnimatingScrollSnap; 60 if (needsCallbacks == m_isRunningAnimatingCallback) 61 return; 62 63 if (needsCallbacks) { 64 m_client.startAnimationCallback(*this); 65 m_isRunningAnimatingCallback = true; 66 return; 67 } 68 69 m_client.stopAnimationCallback(*this); 70 m_isRunningAnimatingCallback = false; 71 } 72 73 void ScrollController::setIsAnimatingRubberBand(bool isAnimatingRubberBand) 74 { 75 if (isAnimatingRubberBand == m_isAnimatingRubberBand) 76 return; 77 78 m_isAnimatingRubberBand = isAnimatingRubberBand; 79 startOrStopAnimationCallbacks(); 80 } 81 82 void ScrollController::setIsAnimatingScrollSnap(bool isAnimatingScrollSnap) 83 { 84 if (isAnimatingScrollSnap == m_isAnimatingScrollSnap) 85 return; 86 87 m_isAnimatingScrollSnap = isAnimatingScrollSnap; 88 startOrStopAnimationCallbacks(); 46 89 } 47 90 … … 170 213 } 171 214 215 void ScrollController::updateScrollSnapAnimatingState(MonotonicTime) 216 { 217 218 } 219 220 void ScrollController::updateRubberBandAnimatingState(MonotonicTime) 221 { 222 223 } 224 172 225 #endif // PLATFORM(MAC) 173 226 -
trunk/Source/WebCore/platform/ScrollController.h
r275354 r277350 71 71 72 72 public: 73 // Only used for non-animation timers. 73 74 virtual std::unique_ptr<ScrollControllerTimer> createTimer(Function<void()>&&) = 0; 75 76 virtual void startAnimationCallback(ScrollController&) = 0; 77 virtual void stopAnimationCallback(ScrollController&) = 0; 74 78 75 79 #if ENABLE(RUBBER_BANDING) … … 131 135 void stopAllTimers(); 132 136 void scrollPositionChanged(); 137 138 // Should be called periodically by the client. Started by startAnimationCallback(), stopped by stopAnimationCallback(). 139 void animationCallback(MonotonicTime); 133 140 134 141 #if ENABLE(CSS_SCROLL_SNAP) … … 172 179 #endif 173 180 181 void updateScrollSnapAnimatingState(MonotonicTime); 182 void updateRubberBandAnimatingState(MonotonicTime); 183 184 void setIsAnimatingRubberBand(bool); 185 void setIsAnimatingScrollSnap(bool); 186 174 187 #if PLATFORM(MAC) 175 188 #if ENABLE(CSS_SCROLL_SNAP) 176 void s crollSnapTimerFired();177 void st artScrollSnapTimer();178 void stopScrollSnapTimer(); 189 void startScrollSnapAnimation(); 190 void stopScrollSnapAnimation(); 191 179 192 bool shouldOverrideMomentumScrolling() const; 180 193 void statelessSnapTransitionTimerFired(); … … 185 198 186 199 #if ENABLE(RUBBER_BANDING) 187 void startSnapRubberbandTimer(); 188 void stopSnapRubberbandTimer(); 200 void startRubberbandAnimation(); 201 void stopSnapRubberbandAnimation(); 202 189 203 void snapRubberBand(); 190 void snapRubberBandTimerFired();191 204 bool shouldRubberBandInHorizontalDirection(const PlatformWheelEvent&) const; 192 205 bool shouldRubberBandInDirection(ScrollDirection) const; … … 197 210 #endif 198 211 212 void startOrStopAnimationCallbacks(); 213 199 214 ScrollControllerClient& m_client; 200 215 #if ENABLE(CSS_SCROLL_SNAP) … … 202 217 bool m_activeScrollSnapIndexDidChange { false }; 203 218 #endif 219 220 bool m_isRunningAnimatingCallback { false }; 221 bool m_isAnimatingRubberBand { false }; 222 bool m_isAnimatingScrollSnap { false }; 204 223 205 224 #if PLATFORM(MAC) … … 217 236 FloatSize m_dragEndedScrollingVelocity; 218 237 std::unique_ptr<ScrollControllerTimer> m_statelessSnapTransitionTimer; 219 std::unique_ptr<ScrollControllerTimer> m_scrollSnapTimer;220 238 #endif 221 239 … … 226 244 FloatSize m_origVelocity; 227 245 RectEdges<bool> m_rubberBandingEdges; 228 std::unique_ptr<ScrollControllerTimer> m_snapRubberbandTimer;229 246 #endif 230 247 -
trunk/Source/WebCore/platform/ScrollSnapAnimatorState.cpp
r277083 r277350 80 80 } 81 81 82 FloatPoint ScrollSnapAnimatorState::currentAnimatedScrollOffset( bool& isAnimationComplete) const82 FloatPoint ScrollSnapAnimatorState::currentAnimatedScrollOffset(MonotonicTime currentTime, bool& isAnimationComplete) const 83 83 { 84 84 if (!m_momentumCalculator) { … … 87 87 } 88 88 89 Seconds elapsedTime = MonotonicTime::now()- m_startTime;89 Seconds elapsedTime = currentTime - m_startTime; 90 90 isAnimationComplete = elapsedTime >= m_momentumCalculator->animationDuration(); 91 91 return m_momentumCalculator->scrollOffsetAfterElapsedTime(elapsedTime); -
trunk/Source/WebCore/platform/ScrollSnapAnimatorState.h
r277083 r277350 76 76 } 77 77 78 FloatPoint currentAnimatedScrollOffset( bool& isAnimationComplete) const;78 FloatPoint currentAnimatedScrollOffset(MonotonicTime, bool& isAnimationComplete) const; 79 79 80 80 // State transition helpers. -
trunk/Source/WebCore/platform/mac/ScrollController.mm
r272878 r277350 78 78 void ScrollController::stopAllTimers() 79 79 { 80 #if ENABLE(RUBBER_BANDING)81 if (m_snapRubberbandTimer)82 m_snapRubberbandTimer->stop();83 #endif84 85 80 #if ENABLE(CSS_SCROLL_SNAP) 86 81 if (m_statelessSnapTransitionTimer) 87 82 m_statelessSnapTransitionTimer->stop(); 88 89 if (m_scrollSnapTimer)90 m_scrollSnapTimer->stop();91 83 #endif 92 84 … … 123 115 m_stretchScrollForce.setWidth(reboundDeltaForElasticDelta(stretchAmount.width())); 124 116 m_stretchScrollForce.setHeight(reboundDeltaForElasticDelta(stretchAmount.height())); 125 m_overflowScrollDelta = FloatSize();126 127 stopSnapRubberband Timer();117 m_overflowScrollDelta = { }; 118 119 stopSnapRubberbandAnimation(); 128 120 updateRubberBandingState(); 129 121 return true; … … 131 123 132 124 if (wheelEvent.phase() == PlatformWheelEventPhase::Ended) { 125 // FIXME: This triggers the rubberband timer even when we don't start rubberbanding. 133 126 snapRubberBand(); 134 127 updateRubberBandingState(); … … 137 130 138 131 bool isMomentumScrollEvent = (wheelEvent.momentumPhase() != PlatformWheelEventPhase::None); 139 if (m_ignoreMomentumScrolls && (isMomentumScrollEvent || m_ snapRubberbandTimer)) {132 if (m_ignoreMomentumScrolls && (isMomentumScrollEvent || m_isAnimatingRubberBand)) { 140 133 if (wheelEvent.momentumPhase() == PlatformWheelEventPhase::Ended) { 141 134 m_ignoreMomentumScrolls = false; … … 153 146 154 147 // Reset overflow values because we may decide to remove delta at various points and put it into overflow. 155 m_overflowScrollDelta = FloatSize();148 m_overflowScrollDelta = { }; 156 149 157 150 IntSize stretchAmount = m_client.stretchAmount(); … … 388 381 } 389 382 390 void ScrollController::snapRubberBandTimerFired() 391 { 383 void ScrollController::updateRubberBandAnimatingState(MonotonicTime currentTime) 384 { 385 if (!m_isAnimatingRubberBand) 386 return; 387 392 388 if (isScrollSnapInProgress()) 393 389 return; 394 390 395 LOG_WITH_STREAM(Scrolling, stream << "ScrollController:: snapRubberBandTimerFired() - main thread " << isMainThread());391 LOG_WITH_STREAM(Scrolling, stream << "ScrollController::updateRubberBandAnimatingState() - main thread " << isMainThread()); 396 392 397 393 if (!m_momentumScrollInProgress || m_ignoreMomentumScrolls) { 398 auto timeDelta = MonotonicTime::now()- m_startTime;394 auto timeDelta = currentTime - m_startTime; 399 395 400 396 if (m_startStretch.isZero()) { … … 435 431 } 436 432 } else { 437 m_startTime = MonotonicTime::now();433 m_startTime = currentTime; 438 434 m_startStretch = { }; 439 435 if (!isRubberBandInProgressInternal()) 440 stopSnapRubberband Timer();436 stopSnapRubberbandAnimation(); 441 437 } 442 438 … … 472 468 473 469 #if ENABLE(CSS_SCROLL_SNAP) 474 if (m_inScrollGesture || m_momentumScrollInProgress || m_ scrollSnapTimer)470 if (m_inScrollGesture || m_momentumScrollInProgress || m_isAnimatingScrollSnap) 475 471 return true; 476 472 #endif … … 481 477 { 482 478 #if ENABLE(RUBBER_BANDING) 483 stopSnapRubberband Timer();479 stopSnapRubberbandAnimation(); 484 480 m_stretchScrollForce = { }; 485 481 m_startTime = { }; … … 491 487 492 488 #if ENABLE(RUBBER_BANDING) 493 void ScrollController::start SnapRubberbandTimer()489 void ScrollController::startRubberbandAnimation() 494 490 { 495 491 m_client.willStartRubberBandSnapAnimation(); 496 492 497 // Make a new one each time to ensure it fires on the current RunLoop. 498 m_snapRubberbandTimer = m_client.createTimer([this] { 499 snapRubberBandTimerFired(); 500 }); 501 m_snapRubberbandTimer->startRepeating(1_s / 60.); 493 setIsAnimatingRubberBand(true); 502 494 503 495 m_client.deferWheelEventTestCompletionForReason(reinterpret_cast<WheelEventTestMonitor::ScrollableAreaIdentifier>(this), WheelEventTestMonitor::RubberbandInProgress); 504 496 } 505 497 506 void ScrollController::stopSnapRubberband Timer()498 void ScrollController::stopSnapRubberbandAnimation() 507 499 { 508 500 m_client.didStopRubberbandSnapAnimation(); 509 501 510 if (m_snapRubberbandTimer) { 511 m_snapRubberbandTimer->stop(); 512 m_snapRubberbandTimer = nullptr; 513 } 502 setIsAnimatingRubberBand(false); 514 503 515 504 m_client.removeWheelEventTestCompletionDeferralForReason(reinterpret_cast<WheelEventTestMonitor::ScrollableAreaIdentifier>(this), WheelEventTestMonitor::RubberbandInProgress); … … 522 511 m_momentumVelocity = { }; 523 512 524 if (m_ snapRubberbandTimer)513 if (m_isAnimatingRubberBand) 525 514 return; 526 515 … … 529 518 m_origVelocity = { }; 530 519 531 start SnapRubberbandTimer();520 startRubberbandAnimation(); 532 521 } 533 522 … … 548 537 bool ScrollController::isRubberBandInProgressInternal() const 549 538 { 550 if (!m_inScrollGesture && !m_momentumScrollInProgress && !m_ snapRubberbandTimer)539 if (!m_inScrollGesture && !m_momentumScrollInProgress && !m_isAnimatingRubberBand) 551 540 return false; 552 541 … … 660 649 void ScrollController::scheduleStatelessScrollSnap() 661 650 { 662 stopScrollSnap Timer();651 stopScrollSnapAnimation(); 663 652 if (m_statelessSnapTransitionTimer) { 664 653 m_statelessSnapTransitionTimer->stop(); … … 684 673 685 674 m_scrollSnapState->transitionToSnapAnimationState(m_client.scrollExtent(), m_client.viewportSize(), m_client.pageScaleFactor(), m_client.scrollOffset()); 686 startScrollSnap Timer();675 startScrollSnapAnimation(); 687 676 } 688 677 … … 713 702 case WheelEventStatus::UserScrollBegin: 714 703 case WheelEventStatus::UserScrolling: 715 stopScrollSnap Timer();704 stopScrollSnapAnimation(); 716 705 m_scrollSnapState->transitionToUserInteractionState(); 717 706 m_dragEndedScrollingVelocity = -wheelEvent.scrollingVelocity(); … … 719 708 case WheelEventStatus::UserScrollEnd: 720 709 m_scrollSnapState->transitionToSnapAnimationState(m_client.scrollExtent(), m_client.viewportSize(), m_client.pageScaleFactor(), m_client.scrollOffset()); 721 startScrollSnap Timer();710 startScrollSnapAnimation(); 722 711 break; 723 712 case WheelEventStatus::MomentumScrollBegin: … … 752 741 } 753 742 754 void ScrollController::startScrollSnap Timer()755 { 756 if (m_ scrollSnapTimer)757 return; 758 759 LOG_WITH_STREAM(ScrollSnap, stream << "ScrollController " << this << " startScrollSnap Timer(main thread " << isMainThread() << ")");743 void ScrollController::startScrollSnapAnimation() 744 { 745 if (m_isAnimatingScrollSnap) 746 return; 747 748 LOG_WITH_STREAM(ScrollSnap, stream << "ScrollController " << this << " startScrollSnapAnimation (main thread " << isMainThread() << ")"); 760 749 761 750 startDeferringWheelEventTestCompletionDueToScrollSnapping(); 762 751 m_client.willStartScrollSnapAnimation(); 763 m_scrollSnapTimer = m_client.createTimer([this] { 764 scrollSnapTimerFired(); 765 }); 766 m_scrollSnapTimer->startRepeating(1_s / 60.); 767 } 768 769 void ScrollController::stopScrollSnapTimer() 770 { 771 if (!m_scrollSnapTimer) 772 return; 773 774 LOG_WITH_STREAM(ScrollSnap, stream << "ScrollController " << this << " stopScrollSnapTimer (main thread " << isMainThread() << ")"); 752 setIsAnimatingScrollSnap(true); 753 } 754 755 void ScrollController::stopScrollSnapAnimation() 756 { 757 if (!m_isAnimatingScrollSnap) 758 return; 759 760 LOG_WITH_STREAM(ScrollSnap, stream << "ScrollController " << this << " stopScrollSnapAnimation (main thread " << isMainThread() << ")"); 775 761 776 762 stopDeferringWheelEventTestCompletionDueToScrollSnapping(); 777 763 m_client.didStopScrollSnapAnimation(); 778 764 779 m_scrollSnapTimer->stop(); 780 m_scrollSnapTimer = nullptr; 781 } 782 783 void ScrollController::scrollSnapTimerFired() 784 { 765 setIsAnimatingScrollSnap(false); 766 } 767 768 void ScrollController::updateScrollSnapAnimatingState(MonotonicTime currentTime) 769 { 770 if (!m_isAnimatingScrollSnap) 771 return; 772 785 773 if (!usesScrollSnap()) { 786 774 ASSERT_NOT_REACHED(); … … 789 777 790 778 bool isAnimationComplete; 791 auto animationOffset = m_scrollSnapState->currentAnimatedScrollOffset( isAnimationComplete);779 auto animationOffset = m_scrollSnapState->currentAnimatedScrollOffset(currentTime, isAnimationComplete); 792 780 auto currentOffset = m_client.scrollOffset(); 793 781 794 LOG_WITH_STREAM(ScrollSnap, stream << "ScrollController " << this << " scrollSnapTimerFired- isAnimationComplete " << isAnimationComplete << " currentOffset " << currentOffset << " (main thread " << isMainThread() << ")");782 LOG_WITH_STREAM(ScrollSnap, stream << "ScrollController " << this << " updateScrollSnapAnimatingState - isAnimationComplete " << isAnimationComplete << " currentOffset " << currentOffset << " (main thread " << isMainThread() << ")"); 795 783 796 784 m_client.immediateScrollByWithoutContentEdgeConstraints(FloatSize(animationOffset.x() - currentOffset.x(), animationOffset.y() - currentOffset.y())); 797 785 if (isAnimationComplete) { 798 786 m_scrollSnapState->transitionToDestinationReachedState(); 799 stopScrollSnap Timer();787 stopScrollSnapAnimation(); 800 788 } 801 789 }
Note:
See TracChangeset
for help on using the changeset viewer.