OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CCAnimationTestCommon_h | 5 #ifndef CCAnimationTestCommon_h |
6 #define CCAnimationTestCommon_h | 6 #define CCAnimationTestCommon_h |
7 | 7 |
8 #include "CCActiveAnimation.h" | 8 #include "CCActiveAnimation.h" |
9 #include "CCAnimationCurve.h" | 9 #include "CCAnimationCurve.h" |
10 #include "CCLayerAnimationController.h" | 10 #include "CCLayerAnimationController.h" |
11 #include "IntSize.h" | 11 #include "IntSize.h" |
12 | 12 |
13 #include <wtf/OwnPtr.h> | 13 #include <wtf/OwnPtr.h> |
14 | 14 |
15 namespace WebCore { | 15 namespace WebCore { |
16 class CCLayerImpl; | 16 class CCLayerImpl; |
17 class LayerChromium; | 17 class LayerChromium; |
18 } | 18 } |
19 | 19 |
20 namespace WebKitTests { | 20 namespace WebKitTests { |
21 | 21 |
22 class FakeFloatAnimationCurve : public WebCore::CCFloatAnimationCurve { | 22 class FakeFloatAnimationCurve : public WebCore::CCFloatAnimationCurve { |
23 public: | 23 public: |
24 FakeFloatAnimationCurve(); | 24 FakeFloatAnimationCurve(); |
25 virtual ~FakeFloatAnimationCurve(); | 25 virtual ~FakeFloatAnimationCurve(); |
26 | 26 |
27 virtual double duration() const OVERRIDE { return 1; } | 27 virtual double duration() const OVERRIDE; |
28 virtual float getValue(double now) const OVERRIDE { return 0; } | 28 virtual float getValue(double now) const OVERRIDE; |
29 virtual PassOwnPtr<WebCore::CCAnimationCurve> clone() const OVERRIDE; | 29 virtual PassOwnPtr<WebCore::CCAnimationCurve> clone() const OVERRIDE; |
30 }; | 30 }; |
31 | 31 |
32 class FakeTransformTransition : public WebCore::CCTransformAnimationCurve { | 32 class FakeTransformTransition : public WebCore::CCTransformAnimationCurve { |
33 public: | 33 public: |
34 FakeTransformTransition(double duration); | 34 FakeTransformTransition(double duration); |
35 virtual ~FakeTransformTransition(); | 35 virtual ~FakeTransformTransition(); |
36 | 36 |
37 virtual double duration() const OVERRIDE { return m_duration; } | 37 virtual double duration() const OVERRIDE; |
38 virtual WebKit::WebTransformationMatrix getValue(double time) const OVERRIDE
; | 38 virtual WebKit::WebTransformationMatrix getValue(double time) const OVERRIDE
; |
39 | 39 |
40 virtual PassOwnPtr<WebCore::CCAnimationCurve> clone() const OVERRIDE; | 40 virtual PassOwnPtr<WebCore::CCAnimationCurve> clone() const OVERRIDE; |
41 | 41 |
42 private: | 42 private: |
43 double m_duration; | 43 double m_duration; |
44 }; | 44 }; |
45 | 45 |
46 class FakeFloatTransition : public WebCore::CCFloatAnimationCurve { | 46 class FakeFloatTransition : public WebCore::CCFloatAnimationCurve { |
47 public: | 47 public: |
48 FakeFloatTransition(double duration, float from, float to); | 48 FakeFloatTransition(double duration, float from, float to); |
49 virtual ~FakeFloatTransition(); | 49 virtual ~FakeFloatTransition(); |
50 | 50 |
51 virtual double duration() const OVERRIDE { return m_duration; } | 51 virtual double duration() const OVERRIDE; |
52 virtual float getValue(double time) const OVERRIDE; | 52 virtual float getValue(double time) const OVERRIDE; |
53 | 53 |
54 virtual PassOwnPtr<WebCore::CCAnimationCurve> clone() const OVERRIDE; | 54 virtual PassOwnPtr<WebCore::CCAnimationCurve> clone() const OVERRIDE; |
55 | 55 |
56 private: | 56 private: |
57 double m_duration; | 57 double m_duration; |
58 float m_from; | 58 float m_from; |
59 float m_to; | 59 float m_to; |
60 }; | 60 }; |
61 | 61 |
62 class FakeLayerAnimationControllerClient : public WebCore::CCLayerAnimationContr
ollerClient { | 62 class FakeLayerAnimationControllerClient : public WebCore::CCLayerAnimationContr
ollerClient { |
63 public: | 63 public: |
64 FakeLayerAnimationControllerClient(); | 64 FakeLayerAnimationControllerClient(); |
65 virtual ~FakeLayerAnimationControllerClient(); | 65 virtual ~FakeLayerAnimationControllerClient(); |
66 | 66 |
67 // CCLayerAnimationControllerClient implementation | 67 // CCLayerAnimationControllerClient implementation |
68 virtual int id() const OVERRIDE { return 0; } | 68 virtual int id() const OVERRIDE; |
69 virtual void setOpacityFromAnimation(float opacity) OVERRIDE { m_opacity = o
pacity; } | 69 virtual void setOpacityFromAnimation(float) OVERRIDE; |
70 virtual float opacity() const OVERRIDE { return m_opacity; } | 70 virtual float opacity() const OVERRIDE; |
71 virtual void setTransformFromAnimation(const WebKit::WebTransformationMatrix
& transform) OVERRIDE { m_transform = transform; } | 71 virtual void setTransformFromAnimation(const WebKit::WebTransformationMatrix
&) OVERRIDE; |
72 virtual const WebKit::WebTransformationMatrix& transform() const OVERRIDE {
return m_transform; } | 72 virtual const WebKit::WebTransformationMatrix& transform() const OVERRIDE; |
73 | 73 |
74 private: | 74 private: |
75 float m_opacity; | 75 float m_opacity; |
76 WebKit::WebTransformationMatrix m_transform; | 76 WebKit::WebTransformationMatrix m_transform; |
77 }; | 77 }; |
78 | 78 |
79 void addOpacityTransitionToController(WebCore::CCLayerAnimationController&, doub
le duration, float startOpacity, float endOpacity, bool useTimingFunction); | 79 void addOpacityTransitionToController(WebCore::CCLayerAnimationController&, doub
le duration, float startOpacity, float endOpacity, bool useTimingFunction); |
80 void addAnimatedTransformToController(WebCore::CCLayerAnimationController&, doub
le duration, int deltaX, int deltaY); | 80 void addAnimatedTransformToController(WebCore::CCLayerAnimationController&, doub
le duration, int deltaX, int deltaY); |
81 | 81 |
82 void addOpacityTransitionToLayer(WebCore::LayerChromium&, double duration, float
startOpacity, float endOpacity, bool useTimingFunction); | 82 void addOpacityTransitionToLayer(WebCore::LayerChromium&, double duration, float
startOpacity, float endOpacity, bool useTimingFunction); |
83 void addOpacityTransitionToLayer(WebCore::CCLayerImpl&, double duration, float s
tartOpacity, float endOpacity, bool useTimingFunction); | 83 void addOpacityTransitionToLayer(WebCore::CCLayerImpl&, double duration, float s
tartOpacity, float endOpacity, bool useTimingFunction); |
84 | 84 |
85 void addAnimatedTransformToLayer(WebCore::LayerChromium&, double duration, int d
eltaX, int deltaY); | 85 void addAnimatedTransformToLayer(WebCore::LayerChromium&, double duration, int d
eltaX, int deltaY); |
86 void addAnimatedTransformToLayer(WebCore::CCLayerImpl&, double duration, int del
taX, int deltaY); | 86 void addAnimatedTransformToLayer(WebCore::CCLayerImpl&, double duration, int del
taX, int deltaY); |
87 | 87 |
88 } // namespace WebKitTests | 88 } // namespace WebKitTests |
89 | 89 |
90 #endif // CCAnimationTesctCommon_h | 90 #endif // CCAnimationTesctCommon_h |
OLD | NEW |