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

Unified Diff: third_party/WebKit/Source/core/animation/ScrollTimeline.h

Issue 2873493002: Basic ScrollTimeline implementation for Animation Worklet (Closed)
Patch Set: Switch back to RuntimeEnabled, fix nits Created 3 years, 6 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/core/animation/ScrollTimeline.h
diff --git a/third_party/WebKit/Source/core/animation/ScrollTimeline.h b/third_party/WebKit/Source/core/animation/ScrollTimeline.h
new file mode 100644
index 0000000000000000000000000000000000000000..4ab08e18c63c00b5633f59bae7814bec9b760ea2
--- /dev/null
+++ b/third_party/WebKit/Source/core/animation/ScrollTimeline.h
@@ -0,0 +1,57 @@
+// Copyright 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 ScrollTimeline_h
+#define ScrollTimeline_h
+
+#include "core/CoreExport.h"
+#include "core/animation/AnimationTimeline.h"
+#include "core/animation/ScrollTimelineOptions.h"
+#include "core/dom/Element.h"
+#include "platform/bindings/ScriptWrappable.h"
+#include "platform/wtf/text/WTFString.h"
+
+namespace blink {
+
+// Implements the ScrollTimeline concept from the Scroll-linked Animations spec.
alancutter (OOO until 2018) 2017/07/04 04:13:41 It's worth adding the spec link here since it's di
smcgruer 2017/07/04 13:48:53 Done.
+//
+// A ScrollTimeline is a special form of AnimationTimeline whose time values are
+// not determined by wall-clock time but instead the progress of scrolling in a
+// scroll container. The user is able to specify which scroll container to
+// track, the direction of scroll they care about, and various attributes to
+// control the conversion of scroll amount to time output.
+class CORE_EXPORT ScrollTimeline final : public AnimationTimeline {
+ DEFINE_WRAPPERTYPEINFO();
+
+ public:
+ enum ScrollDirection {
+ Block,
+ Inline,
+ };
+
+ static ScrollTimeline* Create(Document&,
+ ScrollTimelineOptions,
+ ExceptionState&);
+
+ // AnimationTimeline implementation.
+ double currentTime(bool& is_null) override;
alancutter (OOO until 2018) 2017/07/04 04:13:41 Let's use the final keyword here and save override
smcgruer 2017/07/04 13:48:53 Done.
+
+ // IDL API implementation.
+ Element* scrollSource();
+ String orientation();
+ void timeRange(DoubleOrScrollTimelineAutoKeyword&);
+
+ DECLARE_VIRTUAL_TRACE();
+
+ private:
+ ScrollTimeline(const Document&, Element*, ScrollDirection, double);
+
+ Member<Element> scroll_source_;
+ ScrollDirection orientation_;
+ double time_range_;
+};
+
+} // namespace blink
+
+#endif

Powered by Google App Engine
This is Rietveld 408576698