summaryrefslogtreecommitdiffstats
path: root/views/controls
diff options
context:
space:
mode:
authorasanka@chromium.org <asanka@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-31 23:19:45 +0000
committerasanka@chromium.org <asanka@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-31 23:19:45 +0000
commit7dc9c31ecbb69fad9339b0ca60a9d04cd8227aa4 (patch)
treef9aad9d5f95feccd85f65367593cbc166639dbe4 /views/controls
parentfc7baafb399296475b7e476c59ef717c01d67746 (diff)
downloadchromium_src-7dc9c31ecbb69fad9339b0ca60a9d04cd8227aa4.zip
chromium_src-7dc9c31ecbb69fad9339b0ca60a9d04cd8227aa4.tar.gz
chromium_src-7dc9c31ecbb69fad9339b0ca60a9d04cd8227aa4.tar.bz2
Notify child widgets before and after a reparenting.
Attaching a native view to a NativeViewHostWin may cause that view to be disassociated from a view hierarchy with a different FocusManager. Notifying the widgets that they are about to be removed from their current parent gives them the opportunity to disassociate themselves from their current FocusManager. BUG=77447 TEST=none Review URL: http://codereview.chromium.org/6776025 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@80096 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/controls')
-rw-r--r--views/controls/native/native_view_host_win.cc24
1 files changed, 3 insertions, 21 deletions
diff --git a/views/controls/native/native_view_host_win.cc b/views/controls/native/native_view_host_win.cc
index f8bda8e..f25e722 100644
--- a/views/controls/native/native_view_host_win.cc
+++ b/views/controls/native/native_view_host_win.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -35,33 +35,15 @@ void NativeViewHostWin::NativeViewAttached() {
// borders), when we change the parent below.
ShowWindow(host_->native_view(), SW_HIDE);
- // Need to set the HWND's parent before changing its size to avoid flashing.
- SetParent(host_->native_view(), host_->GetWidget()->GetNativeView());
+ NativeWidget::ReparentNativeView(host_->native_view(),
+ host_->GetWidget()->GetNativeView());
host_->Layout();
- // Notify children that parent changed, so they can adjust focus.
- NativeWidget::NativeWidgets widgets;
- NativeWidget::GetAllNativeWidgets(host_->native_view(), &widgets);
- for (NativeWidget::NativeWidgets::iterator it = widgets.begin();
- it != widgets.end(); ++it) {
- (*it)->GetWidget()->NotifyNativeViewHierarchyChanged(
- true,
- host_->GetWidget()->GetNativeView());
- }
}
void NativeViewHostWin::NativeViewDetaching(bool destroyed) {
if (!destroyed && installed_clip_)
UninstallClip();
installed_clip_ = false;
- // Notify children that parent is removed.
- NativeWidget::NativeWidgets widgets;
- NativeWidget::GetAllNativeWidgets(host_->native_view(), &widgets);
- for (NativeWidget::NativeWidgets::iterator it = widgets.begin();
- it != widgets.end(); ++it) {
- (*it)->GetWidget()->NotifyNativeViewHierarchyChanged(
- false,
- host_->GetWidget()->GetNativeView());
- }
}
void NativeViewHostWin::AddedToWidget() {