| 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();
|
|
|