Chromium Code Reviews| Index: ui/compositor/layer.cc |
| diff --git a/ui/compositor/layer.cc b/ui/compositor/layer.cc |
| index cfa02f27f7e64d399f7af7e887b17c1ed8e21037..f0998117d9d45310354033fd84c05fa320508a61 100644 |
| --- a/ui/compositor/layer.cc |
| +++ b/ui/compositor/layer.cc |
| @@ -159,6 +159,11 @@ void Layer::Add(Layer* child) { |
| child->OnDeviceScaleFactorChanged(device_scale_factor_); |
| if (GetCompositor()) |
| child->SendPendingThreadedAnimations(); |
| + if (child->GetAnimator() && child->GetAnimator()->is_animating()) { |
|
piman
2014/05/23 21:38:56
nit: GetAnimator() is non-trivial:
1- can we call
sadrul
2014/05/23 21:56:11
Done. Added Layer::IsAnimating() const { return an
|
| + LayerAnimatorCollection* collection = GetLayerAnimatorCollection(); |
| + if (collection) |
| + collection->StartAnimator(child->GetAnimator()); |
| + } |
| } |
| void Layer::Remove(Layer* child) { |
| @@ -167,6 +172,11 @@ void Layer::Remove(Layer* child) { |
| if (child->GetAnimator()) { |
| child->GetAnimator()->StopAnimatingProperty( |
| ui::LayerAnimationElement::BOUNDS); |
| + if (child->GetAnimator()->is_animating()) { |
| + LayerAnimatorCollection* collection = GetLayerAnimatorCollection(); |
| + if (collection) |
| + collection->StopAnimator(child->GetAnimator()); |
| + } |
| } |
| 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(); |