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

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

Issue 2521753003: MacViews: Protect against orderOut: on an NSWindow with an attached sheet. (Closed)
Patch Set: Nit comment Created 4 years, 1 month 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/widget_owner_nswindow_adapter.mm
diff --git a/ui/views/cocoa/widget_owner_nswindow_adapter.mm b/ui/views/cocoa/widget_owner_nswindow_adapter.mm
index 5259c7e25b209c1288fc77dd7e7c171cba41fa78..b40ea57f523cfa5353fe51c5b4e5e388a8e34349 100644
--- a/ui/views/cocoa/widget_owner_nswindow_adapter.mm
+++ b/ui/views/cocoa/widget_owner_nswindow_adapter.mm
@@ -102,7 +102,11 @@ void WidgetOwnerNSWindowAdapter::OnWindowDidChangeOcclusionState() {
return;
if (child_->window_visible()) {
- DCHECK([child_->ns_window() parentWindow]);
+ // A sheet should never have a parentWindow, otherwise dismissing the sheet
+ // causes graphical glitches (http://crbug.com/605098). Non-sheets should
+ // always have a parentWindow.
+ DCHECK([child_->ns_window() isSheet] !=
karandeepb 2016/11/28 05:19:32 So this was/is slightly confusing. Is this correct
tapted 2016/11/28 06:15:41 yes. ([NSWindow parentWindow] should be nil -- but
karandeepb 2016/11/28 23:37:57 Acknowledged.
+ !![child_->ns_window() parentWindow]);
DCHECK(child_->wants_to_be_visible());
return;
}
@@ -115,8 +119,8 @@ void WidgetOwnerNSWindowAdapter::OnWindowDidChangeOcclusionState() {
[child_->ns_window() orderWindow:NSWindowAbove
relativeTo:[anchor_window_ windowNumber]];
- // Ordering the window should add back the relationship.
- DCHECK([child_->ns_window() parentWindow]);
+ // Ordering the window should add back the relationship (unless it's a sheet).
+ DCHECK([child_->ns_window() isSheet] != !![child_->ns_window() parentWindow]);
DCHECK(child_->window_visible());
}

Powered by Google App Engine
This is Rietveld 408576698