| 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 SetNeedsCommit(); | 112 SetNeedsCommit(); |
| 113 animations_.clear(); | 113 animations_.clear(); |
| 114 } | 114 } |
| 115 | 115 |
| 116 void AnimationPlayer::UnbindElementAnimations() { | 116 void AnimationPlayer::UnbindElementAnimations() { |
| 117 element_animations_ = nullptr; | 117 element_animations_ = nullptr; |
| 118 DCHECK(animations_.empty()); | 118 DCHECK(animations_.empty()); |
| 119 } | 119 } |
| 120 | 120 |
| 121 void AnimationPlayer::AddAnimation(scoped_ptr<Animation> animation) { | 121 void AnimationPlayer::AddAnimation(scoped_ptr<Animation> animation) { |
| 122 DCHECK_IMPLIES( | 122 DCHECK(animation->target_property() != Animation::SCROLL_OFFSET || |
| 123 animation->target_property() == Animation::SCROLL_OFFSET, | 123 (animation_host_ && animation_host_->SupportsScrollAnimations())); |
| 124 animation_host_ && animation_host_->SupportsScrollAnimations()); | |
| 125 | 124 |
| 126 if (element_animations_) { | 125 if (element_animations_) { |
| 127 element_animations_->layer_animation_controller()->AddAnimation( | 126 element_animations_->layer_animation_controller()->AddAnimation( |
| 128 animation.Pass()); | 127 animation.Pass()); |
| 129 SetNeedsCommit(); | 128 SetNeedsCommit(); |
| 130 } else { | 129 } else { |
| 131 animations_.push_back(animation.Pass()); | 130 animations_.push_back(animation.Pass()); |
| 132 } | 131 } |
| 133 } | 132 } |
| 134 | 133 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 target_property, group); | 180 target_property, group); |
| 182 } | 181 } |
| 183 | 182 |
| 184 void AnimationPlayer::SetNeedsCommit() { | 183 void AnimationPlayer::SetNeedsCommit() { |
| 185 DCHECK(animation_host_); | 184 DCHECK(animation_host_); |
| 186 animation_host_->SetNeedsCommit(); | 185 animation_host_->SetNeedsCommit(); |
| 187 animation_host_->SetNeedsRebuildPropertyTrees(); | 186 animation_host_->SetNeedsRebuildPropertyTrees(); |
| 188 } | 187 } |
| 189 | 188 |
| 190 } // namespace cc | 189 } // namespace cc |
| OLD | NEW |