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

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

Issue 2650343008: Implement Element.scrollIntoView for scroll-behavior: smooth. (Closed)
Patch Set: Added SimTest. Created 3 years, 10 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/ProgrammaticScrollCoordinator.h
diff --git a/third_party/WebKit/Source/platform/scroll/ProgrammaticScrollCoordinator.h b/third_party/WebKit/Source/platform/scroll/ProgrammaticScrollCoordinator.h
new file mode 100644
index 0000000000000000000000000000000000000000..34cd9612ebbda30dd370c614fd8225e29366bfa5
--- /dev/null
+++ b/third_party/WebKit/Source/platform/scroll/ProgrammaticScrollCoordinator.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 ProgrammaticScrollCoordinator_h
+#define ProgrammaticScrollCoordinator_h
+
+#include <utility>
+#include <vector>
+#include "platform/scroll/ProgrammaticScrollAnimatorClient.h"
+#include "platform/scroll/ScrollTypes.h"
+
+namespace blink {
+
+class ScrollableArea;
+
+class PLATFORM_EXPORT ProgrammaticScrollCoordinator
+ : public ProgrammaticScrollAnimatorClient {
+ public:
+ static ProgrammaticScrollCoordinator* create();
+
+ ~ProgrammaticScrollCoordinator();
+
+ // 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 ProgrammaticScrollCoordinator();
+
+ private:
+ typedef std::pair<Member<ScrollableArea>, ScrollOffset> ScrollerAndOffsetPair;
+ std::vector<ScrollerAndOffsetPair> m_queue;
+};
+
+} // namespace blink
+
+#endif // ProgrammaticScrollCoordinator_h

Powered by Google App Engine
This is Rietveld 408576698