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

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

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 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..dcaabf346f463cf989a6aa90849849ffb12d7920
--- /dev/null
+++ b/third_party/WebKit/Source/platform/scroll/SmoothScrollSequencer.h
@@ -0,0 +1,46 @@
+// 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 <vector>
+#include "platform/scroll/ProgrammaticScrollAnimatorClient.h"
+#include "platform/scroll/ScrollTypes.h"
+
+namespace blink {
+
+class ScrollableArea;
+
+class PLATFORM_EXPORT SmoothScrollSequencer
bokan 2017/04/07 15:56:52 Please add a class-level comment about what this c
sunyunjia 2017/05/12 18:40:25 Done.
+ : public ProgrammaticScrollAnimatorClient {
+ public:
+ static SmoothScrollSequencer* create();
+
+ ~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 and sets itself as a client
+ // of ProgrammaticScrollAnimator to receive finish notification.
+ void runQueuedAnimations();
+
+ // Pop the back of the queue and run the next animation in the queue.
+ void notifyAnimationFinished();
+
+ // Abort the currently running anmation and all the animations in the queue.
+ void abortAnimations();
+
+ protected:
+ explicit SmoothScrollSequencer();
bokan 2017/04/07 15:56:52 There's no argument here so there's no implicit co
sunyunjia 2017/05/12 18:40:25 Done.
+
+ private:
+ typedef std::pair<Member<ScrollableArea>, ScrollOffset> ScrollerAndOffsetPair;
+ std::vector<ScrollerAndOffsetPair> m_queue;
+};
+
+} // namespace blink
+
+#endif // SmoothScrollSequencer_h

Powered by Google App Engine
This is Rietveld 408576698