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

Unified Diff: ui/aura/window.cc

Issue 241983003: Stops animations when removing a window from its parent (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Uses GetTargetBounds() in place of bounds() when reparenting layers 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ui/aura/window_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/window.cc
diff --git a/ui/aura/window.cc b/ui/aura/window.cc
index 2c9aab82d83b371a3d53047c2822992457062638..9aaae40998a5d85bf0cb01a7f925b3d2d9d1d025 100644
--- a/ui/aura/window.cc
+++ b/ui/aura/window.cc
@@ -515,15 +515,15 @@ void Window::AddChild(Window* child) {
if (child->parent())
child->parent()->RemoveChildImpl(child, this);
+ child->parent_ = this;
+
gfx::Vector2d offset;
aura::Window* ancestor_with_layer = GetAncestorWithLayer(&offset);
if (ancestor_with_layer) {
- offset += child->bounds().OffsetFromOrigin();
+ offset += child->GetTargetBounds().OffsetFromOrigin();
oshima 2014/04/22 20:47:11 Sorry if I'm misunderstanding something, but I won
varkha 2014/04/22 20:59:05 Isn't that how Window::GetTargetBounds is implemen
oshima 2014/04/22 22:57:11 It looks to me that this is wrong if a) the child
child->ReparentLayers(ancestor_with_layer->layer(), offset);
}
- child->parent_ = this;
-
children_.push_back(child);
if (layout_manager_)
layout_manager_->OnWindowAddedToLayout(child);
@@ -665,7 +665,7 @@ bool Window::ContainsPointInRoot(const gfx::Point& point_in_root) const {
}
bool Window::ContainsPoint(const gfx::Point& local_point) const {
- return gfx::Rect(bounds().size()).Contains(local_point);
+ return gfx::Rect(GetTargetBounds().size()).Contains(local_point);
}
Window* Window::GetEventHandlerForPoint(const gfx::Point& local_point) {
@@ -1050,8 +1050,8 @@ void Window::UnparentLayers(bool has_layerless_ancestor,
if (layer()->parent())
layer()->parent()->Remove(layer());
if (has_layerless_ancestor) {
- const gfx::Rect real_bounds(bounds_);
- gfx::Rect layer_bounds(layer()->bounds());
+ const gfx::Rect real_bounds(GetTargetBounds());
+ gfx::Rect layer_bounds(layer()->GetTargetBounds());
layer_bounds.Offset(-offset);
layer()->SetBounds(layer_bounds);
bounds_ = real_bounds;
@@ -1066,12 +1066,12 @@ void Window::ReparentLayers(ui::Layer* parent_layer,
for (size_t i = 0; i < children_.size(); ++i) {
children_[i]->ReparentLayers(
parent_layer,
- offset + children_[i]->bounds().OffsetFromOrigin());
+ offset + children_[i]->GetTargetBounds().OffsetFromOrigin());
}
} else {
- const gfx::Rect real_bounds(bounds());
+ const gfx::Rect real_bounds(GetTargetBounds());
parent_layer->Add(layer());
- gfx::Rect layer_bounds(layer()->bounds().size());
+ gfx::Rect layer_bounds(layer()->GetTargetBounds().size());
layer_bounds += offset;
layer()->SetBounds(layer_bounds);
bounds_ = real_bounds;
@@ -1083,7 +1083,7 @@ void Window::OffsetLayerBounds(const gfx::Vector2d& offset) {
for (size_t i = 0; i < children_.size(); ++i)
children_[i]->OffsetLayerBounds(offset);
} else {
- gfx::Rect layer_bounds(layer()->bounds());
+ gfx::Rect layer_bounds(layer()->GetTargetBounds());
layer_bounds += offset;
layer()->SetBounds(layer_bounds);
}
@@ -1435,7 +1435,7 @@ const Window* Window::GetAncestorWithLayer(gfx::Vector2d* offset) const {
if (window->layer())
return window;
if (offset)
- *offset += window->bounds().OffsetFromOrigin();
+ *offset += window->GetTargetBounds().OffsetFromOrigin();
}
if (offset)
*offset = gfx::Vector2d();
« no previous file with comments | « no previous file | ui/aura/window_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698