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" |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
88 } | 88 } |
89 | 89 |
90 double WebAnimationImpl::timeOffset() const { | 90 double WebAnimationImpl::timeOffset() const { |
91 return animation_->time_offset(); | 91 return animation_->time_offset(); |
92 } | 92 } |
93 | 93 |
94 void WebAnimationImpl::setTimeOffset(double monotonic_time) { | 94 void WebAnimationImpl::setTimeOffset(double monotonic_time) { |
95 animation_->set_time_offset(monotonic_time); | 95 animation_->set_time_offset(monotonic_time); |
96 } | 96 } |
97 | 97 |
98 #if WEB_ANIMATION_SUPPORTS_FULL_DIRECTION | |
99 blink::WebAnimation::Direction WebAnimationImpl::direction() const { | |
100 switch (animation_->direction()) { | |
101 case cc::Animation::Normal: | |
102 return Normal; | |
103 case cc::Animation::Reverse: | |
104 return Reverse; | |
105 case cc::Animation::Alternate: | |
106 return Alternate; | |
107 case cc::Animation::AlternateReverse: | |
108 return AlternateReverse; | |
109 default: | |
110 NOTREACHED(); | |
111 } | |
112 return Normal; | |
113 } | |
114 | |
115 void WebAnimationImpl::setDirection(Direction direction) { | |
116 switch (direction) { | |
117 case Normal: | |
118 animation_->set_direction(cc::Animation::Normal); | |
119 break; | |
120 case Reverse: | |
121 animation_->set_direction(cc::Animation::Reverse); | |
122 break; | |
123 case Alternate: | |
124 animation_->set_direction(cc::Animation::Alternate); | |
125 break; | |
126 case AlternateReverse: | |
127 animation_->set_direction(cc::Animation::AlternateReverse); | |
128 break; | |
129 } | |
130 } | |
131 #else | |
98 bool WebAnimationImpl::alternatesDirection() const { | 132 bool WebAnimationImpl::alternatesDirection() const { |
99 return animation_->alternates_direction(); | 133 return animation_->direction() == cc::Animation::Alternate; |
100 } | 134 } |
101 | 135 |
102 void WebAnimationImpl::setAlternatesDirection(bool alternates) { | 136 void WebAnimationImpl::setAlternatesDirection(bool alternates) { |
103 animation_->set_alternates_direction(alternates); | 137 return animation_->set_direction(cc::Animation::Alternate); |
104 } | 138 } |
139 #endif | |
105 | 140 |
106 scoped_ptr<cc::Animation> WebAnimationImpl::PassAnimation() { | 141 scoped_ptr<cc::Animation> WebAnimationImpl::PassAnimation() { |
107 animation_->set_needs_synchronized_start_time(true); | 142 animation_->set_needs_synchronized_start_time(true); |
108 return animation_.Pass(); | 143 return animation_.Pass(); |
109 } | 144 } |
110 | 145 |
111 #define COMPILE_ASSERT_MATCHING_ENUMS(webkit_name, cc_name) \ | 146 #define COMPILE_ASSERT_MATCHING_ENUMS(webkit_name, cc_name) \ |
112 COMPILE_ASSERT(static_cast<int>(webkit_name) == static_cast<int>(cc_name), \ | 147 COMPILE_ASSERT(static_cast<int>(webkit_name) == static_cast<int>(cc_name), \ |
113 mismatching_enums) | 148 mismatching_enums) |
114 | 149 |
115 COMPILE_ASSERT_MATCHING_ENUMS( | 150 COMPILE_ASSERT_MATCHING_ENUMS( |
116 WebAnimation::TargetPropertyTransform, Animation::Transform); | 151 WebAnimation::TargetPropertyTransform, Animation::Transform); |
117 COMPILE_ASSERT_MATCHING_ENUMS( | 152 COMPILE_ASSERT_MATCHING_ENUMS( |
118 WebAnimation::TargetPropertyOpacity, Animation::Opacity); | 153 WebAnimation::TargetPropertyOpacity, Animation::Opacity); |
119 COMPILE_ASSERT_MATCHING_ENUMS( | 154 COMPILE_ASSERT_MATCHING_ENUMS( |
120 WebAnimation::TargetPropertyFilter, Animation::Filter); | 155 WebAnimation::TargetPropertyFilter, Animation::Filter); |
121 #if WEB_SCROLL_OFFSET_ANIMATION_CURVE_IS_DEFINED | 156 #if WEB_SCROLL_OFFSET_ANIMATION_CURVE_IS_DEFINED |
122 COMPILE_ASSERT_MATCHING_ENUMS( | 157 COMPILE_ASSERT_MATCHING_ENUMS( |
123 WebAnimation::TargetPropertyScrollOffset, Animation::ScrollOffset); | 158 WebAnimation::TargetPropertyScrollOffset, Animation::ScrollOffset); |
124 #endif | 159 #endif |
mithro-old
2014/03/03 06:30:52
Should there be the following ASSERT? (Following t
ajuma
2014/03/03 15:03:20
No, note that the current version of this CL no lo
| |
125 | 160 |
126 } // namespace webkit | 161 } // namespace webkit |
OLD | NEW |