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 #include "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "WebAnimationImpl.h" | 7 #include "WebAnimationImpl.h" |
8 | 8 |
9 #include "CCActiveAnimation.h" | 9 #include "CCActiveAnimation.h" |
10 #include "CCAnimationCurve.h" | 10 #include "CCAnimationCurve.h" |
11 #include "WebFloatAnimationCurveImpl.h" | 11 #include "WebFloatAnimationCurveImpl.h" |
12 #include "WebTransformAnimationCurveImpl.h" | 12 #include "WebTransformAnimationCurveImpl.h" |
13 #include <public/WebAnimation.h> | 13 #include <public/WebAnimation.h> |
14 #include <public/WebAnimationCurve.h> | 14 #include <public/WebAnimationCurve.h> |
15 #include <wtf/OwnPtr.h> | 15 #include <wtf/OwnPtr.h> |
16 #include <wtf/PassOwnPtr.h> | 16 #include <wtf/PassOwnPtr.h> |
17 | 17 |
18 using WebCore::CCActiveAnimation; | 18 using cc::CCActiveAnimation; |
19 | 19 |
20 namespace WebKit { | 20 namespace WebKit { |
21 | 21 |
22 WebAnimation* WebAnimation::create(const WebAnimationCurve& curve, TargetPropert
y targetProperty, int animationId) | 22 WebAnimation* WebAnimation::create(const WebAnimationCurve& curve, TargetPropert
y targetProperty, int animationId) |
23 { | 23 { |
24 return new WebAnimationImpl(curve, targetProperty, animationId, 0); | 24 return new WebAnimationImpl(curve, targetProperty, animationId, 0); |
25 } | 25 } |
26 | 26 |
27 WebAnimationImpl::WebAnimationImpl(const WebAnimationCurve& webCurve, TargetProp
erty targetProperty, int animationId, int groupId) | 27 WebAnimationImpl::WebAnimationImpl(const WebAnimationCurve& webCurve, TargetProp
erty targetProperty, int animationId, int groupId) |
28 { | 28 { |
29 static int nextAnimationId = 1; | 29 static int nextAnimationId = 1; |
30 static int nextGroupId = 1; | 30 static int nextGroupId = 1; |
31 if (!animationId) | 31 if (!animationId) |
32 animationId = nextAnimationId++; | 32 animationId = nextAnimationId++; |
33 if (!groupId) | 33 if (!groupId) |
34 groupId = nextGroupId++; | 34 groupId = nextGroupId++; |
35 | 35 |
36 WebAnimationCurve::AnimationCurveType curveType = webCurve.type(); | 36 WebAnimationCurve::AnimationCurveType curveType = webCurve.type(); |
37 OwnPtr<WebCore::CCAnimationCurve> curve; | 37 OwnPtr<cc::CCAnimationCurve> curve; |
38 switch (curveType) { | 38 switch (curveType) { |
39 case WebAnimationCurve::AnimationCurveTypeFloat: { | 39 case WebAnimationCurve::AnimationCurveTypeFloat: { |
40 const WebFloatAnimationCurveImpl* floatCurveImpl = static_cast<const Web
FloatAnimationCurveImpl*>(&webCurve); | 40 const WebFloatAnimationCurveImpl* floatCurveImpl = static_cast<const Web
FloatAnimationCurveImpl*>(&webCurve); |
41 curve = floatCurveImpl->cloneToCCAnimationCurve(); | 41 curve = floatCurveImpl->cloneToCCAnimationCurve(); |
42 break; | 42 break; |
43 } | 43 } |
44 case WebAnimationCurve::AnimationCurveTypeTransform: { | 44 case WebAnimationCurve::AnimationCurveTypeTransform: { |
45 const WebTransformAnimationCurveImpl* transformCurveImpl = static_cast<c
onst WebTransformAnimationCurveImpl*>(&webCurve); | 45 const WebTransformAnimationCurveImpl* transformCurveImpl = static_cast<c
onst WebTransformAnimationCurveImpl*>(&webCurve); |
46 curve = transformCurveImpl->cloneToCCAnimationCurve(); | 46 curve = transformCurveImpl->cloneToCCAnimationCurve(); |
47 break; | 47 break; |
48 } | 48 } |
49 } | 49 } |
50 m_animation = CCActiveAnimation::create(curve.release(), animationId, groupI
d, static_cast<WebCore::CCActiveAnimation::TargetProperty>(targetProperty)); | 50 m_animation = CCActiveAnimation::create(curve.release(), animationId, groupI
d, static_cast<cc::CCActiveAnimation::TargetProperty>(targetProperty)); |
51 } | 51 } |
52 | 52 |
53 WebAnimationImpl::~WebAnimationImpl() | 53 WebAnimationImpl::~WebAnimationImpl() |
54 { | 54 { |
55 } | 55 } |
56 | 56 |
57 int WebAnimationImpl::id() | 57 int WebAnimationImpl::id() |
58 { | 58 { |
59 return m_animation->id(); | 59 return m_animation->id(); |
60 } | 60 } |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 bool WebAnimationImpl::alternatesDirection() const | 97 bool WebAnimationImpl::alternatesDirection() const |
98 { | 98 { |
99 return m_animation->alternatesDirection(); | 99 return m_animation->alternatesDirection(); |
100 } | 100 } |
101 | 101 |
102 void WebAnimationImpl::setAlternatesDirection(bool alternates) | 102 void WebAnimationImpl::setAlternatesDirection(bool alternates) |
103 { | 103 { |
104 m_animation->setAlternatesDirection(alternates); | 104 m_animation->setAlternatesDirection(alternates); |
105 } | 105 } |
106 | 106 |
107 PassOwnPtr<WebCore::CCActiveAnimation> WebAnimationImpl::cloneToCCAnimation() | 107 PassOwnPtr<cc::CCActiveAnimation> WebAnimationImpl::cloneToCCAnimation() |
108 { | 108 { |
109 OwnPtr<WebCore::CCActiveAnimation> toReturn(m_animation->clone(WebCore::CCAc
tiveAnimation::NonControllingInstance)); | 109 OwnPtr<cc::CCActiveAnimation> toReturn(m_animation->clone(cc::CCActiveAnimat
ion::NonControllingInstance)); |
110 toReturn->setNeedsSynchronizedStartTime(true); | 110 toReturn->setNeedsSynchronizedStartTime(true); |
111 return toReturn.release(); | 111 return toReturn.release(); |
112 } | 112 } |
113 | 113 |
114 } // namespace WebKit | 114 } // namespace WebKit |
OLD | NEW |