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

Unified Diff: chrome/browser/ui/cocoa/bookmarks/bookmark_button.mm

Issue 2418893004: [Mac] Ensure bookmark items are highlighted when invoking a context menu (Closed)
Patch Set: Created 4 years, 2 months 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/bookmarks/bookmark_button.mm
diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_button.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_button.mm
index 86e5c947692a8cc27f533e004e715d5d79eb12f8..868fd331b77df737835c72a24fab98b3a085f72c 100644
--- a/chrome/browser/ui/cocoa/bookmarks/bookmark_button.mm
+++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_button.mm
@@ -369,17 +369,23 @@ BookmarkButton* gDraggedButton = nil; // Weak
[id(delegate_) mouseDragged:theEvent];
}
-- (void)rightMouseDown:(NSEvent*)event {
- // Ensure that right-clicking on a button while a context menu is open
+- (void)willOpenMenu:(NSMenu *)menu withEvent:(NSEvent *)event {
+ // Ensure that right-clicking on a button while a context menu is already open
// highlights the new button.
+ [delegate_ mouseEnteredButton:self event:event];
+
GradientButtonCell* cell =
base::mac::ObjCCastStrict<GradientButtonCell>([self cell]);
- [delegate_ mouseEnteredButton:self event:event];
- [cell setMouseInside:YES animate:YES];
+ // Opt for animate:NO, otherwise the upcoming contextual menu's modal loop
+ // will block the animation and the button's state will visually never change
+ // ( https://crbug.com/649256 ).
+ [cell setMouseInside:YES animate:NO];
+}
- // Keep a ref to |self|, in case -rightMouseDown: deletes this bookmark.
- base::scoped_nsobject<BookmarkButton> keepAlive([self retain]);
- [super rightMouseDown:event];
+- (void)didCloseMenu:(NSMenu *)menu withEvent:(NSEvent *)event {
+ // Update the highlight after the contextual menu closes.
+ GradientButtonCell* cell =
+ base::mac::ObjCCastStrict<GradientButtonCell>([self cell]);
if (![cell isMouseReallyInside]) {
[cell setMouseInside:NO animate:YES];
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698