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

Unified Diff: Source/core/animation/Animation.h

Issue 182063005: Web Animations API: Refactor IDL input conversion out of Animation (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Move timing input conversion from Animation into Timing Created 6 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
« no previous file with comments | « no previous file | Source/core/animation/Animation.cpp » ('j') | Source/core/animation/Animation.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/animation/Animation.h
diff --git a/Source/core/animation/Animation.h b/Source/core/animation/Animation.h
index f360e3c9a57909c5249bf91080146c5a504681ce..acd0c7889bdcc56e7e5a1c704ca764bb1d104ff2 100644
--- a/Source/core/animation/Animation.h
+++ b/Source/core/animation/Animation.h
@@ -48,9 +48,12 @@ public:
static PassRefPtr<Animation> create(PassRefPtr<Element>, PassRefPtrWillBeRawPtr<AnimationEffect>, const Timing&, Priority = DefaultPriority, PassOwnPtr<EventDelegate> = nullptr);
// Web Animations API Bindings constructors.
- static PassRefPtr<Animation> create(Element*, Vector<Dictionary> keyframeDictionaryVector, Dictionary timingInput);
- static PassRefPtr<Animation> create(Element*, Vector<Dictionary> keyframeDictionaryVector, double timingInput);
- static PassRefPtr<Animation> create(Element*, Vector<Dictionary> keyframeDictionaryVector);
+ template<typename E, typename T = double>
+ static PassRefPtr<Animation> create(Element* element, E effectInput, T timingInput = Timing::initialIterationDuration())
+ {
+ ASSERT(RuntimeEnabledFeatures::webAnimationsAPIEnabled());
+ return adoptRef(new Animation(element, convertEffectInput(element, effectInput), Timing::convertInput(timingInput), DefaultPriority, nullptr));
+ }
// FIXME: Move all of these setter methods out of Animation,
// possibly into a new class (TimingInput?).
@@ -94,11 +97,9 @@ protected:
virtual double calculateTimeToEffectChange(bool forwards, double inheritedTime, double timeToNextIteration) const OVERRIDE;
private:
+ static PassRefPtrWillBeRawPtr<AnimationEffect> convertEffectInput(Element*, Vector<Dictionary> keyframeDictionaryVector, bool unsafe = false);
+ static PassRefPtrWillBeRawPtr<AnimationEffect> convertEffectInput(Element*, PassRefPtrWillBeRawPtr<AnimationEffect> effect) { return effect; }
static void populateTiming(Timing&, Dictionary);
- // createUnsafe should only be directly called from tests.
- static PassRefPtr<Animation> createUnsafe(Element*, Vector<Dictionary> keyframeDictionaryVector, Dictionary timingInput);
- static PassRefPtr<Animation> createUnsafe(Element*, Vector<Dictionary> keyframeDictionaryVector, double timingInput);
- static PassRefPtr<Animation> createUnsafe(Element*, Vector<Dictionary> keyframeDictionaryVector);
Animation(PassRefPtr<Element>, PassRefPtrWillBeRawPtr<AnimationEffect>, const Timing&, Priority, PassOwnPtr<EventDelegate>);
« no previous file with comments | « no previous file | Source/core/animation/Animation.cpp » ('j') | Source/core/animation/Animation.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698