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

Unified Diff: third_party/WebKit/Source/platform/scroll/SmoothScrollSequencer.h

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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/scroll/SmoothScrollSequencer.h
diff --git a/third_party/WebKit/Source/platform/scroll/SmoothScrollSequencer.h b/third_party/WebKit/Source/platform/scroll/SmoothScrollSequencer.h
new file mode 100644
index 0000000000000000000000000000000000000000..3c72499c587766dd357627092074c388ee8c2eba
--- /dev/null
+++ b/third_party/WebKit/Source/platform/scroll/SmoothScrollSequencer.h
@@ -0,0 +1,41 @@
+// Copyright (c) 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+#ifndef SmoothScrollSequencer_h
+#define SmoothScrollSequencer_h
+
+#include <utility>
+#include "platform/heap/Handle.h"
+#include "platform/scroll/ScrollTypes.h"
+
+namespace blink {
+
+class ScrollableArea;
+
+// A sequencer that queues the nested scrollers from inside to outside,
+// so that they can be animated from outside to inside when smooth scroll
+// is called.
+class PLATFORM_EXPORT SmoothScrollSequencer final
+ : public GarbageCollected<SmoothScrollSequencer> {
+ public:
+ SmoothScrollSequencer();
+ // Add a scroll offset animation to the back of a queue.
+ void QueueAnimation(ScrollableArea*, ScrollOffset);
+
+ // Run the animation at the back of the queue.
+ void RunQueuedAnimations();
+
+ // Abort the currently running animation and all the animations in the queue.
+ void AbortAnimations();
+
+ DECLARE_TRACE();
+
+ private:
+ typedef std::pair<Member<ScrollableArea>, ScrollOffset> ScrollerAndOffsetPair;
+ HeapVector<ScrollerAndOffsetPair> queue_;
+ Member<ScrollableArea> current_scrollable_;
+};
+
+} // namespace blink
+
+#endif // SmoothScrollSequencer_h

Powered by Google App Engine
This is Rietveld 408576698