| 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_host.h" | 5 #include "cc/animation/animation_host.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 const gfx::Vector2dF& scroll_delta, | 72 const gfx::Vector2dF& scroll_delta, |
| 73 const gfx::ScrollOffset& max_scroll_offset, | 73 const gfx::ScrollOffset& max_scroll_offset, |
| 74 base::TimeTicks frame_monotonic_time) { | 74 base::TimeTicks frame_monotonic_time) { |
| 75 DCHECK(scroll_offset_animation_player_); | 75 DCHECK(scroll_offset_animation_player_); |
| 76 if (!scroll_offset_animation_player_->element_animations()) | 76 if (!scroll_offset_animation_player_->element_animations()) |
| 77 return false; | 77 return false; |
| 78 | 78 |
| 79 DCHECK_EQ(layer_id, scroll_offset_animation_player_->layer_id()); | 79 DCHECK_EQ(layer_id, scroll_offset_animation_player_->layer_id()); |
| 80 | 80 |
| 81 Animation* animation = scroll_offset_animation_player_->element_animations() | 81 Animation* animation = scroll_offset_animation_player_->element_animations() |
| 82 ->layer_animation_controller() | |
| 83 ->GetAnimation(TargetProperty::SCROLL_OFFSET); | 82 ->GetAnimation(TargetProperty::SCROLL_OFFSET); |
| 84 if (!animation) { | 83 if (!animation) { |
| 85 scroll_offset_animation_player_->DetachLayer(); | 84 scroll_offset_animation_player_->DetachLayer(); |
| 86 return false; | 85 return false; |
| 87 } | 86 } |
| 88 | 87 |
| 89 ScrollOffsetAnimationCurve* curve = | 88 ScrollOffsetAnimationCurve* curve = |
| 90 animation->curve()->ToScrollOffsetAnimationCurve(); | 89 animation->curve()->ToScrollOffsetAnimationCurve(); |
| 91 | 90 |
| 92 gfx::ScrollOffset new_target = | 91 gfx::ScrollOffset new_target = |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 } | 329 } |
| 331 } | 330 } |
| 332 | 331 |
| 333 LayerAnimationController* AnimationHost::GetControllerForLayerId( | 332 LayerAnimationController* AnimationHost::GetControllerForLayerId( |
| 334 int layer_id) const { | 333 int layer_id) const { |
| 335 const ElementAnimations* element_animations = | 334 const ElementAnimations* element_animations = |
| 336 GetElementAnimationsForLayerId(layer_id); | 335 GetElementAnimationsForLayerId(layer_id); |
| 337 if (!element_animations) | 336 if (!element_animations) |
| 338 return nullptr; | 337 return nullptr; |
| 339 | 338 |
| 340 return element_animations->layer_animation_controller(); | 339 return element_animations->layer_animation_controller_.get(); |
| 341 } | 340 } |
| 342 | 341 |
| 343 ElementAnimations* AnimationHost::GetElementAnimationsForLayerId( | 342 ElementAnimations* AnimationHost::GetElementAnimationsForLayerId( |
| 344 int layer_id) const { | 343 int layer_id) const { |
| 345 DCHECK(layer_id); | 344 DCHECK(layer_id); |
| 346 auto iter = layer_to_element_animations_map_.find(layer_id); | 345 auto iter = layer_to_element_animations_map_.find(layer_id); |
| 347 return iter == layer_to_element_animations_map_.end() ? nullptr | 346 return iter == layer_to_element_animations_map_.end() ? nullptr |
| 348 : iter->second.get(); | 347 : iter->second.get(); |
| 349 } | 348 } |
| 350 | 349 |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 708 AnimationHost::active_animation_controllers_for_testing() const { | 707 AnimationHost::active_animation_controllers_for_testing() const { |
| 709 return active_animation_controllers_; | 708 return active_animation_controllers_; |
| 710 } | 709 } |
| 711 | 710 |
| 712 const AnimationHost::AnimationControllerMap& | 711 const AnimationHost::AnimationControllerMap& |
| 713 AnimationHost::all_animation_controllers_for_testing() const { | 712 AnimationHost::all_animation_controllers_for_testing() const { |
| 714 return all_animation_controllers_; | 713 return all_animation_controllers_; |
| 715 } | 714 } |
| 716 | 715 |
| 717 } // namespace cc | 716 } // namespace cc |
| OLD | NEW |