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

Unified Diff: third_party/WebKit/Source/core/animation/Animation.cpp

Issue 2806623003: Implement Animation constructor (Closed)
Patch Set: Rebase 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/Animation.cpp
diff --git a/third_party/WebKit/Source/core/animation/Animation.cpp b/third_party/WebKit/Source/core/animation/Animation.cpp
index 9fea2968cc53c92ba76ecd8c237ce0115b76dfb8..1b5ff420fa012e7a7ae26194496310c9843c2bfc 100644
--- a/third_party/WebKit/Source/core/animation/Animation.cpp
+++ b/third_party/WebKit/Source/core/animation/Animation.cpp
@@ -32,6 +32,7 @@
#include "core/animation/AnimationTimeline.h"
#include "core/animation/CompositorPendingAnimations.h"
+#include "core/animation/DocumentTimeline.h"
#include "core/animation/KeyframeEffectReadOnly.h"
#include "core/animation/css/CSSAnimations.h"
#include "core/dom/DOMNodeIds.h"
@@ -70,6 +71,7 @@ Animation* Animation::Create(AnimationEffectReadOnly* effect,
AnimationTimeline* timeline) {
if (!timeline) {
// FIXME: Support creating animations without a timeline.
+ NOTREACHED();
return nullptr;
}
@@ -84,6 +86,34 @@ Animation* Animation::Create(AnimationEffectReadOnly* effect,
return animation;
}
+Animation* Animation::Create(ExecutionContext* execution_context,
+ AnimationEffectReadOnly* effect,
+ ExceptionState& exception_state) {
+ if (!RuntimeEnabledFeatures::webAnimationsAPIEnabled()) {
suzyh_UTC10 (ex-contributor) 2017/06/06 06:21:48 Given I'm now selectively exposing this, do you th
alancutter (OOO until 2018) 2017/06/07 05:36:15 Yes, this branch should be unreachable now.
+ exception_state.ThrowTypeError("Illegal constructor");
+ return nullptr;
+ }
+
+ Document* document = ToDocument(execution_context);
+ return Create(effect, &document->Timeline());
+}
+
+Animation* Animation::Create(ExecutionContext* execution_context,
+ AnimationEffectReadOnly* effect,
+ AnimationTimeline* timeline,
+ ExceptionState& exception_state) {
+ if (!RuntimeEnabledFeatures::webAnimationsAPIEnabled()) {
+ exception_state.ThrowTypeError("Illegal constructor");
+ return nullptr;
+ }
+
+ if (!timeline) {
+ return Create(execution_context, effect, exception_state);
+ }
+
+ return Create(effect, timeline);
+}
+
Animation::Animation(ExecutionContext* execution_context,
AnimationTimeline& timeline,
AnimationEffectReadOnly* content)
« no previous file with comments | « third_party/WebKit/Source/core/animation/Animation.h ('k') | third_party/WebKit/Source/core/animation/Animation.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698