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

Side by Side 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 unified diff | 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 »
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/views/widget/native_widget_aura.h" 5 #include "ui/views/widget/native_widget_aura.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
(...skipping 1127 matching lines...) Expand 10 before | Expand all | Expand 10 after
1138 Widget::Widgets widgets; 1138 Widget::Widgets widgets;
1139 GetAllChildWidgets(native_view, &widgets); 1139 GetAllChildWidgets(native_view, &widgets);
1140 1140
1141 // First notify all the widgets that they are being disassociated 1141 // First notify all the widgets that they are being disassociated
1142 // from their previous parent. 1142 // from their previous parent.
1143 for (Widget::Widgets::iterator it = widgets.begin(); 1143 for (Widget::Widgets::iterator it = widgets.begin();
1144 it != widgets.end(); ++it) { 1144 it != widgets.end(); ++it) {
1145 (*it)->NotifyNativeViewHierarchyWillChange(); 1145 (*it)->NotifyNativeViewHierarchyWillChange();
1146 } 1146 }
1147 1147
1148 if (new_parent) 1148 if (new_parent) {
1149 new_parent->AddChild(native_view); 1149 new_parent->AddChild(native_view);
1150 else if (previous_parent) 1150 } else {
1151 previous_parent->RemoveChild(native_view); 1151 // The following looks weird, but it's the equivalent of what aura has
1152 // always done. (The previous behaviour of aura::Window::SetParent() used
1153 // NULL as a special value that meant ask the WindowTreeClient where things
1154 // should go.)
1155 //
1156 // This probably isn't strictly correct, but its an invariant that a Window
1157 // in use will be attached to a RootWindow, so we can't just call
1158 // RemoveChild here. The only possible thing that could assign a RootWindow
1159 // in this case is the stacking client of the current RootWindow. This
1160 // matches our previous behaviour; the global stacking client would almost
1161 // always reattach the window to the same RootWindow.
1162 aura::Window* root_window = native_view->GetRootWindow();
1163 aura::client::ParentWindowWithContext(
1164 native_view, root_window, root_window->GetBoundsInScreen());
1165 }
1152 1166
1153 // And now, notify them that they have a brand new parent. 1167 // And now, notify them that they have a brand new parent.
1154 for (Widget::Widgets::iterator it = widgets.begin(); 1168 for (Widget::Widgets::iterator it = widgets.begin();
1155 it != widgets.end(); ++it) { 1169 it != widgets.end(); ++it) {
1156 (*it)->NotifyNativeViewHierarchyChanged(); 1170 (*it)->NotifyNativeViewHierarchyChanged();
1157 } 1171 }
1158 } 1172 }
1159 1173
1160 // static 1174 // static
1161 bool NativeWidgetPrivate::IsMouseButtonDown() { 1175 bool NativeWidgetPrivate::IsMouseButtonDown() {
(...skipping 18 matching lines...) Expand all
1180 gfx::NativeView native_view) { 1194 gfx::NativeView native_view) {
1181 aura::client::CaptureClient* capture_client = 1195 aura::client::CaptureClient* capture_client =
1182 aura::client::GetCaptureClient(native_view->GetRootWindow()); 1196 aura::client::GetCaptureClient(native_view->GetRootWindow());
1183 if (!capture_client) 1197 if (!capture_client)
1184 return nullptr; 1198 return nullptr;
1185 return capture_client->GetGlobalCaptureWindow(); 1199 return capture_client->GetGlobalCaptureWindow();
1186 } 1200 }
1187 1201
1188 } // namespace internal 1202 } // namespace internal
1189 } // namespace views 1203 } // namespace views
OLDNEW
« 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