Chromium Code Reviews| 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 return static_cast<WebAnimationImpl::Direction>(animation_->direction()); | |
| 101 } | |
| 102 | |
| 103 void WebAnimationImpl::setDirection(Direction direction) { | |
| 104 return animation_->set_direction( | |
| 105 static_cast<cc::Animation::Direction>(direction)); | |
|
ajuma
2014/02/28 17:55:51
I know we have existing code that assumes that enu
| |
| 106 } | |
| 107 #else | |
| 98 bool WebAnimationImpl::alternatesDirection() const { | 108 bool WebAnimationImpl::alternatesDirection() const { |
| 99 return animation_->alternates_direction(); | 109 return animation_->direction() == cc::Animation::Alternate; |
| 100 } | 110 } |
| 101 | 111 |
| 102 void WebAnimationImpl::setAlternatesDirection(bool alternates) { | 112 void WebAnimationImpl::setAlternatesDirection(bool alternates) { |
| 103 animation_->set_alternates_direction(alternates); | 113 return animation_->set_direction(cc::Animation::Alternate); |
| 104 } | 114 } |
| 115 #endif | |
| 105 | 116 |
| 106 scoped_ptr<cc::Animation> WebAnimationImpl::PassAnimation() { | 117 scoped_ptr<cc::Animation> WebAnimationImpl::PassAnimation() { |
| 107 animation_->set_needs_synchronized_start_time(true); | 118 animation_->set_needs_synchronized_start_time(true); |
| 108 return animation_.Pass(); | 119 return animation_.Pass(); |
| 109 } | 120 } |
| 110 | 121 |
| 111 #define COMPILE_ASSERT_MATCHING_ENUMS(webkit_name, cc_name) \ | 122 #define COMPILE_ASSERT_MATCHING_ENUMS(webkit_name, cc_name) \ |
| 112 COMPILE_ASSERT(static_cast<int>(webkit_name) == static_cast<int>(cc_name), \ | 123 COMPILE_ASSERT(static_cast<int>(webkit_name) == static_cast<int>(cc_name), \ |
| 113 mismatching_enums) | 124 mismatching_enums) |
| 114 | 125 |
| 115 COMPILE_ASSERT_MATCHING_ENUMS( | 126 COMPILE_ASSERT_MATCHING_ENUMS( |
| 116 WebAnimation::TargetPropertyTransform, Animation::Transform); | 127 WebAnimation::TargetPropertyTransform, Animation::Transform); |
| 117 COMPILE_ASSERT_MATCHING_ENUMS( | 128 COMPILE_ASSERT_MATCHING_ENUMS( |
| 118 WebAnimation::TargetPropertyOpacity, Animation::Opacity); | 129 WebAnimation::TargetPropertyOpacity, Animation::Opacity); |
| 119 COMPILE_ASSERT_MATCHING_ENUMS( | 130 COMPILE_ASSERT_MATCHING_ENUMS( |
| 120 WebAnimation::TargetPropertyFilter, Animation::Filter); | 131 WebAnimation::TargetPropertyFilter, Animation::Filter); |
| 121 #if WEB_SCROLL_OFFSET_ANIMATION_CURVE_IS_DEFINED | 132 #if WEB_SCROLL_OFFSET_ANIMATION_CURVE_IS_DEFINED |
| 122 COMPILE_ASSERT_MATCHING_ENUMS( | 133 COMPILE_ASSERT_MATCHING_ENUMS( |
| 123 WebAnimation::TargetPropertyScrollOffset, Animation::ScrollOffset); | 134 WebAnimation::TargetPropertyScrollOffset, Animation::ScrollOffset); |
| 124 #endif | 135 #endif |
| 125 | 136 |
| 126 } // namespace webkit | 137 } // namespace webkit |
| OLD | NEW |