Chromium Code Reviews| Index: third_party/WebKit/Source/platform/scroll/ProgrammaticScrollAnimator.cpp |
| diff --git a/third_party/WebKit/Source/platform/scroll/ProgrammaticScrollAnimator.cpp b/third_party/WebKit/Source/platform/scroll/ProgrammaticScrollAnimator.cpp |
| index b717e08a653fad1d135766e18a01070cddfca373..bdf2e2bbcefb9d366c1d678f1e9260dd32e2f85e 100644 |
| --- a/third_party/WebKit/Source/platform/scroll/ProgrammaticScrollAnimator.cpp |
| +++ b/third_party/WebKit/Source/platform/scroll/ProgrammaticScrollAnimator.cpp |
| @@ -10,6 +10,7 @@ |
| #include "platform/geometry/IntSize.h" |
| #include "platform/graphics/GraphicsLayer.h" |
| #include "platform/scroll/ScrollableArea.h" |
| +#include "platform/scroll/SmoothScrollSequencer.h" |
| #include "platform/wtf/PtrUtil.h" |
| #include "public/platform/Platform.h" |
| #include "public/platform/WebCompositorSupport.h" |
| @@ -39,12 +40,15 @@ void ProgrammaticScrollAnimator::ScrollToOffsetWithoutAnimation( |
| NotifyOffsetChanged(offset); |
| } |
| -void ProgrammaticScrollAnimator::AnimateToOffset(const ScrollOffset& offset) { |
| +void ProgrammaticScrollAnimator::AnimateToOffset( |
| + const ScrollOffset& offset, |
| + bool sequenced_for_smooth_scroll) { |
| if (run_state_ == RunState::kPostAnimationCleanup) |
| ResetAnimationState(); |
| start_time_ = 0.0; |
| target_offset_ = offset; |
| + sequenced_for_smooth_scroll_ = sequenced_for_smooth_scroll; |
| animation_curve_ = CompositorScrollOffsetAnimationCurve::Create( |
| CompositorOffsetFromBlinkOffset(target_offset_), |
| CompositorScrollOffsetAnimationCurve::kScrollDurationDeltaBased); |
| @@ -76,6 +80,10 @@ void ProgrammaticScrollAnimator::TickAnimation(double monotonic_time) { |
| if (is_finished) { |
| run_state_ = RunState::kPostAnimationCleanup; |
| + if (sequenced_for_smooth_scroll_) { |
| + sequenced_for_smooth_scroll_ = false; |
| + GetScrollableArea()->GetSmoothScrollSequencer()->RunQueuedAnimations(); |
|
bokan
2017/05/15 17:15:28
You need to handle the case where GetSmoothScrollS
sunyunjia
2017/05/19 16:24:29
Done.
|
| + } |
| } else if (!scrollable_area_->ScheduleAnimation()) { |
| NotifyOffsetChanged(offset); |
| ResetAnimationState(); |
| @@ -169,6 +177,10 @@ void ProgrammaticScrollAnimator::NotifyCompositorAnimationFinished( |
| int group_id) { |
| DCHECK_NE(run_state_, RunState::kRunningOnCompositorButNeedsUpdate); |
| ScrollAnimatorCompositorCoordinator::CompositorAnimationFinished(group_id); |
| + if (sequenced_for_smooth_scroll_) { |
|
bokan
2017/05/15 17:15:28
Put these into an "AnimationFinished" helper and c
sunyunjia
2017/05/19 16:24:29
Done.
|
| + sequenced_for_smooth_scroll_ = false; |
| + GetScrollableArea()->GetSmoothScrollSequencer()->RunQueuedAnimations(); |
| + } |
| } |
| DEFINE_TRACE(ProgrammaticScrollAnimator) { |