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 "web_animation_impl.h" | 5 #include "web_animation_impl.h" |
6 | 6 |
7 #include "cc/active_animation.h" | 7 #include "cc/animation.h" |
8 #include "cc/animation_curve.h" | 8 #include "cc/animation_curve.h" |
9 #include "third_party/WebKit/Source/Platform/chromium/public/WebAnimationCurve.h
" | 9 #include "third_party/WebKit/Source/Platform/chromium/public/WebAnimationCurve.h
" |
10 #include "third_party/WebKit/Source/Platform/chromium/public/WebAnimation.h" | 10 #include "third_party/WebKit/Source/Platform/chromium/public/WebAnimation.h" |
11 #include "web_animation_id_provider.h" | 11 #include "web_animation_id_provider.h" |
12 #include "web_float_animation_curve_impl.h" | 12 #include "web_float_animation_curve_impl.h" |
13 #include "web_transform_animation_curve_impl.h" | 13 #include "web_transform_animation_curve_impl.h" |
14 | 14 |
15 using cc::ActiveAnimation; | 15 using cc::Animation; |
16 using webkit::WebAnimationIdProvider; | 16 using webkit::WebAnimationIdProvider; |
17 | 17 |
18 namespace WebKit { | 18 namespace WebKit { |
19 | 19 |
20 WebAnimationImpl::WebAnimationImpl(const WebAnimationCurve& webCurve, TargetProp
erty targetProperty, int animationId, int groupId) | 20 WebAnimationImpl::WebAnimationImpl(const WebAnimationCurve& webCurve, TargetProp
erty targetProperty, int animationId, int groupId) |
21 { | 21 { |
22 if (!animationId) | 22 if (!animationId) |
23 animationId = WebAnimationIdProvider::NextAnimationId(); | 23 animationId = WebAnimationIdProvider::NextAnimationId(); |
24 if (!groupId) | 24 if (!groupId) |
25 groupId = WebAnimationIdProvider::NextGroupId(); | 25 groupId = WebAnimationIdProvider::NextGroupId(); |
26 | 26 |
27 WebAnimationCurve::AnimationCurveType curveType = webCurve.type(); | 27 WebAnimationCurve::AnimationCurveType curveType = webCurve.type(); |
28 scoped_ptr<cc::AnimationCurve> curve; | 28 scoped_ptr<cc::AnimationCurve> curve; |
29 switch (curveType) { | 29 switch (curveType) { |
30 case WebAnimationCurve::AnimationCurveTypeFloat: { | 30 case WebAnimationCurve::AnimationCurveTypeFloat: { |
31 const WebFloatAnimationCurveImpl* floatCurveImpl = static_cast<const Web
FloatAnimationCurveImpl*>(&webCurve); | 31 const WebFloatAnimationCurveImpl* floatCurveImpl = static_cast<const Web
FloatAnimationCurveImpl*>(&webCurve); |
32 curve = floatCurveImpl->cloneToAnimationCurve(); | 32 curve = floatCurveImpl->cloneToAnimationCurve(); |
33 break; | 33 break; |
34 } | 34 } |
35 case WebAnimationCurve::AnimationCurveTypeTransform: { | 35 case WebAnimationCurve::AnimationCurveTypeTransform: { |
36 const WebTransformAnimationCurveImpl* transformCurveImpl = static_cast<c
onst WebTransformAnimationCurveImpl*>(&webCurve); | 36 const WebTransformAnimationCurveImpl* transformCurveImpl = static_cast<c
onst WebTransformAnimationCurveImpl*>(&webCurve); |
37 curve = transformCurveImpl->cloneToAnimationCurve(); | 37 curve = transformCurveImpl->cloneToAnimationCurve(); |
38 break; | 38 break; |
39 } | 39 } |
40 } | 40 } |
41 m_animation = ActiveAnimation::create(curve.Pass(), animationId, groupId, st
atic_cast<cc::ActiveAnimation::TargetProperty>(targetProperty)); | 41 m_animation = Animation::create(curve.Pass(), animationId, groupId, static_c
ast<cc::Animation::TargetProperty>(targetProperty)); |
42 } | 42 } |
43 | 43 |
44 WebAnimationImpl::~WebAnimationImpl() | 44 WebAnimationImpl::~WebAnimationImpl() |
45 { | 45 { |
46 } | 46 } |
47 | 47 |
48 int WebAnimationImpl::id() | 48 int WebAnimationImpl::id() |
49 { | 49 { |
50 return m_animation->id(); | 50 return m_animation->id(); |
51 } | 51 } |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 bool WebAnimationImpl::alternatesDirection() const | 88 bool WebAnimationImpl::alternatesDirection() const |
89 { | 89 { |
90 return m_animation->alternatesDirection(); | 90 return m_animation->alternatesDirection(); |
91 } | 91 } |
92 | 92 |
93 void WebAnimationImpl::setAlternatesDirection(bool alternates) | 93 void WebAnimationImpl::setAlternatesDirection(bool alternates) |
94 { | 94 { |
95 m_animation->setAlternatesDirection(alternates); | 95 m_animation->setAlternatesDirection(alternates); |
96 } | 96 } |
97 | 97 |
98 scoped_ptr<cc::ActiveAnimation> WebAnimationImpl::cloneToAnimation() | 98 scoped_ptr<cc::Animation> WebAnimationImpl::cloneToAnimation() |
99 { | 99 { |
100 scoped_ptr<cc::ActiveAnimation> toReturn(m_animation->clone(cc::ActiveAnimat
ion::NonControllingInstance)); | 100 scoped_ptr<cc::Animation> toReturn(m_animation->clone(cc::Animation::NonCont
rollingInstance)); |
101 toReturn->setNeedsSynchronizedStartTime(true); | 101 toReturn->setNeedsSynchronizedStartTime(true); |
102 return toReturn.Pass(); | 102 return toReturn.Pass(); |
103 } | 103 } |
104 | 104 |
105 } // namespace WebKit | 105 } // namespace WebKit |
OLD | NEW |