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/element_animations.h" | 5 #include "cc/animation/element_animations.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 } | 128 } |
129 | 129 |
130 void ElementAnimations::PushPropertiesTo( | 130 void ElementAnimations::PushPropertiesTo( |
131 scoped_refptr<ElementAnimations> element_animations_impl) { | 131 scoped_refptr<ElementAnimations> element_animations_impl) { |
132 DCHECK_NE(this, element_animations_impl); | 132 DCHECK_NE(this, element_animations_impl); |
133 | 133 |
134 if (!needs_push_properties_) | 134 if (!needs_push_properties_) |
135 return; | 135 return; |
136 needs_push_properties_ = false; | 136 needs_push_properties_ = false; |
137 | 137 |
138 if (!has_any_animation() && !element_animations_impl->has_any_animation()) | 138 if (!HasAnyAnimation() && !element_animations_impl->HasAnyAnimation()) |
139 return; | 139 return; |
140 MarkAbortedAnimationsForDeletion(element_animations_impl.get()); | 140 MarkAbortedAnimationsForDeletion(element_animations_impl.get()); |
141 PurgeAnimationsMarkedForDeletion(); | 141 PurgeAnimationsMarkedForDeletion(); |
142 PushNewAnimationsToImplThread(element_animations_impl.get()); | 142 PushNewAnimationsToImplThread(element_animations_impl.get()); |
143 | 143 |
144 // Remove finished impl side animations only after pushing, | 144 // Remove finished impl side animations only after pushing, |
145 // and only after the animations are deleted on the main thread | 145 // and only after the animations are deleted on the main thread |
146 // this insures we will never push an animation twice. | 146 // this insures we will never push an animation twice. |
147 RemoveAnimationsCompletedOnMainThread(element_animations_impl.get()); | 147 RemoveAnimationsCompletedOnMainThread(element_animations_impl.get()); |
148 | 148 |
(...skipping 1054 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1203 } | 1203 } |
1204 | 1204 |
1205 bool ElementAnimations::HasActiveAnimation() const { | 1205 bool ElementAnimations::HasActiveAnimation() const { |
1206 for (size_t i = 0; i < animations_.size(); ++i) { | 1206 for (size_t i = 0; i < animations_.size(); ++i) { |
1207 if (!animations_[i]->is_finished()) | 1207 if (!animations_[i]->is_finished()) |
1208 return true; | 1208 return true; |
1209 } | 1209 } |
1210 return false; | 1210 return false; |
1211 } | 1211 } |
1212 | 1212 |
| 1213 bool ElementAnimations::HasAnyAnimation() const { |
| 1214 return !animations_.empty(); |
| 1215 } |
| 1216 |
1213 bool ElementAnimations::IsPotentiallyAnimatingProperty( | 1217 bool ElementAnimations::IsPotentiallyAnimatingProperty( |
1214 TargetProperty::Type target_property, | 1218 TargetProperty::Type target_property, |
1215 ElementListType list_type) const { | 1219 ElementListType list_type) const { |
1216 for (size_t i = 0; i < animations_.size(); ++i) { | 1220 for (size_t i = 0; i < animations_.size(); ++i) { |
1217 if (!animations_[i]->is_finished() && | 1221 if (!animations_[i]->is_finished() && |
1218 animations_[i]->target_property() == target_property) { | 1222 animations_[i]->target_property() == target_property) { |
1219 if ((list_type == ElementListType::ACTIVE && | 1223 if ((list_type == ElementListType::ACTIVE && |
1220 animations_[i]->affects_active_elements()) || | 1224 animations_[i]->affects_active_elements()) || |
1221 (list_type == ElementListType::PENDING && | 1225 (list_type == ElementListType::PENDING && |
1222 animations_[i]->affects_pending_elements())) | 1226 animations_[i]->affects_pending_elements())) |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1495 if (animation_host()) { | 1499 if (animation_host()) { |
1496 DCHECK(animation_host()->mutator_host_client()); | 1500 DCHECK(animation_host()->mutator_host_client()); |
1497 return animation_host()->mutator_host_client()->GetScrollOffsetForAnimation( | 1501 return animation_host()->mutator_host_client()->GetScrollOffsetForAnimation( |
1498 element_id()); | 1502 element_id()); |
1499 } | 1503 } |
1500 | 1504 |
1501 return gfx::ScrollOffset(); | 1505 return gfx::ScrollOffset(); |
1502 } | 1506 } |
1503 | 1507 |
1504 } // namespace cc | 1508 } // namespace cc |
OLD | NEW |