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::iterationStart() const { | 90 double WebCompositorAnimationImpl::iterationStart() const { |
101 return animation_->iteration_start(); | 91 return animation_->iteration_start(); |
102 } | 92 } |
103 | 93 |
104 void WebCompositorAnimationImpl::setIterationStart(double iteration_start) { | 94 void WebCompositorAnimationImpl::setIterationStart(double iteration_start) { |
105 animation_->set_iteration_start(iteration_start); | 95 animation_->set_iteration_start(iteration_start); |
106 } | 96 } |
107 | 97 |
108 double WebCompositorAnimationImpl::startTime() const { | 98 double WebCompositorAnimationImpl::startTime() const { |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 } | 147 } |
158 | 148 |
159 double WebCompositorAnimationImpl::playbackRate() const { | 149 double WebCompositorAnimationImpl::playbackRate() const { |
160 return animation_->playback_rate(); | 150 return animation_->playback_rate(); |
161 } | 151 } |
162 | 152 |
163 void WebCompositorAnimationImpl::setPlaybackRate(double playback_rate) { | 153 void WebCompositorAnimationImpl::setPlaybackRate(double playback_rate) { |
164 animation_->set_playback_rate(playback_rate); | 154 animation_->set_playback_rate(playback_rate); |
165 } | 155 } |
166 | 156 |
| 157 #if WEB_ANIMATION_SUPPORTS_FILL_MODE |
| 158 blink::WebCompositorAnimation::FillMode WebCompositorAnimationImpl::fillMode() |
| 159 const { |
| 160 switch (animation_->fill_mode()) { |
| 161 case cc::Animation::FillModeNone: |
| 162 return FillModeNone; |
| 163 case cc::Animation::FillModeForwards: |
| 164 return FillModeForwards; |
| 165 case cc::Animation::FillModeBackwards: |
| 166 return FillModeBackwards; |
| 167 case cc::Animation::FillModeBoth: |
| 168 return FillModeBoth; |
| 169 default: |
| 170 NOTREACHED(); |
| 171 } |
| 172 return FillModeNone; |
| 173 } |
| 174 |
| 175 void WebCompositorAnimationImpl::setFillMode(FillMode fill_mode) { |
| 176 switch (fill_mode) { |
| 177 case FillModeNone: |
| 178 animation_->set_fill_mode(cc::Animation::FillModeNone); |
| 179 break; |
| 180 case FillModeForwards: |
| 181 animation_->set_fill_mode(cc::Animation::FillModeForwards); |
| 182 break; |
| 183 case FillModeBackwards: |
| 184 animation_->set_fill_mode(cc::Animation::FillModeBackwards); |
| 185 break; |
| 186 case FillModeBoth: |
| 187 animation_->set_fill_mode(cc::Animation::FillModeBoth); |
| 188 break; |
| 189 } |
| 190 } |
| 191 #endif |
167 scoped_ptr<cc::Animation> WebCompositorAnimationImpl::PassAnimation() { | 192 scoped_ptr<cc::Animation> WebCompositorAnimationImpl::PassAnimation() { |
168 animation_->set_needs_synchronized_start_time(true); | 193 animation_->set_needs_synchronized_start_time(true); |
169 return animation_.Pass(); | 194 return animation_.Pass(); |
170 } | 195 } |
171 | 196 |
172 } // namespace cc_blink | 197 } // namespace cc_blink |
OLD | NEW |