Chromium Code Reviews| 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 b6aa9faaca7005f07091ef3fa11042228d128c2c..f5f4cc2f90f060b86151283de29751f5fc7a278f 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" |
| @@ -69,6 +70,7 @@ Animation* Animation::Create(AnimationEffectReadOnly* effect, |
| AnimationTimeline* timeline) { |
| if (!timeline) { |
| // FIXME: Support creating animations without a timeline. |
| + NOTREACHED(); |
| return nullptr; |
| } |
| @@ -83,6 +85,39 @@ Animation* Animation::Create(AnimationEffectReadOnly* effect, |
| return animation; |
| } |
| +Animation* Animation::Create(ExecutionContext* execution_context, |
| + AnimationEffectReadOnly* effect, |
| + ExceptionState& exception_state) { |
| + if (!RuntimeEnabledFeatures::webAnimationsAPIEnabled()) { |
| + exception_state.ThrowTypeError("Illegal constructor"); |
| + return nullptr; |
| + } |
| + |
| + if (!execution_context || !execution_context->IsDocument()) { |
| + NOTREACHED(); |
|
alancutter (OOO until 2018)
2017/04/26 04:34:48
This is redundant with the ToDocument() call below
suzyh_UTC10 (ex-contributor)
2017/06/06 06:21:48
Removed.
|
| + 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) |