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

Issue 2710763003: Work around an AppKit bug that can leave two windows in a key state.

Created:
3 years, 10 months ago by Sidney San Martín
Modified:
3 years, 9 months ago
Reviewers:
Robert Sesek, tapted, shrike
CC:
chromium-reviews, mac-reviews_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Work around an AppKit bug that can leave two windows in a key state. BUG=692408

Patch Set 1 #

Total comments: 24

Patch Set 2 : Add rdar: link and a comment about WEAK_IMPORT_ATTRIBUTE. #

Patch Set 3 : Remove a comment that I don't think I needed to add. #

Patch Set 4 : Add a DCHECK to give us a heads up if the ivar changes or goes away. #

Patch Set 5 : Use base::mac::ScopedObjCClassSwizzler. #

Total comments: 6

Patch Set 6 : Nits (#import->#include, variable naming, C++ cast) #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+79 lines, -0 lines) Patch
M chrome/browser/BUILD.gn View 1 1 chunk +1 line, -0 lines 0 comments Download
A chrome/browser/mac/patch_nsmenu_key_window_bug.mm View 1 2 3 4 5 1 chunk +78 lines, -0 lines 2 comments Download

Messages

Total messages: 55 (37 generated)
Sidney San Martín
Take a look when you have a minute. The main question is whether a case-by-case ...
3 years, 9 months ago (2017-02-27 19:29:08 UTC) #7
Sidney San Martín
+tapted +rsesek This patches the AppKit bug, so it should fix any menu that could ...
3 years, 9 months ago (2017-02-28 16:20:35 UTC) #9
Avi (use Gerrit)
https://codereview.chromium.org/2710763003/diff/1/chrome/browser/mac/patch_nsmenu_key_window_bug.mm File chrome/browser/mac/patch_nsmenu_key_window_bug.mm (right): https://codereview.chromium.org/2710763003/diff/1/chrome/browser/mac/patch_nsmenu_key_window_bug.mm#newcode8 chrome/browser/mac/patch_nsmenu_key_window_bug.mm:8: // https://crbug.com/692408 Radar # too?
3 years, 9 months ago (2017-02-28 16:24:24 UTC) #10
tapted
yah still no update on rdar://30572648 yet it all frightens me a little.. there are ...
3 years, 9 months ago (2017-02-28 23:24:14 UTC) #11
Sidney San Martín
https://codereview.chromium.org/2710763003/diff/1/chrome/browser/mac/patch_nsmenu_key_window_bug.mm File chrome/browser/mac/patch_nsmenu_key_window_bug.mm (right): https://codereview.chromium.org/2710763003/diff/1/chrome/browser/mac/patch_nsmenu_key_window_bug.mm#newcode8 chrome/browser/mac/patch_nsmenu_key_window_bug.mm:8: // https://crbug.com/692408 On 2017/02/28 16:24:24, Avi wrote: > Radar ...
3 years, 9 months ago (2017-03-01 00:50:20 UTC) #14
tapted
https://codereview.chromium.org/2710763003/diff/1/chrome/browser/mac/patch_nsmenu_key_window_bug.mm File chrome/browser/mac/patch_nsmenu_key_window_bug.mm (right): https://codereview.chromium.org/2710763003/diff/1/chrome/browser/mac/patch_nsmenu_key_window_bug.mm#newcode53 chrome/browser/mac/patch_nsmenu_key_window_bug.mm:53: object_getInstanceVariable(self, "_rememberedKeyWindow", What happens if `_rememberedKeyWindow` gets renamed? https://codereview.chromium.org/2710763003/diff/1/chrome/browser/mac/patch_nsmenu_key_window_bug.mm#newcode57 ...
3 years, 9 months ago (2017-03-01 02:12:20 UTC) #17
Sidney San Martín
https://codereview.chromium.org/2710763003/diff/1/chrome/browser/mac/patch_nsmenu_key_window_bug.mm File chrome/browser/mac/patch_nsmenu_key_window_bug.mm (right): https://codereview.chromium.org/2710763003/diff/1/chrome/browser/mac/patch_nsmenu_key_window_bug.mm#newcode53 chrome/browser/mac/patch_nsmenu_key_window_bug.mm:53: object_getInstanceVariable(self, "_rememberedKeyWindow", On 2017/03/01 02:12:20, tapted wrote: > What ...
3 years, 9 months ago (2017-03-01 03:08:35 UTC) #21
tapted
https://codereview.chromium.org/2710763003/diff/1/chrome/browser/mac/patch_nsmenu_key_window_bug.mm File chrome/browser/mac/patch_nsmenu_key_window_bug.mm (right): https://codereview.chromium.org/2710763003/diff/1/chrome/browser/mac/patch_nsmenu_key_window_bug.mm#newcode53 chrome/browser/mac/patch_nsmenu_key_window_bug.mm:53: object_getInstanceVariable(self, "_rememberedKeyWindow", On 2017/03/01 03:08:35, sdy wrote: > On ...
3 years, 9 months ago (2017-03-01 07:56:02 UTC) #24
tapted
https://codereview.chromium.org/2710763003/diff/1/chrome/browser/mac/patch_nsmenu_key_window_bug.mm File chrome/browser/mac/patch_nsmenu_key_window_bug.mm (right): https://codereview.chromium.org/2710763003/diff/1/chrome/browser/mac/patch_nsmenu_key_window_bug.mm#newcode64 chrome/browser/mac/patch_nsmenu_key_window_bug.mm:64: _restorePreviousKeyWindowFromSavedProperties = On 2017/03/01 03:08:35, sdy wrote: > On ...
3 years, 9 months ago (2017-03-01 08:20:35 UTC) #25
Sidney San Martín
https://codereview.chromium.org/2710763003/diff/1/chrome/browser/mac/patch_nsmenu_key_window_bug.mm File chrome/browser/mac/patch_nsmenu_key_window_bug.mm (right): https://codereview.chromium.org/2710763003/diff/1/chrome/browser/mac/patch_nsmenu_key_window_bug.mm#newcode53 chrome/browser/mac/patch_nsmenu_key_window_bug.mm:53: object_getInstanceVariable(self, "_rememberedKeyWindow", On 2017/03/01 07:56:02, tapted wrote: > On ...
3 years, 9 months ago (2017-03-01 17:42:59 UTC) #28
tapted
https://codereview.chromium.org/2710763003/diff/1/chrome/browser/mac/patch_nsmenu_key_window_bug.mm File chrome/browser/mac/patch_nsmenu_key_window_bug.mm (right): https://codereview.chromium.org/2710763003/diff/1/chrome/browser/mac/patch_nsmenu_key_window_bug.mm#newcode64 chrome/browser/mac/patch_nsmenu_key_window_bug.mm:64: _restorePreviousKeyWindowFromSavedProperties = On 2017/03/01 17:42:59, sdy wrote: > On ...
3 years, 9 months ago (2017-03-01 22:56:46 UTC) #31
Sidney San Martín
tapted@: OK, these are all good points. New patch set — thoughts?
3 years, 9 months ago (2017-03-02 08:16:33 UTC) #43
tapted
lgtm, but wait for rsesek to chime in (I'm still mildly spooked by the whole ...
3 years, 9 months ago (2017-03-02 09:35:00 UTC) #46
Sidney San Martín
https://codereview.chromium.org/2710763003/diff/120001/chrome/browser/mac/patch_nsmenu_key_window_bug.mm File chrome/browser/mac/patch_nsmenu_key_window_bug.mm (right): https://codereview.chromium.org/2710763003/diff/120001/chrome/browser/mac/patch_nsmenu_key_window_bug.mm#newcode7 chrome/browser/mac/patch_nsmenu_key_window_bug.mm:7: #import "base/logging.h" On 2017/03/02 09:34:59, tapted wrote: > nit: ...
3 years, 9 months ago (2017-03-02 18:40:09 UTC) #49
Robert Sesek
https://codereview.chromium.org/2710763003/diff/140001/chrome/browser/mac/patch_nsmenu_key_window_bug.mm File chrome/browser/mac/patch_nsmenu_key_window_bug.mm (right): https://codereview.chromium.org/2710763003/diff/140001/chrome/browser/mac/patch_nsmenu_key_window_bug.mm#newcode42 chrome/browser/mac/patch_nsmenu_key_window_bug.mm:42: // The app/wrench/hotdog menu uses custom views, which gives ...
3 years, 9 months ago (2017-03-06 20:57:38 UTC) #52
Sidney San Martín
https://codereview.chromium.org/2710763003/diff/140001/chrome/browser/mac/patch_nsmenu_key_window_bug.mm File chrome/browser/mac/patch_nsmenu_key_window_bug.mm (right): https://codereview.chromium.org/2710763003/diff/140001/chrome/browser/mac/patch_nsmenu_key_window_bug.mm#newcode42 chrome/browser/mac/patch_nsmenu_key_window_bug.mm:42: // The app/wrench/hotdog menu uses custom views, which gives ...
3 years, 9 months ago (2017-03-06 21:38:49 UTC) #53
Robert Sesek
On 2017/03/06 21:38:49, sdy wrote: > https://codereview.chromium.org/2710763003/diff/140001/chrome/browser/mac/patch_nsmenu_key_window_bug.mm > File chrome/browser/mac/patch_nsmenu_key_window_bug.mm (right): > > https://codereview.chromium.org/2710763003/diff/140001/chrome/browser/mac/patch_nsmenu_key_window_bug.mm#newcode42 > ...
3 years, 9 months ago (2017-03-06 22:41:00 UTC) #54
Robert Sesek
3 years, 9 months ago (2017-03-06 22:45:56 UTC) #55
On 2017/03/06 22:41:00, Robert Sesek wrote:
> On 2017/03/06 21:38:49, sdy wrote:
> >
>
https://codereview.chromium.org/2710763003/diff/140001/chrome/browser/mac/pat...
> > File chrome/browser/mac/patch_nsmenu_key_window_bug.mm (right):
> > 
> >
>
https://codereview.chromium.org/2710763003/diff/140001/chrome/browser/mac/pat...
> > chrome/browser/mac/patch_nsmenu_key_window_bug.mm:42: // The
app/wrench/hotdog
> > menu uses custom views, which gives Chrome more
> > On 2017/03/06 20:57:38, Robert Sesek wrote:
> > > This CL makes sense, but I'm a little concerned about patching this
> > AppKit-wide.
> > > Did you look into using the NSMenuDelegate to do this instead, just for
the
> > > wrench menu?
> > 
> > The bug also affects AppKit-provided menus like the Help menu, so I didn't
> look
> > into using NSMenuDelegate to fix it only for the wrench menu. I can if you'd
> > like.
> 
> Yeah, I understand that it also affects the Help menu, but I think focusing on
> the wrench menu is probably fine and will account for most of the impact of
> fixing this. The internals of NSMenu are rather terrifying, which is why I'm a
> little hesitant about patching this. If a solution works without needing
private
> API and patching, I think that'd be preferable.

Looking at the notifications that are available, I'm wondering if this may be
fixable globally using NSMenuDidBeginTrackingNotification and
NSMenuDidEndTrackingNotification, but without the hooking.

Powered by Google App Engine
This is Rietveld 408576698