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