Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(240)

Side by Side Diff: webkit/renderer/compositor_bindings/web_animation_impl.cc

Issue 226543005: CC should use TimeTicks and TimeDelta to represent time (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Tests related changes Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« cc/layers/layer.cc ('K') | « ui/compositor/layer_animator.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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_->ticks_inseconds(animation_->start_time());
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_->delta_inseconds(animation_->time_offset());
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::FromSeconds(monotonic_time));
96 } 99 }
97 100
98 bool WebAnimationImpl::alternatesDirection() const { 101 bool WebAnimationImpl::alternatesDirection() const {
99 return animation_->alternates_direction(); 102 return animation_->alternates_direction();
100 } 103 }
101 104
102 void WebAnimationImpl::setAlternatesDirection(bool alternates) { 105 void WebAnimationImpl::setAlternatesDirection(bool alternates) {
103 animation_->set_alternates_direction(alternates); 106 animation_->set_alternates_direction(alternates);
104 } 107 }
105 108
(...skipping 11 matching lines...) Expand all
117 COMPILE_ASSERT_MATCHING_ENUMS( 120 COMPILE_ASSERT_MATCHING_ENUMS(
118 WebAnimation::TargetPropertyOpacity, Animation::Opacity); 121 WebAnimation::TargetPropertyOpacity, Animation::Opacity);
119 COMPILE_ASSERT_MATCHING_ENUMS( 122 COMPILE_ASSERT_MATCHING_ENUMS(
120 WebAnimation::TargetPropertyFilter, Animation::Filter); 123 WebAnimation::TargetPropertyFilter, Animation::Filter);
121 #if WEB_SCROLL_OFFSET_ANIMATION_CURVE_IS_DEFINED 124 #if WEB_SCROLL_OFFSET_ANIMATION_CURVE_IS_DEFINED
122 COMPILE_ASSERT_MATCHING_ENUMS( 125 COMPILE_ASSERT_MATCHING_ENUMS(
123 WebAnimation::TargetPropertyScrollOffset, Animation::ScrollOffset); 126 WebAnimation::TargetPropertyScrollOffset, Animation::ScrollOffset);
124 #endif 127 #endif
125 128
126 } // namespace webkit 129 } // namespace webkit
OLDNEW
« cc/layers/layer.cc ('K') | « ui/compositor/layer_animator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698