OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "cc/blink/web_animation_impl.h" | 5 #include "cc/blink/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/blink/web_filter_animation_curve_impl.h" | 10 #include "cc/blink/web_filter_animation_curve_impl.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 int WebCompositorAnimationImpl::id() { | 72 int WebCompositorAnimationImpl::id() { |
73 return animation_->id(); | 73 return animation_->id(); |
74 } | 74 } |
75 | 75 |
76 blink::WebCompositorAnimation::TargetProperty | 76 blink::WebCompositorAnimation::TargetProperty |
77 WebCompositorAnimationImpl::targetProperty() const { | 77 WebCompositorAnimationImpl::targetProperty() const { |
78 return static_cast<WebCompositorAnimationImpl::TargetProperty>( | 78 return static_cast<WebCompositorAnimationImpl::TargetProperty>( |
79 animation_->target_property()); | 79 animation_->target_property()); |
80 } | 80 } |
81 | 81 |
82 #if WEB_ANIMATION_SUPPORTS_FRACTIONAL_ITERATIONS | |
83 double WebCompositorAnimationImpl::iterations() const { | 82 double WebCompositorAnimationImpl::iterations() const { |
84 return animation_->iterations(); | 83 return animation_->iterations(); |
85 } | 84 } |
86 | 85 |
87 void WebCompositorAnimationImpl::setIterations(double n) { | 86 void WebCompositorAnimationImpl::setIterations(double n) { |
88 animation_->set_iterations(n); | 87 animation_->set_iterations(n); |
89 } | 88 } |
90 #else | |
91 int WebCompositorAnimationImpl::iterations() const { | |
92 return animation_->iterations(); | |
93 } | |
94 | |
95 void WebCompositorAnimationImpl::setIterations(int n) { | |
96 animation_->set_iterations(n); | |
97 } | |
98 #endif | |
99 | 89 |
100 double WebCompositorAnimationImpl::startTime() const { | 90 double WebCompositorAnimationImpl::startTime() const { |
101 return (animation_->start_time() - base::TimeTicks()).InSecondsF(); | 91 return (animation_->start_time() - base::TimeTicks()).InSecondsF(); |
102 } | 92 } |
103 | 93 |
104 void WebCompositorAnimationImpl::setStartTime(double monotonic_time) { | 94 void WebCompositorAnimationImpl::setStartTime(double monotonic_time) { |
105 animation_->set_start_time(base::TimeTicks::FromInternalValue( | 95 animation_->set_start_time(base::TimeTicks::FromInternalValue( |
106 monotonic_time * base::Time::kMicrosecondsPerSecond)); | 96 monotonic_time * base::Time::kMicrosecondsPerSecond)); |
107 } | 97 } |
108 | 98 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 } | 139 } |
150 | 140 |
151 double WebCompositorAnimationImpl::playbackRate() const { | 141 double WebCompositorAnimationImpl::playbackRate() const { |
152 return animation_->playback_rate(); | 142 return animation_->playback_rate(); |
153 } | 143 } |
154 | 144 |
155 void WebCompositorAnimationImpl::setPlaybackRate(double playback_rate) { | 145 void WebCompositorAnimationImpl::setPlaybackRate(double playback_rate) { |
156 animation_->set_playback_rate(playback_rate); | 146 animation_->set_playback_rate(playback_rate); |
157 } | 147 } |
158 | 148 |
| 149 #if WEB_ANIMATION_SUPPORTS_FILL_MODE |
| 150 blink::WebCompositorAnimation::FillMode WebCompositorAnimationImpl::fillMode() |
| 151 const { |
| 152 switch (animation_->fill_mode()) { |
| 153 case cc::Animation::FillModeNone: |
| 154 return FillModeNone; |
| 155 case cc::Animation::FillModeForwards: |
| 156 return FillModeForwards; |
| 157 case cc::Animation::FillModeBackwards: |
| 158 return FillModeBackwards; |
| 159 case cc::Animation::FillModeBoth: |
| 160 return FillModeBoth; |
| 161 default: |
| 162 NOTREACHED(); |
| 163 } |
| 164 return FillModeNone; |
| 165 } |
| 166 |
| 167 void WebCompositorAnimationImpl::setFillMode(FillMode fill_mode) { |
| 168 switch (fill_mode) { |
| 169 case FillModeNone: |
| 170 animation_->set_fill_mode(cc::Animation::FillModeNone); |
| 171 break; |
| 172 case FillModeForwards: |
| 173 animation_->set_fill_mode(cc::Animation::FillModeForwards); |
| 174 break; |
| 175 case FillModeBackwards: |
| 176 animation_->set_fill_mode(cc::Animation::FillModeBackwards); |
| 177 break; |
| 178 case FillModeBoth: |
| 179 animation_->set_fill_mode(cc::Animation::FillModeBoth); |
| 180 break; |
| 181 } |
| 182 } |
| 183 #endif |
159 scoped_ptr<cc::Animation> WebCompositorAnimationImpl::PassAnimation() { | 184 scoped_ptr<cc::Animation> WebCompositorAnimationImpl::PassAnimation() { |
160 animation_->set_needs_synchronized_start_time(true); | 185 animation_->set_needs_synchronized_start_time(true); |
161 return animation_.Pass(); | 186 return animation_.Pass(); |
162 } | 187 } |
163 | 188 |
164 } // namespace cc_blink | 189 } // namespace cc_blink |
OLD | NEW |