| Index: cc/animation/animation_host.cc
|
| diff --git a/cc/animation/animation_host.cc b/cc/animation/animation_host.cc
|
| index 10f3202b72f9f11729c030268dd5a8f6d9e5a86b..f00469ab55db5dd2679508dba21b333f1825a29e 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,211 @@ 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::SupportsScrollAnimations() const {
|
| + 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::ScrollOffsetAnimationWasInterrupted(int layer_id) const {
|
| + AnimationPlayer* player = GetPlayerForLayerId(layer_id);
|
| + return player
|
| + ? player->layer_animation_controller()
|
| + ->scroll_offset_animation_was_interrupted()
|
| + : false;
|
| +}
|
| +
|
| +bool AnimationHost::IsAnimatingFilterProperty(int layer_id) const {
|
| + AnimationPlayer* player = GetPlayerForLayerId(layer_id);
|
| + 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::HasPotentiallyRunningOpacityAnimation(int layer_id) const {
|
| + AnimationPlayer* player = GetPlayerForLayerId(layer_id);
|
| + if (player) {
|
| + if (Animation* animation =
|
| + player->layer_animation_controller()->GetAnimation(
|
| + Animation::OPACITY)) {
|
| + return !animation->is_finished();
|
| + }
|
| + }
|
| + return false;
|
| +}
|
| +
|
| +bool AnimationHost::HasPotentiallyRunningTransformAnimation(
|
| + int layer_id) const {
|
| + AnimationPlayer* player = GetPlayerForLayerId(layer_id);
|
| + if (player) {
|
| + if (Animation* animation =
|
| + player->layer_animation_controller()->GetAnimation(
|
| + Animation::TRANSFORM)) {
|
| + return !animation->is_finished();
|
| + }
|
| + }
|
| + return 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
|
|
|