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

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

Issue 2650343008: Implement Element.scrollIntoView for scroll-behavior: smooth. (Closed)
Patch Set: Change the default setting. Created 3 years, 7 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() {}
12
13 void SmoothScrollSequencer::QueueAnimation(ScrollableArea* scrollable,
14 ScrollOffset offset) {
15 ScrollerAndOffsetPair scroller_offset(scrollable, offset);
16 queue_.push_back(scroller_offset);
17 }
18
19 void SmoothScrollSequencer::RunQueuedAnimations() {
20 if (queue_.IsEmpty()) {
21 current_scrollable_ = nullptr;
22 return;
23 }
24 ScrollerAndOffsetPair scroller_offset = queue_.back();
25 queue_.pop_back();
26 ScrollableArea* scrollable = scroller_offset.first;
27 current_scrollable_ = scrollable;
28 ScrollOffset offset = scroller_offset.second;
29 scrollable->GetProgrammaticScrollAnimator().AnimateToOffset(offset, true);
30 }
31
32 void SmoothScrollSequencer::AbortAnimations() {
33 if (current_scrollable_) {
34 current_scrollable_->GetProgrammaticScrollAnimator().CancelAnimation();
35 current_scrollable_ = nullptr;
36 }
37 queue_.clear();
38 }
39
40 DEFINE_TRACE(SmoothScrollSequencer) {
41 visitor->Trace(queue_);
42 visitor->Trace(current_scrollable_);
43 }
44
45 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/scroll/SmoothScrollSequencer.h ('k') | third_party/WebKit/Source/web/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698