| 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 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/ptr_util.h" | 12 #include "base/memory/ptr_util.h" |
| 13 #include "cc/animation/animation_delegate.h" | 13 #include "cc/animation/animation_delegate.h" |
| 14 #include "cc/animation/animation_events.h" | 14 #include "cc/animation/animation_events.h" |
| 15 #include "cc/animation/animation_host.h" | 15 #include "cc/animation/animation_host.h" |
| 16 #include "cc/animation/animation_player.h" | 16 #include "cc/animation/animation_player.h" |
| 17 #include "cc/animation/keyframed_animation_curve.h" | 17 #include "cc/animation/keyframed_animation_curve.h" |
| 18 #include "cc/animation/transform_operations.h" |
| 18 #include "cc/base/filter_operations.h" | 19 #include "cc/base/filter_operations.h" |
| 19 #include "cc/trees/mutator_host_client.h" | 20 #include "cc/trees/mutator_host_client.h" |
| 20 #include "ui/gfx/geometry/box_f.h" | 21 #include "ui/gfx/geometry/box_f.h" |
| 21 | 22 |
| 22 namespace cc { | 23 namespace cc { |
| 23 | 24 |
| 24 scoped_refptr<ElementAnimations> ElementAnimations::Create() { | 25 scoped_refptr<ElementAnimations> ElementAnimations::Create() { |
| 25 return make_scoped_refptr(new ElementAnimations()); | 26 return make_scoped_refptr(new ElementAnimations()); |
| 26 } | 27 } |
| 27 | 28 |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 | 194 |
| 194 UpdateClientAnimationState(); | 195 UpdateClientAnimationState(); |
| 195 } | 196 } |
| 196 | 197 |
| 197 void ElementAnimations::NotifyAnimationPropertyUpdate( | 198 void ElementAnimations::NotifyAnimationPropertyUpdate( |
| 198 const AnimationEvent& event) { | 199 const AnimationEvent& event) { |
| 199 DCHECK(!event.is_impl_only); | 200 DCHECK(!event.is_impl_only); |
| 200 bool notify_active_elements = true; | 201 bool notify_active_elements = true; |
| 201 bool notify_pending_elements = true; | 202 bool notify_pending_elements = true; |
| 202 switch (event.target_property) { | 203 switch (event.target_property) { |
| 203 case TargetProperty::OPACITY: | 204 case TargetProperty::OPACITY: { |
| 204 NotifyClientOpacityAnimated(event.opacity, notify_active_elements, | 205 NotifyClientOpacityAnimated(event.opacity, notify_active_elements, |
| 205 notify_pending_elements); | 206 notify_pending_elements); |
| 206 break; | 207 break; |
| 207 case TargetProperty::TRANSFORM: | 208 } |
| 208 NotifyClientTransformAnimated(event.transform, notify_active_elements, | 209 case TargetProperty::TRANSFORM: { |
| 209 notify_pending_elements); | 210 TransformOperations operations; |
| 211 operations.AppendMatrix(event.transform); |
| 212 NotifyClientTransformOperationsAnimated( |
| 213 operations, notify_active_elements, notify_pending_elements); |
| 210 break; | 214 break; |
| 215 } |
| 211 default: | 216 default: |
| 212 NOTREACHED(); | 217 NOTREACHED(); |
| 213 } | 218 } |
| 214 } | 219 } |
| 215 | 220 |
| 216 bool ElementAnimations::HasFilterAnimationThatInflatesBounds() const { | 221 bool ElementAnimations::HasFilterAnimationThatInflatesBounds() const { |
| 217 for (auto& player : players_list_) { | 222 for (auto& player : players_list_) { |
| 218 if (player.HasFilterAnimationThatInflatesBounds()) | 223 if (player.HasFilterAnimationThatInflatesBounds()) |
| 219 return true; | 224 return true; |
| 220 } | 225 } |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 void ElementAnimations::NotifyClientOpacityAnimated( | 322 void ElementAnimations::NotifyClientOpacityAnimated( |
| 318 float opacity, | 323 float opacity, |
| 319 bool notify_active_elements, | 324 bool notify_active_elements, |
| 320 bool notify_pending_elements) { | 325 bool notify_pending_elements) { |
| 321 if (notify_active_elements && has_element_in_active_list()) | 326 if (notify_active_elements && has_element_in_active_list()) |
| 322 OnOpacityAnimated(ElementListType::ACTIVE, opacity); | 327 OnOpacityAnimated(ElementListType::ACTIVE, opacity); |
| 323 if (notify_pending_elements && has_element_in_pending_list()) | 328 if (notify_pending_elements && has_element_in_pending_list()) |
| 324 OnOpacityAnimated(ElementListType::PENDING, opacity); | 329 OnOpacityAnimated(ElementListType::PENDING, opacity); |
| 325 } | 330 } |
| 326 | 331 |
| 327 void ElementAnimations::NotifyClientTransformAnimated( | 332 void ElementAnimations::NotifyClientTransformOperationsAnimated( |
| 328 const gfx::Transform& transform, | 333 const TransformOperations& operations, |
| 329 bool notify_active_elements, | 334 bool notify_active_elements, |
| 330 bool notify_pending_elements) { | 335 bool notify_pending_elements) { |
| 336 gfx::Transform transform = operations.Apply(); |
| 331 if (notify_active_elements && has_element_in_active_list()) | 337 if (notify_active_elements && has_element_in_active_list()) |
| 332 OnTransformAnimated(ElementListType::ACTIVE, transform); | 338 OnTransformAnimated(ElementListType::ACTIVE, transform); |
| 333 if (notify_pending_elements && has_element_in_pending_list()) | 339 if (notify_pending_elements && has_element_in_pending_list()) |
| 334 OnTransformAnimated(ElementListType::PENDING, transform); | 340 OnTransformAnimated(ElementListType::PENDING, transform); |
| 335 } | 341 } |
| 336 | 342 |
| 337 void ElementAnimations::NotifyClientFilterAnimated( | 343 void ElementAnimations::NotifyClientFilterAnimated( |
| 338 const FilterOperations& filters, | 344 const FilterOperations& filters, |
| 339 bool notify_active_elements, | 345 bool notify_active_elements, |
| 340 bool notify_pending_elements) { | 346 bool notify_pending_elements) { |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 if (animation_host()) { | 503 if (animation_host()) { |
| 498 DCHECK(animation_host()->mutator_host_client()); | 504 DCHECK(animation_host()->mutator_host_client()); |
| 499 return animation_host()->mutator_host_client()->GetScrollOffsetForAnimation( | 505 return animation_host()->mutator_host_client()->GetScrollOffsetForAnimation( |
| 500 element_id()); | 506 element_id()); |
| 501 } | 507 } |
| 502 | 508 |
| 503 return gfx::ScrollOffset(); | 509 return gfx::ScrollOffset(); |
| 504 } | 510 } |
| 505 | 511 |
| 506 } // namespace cc | 512 } // namespace cc |
| OLD | NEW |