Index: ui/views/controls/native_control_win.cc |
diff --git a/ui/views/controls/native_control_win.cc b/ui/views/controls/native_control_win.cc |
index 041b85a058d6d28574a06e4bd078c15c49a5ec22..25278411c35be247c986a08ef6f06b129ff7ba73 100644 |
--- a/ui/views/controls/native_control_win.cc |
+++ b/ui/views/controls/native_control_win.cc |
@@ -79,18 +79,18 @@ void NativeControlWin::ViewHierarchyChanged(bool is_add, View* parent, |
void NativeControlWin::VisibilityChanged(View* starting_from, bool 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()) { |
+ bool is_drawn = IsDrawn(); |
+ if (!is_drawn && 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 (visible && !native_view()) { |
+ } else if (is_drawn && !native_view()) { |
if (GetWidget()) |
CreateNativeControl(); |
} |
- if (visible) { |
+ if (is_drawn) { |
// The view becomes visible after native control is created. |
// Layout now. |
Layout(); |