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 "webkit/renderer/compositor_bindings/web_animation_impl.h" | 5 #include "webkit/renderer/compositor_bindings/web_animation_impl.h" |
6 | 6 |
7 #include "cc/animation/animation.h" | 7 #include "cc/animation/animation.h" |
8 #include "cc/animation/animation_curve.h" | 8 #include "cc/animation/animation_curve.h" |
9 #include "cc/animation/animation_id_provider.h" | 9 #include "cc/animation/animation_id_provider.h" |
10 #include "third_party/WebKit/public/platform/WebAnimation.h" | 10 #include "third_party/WebKit/public/platform/WebAnimation.h" |
11 #include "third_party/WebKit/public/platform/WebAnimationCurve.h" | 11 #include "third_party/WebKit/public/platform/WebAnimationCurve.h" |
12 #include "webkit/renderer/compositor_bindings/web_filter_animation_curve_impl.h" | 12 #include "webkit/renderer/compositor_bindings/web_filter_animation_curve_impl.h" |
13 #include "webkit/renderer/compositor_bindings/web_float_animation_curve_impl.h" | 13 #include "webkit/renderer/compositor_bindings/web_float_animation_curve_impl.h" |
14 #include "webkit/renderer/compositor_bindings/web_scroll_offset_animation_curve_
impl.h" | |
15 #include "webkit/renderer/compositor_bindings/web_transform_animation_curve_impl
.h" | 14 #include "webkit/renderer/compositor_bindings/web_transform_animation_curve_impl
.h" |
16 | 15 |
17 using cc::Animation; | 16 using cc::Animation; |
18 using cc::AnimationIdProvider; | 17 using cc::AnimationIdProvider; |
19 | 18 |
20 using blink::WebAnimation; | 19 using blink::WebAnimation; |
21 using blink::WebAnimationCurve; | 20 using blink::WebAnimationCurve; |
22 | 21 |
23 namespace webkit { | 22 namespace webkit { |
24 | 23 |
(...skipping 20 matching lines...) Expand all Loading... |
45 static_cast<const WebTransformAnimationCurveImpl*>(&web_curve); | 44 static_cast<const WebTransformAnimationCurveImpl*>(&web_curve); |
46 curve = transform_curve_impl->CloneToAnimationCurve(); | 45 curve = transform_curve_impl->CloneToAnimationCurve(); |
47 break; | 46 break; |
48 } | 47 } |
49 case WebAnimationCurve::AnimationCurveTypeFilter: { | 48 case WebAnimationCurve::AnimationCurveTypeFilter: { |
50 const WebFilterAnimationCurveImpl* filter_curve_impl = | 49 const WebFilterAnimationCurveImpl* filter_curve_impl = |
51 static_cast<const WebFilterAnimationCurveImpl*>(&web_curve); | 50 static_cast<const WebFilterAnimationCurveImpl*>(&web_curve); |
52 curve = filter_curve_impl->CloneToAnimationCurve(); | 51 curve = filter_curve_impl->CloneToAnimationCurve(); |
53 break; | 52 break; |
54 } | 53 } |
55 #if WEB_SCROLL_OFFSET_ANIMATION_CURVE_IS_DEFINED | |
56 case WebAnimationCurve::AnimationCurveTypeScrollOffset: { | |
57 const WebScrollOffsetAnimationCurveImpl* scroll_curve_impl = | |
58 static_cast<const WebScrollOffsetAnimationCurveImpl*>(&web_curve); | |
59 curve = scroll_curve_impl->CloneToAnimationCurve(); | |
60 break; | |
61 } | |
62 #endif | |
63 } | 54 } |
64 animation_ = Animation::Create( | 55 animation_ = Animation::Create( |
65 curve.Pass(), | 56 curve.Pass(), |
66 animation_id, | 57 animation_id, |
67 group_id, | 58 group_id, |
68 static_cast<cc::Animation::TargetProperty>(target_property)); | 59 static_cast<cc::Animation::TargetProperty>(target_property)); |
69 } | 60 } |
70 | 61 |
71 WebAnimationImpl::~WebAnimationImpl() {} | 62 WebAnimationImpl::~WebAnimationImpl() {} |
72 | 63 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 #define COMPILE_ASSERT_MATCHING_ENUMS(webkit_name, cc_name) \ | 102 #define COMPILE_ASSERT_MATCHING_ENUMS(webkit_name, cc_name) \ |
112 COMPILE_ASSERT(static_cast<int>(webkit_name) == static_cast<int>(cc_name), \ | 103 COMPILE_ASSERT(static_cast<int>(webkit_name) == static_cast<int>(cc_name), \ |
113 mismatching_enums) | 104 mismatching_enums) |
114 | 105 |
115 COMPILE_ASSERT_MATCHING_ENUMS( | 106 COMPILE_ASSERT_MATCHING_ENUMS( |
116 WebAnimation::TargetPropertyTransform, Animation::Transform); | 107 WebAnimation::TargetPropertyTransform, Animation::Transform); |
117 COMPILE_ASSERT_MATCHING_ENUMS( | 108 COMPILE_ASSERT_MATCHING_ENUMS( |
118 WebAnimation::TargetPropertyOpacity, Animation::Opacity); | 109 WebAnimation::TargetPropertyOpacity, Animation::Opacity); |
119 COMPILE_ASSERT_MATCHING_ENUMS( | 110 COMPILE_ASSERT_MATCHING_ENUMS( |
120 WebAnimation::TargetPropertyFilter, Animation::Filter); | 111 WebAnimation::TargetPropertyFilter, Animation::Filter); |
121 #if WEB_SCROLL_OFFSET_ANIMATION_CURVE_IS_DEFINED | |
122 COMPILE_ASSERT_MATCHING_ENUMS( | |
123 WebAnimation::TargetPropertyScrollOffset, Animation::ScrollOffset); | |
124 #endif | |
125 | 112 |
126 } // namespace webkit | 113 } // namespace webkit |
OLD | NEW |