Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Side by Side Diff: third_party/WebKit/Source/platform/scroll/SmoothScrollSequencer.cpp

Issue 2650343008: Implement Element.scrollIntoView for scroll-behavior: smooth. (Closed)
Patch Set: Rebase Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 #include "platform/scroll/SmoothScrollSequencer.h"
5
6 #include "platform/scroll/ProgrammaticScrollAnimator.h"
7 #include "platform/scroll/ScrollableArea.h"
8
9 namespace blink {
10
11 SmoothScrollSequencer* SmoothScrollSequencer::create() {
12 return new SmoothScrollSequencer();
13 }
14
15 SmoothScrollSequencer::SmoothScrollSequencer() {}
16
17 SmoothScrollSequencer::~SmoothScrollSequencer() {}
18
19 void SmoothScrollSequencer::queueAnimation(ScrollableArea* scrollable,
20 ScrollOffset offset) {
21 ScrollerAndOffsetPair scrollerOffset(scrollable, offset);
22 m_queue.push_back(scrollerOffset);
23 }
24
25 void SmoothScrollSequencer::runQueuedAnimations() {
26 if (!m_queue.empty()) {
27 ScrollerAndOffsetPair scrollerOffset = m_queue.back();
28 ScrollableArea* scrollable = scrollerOffset.first;
29 ScrollOffset offset = scrollerOffset.second;
30 scrollable->programmaticScrollAnimator().animateToOffset(offset);
bokan 2017/04/07 15:56:52 Unless I'm missing something, I think it'd be bett
sunyunjia 2017/05/12 18:40:25 Done.
31 }
32 }
33
34 void SmoothScrollSequencer::notifyAnimationFinished() {
35 if (!m_queue.empty()) {
36 m_queue.pop_back();
37 runQueuedAnimations();
38 }
39 }
40
41 void SmoothScrollSequencer::abortAnimations() {
42 m_queue.clear();
43 }
44
45 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698