Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / core / animation / CompositorAnimations.h
index d95196d..64a039f 100644 (file)
 #ifndef CompositorAnimations_h
 #define CompositorAnimations_h
 
+#include "core/animation/AnimationEffect.h"
 #include "core/animation/Timing.h"
+#include "platform/animation/TimingFunction.h"
 #include "wtf/Vector.h"
 
-namespace WebCore {
+namespace blink {
 
 class Element;
-class AnimationEffect;
+class FloatBox;
 
-class CompositorAnimations {
+// Given an input timing function between keyframe at 0 and keyframe at 1.0, we
+// need a timing function such that the behavior with the keyframes swapped is
+// equivalent to reversing time with the input timing function and keyframes.
+// This means flipping the timing function about x=0.5 and about y=0.5.
+// FIXME: Remove once the Compositor natively understands reversing time.
+class CompositorAnimationsTimingFunctionReverser {
+public:
+    static PassRefPtr<TimingFunction> reverse(const LinearTimingFunction* timefunc);
+    static PassRefPtr<TimingFunction> reverse(const CubicBezierTimingFunction* timefunc);
+    static PassRefPtr<TimingFunction> reverse(const TimingFunction* timefunc);
+};
 
+class CompositorAnimations {
 public:
     static CompositorAnimations* instance() { return instance(0); }
     static void setInstanceForTesting(CompositorAnimations* newInstance) { instance(newInstance); }
 
-    virtual bool isCandidateForCompositorAnimation(const Timing&, const AnimationEffect*);
-    virtual bool canStartCompositorAnimation(const Element*);
-    virtual void startCompositorAnimation(const Element*, const Timing&, const AnimationEffect*, Vector<int>& startedAnimationIds);
-    virtual void cancelCompositorAnimation(const Element*, int id);
+    virtual bool isCandidateForAnimationOnCompositor(const Timing&, const AnimationEffect&);
+    virtual bool canStartAnimationOnCompositor(const Element&);
+    // FIXME: This should return void. We should know ahead of time whether these animations can be started.
+    virtual bool startAnimationOnCompositor(const Element&, double startTime, const Timing&, const AnimationEffect&, Vector<int>& startedAnimationIds);
+    virtual void cancelAnimationOnCompositor(const Element&, int id);
+    virtual void pauseAnimationForTestingOnCompositor(const Element&, int id, double pauseTime);
 
+    virtual bool getAnimatedBoundingBox(FloatBox&, const AnimationEffect&, double minValue, double maxValue) const;
 protected:
     CompositorAnimations() { }
 
 private:
-    static CompositorAnimations* instance(CompositorAnimations* newInstance = 0)
+    static CompositorAnimations* instance(CompositorAnimations* newInstance)
     {
         static CompositorAnimations* instance = new CompositorAnimations();
         if (newInstance) {
@@ -64,6 +80,6 @@ private:
     }
 };
 
-} // namespace WebCore
+} // namespace blink
 
 #endif