Chromium Code Reviews| Index: cc/animation/animation_host.cc |
| diff --git a/cc/animation/animation_host.cc b/cc/animation/animation_host.cc |
| index 10f3202b72f9f11729c030268dd5a8f6d9e5a86b..4c709bcd6ffaaa26aee7aaa8a3b554f248d1e9f5 100644 |
| --- a/cc/animation/animation_host.cc |
| +++ b/cc/animation/animation_host.cc |
| @@ -10,6 +10,7 @@ |
| #include "cc/animation/animation_registrar.h" |
| #include "cc/animation/animation_timeline.h" |
| #include "cc/trees/layer_tree_mutators_client.h" |
| +#include "ui/gfx/geometry/box_f.h" |
| namespace cc { |
| @@ -153,4 +154,178 @@ AnimationPlayer* AnimationHost::GetPlayerForLayerId(int layer_id) const { |
| return iter == layer_to_player_map_.end() ? nullptr : iter->second; |
| } |
| +void AnimationHost::SetSupportsScrollAnimations( |
| + bool supports_scroll_animations) { |
| + animation_registrar_->set_supports_scroll_animations( |
| + supports_scroll_animations); |
| +} |
| + |
| +bool AnimationHost::GetSupportsScrollAnimations() const { |
|
ajuma
2015/04/21 17:57:57
Nit: s/GetSupportsScrollAnimations/SupportsScrollA
loyso (OOO)
2015/04/22 01:08:11
Acknowledged.
|
| + return animation_registrar_->supports_scroll_animations(); |
| +} |
| + |
| +bool AnimationHost::NeedsAnimateLayers() const { |
| + return animation_registrar_->needs_animate_layers(); |
| +} |
| + |
| +bool AnimationHost::ActivateAnimations() { |
| + return animation_registrar_->ActivateAnimations(); |
| +} |
| + |
| +bool AnimationHost::AnimateLayers(base::TimeTicks monotonic_time) { |
| + return animation_registrar_->AnimateLayers(monotonic_time); |
| +} |
| + |
| +bool AnimationHost::UpdateAnimationState(bool start_ready_animations, |
| + AnimationEventsVector* events) { |
| + return animation_registrar_->UpdateAnimationState(start_ready_animations, |
| + events); |
| +} |
| + |
| +scoped_ptr<AnimationEventsVector> AnimationHost::CreateEvents() { |
| + return animation_registrar_->CreateEvents(); |
| +} |
| + |
| +void AnimationHost::SetAnimationEvents( |
| + scoped_ptr<AnimationEventsVector> events) { |
| + return animation_registrar_->SetAnimationEvents(events.Pass()); |
| +} |
| + |
| +bool AnimationHost::IsAnimatingFilterProperty(int layer_id) const { |
| + AnimationPlayer* player = GetPlayerForLayerId(layer_id); |
|
loyso (OOO)
2015/04/22 01:27:30
We have a hash look-up for such a request. The num
|
| + return player |
| + ? player->layer_animation_controller()->IsAnimatingProperty( |
| + Animation::FILTER) |
| + : false; |
| +} |
| + |
| +bool AnimationHost::IsAnimatingOpacityProperty(int layer_id) const { |
| + AnimationPlayer* player = GetPlayerForLayerId(layer_id); |
| + return player |
| + ? player->layer_animation_controller()->IsAnimatingProperty( |
| + Animation::OPACITY) |
| + : false; |
| +} |
| + |
| +bool AnimationHost::IsAnimatingTransformProperty(int layer_id) const { |
| + AnimationPlayer* player = GetPlayerForLayerId(layer_id); |
| + return player |
| + ? player->layer_animation_controller()->IsAnimatingProperty( |
| + Animation::TRANSFORM) |
| + : false; |
| +} |
| + |
| +bool AnimationHost::FilterIsAnimatingOnImplOnly(int layer_id) const { |
| + AnimationPlayer* player = GetPlayerForLayerId(layer_id); |
| + if (!player) |
| + return false; |
| + |
| + Animation* animation = |
| + player->layer_animation_controller()->GetAnimation(Animation::FILTER); |
| + return animation && animation->is_impl_only(); |
| +} |
| + |
| +bool AnimationHost::OpacityIsAnimatingOnImplOnly(int layer_id) const { |
| + AnimationPlayer* player = GetPlayerForLayerId(layer_id); |
| + if (!player) |
| + return false; |
| + |
| + Animation* animation = |
| + player->layer_animation_controller()->GetAnimation(Animation::OPACITY); |
| + return animation && animation->is_impl_only(); |
| +} |
| + |
| +bool AnimationHost::TransformIsAnimatingOnImplOnly(int layer_id) const { |
| + AnimationPlayer* player = GetPlayerForLayerId(layer_id); |
| + if (!player) |
| + return false; |
| + |
| + Animation* animation = |
| + player->layer_animation_controller()->GetAnimation(Animation::TRANSFORM); |
| + return animation && animation->is_impl_only(); |
| +} |
| + |
| +bool AnimationHost::HasFilterAnimationThatInflatesBounds(int layer_id) const { |
| + AnimationPlayer* player = GetPlayerForLayerId(layer_id); |
| + return player |
| + ? player->layer_animation_controller() |
| + ->HasFilterAnimationThatInflatesBounds() |
| + : false; |
| +} |
| + |
| +bool AnimationHost::HasTransformAnimationThatInflatesBounds( |
| + int layer_id) const { |
| + AnimationPlayer* player = GetPlayerForLayerId(layer_id); |
| + return player |
| + ? player->layer_animation_controller() |
| + ->HasTransformAnimationThatInflatesBounds() |
| + : false; |
| +} |
| + |
| +bool AnimationHost::HasAnimationThatInflatesBounds(int layer_id) const { |
| + AnimationPlayer* player = GetPlayerForLayerId(layer_id); |
| + return player |
| + ? player->layer_animation_controller() |
| + ->HasAnimationThatInflatesBounds() |
| + : false; |
| +} |
| + |
| +bool AnimationHost::FilterAnimationBoundsForBox(int layer_id, |
| + const gfx::BoxF& box, |
| + gfx::BoxF* bounds) const { |
| + AnimationPlayer* player = GetPlayerForLayerId(layer_id); |
| + return player |
| + ? player->layer_animation_controller() |
| + ->FilterAnimationBoundsForBox(box, bounds) |
| + : false; |
| +} |
| + |
| +bool AnimationHost::TransformAnimationBoundsForBox(int layer_id, |
| + const gfx::BoxF& box, |
| + gfx::BoxF* bounds) const { |
| + *bounds = gfx::BoxF(); |
| + AnimationPlayer* player = GetPlayerForLayerId(layer_id); |
| + return player |
| + ? player->layer_animation_controller() |
| + ->TransformAnimationBoundsForBox(box, bounds) |
| + : true; |
| +} |
| + |
| +bool AnimationHost::HasOnlyTranslationTransforms(int layer_id) const { |
| + AnimationPlayer* player = GetPlayerForLayerId(layer_id); |
| + return player |
| + ? player->layer_animation_controller() |
| + ->HasOnlyTranslationTransforms() |
| + : true; |
| +} |
| + |
| +bool AnimationHost::AnimationsPreserveAxisAlignment(int layer_id) const { |
| + AnimationPlayer* player = GetPlayerForLayerId(layer_id); |
| + return player |
| + ? player->layer_animation_controller() |
| + ->AnimationsPreserveAxisAlignment() |
| + : true; |
| +} |
| + |
| +bool AnimationHost::MaximumTargetScale(int layer_id, float* max_scale) const { |
| + *max_scale = 0.f; |
| + AnimationPlayer* player = GetPlayerForLayerId(layer_id); |
| + return player |
| + ? player->layer_animation_controller()->MaximumTargetScale( |
| + max_scale) |
| + : true; |
| +} |
| + |
| +bool AnimationHost::HasAnyAnimation(int layer_id) const { |
| + AnimationPlayer* player = GetPlayerForLayerId(layer_id); |
| + return player ? player->layer_animation_controller()->has_any_animation() |
| + : false; |
| +} |
| + |
| +bool AnimationHost::HasActiveAnimation(int layer_id) const { |
| + AnimationPlayer* player = GetPlayerForLayerId(layer_id); |
| + return player ? player->layer_animation_controller()->HasActiveAnimation() |
| + : false; |
| +} |
| + |
| } // namespace cc |