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

Unified Diff: ui/views/widget/native_widget_aura.cc

Issue 2094513003: views: Restore to old behaviour of Widget::ReparentNativeView(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 | « ui/views/controls/native/native_view_host_aura_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/widget/native_widget_aura.cc
diff --git a/ui/views/widget/native_widget_aura.cc b/ui/views/widget/native_widget_aura.cc
index 5d1dfc445aee2d21e0b0e149ee891a1e8e6841d6..a455eddf26809e303c101406e72dd02b59b10ab7 100644
--- a/ui/views/widget/native_widget_aura.cc
+++ b/ui/views/widget/native_widget_aura.cc
@@ -1145,10 +1145,24 @@ void NativeWidgetPrivate::ReparentNativeView(gfx::NativeView native_view,
(*it)->NotifyNativeViewHierarchyWillChange();
}
- if (new_parent)
+ if (new_parent) {
new_parent->AddChild(native_view);
- else if (previous_parent)
- previous_parent->RemoveChild(native_view);
+ } else {
+ // The following looks weird, but it's the equivalent of what aura has
+ // always done. (The previous behaviour of aura::Window::SetParent() used
+ // NULL as a special value that meant ask the WindowTreeClient where things
+ // should go.)
+ //
+ // This probably isn't strictly correct, but its an invariant that a Window
+ // in use will be attached to a RootWindow, so we can't just call
+ // RemoveChild here. The only possible thing that could assign a RootWindow
+ // in this case is the stacking client of the current RootWindow. This
+ // matches our previous behaviour; the global stacking client would almost
+ // always reattach the window to the same RootWindow.
+ aura::Window* root_window = native_view->GetRootWindow();
+ aura::client::ParentWindowWithContext(
+ native_view, root_window, root_window->GetBoundsInScreen());
+ }
// And now, notify them that they have a brand new parent.
for (Widget::Widgets::iterator it = widgets.begin();
« no previous file with comments | « ui/views/controls/native/native_view_host_aura_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698