| 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 74 | 74 | 
| 75 blink::WebAnimation::TargetProperty WebAnimationImpl::targetProperty() const { | 75 blink::WebAnimation::TargetProperty WebAnimationImpl::targetProperty() const { | 
| 76   return static_cast<WebAnimationImpl::TargetProperty>( | 76   return static_cast<WebAnimationImpl::TargetProperty>( | 
| 77       animation_->target_property()); | 77       animation_->target_property()); | 
| 78 } | 78 } | 
| 79 | 79 | 
| 80 int WebAnimationImpl::iterations() const { return animation_->iterations(); } | 80 int WebAnimationImpl::iterations() const { return animation_->iterations(); } | 
| 81 | 81 | 
| 82 void WebAnimationImpl::setIterations(int n) { animation_->set_iterations(n); } | 82 void WebAnimationImpl::setIterations(int n) { animation_->set_iterations(n); } | 
| 83 | 83 | 
| 84 double WebAnimationImpl::startTime() const { return animation_->start_time(); } | 84 double WebAnimationImpl::startTime() const { | 
|  | 85   return (animation_->start_time() - base::TimeTicks()).InSecondsF(); | 
|  | 86 } | 
| 85 | 87 | 
| 86 void WebAnimationImpl::setStartTime(double monotonic_time) { | 88 void WebAnimationImpl::setStartTime(double monotonic_time) { | 
| 87   animation_->set_start_time(monotonic_time); | 89   animation_->set_start_time(base::TimeTicks::FromInternalValue( | 
|  | 90       monotonic_time * base::Time::kMicrosecondsPerSecond)); | 
| 88 } | 91 } | 
| 89 | 92 | 
| 90 double WebAnimationImpl::timeOffset() const { | 93 double WebAnimationImpl::timeOffset() const { | 
| 91   return animation_->time_offset(); | 94   return animation_->time_offset().InSecondsF(); | 
| 92 } | 95 } | 
| 93 | 96 | 
| 94 void WebAnimationImpl::setTimeOffset(double monotonic_time) { | 97 void WebAnimationImpl::setTimeOffset(double monotonic_time) { | 
| 95   animation_->set_time_offset(monotonic_time); | 98   animation_->set_time_offset(base::TimeDelta::FromSecondsD(monotonic_time)); | 
| 96 } | 99 } | 
| 97 | 100 | 
| 98 #if WEB_ANIMATION_SUPPORTS_FULL_DIRECTION | 101 #if WEB_ANIMATION_SUPPORTS_FULL_DIRECTION | 
| 99 blink::WebAnimation::Direction WebAnimationImpl::direction() const { | 102 blink::WebAnimation::Direction WebAnimationImpl::direction() const { | 
| 100   switch (animation_->direction()) { | 103   switch (animation_->direction()) { | 
| 101     case cc::Animation::Normal: | 104     case cc::Animation::Normal: | 
| 102       return DirectionNormal; | 105       return DirectionNormal; | 
| 103     case cc::Animation::Reverse: | 106     case cc::Animation::Reverse: | 
| 104       return DirectionReverse; | 107       return DirectionReverse; | 
| 105     case cc::Animation::Alternate: | 108     case cc::Animation::Alternate: | 
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 155 COMPILE_ASSERT_MATCHING_ENUMS( | 158 COMPILE_ASSERT_MATCHING_ENUMS( | 
| 156     WebAnimation::TargetPropertyOpacity, Animation::Opacity); | 159     WebAnimation::TargetPropertyOpacity, Animation::Opacity); | 
| 157 COMPILE_ASSERT_MATCHING_ENUMS( | 160 COMPILE_ASSERT_MATCHING_ENUMS( | 
| 158     WebAnimation::TargetPropertyFilter, Animation::Filter); | 161     WebAnimation::TargetPropertyFilter, Animation::Filter); | 
| 159 #if WEB_SCROLL_OFFSET_ANIMATION_CURVE_IS_DEFINED | 162 #if WEB_SCROLL_OFFSET_ANIMATION_CURVE_IS_DEFINED | 
| 160 COMPILE_ASSERT_MATCHING_ENUMS( | 163 COMPILE_ASSERT_MATCHING_ENUMS( | 
| 161     WebAnimation::TargetPropertyScrollOffset, Animation::ScrollOffset); | 164     WebAnimation::TargetPropertyScrollOffset, Animation::ScrollOffset); | 
| 162 #endif | 165 #endif | 
| 163 | 166 | 
| 164 }  // namespace webkit | 167 }  // namespace webkit | 
| OLD | NEW | 
|---|