Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(505)

Side by Side Diff: ui/compositor/layer.cc

Issue 241983003: Stops animations when removing a window from its parent (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Stops animations when removing a layer from its parent and fixes broken test Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/aura/window.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/compositor/layer.h" 5 #include "ui/compositor/layer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 child->parent_->Remove(child); 157 child->parent_->Remove(child);
158 child->parent_ = this; 158 child->parent_ = this;
159 children_.push_back(child); 159 children_.push_back(child);
160 cc_layer_->AddChild(child->cc_layer_); 160 cc_layer_->AddChild(child->cc_layer_);
161 child->OnDeviceScaleFactorChanged(device_scale_factor_); 161 child->OnDeviceScaleFactorChanged(device_scale_factor_);
162 if (GetCompositor()) 162 if (GetCompositor())
163 child->SendPendingThreadedAnimations(); 163 child->SendPendingThreadedAnimations();
164 } 164 }
165 165
166 void Layer::Remove(Layer* child) { 166 void Layer::Remove(Layer* child) {
167 // Current bounds are used to calculate offsets when layers are reparented.
168 // Stop (and complete) an ongoing animation to update the bounds immediately.
169 if (child->GetAnimator()) {
170 child->GetAnimator()->StopAnimatingProperty(
171 ui::LayerAnimationElement::BOUNDS);
172 }
167 std::vector<Layer*>::iterator i = 173 std::vector<Layer*>::iterator i =
168 std::find(children_.begin(), children_.end(), child); 174 std::find(children_.begin(), children_.end(), child);
169 DCHECK(i != children_.end()); 175 DCHECK(i != children_.end());
170 children_.erase(i); 176 children_.erase(i);
171 child->parent_ = NULL; 177 child->parent_ = NULL;
172 child->cc_layer_->RemoveFromParent(); 178 child->cc_layer_->RemoveFromParent();
173 } 179 }
174 180
175 void Layer::StackAtTop(Layer* child) { 181 void Layer::StackAtTop(Layer* child) {
176 if (children_.size() <= 1 || child == children_.back()) 182 if (children_.size() <= 1 || child == children_.back())
(...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after
957 cc_layer_->SetBounds(ConvertSizeToPixel(this, size)); 963 cc_layer_->SetBounds(ConvertSizeToPixel(this, size));
958 } 964 }
959 965
960 void Layer::RecomputePosition() { 966 void Layer::RecomputePosition() {
961 cc_layer_->SetPosition(gfx::ScalePoint( 967 cc_layer_->SetPosition(gfx::ScalePoint(
962 gfx::PointF(bounds_.x(), bounds_.y()), 968 gfx::PointF(bounds_.x(), bounds_.y()),
963 device_scale_factor_)); 969 device_scale_factor_));
964 } 970 }
965 971
966 } // namespace ui 972 } // namespace ui
OLDNEW
« no previous file with comments | « ui/aura/window.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698