Index: cc/layers/layer_impl.cc |
diff --git a/cc/layers/layer_impl.cc b/cc/layers/layer_impl.cc |
index 8b37d12eef225b75ca6267302d693bd836205e38..4440a63c5554c2731021b0f8d3f8ab71f74ccbe7 100644 |
--- a/cc/layers/layer_impl.cc |
+++ b/cc/layers/layer_impl.cc |
@@ -81,13 +81,16 @@ LayerImpl::LayerImpl(LayerTreeImpl* tree_impl, |
DCHECK_GT(layer_id_, 0); |
DCHECK(layer_tree_impl_); |
layer_tree_impl_->RegisterLayer(this); |
- AnimationRegistrar* registrar = layer_tree_impl_->GetAnimationRegistrar(); |
- layer_animation_controller_ = |
- registrar->GetAnimationControllerForId(layer_id_); |
- layer_animation_controller_->AddValueObserver(this); |
- if (IsActive()) { |
- layer_animation_controller_->set_value_provider(this); |
- layer_animation_controller_->set_layer_animation_delegate(this); |
+ |
+ if (!layer_tree_impl_->settings().use_compositor_animation_timelines) { |
+ AnimationRegistrar* registrar = layer_tree_impl_->GetAnimationRegistrar(); |
+ layer_animation_controller_ = |
+ registrar->GetAnimationControllerForId(layer_id_); |
+ layer_animation_controller_->AddValueObserver(this); |
+ if (IsActive()) { |
+ layer_animation_controller_->set_value_provider(this); |
+ layer_animation_controller_->set_layer_animation_delegate(this); |
+ } |
} |
SetNeedsPushProperties(); |
} |
@@ -95,9 +98,11 @@ LayerImpl::LayerImpl(LayerTreeImpl* tree_impl, |
LayerImpl::~LayerImpl() { |
DCHECK_EQ(DRAW_MODE_NONE, current_draw_mode_); |
- layer_animation_controller_->RemoveValueObserver(this); |
- layer_animation_controller_->remove_value_provider(this); |
- layer_animation_controller_->remove_layer_animation_delegate(this); |
+ if (layer_animation_controller_) { |
+ layer_animation_controller_->RemoveValueObserver(this); |
+ layer_animation_controller_->remove_value_provider(this); |
+ layer_animation_controller_->remove_layer_animation_delegate(this); |
+ } |
if (!copy_requests_.empty() && layer_tree_impl_->IsActiveTree()) |
layer_tree_impl()->RemoveLayerWithCopyOutputRequest(this); |
@@ -939,10 +944,16 @@ void LayerImpl::SetFilters(const FilterOperations& filters) { |
} |
bool LayerImpl::FilterIsAnimating() const { |
- return layer_animation_controller_->IsAnimatingProperty(Animation::FILTER); |
+ return layer_animation_controller_ |
+ ? layer_animation_controller_->IsAnimatingProperty( |
+ Animation::FILTER) |
+ : layer_tree_impl_->IsAnimatingFilterProperty(this); |
} |
bool LayerImpl::FilterIsAnimatingOnImplOnly() const { |
+ if (!layer_animation_controller_) |
+ return layer_tree_impl_->FilterIsAnimatingOnImplOnly(this); |
+ |
Animation* filter_animation = |
layer_animation_controller_->GetAnimation(Animation::FILTER); |
return filter_animation && filter_animation->is_impl_only(); |
@@ -982,10 +993,16 @@ void LayerImpl::SetOpacity(float opacity) { |
} |
bool LayerImpl::OpacityIsAnimating() const { |
- return layer_animation_controller_->IsAnimatingProperty(Animation::OPACITY); |
+ return layer_animation_controller_ |
+ ? layer_animation_controller_->IsAnimatingProperty( |
+ Animation::OPACITY) |
+ : layer_tree_impl_->IsAnimatingOpacityProperty(this); |
} |
bool LayerImpl::OpacityIsAnimatingOnImplOnly() const { |
+ if (!layer_animation_controller_) |
+ return layer_tree_impl_->OpacityIsAnimatingOnImplOnly(this); |
+ |
Animation* opacity_animation = |
layer_animation_controller_->GetAnimation(Animation::OPACITY); |
return opacity_animation && opacity_animation->is_impl_only(); |
@@ -1064,15 +1081,73 @@ void LayerImpl::SetTransformAndInvertibility(const gfx::Transform& transform, |
} |
bool LayerImpl::TransformIsAnimating() const { |
- return layer_animation_controller_->IsAnimatingProperty(Animation::TRANSFORM); |
+ return layer_animation_controller_ |
+ ? layer_animation_controller_->IsAnimatingProperty( |
+ Animation::TRANSFORM) |
+ : layer_tree_impl_->IsAnimatingTransformProperty(this); |
} |
bool LayerImpl::TransformIsAnimatingOnImplOnly() const { |
+ if (!layer_animation_controller_) |
+ return layer_tree_impl_->TransformIsAnimatingOnImplOnly(this); |
+ |
Animation* transform_animation = |
layer_animation_controller_->GetAnimation(Animation::TRANSFORM); |
return transform_animation && transform_animation->is_impl_only(); |
} |
+bool LayerImpl::HasOnlyTranslationTransforms() const { |
+ if (!layer_animation_controller_) |
+ return layer_tree_impl_->HasOnlyTranslationTransforms(this); |
+ |
+ return layer_animation_controller_->HasOnlyTranslationTransforms(); |
+} |
+ |
+bool LayerImpl::MaximumTargetScale(float* max_scale) const { |
+ if (!layer_animation_controller_) |
+ return layer_tree_impl_->MaximumTargetScale(this, max_scale); |
+ |
+ return layer_animation_controller_->MaximumTargetScale(max_scale); |
+} |
+ |
+bool LayerImpl::HasFilterAnimationThatInflatesBounds() const { |
+ if (!layer_animation_controller_) |
+ return layer_tree_impl_->HasFilterAnimationThatInflatesBounds(this); |
+ |
+ return layer_animation_controller_->HasFilterAnimationThatInflatesBounds(); |
+} |
+ |
+bool LayerImpl::HasTransformAnimationThatInflatesBounds() const { |
+ if (!layer_animation_controller_) |
+ return layer_tree_impl_->HasTransformAnimationThatInflatesBounds(this); |
+ |
+ return layer_animation_controller_->HasTransformAnimationThatInflatesBounds(); |
+} |
+ |
+bool LayerImpl::HasAnimationThatInflatesBounds() const { |
+ if (!layer_animation_controller_) |
+ return layer_tree_impl_->HasAnimationThatInflatesBounds(this); |
+ |
+ return layer_animation_controller_->HasAnimationThatInflatesBounds(); |
+} |
+ |
+bool LayerImpl::FilterAnimationBoundsForBox(const gfx::BoxF& box, |
+ gfx::BoxF* bounds) const { |
+ if (!layer_animation_controller_) |
+ return layer_tree_impl_->FilterAnimationBoundsForBox(this, box, bounds); |
+ |
+ return layer_animation_controller_->FilterAnimationBoundsForBox(box, bounds); |
+} |
+ |
+bool LayerImpl::TransformAnimationBoundsForBox(const gfx::BoxF& box, |
+ gfx::BoxF* bounds) const { |
+ if (!layer_animation_controller_) |
+ return layer_tree_impl_->TransformAnimationBoundsForBox(this, box, bounds); |
+ |
+ return layer_animation_controller_->TransformAnimationBoundsForBox(box, |
+ bounds); |
+} |
+ |
void LayerImpl::SetUpdateRect(const gfx::Rect& update_rect) { |
update_rect_ = update_rect; |
SetNeedsPushProperties(); |
@@ -1517,7 +1592,9 @@ void LayerImpl::AsValueInto(base::trace_event::TracedValue* state) const { |
state->SetBoolean( |
"has_animation_bounds", |
- layer_animation_controller()->HasAnimationThatInflatesBounds()); |
+ layer_animation_controller_ |
+ ? layer_animation_controller_->HasAnimationThatInflatesBounds() |
+ : layer_tree_impl_->HasAnimationThatInflatesBounds(this)); |
gfx::BoxF box; |
if (LayerUtils::GetAnimationBounds(*this, &box)) |