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

Issue 2521753003: MacViews: Protect against orderOut: on an NSWindow with an attached sheet. (Closed)

Created:
4 years, 1 month ago by tapted
Modified:
3 years, 11 months ago
Reviewers:
karandeepb
CC:
chromium-reviews, tfarina, mac-reviews_chromium.org, chrome-apps-syd-reviews_chromium.org, Elly Fong-Jones
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

MacViews: Protect against orderOut: on an NSWindow with an attached sheet. This fixes and re-enables NativeWidgetMacTest.WindowModalSheet with some additional test expectations. It was reverted in r433028 when it started failing. Fundamentally, the problem is that calling orderOut: on an NSWindow with an attached sheet results in utterly broken behavior in AppKit, documented in http://crbug.com/667602. AppKit's broken behaviour with orderOut and regular child windows is already handled by BridgedNativeWidget by recreating the parent/child relationships. However, it can't do this for sheets. It's not possible to "reattach" a sheet once it becomes detached. And even giving a sheet a parentWindow results in graphical glitches (http://crbug.com/605098). Sheets use -[NSWindow sheetParent], not -[NSWindow parentWindow]. Note that -[NSApp hide:] works. It's just -[NSWindow orderOut:] that's broken. But we need the triggers from -[NSApp hide:] to be consistent with the different things that need to happen for sheets. Add checks to BridgedNativeWidget to detect attempts to orderOut: a window with an attached sheet. Different solutions need to be sought for these, such as what Chrome already does for the certificate viewer sheet when we make it tab-modal. Update DCHECKs in WidgetOwnerNSWindowAdapter to properly support sheets. This allows NativeWidgetMacTest.WindowModalSheet to be re-enabled. Updates BridgedNativeWidget::OnVisibilityChanged() to properly fix http://crbug.com/605098. This bug still manifests in Chrome, but only after a call to [NSApp hide:]. Re-showing a window improperly attaches the parent as a parentWindow (rather than only sheetParent), and this is the cause of the graphical glitches. BUG=666503, 605098, 667602 Committed: https://crrev.com/9464d37d42d7b7895421a05bd3f0b5f0a3eb3266 Cr-Commit-Position: refs/heads/master@{#434882}

Patch Set 1 #

Patch Set 2 : Fix and wow. #

Patch Set 3 : Nit comment #

Total comments: 10
Unified diffs Side-by-side diffs Delta from patch set Stats (+41 lines, -10 lines) Patch
M ui/views/cocoa/bridged_native_widget.mm View 1 2 chunks +10 lines, -1 line 7 comments Download
M ui/views/cocoa/widget_owner_nswindow_adapter.mm View 1 2 chunks +7 lines, -3 lines 3 comments Download
M ui/views/widget/native_widget_mac_unittest.mm View 1 2 4 chunks +24 lines, -6 lines 0 comments Download

Messages

Total messages: 29 (16 generated)
tapted
Hi Elly, please take a look - thanks!
4 years, 1 month ago (2016-11-22 04:07:37 UTC) #11
tapted
Elly: ping?
4 years ago (2016-11-23 20:59:04 UTC) #12
tapted
+karan maybe you can take a look now you're back :) - Thanks!
4 years ago (2016-11-27 23:59:47 UTC) #14
karandeepb
https://codereview.chromium.org/2521753003/diff/30004/ui/views/cocoa/bridged_native_widget.mm File ui/views/cocoa/bridged_native_widget.mm (right): https://codereview.chromium.org/2521753003/diff/30004/ui/views/cocoa/bridged_native_widget.mm#newcode566 ui/views/cocoa/bridged_native_widget.mm:566: DCHECK(![window_ attachedSheet]); Won't this trigger for the case given ...
4 years ago (2016-11-28 05:19:32 UTC) #15
tapted
https://codereview.chromium.org/2521753003/diff/30004/ui/views/cocoa/bridged_native_widget.mm File ui/views/cocoa/bridged_native_widget.mm (right): https://codereview.chromium.org/2521753003/diff/30004/ui/views/cocoa/bridged_native_widget.mm#newcode566 ui/views/cocoa/bridged_native_widget.mm:566: DCHECK(![window_ attachedSheet]); On 2016/11/28 05:19:32, karandeepb wrote: > Won't ...
4 years ago (2016-11-28 06:15:41 UTC) #16
karandeepb
LGTM. https://codereview.chromium.org/2521753003/diff/30004/ui/views/cocoa/bridged_native_widget.mm File ui/views/cocoa/bridged_native_widget.mm (right): https://codereview.chromium.org/2521753003/diff/30004/ui/views/cocoa/bridged_native_widget.mm#newcode566 ui/views/cocoa/bridged_native_widget.mm:566: DCHECK(![window_ attachedSheet]); On 2016/11/28 06:15:41, tapted wrote: > ...
4 years ago (2016-11-28 23:37:57 UTC) #17
tapted
https://codereview.chromium.org/2521753003/diff/30004/ui/views/cocoa/bridged_native_widget.mm File ui/views/cocoa/bridged_native_widget.mm (right): https://codereview.chromium.org/2521753003/diff/30004/ui/views/cocoa/bridged_native_widget.mm#newcode838 ui/views/cocoa/bridged_native_widget.mm:838: // glitches (http://crbug.com/605098). On 2016/11/28 23:37:57, karandeepb wrote: > ...
4 years ago (2016-11-29 03:28:51 UTC) #19
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2521753003/30004
4 years ago (2016-11-29 03:29:43 UTC) #21
commit-bot: I haz the power
Committed patchset #3 (id:30004)
4 years ago (2016-11-29 04:03:22 UTC) #24
commit-bot: I haz the power
Patchset 3 (id:??) landed as https://crrev.com/9464d37d42d7b7895421a05bd3f0b5f0a3eb3266 Cr-Commit-Position: refs/heads/master@{#434882}
4 years ago (2016-11-29 04:05:17 UTC) #26
atimoxin
This CL broke WebDialogBrowserTest.CloseParentWindow test on mac_views_browser build. Test now fails on newly added DCHECK ...
3 years, 11 months ago (2016-12-28 13:36:20 UTC) #27
karandeepb
On 2016/12/28 13:36:20, atimoxin wrote: > This CL broke WebDialogBrowserTest.CloseParentWindow test on mac_views_browser > build. ...
3 years, 11 months ago (2016-12-28 17:04:29 UTC) #28
atimoxin
3 years, 11 months ago (2016-12-29 17:38:56 UTC) #29
Message was sent while issue was closed.
On 2016/12/28 17:04:29, karandeepb wrote:
> On 2016/12/28 13:36:20, atimoxin wrote:
> > This CL broke WebDialogBrowserTest.CloseParentWindow test on
mac_views_browser
> > build.
> > 
> > Test now fails on newly added DCHECK in bridged_native_widget.mm.
> 
> Can you please file a bug? Trent can take a look when he gets back.

Yes, of course: crbug.com/677520

Powered by Google App Engine
This is Rietveld 408576698