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

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 reordering the child window array instead of setting the window level manually. 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..aafe789f935296b8f395fa6d4ad68b26bfcb5ba4 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,25 @@ 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];
+
+ if (visible) {
+ // When showing the sheet, re-order the overlay and sheet to be on top of
+ // any other sheet/overlay pairs which may be open at the same time. Without
+ // doing this, the sheet and overlay become obscured behind overlays for
+ // other sheets, which block mouse events intended for the current sheet.
+ NSWindow* parent = [overlay parentWindow];
+ [parent removeChildWindow:overlay];
+ [parent addChildWindow:overlay ordered:NSWindowAbove];
+ [overlay removeChildWindow:[overlay attachedSheet]];
+ [overlay addChildWindow:[overlay attachedSheet] ordered:NSWindowAbove];
+ }
}
} // 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