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

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: 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
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..87fb52678d13bc5cc6f8ed5cf7d1f7f1011aafbb 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,19 @@ 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 ? 1 : 0];
+ [[overlay attachedSheet] setLevel:visible ? 2 : 0];
}
} // namespace

Powered by Google App Engine
This is Rietveld 408576698