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

Unified Diff: ui/views/cocoa/bridged_native_widget.mm

Issue 2454283002: MacViews: Hide windows before closing. (Closed)
Patch Set: Fix tests. Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: ui/views/cocoa/bridged_native_widget.mm
diff --git a/ui/views/cocoa/bridged_native_widget.mm b/ui/views/cocoa/bridged_native_widget.mm
index ce3731d026165eb42ef39e0b00bafe6953e2fcf9..7fdc5f342792acb8c9b9e3749c32f2965210b79d 100644
--- a/ui/views/cocoa/bridged_native_widget.mm
+++ b/ui/views/cocoa/bridged_native_widget.mm
@@ -363,6 +363,8 @@ NSUInteger CountBridgedWindows(NSArray* child_windows) {
DCHECK(child_windows_.empty());
SetFocusManager(nullptr);
SetRootView(nullptr);
+
+ DCHECK(![window_ isVisible]);
DestroyCompositor();
}
@@ -681,6 +683,11 @@ NSUInteger CountBridgedWindows(NSArray* child_windows) {
}
void BridgedNativeWidget::OnWindowWillClose() {
+ // Hide the window before closing. This ensures that destroying the compositor
+ // during the close does not cause a flash, which would be the case if the
+ // window was still visible.
+ SetVisibilityState(HIDE_WINDOW);
+
native_widget_mac_->GetWidget()->OnNativeWidgetDestroying();
// Ensure BridgedNativeWidget does not have capture, otherwise
« no previous file with comments | « no previous file | ui/views/widget/native_widget_mac_unittest.mm » ('j') | ui/views/widget/native_widget_mac_unittest.mm » ('J')

Powered by Google App Engine
This is Rietveld 408576698