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

Unified Diff: components/constrained_window/native_web_contents_modal_dialog_manager_views_mac.mm

Issue 2562653002: Mac: Fix window ordering for certificate viewer/selector sheets and overlays.
Patch Set: Switch to using NSFooWindowLevels. Created 4 years 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
« no previous file with comments | « chrome/browser/ui/cocoa/ssl_client_certificate_selector_cocoa.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/constrained_window/native_web_contents_modal_dialog_manager_views_mac.mm
diff --git a/components/constrained_window/native_web_contents_modal_dialog_manager_views_mac.mm b/components/constrained_window/native_web_contents_modal_dialog_manager_views_mac.mm
index 5df747e7ecef4bb8ac1c193e4cdd0835d64b641e..d12780c5d54783a5ea165666dffd0a333a0b9272 100644
--- a/components/constrained_window/native_web_contents_modal_dialog_manager_views_mac.mm
+++ b/components/constrained_window/native_web_contents_modal_dialog_manager_views_mac.mm
@@ -21,14 +21,20 @@ namespace {
// Sets visibility and mouse events for a Cocoa NSWindow* and an attached sheet.
void SetSheetVisible(gfx::NativeWindow overlay, bool visible) {
- CGFloat alpha = visible ? 1.0 : 0.0;
BOOL ignore_events = visible ? NO : YES;
// Don't allow interaction with the tab underneath the overlay.
[overlay setIgnoresMouseEvents:ignore_events];
- [[overlay attachedSheet] setAlphaValue:alpha];
+ [[overlay attachedSheet] setAlphaValue:visible ? 1.0 : 0.0];
[[overlay attachedSheet] setIgnoresMouseEvents:ignore_events];
+
+ // Make sure overlay layers for hidden Cocoa dialogs are always behind
+ // overlays which are in use. If they are not hidden, the attached sheet needs
+ // to be in front of its corresponding overlay window to accept mouse clicks.
+ [overlay setLevel:visible ? NSFloatingWindowLevel : NSNormalWindowLevel];
tapted 2016/12/11 23:28:20 I think NSFloatingWindowLevel would mean that drag
Patti Lor 2016/12/12 01:29:04 That works! Have done this for all three cases. Al
+ [[overlay attachedSheet]
+ setLevel:visible ? NSStatusWindowLevel : NSNormalWindowLevel];
}
} // namespace
« no previous file with comments | « chrome/browser/ui/cocoa/ssl_client_certificate_selector_cocoa.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698