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

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

Issue 2814523002: Web Animations: Coalesce constructors where possible. (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/core/animation/ElementAnimation.h
diff --git a/third_party/WebKit/Source/core/animation/ElementAnimation.h b/third_party/WebKit/Source/core/animation/ElementAnimation.h
index 7c33edafe13c3a93ac159de3e4ef19229a323ca9..625df831dbb93af7ac2ec53ada9e88ba5dece985 100644
--- a/third_party/WebKit/Source/core/animation/ElementAnimation.h
+++ b/third_party/WebKit/Source/core/animation/ElementAnimation.h
@@ -33,11 +33,11 @@
#include "bindings/core/v8/DictionarySequenceOrDictionary.h"
#include "bindings/core/v8/ScriptState.h"
+#include "bindings/core/v8/UnrestrictedDoubleOrKeyframeEffectOptions.h"
#include "core/animation/DocumentTimeline.h"
#include "core/animation/EffectInput.h"
#include "core/animation/ElementAnimations.h"
#include "core/animation/KeyframeEffect.h"
-#include "core/animation/KeyframeEffectOptions.h"
#include "core/animation/KeyframeEffectReadOnly.h"
#include "core/animation/TimingInput.h"
#include "core/dom/Document.h"
@@ -55,25 +55,7 @@ class ElementAnimation {
static Animation* animate(ScriptState* script_state,
Element& element,
const DictionarySequenceOrDictionary& effect_input,
- double duration,
- ExceptionState& exception_state) {
- EffectModel* effect = EffectInput::Convert(
- &element, effect_input, ExecutionContext::From(script_state),
- exception_state);
- if (exception_state.HadException())
- return nullptr;
-
- Timing timing;
- if (!TimingInput::Convert(duration, timing, exception_state))
- return nullptr;
-
- return animate(element, effect, timing);
- }
-
- static Animation* animate(ScriptState* script_state,
- Element& element,
- const DictionarySequenceOrDictionary& effect_input,
- const KeyframeEffectOptions& options,
+ UnrestrictedDoubleOrKeyframeEffectOptions options,
ExceptionState& exception_state) {
EffectModel* effect = EffectInput::Convert(
&element, effect_input, ExecutionContext::From(script_state),
@@ -86,9 +68,12 @@ class ElementAnimation {
exception_state))
return nullptr;
- Animation* animation = animate(element, effect, timing);
- animation->setId(options.id());
- return animation;
+ if (options.isKeyframeEffectOptions()) {
+ Animation* animation = animate(element, effect, timing);
+ animation->setId(options.getAsKeyframeEffectOptions().id());
+ return animation;
+ }
+ return animate(element, effect, timing);
}
static Animation* animate(ScriptState* script_state,
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/BUILD.gn ('k') | third_party/WebKit/Source/core/animation/ElementAnimation.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698