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

Unified Diff: ui/views/cocoa/bridged_native_widget.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/bridged_native_widget.mm
diff --git a/ui/views/cocoa/bridged_native_widget.mm b/ui/views/cocoa/bridged_native_widget.mm
index 5dded116ff5474a67c59f354da9a31290e809bf1..83fff461b16e1c83a43717e52dc7ef7cefaca474 100644
--- a/ui/views/cocoa/bridged_native_widget.mm
+++ b/ui/views/cocoa/bridged_native_widget.mm
@@ -558,6 +558,13 @@ void BridgedNativeWidget::SetVisibilityState(WindowVisibilityState new_state) {
wants_to_be_visible_ = new_state != HIDE_WINDOW;
if (new_state == HIDE_WINDOW) {
+ // Calling -orderOut: on a window with an attached sheet encounters broken
+ // AppKit behavior. The sheet effectively becomes "lost".
+ // See http://crbug.com/667602. Alternatives: call -setAlphaValue:0 and
+ // -setIgnoresMouseEvents:YES on the NSWindow, or dismiss the sheet before
+ // hiding.
+ DCHECK(![window_ attachedSheet]);
karandeepb 2016/11/28 05:19:32 Won't this trigger for the case given in issue 667
tapted 2016/11/28 06:15:41 Yes, but only with chrome://flags/#mac-views-nativ
karandeepb 2016/11/28 23:37:57 Acknowledged.
+
[window_ orderOut:nil];
DCHECK(!window_visible_);
return;
@@ -827,7 +834,9 @@ void BridgedNativeWidget::OnVisibilityChanged() {
if (window_visible_) {
wants_to_be_visible_ = true;
- if (parent_)
+ // Sheets don't need a parentWindow set, and setting one causes graphical
+ // glitches (http://crbug.com/605098).
karandeepb 2016/11/28 05:19:32 I can't see it being concluded on issue 605098 tha
tapted 2016/11/28 06:15:41 Yup :). Turns out this was the culprit. It went aw
karandeepb 2016/11/28 23:37:57 Acknowledged. Maybe mention this explicitly in the
tapted 2016/11/29 03:28:51 Done.
+ if (parent_ && ![window_ isSheet])
[parent_->GetNSWindow() addChildWindow:window_ ordered:NSWindowAbove];
} else {
ReleaseCapture(); // Capture on hidden windows is not permitted.
« no previous file with comments | « no previous file | ui/views/cocoa/widget_owner_nswindow_adapter.mm » ('j') | ui/views/cocoa/widget_owner_nswindow_adapter.mm » ('J')

Powered by Google App Engine
This is Rietveld 408576698