| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/animation/animation_player.h" | 5 #include "cc/animation/animation_player.h" |
| 6 | 6 |
| 7 #include "cc/animation/animation_delegate.h" | 7 #include "cc/animation/animation_delegate.h" |
| 8 #include "cc/animation/animation_host.h" | 8 #include "cc/animation/animation_host.h" |
| 9 #include "cc/animation/animation_timeline.h" | 9 #include "cc/animation/animation_timeline.h" |
| 10 #include "cc/animation/element_animations.h" | 10 #include "cc/animation/element_animations.h" |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 auto animations_to_remove = | 147 auto animations_to_remove = |
| 148 std::remove_if(animations_.begin(), animations_.end(), | 148 std::remove_if(animations_.begin(), animations_.end(), |
| 149 [animation_id](const scoped_ptr<Animation>& animation) { | 149 [animation_id](const scoped_ptr<Animation>& animation) { |
| 150 return animation->id() == animation_id; | 150 return animation->id() == animation_id; |
| 151 }); | 151 }); |
| 152 animations_.erase(animations_to_remove, animations_.end()); | 152 animations_.erase(animations_to_remove, animations_.end()); |
| 153 } | 153 } |
| 154 } | 154 } |
| 155 | 155 |
| 156 void AnimationPlayer::PushPropertiesTo(AnimationPlayer* player_impl) { | 156 void AnimationPlayer::PushPropertiesTo(AnimationPlayer* player_impl) { |
| 157 if (!element_animations_) { | 157 if (layer_id_ != player_impl->layer_id()) { |
| 158 if (player_impl->element_animations()) | 158 if (player_impl->layer_id()) |
| 159 player_impl->DetachLayer(); | 159 player_impl->DetachLayer(); |
| 160 return; | 160 if (layer_id_) |
| 161 player_impl->AttachLayer(layer_id_); |
| 161 } | 162 } |
| 162 | |
| 163 DCHECK(layer_id_); | |
| 164 if (!player_impl->element_animations()) | |
| 165 player_impl->AttachLayer(layer_id_); | |
| 166 } | 163 } |
| 167 | 164 |
| 168 void AnimationPlayer::NotifyAnimationStarted( | 165 void AnimationPlayer::NotifyAnimationStarted( |
| 169 base::TimeTicks monotonic_time, | 166 base::TimeTicks monotonic_time, |
| 170 Animation::TargetProperty target_property, | 167 Animation::TargetProperty target_property, |
| 171 int group) { | 168 int group) { |
| 172 if (layer_animation_delegate_) | 169 if (layer_animation_delegate_) |
| 173 layer_animation_delegate_->NotifyAnimationStarted(monotonic_time, | 170 layer_animation_delegate_->NotifyAnimationStarted(monotonic_time, |
| 174 target_property, group); | 171 target_property, group); |
| 175 } | 172 } |
| 176 | 173 |
| 177 void AnimationPlayer::NotifyAnimationFinished( | 174 void AnimationPlayer::NotifyAnimationFinished( |
| 178 base::TimeTicks monotonic_time, | 175 base::TimeTicks monotonic_time, |
| 179 Animation::TargetProperty target_property, | 176 Animation::TargetProperty target_property, |
| 180 int group) { | 177 int group) { |
| 181 if (layer_animation_delegate_) | 178 if (layer_animation_delegate_) |
| 182 layer_animation_delegate_->NotifyAnimationFinished(monotonic_time, | 179 layer_animation_delegate_->NotifyAnimationFinished(monotonic_time, |
| 183 target_property, group); | 180 target_property, group); |
| 184 } | 181 } |
| 185 | 182 |
| 186 void AnimationPlayer::SetNeedsCommit() { | 183 void AnimationPlayer::SetNeedsCommit() { |
| 187 DCHECK(animation_host_); | 184 DCHECK(animation_host_); |
| 188 animation_host_->SetNeedsCommit(); | 185 animation_host_->SetNeedsCommit(); |
| 189 animation_host_->SetNeedsRebuildPropertyTrees(); | 186 animation_host_->SetNeedsRebuildPropertyTrees(); |
| 190 } | 187 } |
| 191 | 188 |
| 192 } // namespace cc | 189 } // namespace cc |
| OLD | NEW |