diff options
author | mnissler@chromium.org <mnissler@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-16 07:51:50 +0000 |
---|---|---|
committer | mnissler@chromium.org <mnissler@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-16 07:51:50 +0000 |
commit | 21c6cd1478fa14a88c679723d7d6f702861abb4d (patch) | |
tree | f094f139796b4c5e757d95bd8a2cf1f28394def6 /views | |
parent | 3b9a9abc81f3223207ef9fc1d9c9104c0220d873 (diff) | |
download | chromium_src-21c6cd1478fa14a88c679723d7d6f702861abb4d.zip chromium_src-21c6cd1478fa14a88c679723d7d6f702861abb4d.tar.gz chromium_src-21c6cd1478fa14a88c679723d7d6f702861abb4d.tar.bz2 |
Make sure to only handle real visiblity changes in NativeViewHost.
BUG=49100
TEST=Open options dialog -> Personal Stuff. Turn on sync, turn off sync, switch to advanced page. Browser shouldn't crash.
Review URL: http://codereview.chromium.org/2868048
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@52629 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r-- | views/controls/native_control_win.cc | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/views/controls/native_control_win.cc b/views/controls/native_control_win.cc index d9cd230..6d23a5c 100644 --- a/views/controls/native_control_win.cc +++ b/views/controls/native_control_win.cc @@ -73,16 +73,20 @@ void NativeControlWin::ViewHierarchyChanged(bool is_add, View* parent, } void NativeControlWin::VisibilityChanged(View* starting_from, bool is_visible) { - if (!is_visible) { + // We might get called due to visibility changes at any point in the + // hierarchy, lets check whether we are really visible or not. + bool visible = IsVisibleInRootView(); + if (!visible && native_view()) { // We destroy the child control HWND when we become invisible because of the // performance cost of maintaining many HWNDs. HWND hwnd = native_view(); Detach(); DestroyWindow(hwnd); - } else if (!native_view()) { + } else if (visible && !native_view()) { if (GetWidget()) CreateNativeControl(); - } else { + } + if (visible) { // The view becomes visible after native control is created. // Layout now. Layout(); |