| Index: ui/compositor/layer.cc
|
| diff --git a/ui/compositor/layer.cc b/ui/compositor/layer.cc
|
| index cfa02f27f7e64d399f7af7e887b17c1ed8e21037..ee9b12ecd5f2ab331a8f9df9d462b5bca8b4656e 100644
|
| --- a/ui/compositor/layer.cc
|
| +++ b/ui/compositor/layer.cc
|
| @@ -159,14 +159,24 @@ void Layer::Add(Layer* child) {
|
| child->OnDeviceScaleFactorChanged(device_scale_factor_);
|
| if (GetCompositor())
|
| child->SendPendingThreadedAnimations();
|
| + if (child->IsAnimating()) {
|
| + LayerAnimatorCollection* collection = GetLayerAnimatorCollection();
|
| + if (collection)
|
| + collection->StartAnimator(child->GetAnimator());
|
| + }
|
| }
|
|
|
| void Layer::Remove(Layer* child) {
|
| // Current bounds are used to calculate offsets when layers are reparented.
|
| // Stop (and complete) an ongoing animation to update the bounds immediately.
|
| - if (child->GetAnimator()) {
|
| - child->GetAnimator()->StopAnimatingProperty(
|
| - ui::LayerAnimationElement::BOUNDS);
|
| + LayerAnimator* child_animator = child->animator_;
|
| + if (child_animator) {
|
| + child_animator->StopAnimatingProperty(ui::LayerAnimationElement::BOUNDS);
|
| + if (child->IsAnimating()) {
|
| + LayerAnimatorCollection* collection = GetLayerAnimatorCollection();
|
| + if (collection)
|
| + collection->StopAnimator(child_animator);
|
| + }
|
| }
|
| std::vector<Layer*>::iterator i =
|
| std::find(children_.begin(), children_.end(), child);
|
| @@ -874,6 +884,11 @@ void Layer::RemoveThreadedAnimation(int animation_id) {
|
| pending_threaded_animations_.end());
|
| }
|
|
|
| +LayerAnimatorCollection* Layer::GetLayerAnimatorCollection() {
|
| + Compositor* compositor = GetCompositor();
|
| + return compositor ? compositor->layer_animator_collection() : NULL;
|
| +}
|
| +
|
| void Layer::SendPendingThreadedAnimations() {
|
| for (cc::ScopedPtrVector<cc::Animation>::iterator it =
|
| pending_threaded_animations_.begin();
|
| @@ -931,4 +946,8 @@ void Layer::RecomputePosition() {
|
| cc_layer_->SetPosition(gfx::PointF(bounds_.x(), bounds_.y()));
|
| }
|
|
|
| +bool Layer::IsAnimating() const {
|
| + return animator_ && animator_->is_animating();
|
| +}
|
| +
|
| } // namespace ui
|
|
|