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 "cc/base/time_util.h" | |
|
ajuma
2014/05/07 17:04:42
Please remove, since this file no longer exists in
Sikugu_
2014/05/12 16:01:53
Done.
| |
| 10 #include "third_party/WebKit/public/platform/WebAnimation.h" | 11 #include "third_party/WebKit/public/platform/WebAnimation.h" |
| 11 #include "third_party/WebKit/public/platform/WebAnimationCurve.h" | 12 #include "third_party/WebKit/public/platform/WebAnimationCurve.h" |
| 12 #include "webkit/renderer/compositor_bindings/web_filter_animation_curve_impl.h" | 13 #include "webkit/renderer/compositor_bindings/web_filter_animation_curve_impl.h" |
| 13 #include "webkit/renderer/compositor_bindings/web_float_animation_curve_impl.h" | 14 #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_scroll_offset_animation_curve_ impl.h" |
| 15 #include "webkit/renderer/compositor_bindings/web_transform_animation_curve_impl .h" | 16 #include "webkit/renderer/compositor_bindings/web_transform_animation_curve_impl .h" |
| 16 | 17 |
| 17 using cc::Animation; | 18 using cc::Animation; |
| 18 using cc::AnimationIdProvider; | 19 using cc::AnimationIdProvider; |
| 20 using cc::TimeUtil; | |
|
ajuma
2014/05/07 17:04:42
Please remove.
Sikugu_
2014/05/12 16:01:53
Done.
| |
| 19 | 21 |
| 20 using blink::WebAnimation; | 22 using blink::WebAnimation; |
| 21 using blink::WebAnimationCurve; | 23 using blink::WebAnimationCurve; |
| 22 | 24 |
| 23 namespace webkit { | 25 namespace webkit { |
| 24 | 26 |
| 25 WebAnimationImpl::WebAnimationImpl(const WebAnimationCurve& web_curve, | 27 WebAnimationImpl::WebAnimationImpl(const WebAnimationCurve& web_curve, |
| 26 TargetProperty target_property, | 28 TargetProperty target_property, |
| 27 int animation_id, | 29 int animation_id, |
| 28 int group_id) { | 30 int group_id) { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 74 | 76 |
| 75 blink::WebAnimation::TargetProperty WebAnimationImpl::targetProperty() const { | 77 blink::WebAnimation::TargetProperty WebAnimationImpl::targetProperty() const { |
| 76 return static_cast<WebAnimationImpl::TargetProperty>( | 78 return static_cast<WebAnimationImpl::TargetProperty>( |
| 77 animation_->target_property()); | 79 animation_->target_property()); |
| 78 } | 80 } |
| 79 | 81 |
| 80 int WebAnimationImpl::iterations() const { return animation_->iterations(); } | 82 int WebAnimationImpl::iterations() const { return animation_->iterations(); } |
| 81 | 83 |
| 82 void WebAnimationImpl::setIterations(int n) { animation_->set_iterations(n); } | 84 void WebAnimationImpl::setIterations(int n) { animation_->set_iterations(n); } |
| 83 | 85 |
| 84 double WebAnimationImpl::startTime() const { return animation_->start_time(); } | 86 double WebAnimationImpl::startTime() const { |
| 87 return TimeUtil::TicksInSecondsF(animation_->start_time()); | |
|
ajuma
2014/05/07 17:04:42
TimeUtil no longer exists in the latest patch set.
Sikugu_
2014/05/12 16:01:53
Done.
| |
| 88 } | |
| 85 | 89 |
| 86 void WebAnimationImpl::setStartTime(double monotonic_time) { | 90 void WebAnimationImpl::setStartTime(double monotonic_time) { |
| 87 animation_->set_start_time(monotonic_time); | 91 animation_->set_start_time(base::TimeTicks::FromInternalValue( |
| 92 monotonic_time * base::Time::kMicrosecondsPerSecond)); | |
| 88 } | 93 } |
| 89 | 94 |
| 90 double WebAnimationImpl::timeOffset() const { | 95 double WebAnimationImpl::timeOffset() const { |
| 91 return animation_->time_offset(); | 96 return animation_->time_offset().InSecondsF(); |
| 92 } | 97 } |
| 93 | 98 |
| 94 void WebAnimationImpl::setTimeOffset(double monotonic_time) { | 99 void WebAnimationImpl::setTimeOffset(double monotonic_time) { |
| 95 animation_->set_time_offset(monotonic_time); | 100 animation_->set_time_offset(base::TimeDelta::FromSeconds(monotonic_time)); |
|
ajuma
2014/05/07 17:04:42
FromSecondsD (or else we'll lose precision).
Sikugu_
2014/05/12 16:01:53
Done.
| |
| 96 } | 101 } |
| 97 | 102 |
| 98 #if WEB_ANIMATION_SUPPORTS_FULL_DIRECTION | 103 #if WEB_ANIMATION_SUPPORTS_FULL_DIRECTION |
| 99 blink::WebAnimation::Direction WebAnimationImpl::direction() const { | 104 blink::WebAnimation::Direction WebAnimationImpl::direction() const { |
| 100 switch (animation_->direction()) { | 105 switch (animation_->direction()) { |
| 101 case cc::Animation::Normal: | 106 case cc::Animation::Normal: |
| 102 return DirectionNormal; | 107 return DirectionNormal; |
| 103 case cc::Animation::Reverse: | 108 case cc::Animation::Reverse: |
| 104 return DirectionReverse; | 109 return DirectionReverse; |
| 105 case cc::Animation::Alternate: | 110 case cc::Animation::Alternate: |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 155 COMPILE_ASSERT_MATCHING_ENUMS( | 160 COMPILE_ASSERT_MATCHING_ENUMS( |
| 156 WebAnimation::TargetPropertyOpacity, Animation::Opacity); | 161 WebAnimation::TargetPropertyOpacity, Animation::Opacity); |
| 157 COMPILE_ASSERT_MATCHING_ENUMS( | 162 COMPILE_ASSERT_MATCHING_ENUMS( |
| 158 WebAnimation::TargetPropertyFilter, Animation::Filter); | 163 WebAnimation::TargetPropertyFilter, Animation::Filter); |
| 159 #if WEB_SCROLL_OFFSET_ANIMATION_CURVE_IS_DEFINED | 164 #if WEB_SCROLL_OFFSET_ANIMATION_CURVE_IS_DEFINED |
| 160 COMPILE_ASSERT_MATCHING_ENUMS( | 165 COMPILE_ASSERT_MATCHING_ENUMS( |
| 161 WebAnimation::TargetPropertyScrollOffset, Animation::ScrollOffset); | 166 WebAnimation::TargetPropertyScrollOffset, Animation::ScrollOffset); |
| 162 #endif | 167 #endif |
| 163 | 168 |
| 164 } // namespace webkit | 169 } // namespace webkit |
| OLD | NEW |