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

Unified Diff: chrome/browser/ui/cocoa/image_button_cell.mm

Issue 1327203003: Mac: Fix missing focus rings on toolbar, profile, and tab buttons (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2490
Patch Set: Created 5 years, 3 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 | « chrome/browser/ui/cocoa/hover_close_button.mm ('k') | chrome/browser/ui/cocoa/new_tab_button.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/image_button_cell.mm
diff --git a/chrome/browser/ui/cocoa/image_button_cell.mm b/chrome/browser/ui/cocoa/image_button_cell.mm
index ac155151058123f93839eaef46275fec062a4525..222ba36c7a53b31f23d7c85af56691994d02d284 100644
--- a/chrome/browser/ui/cocoa/image_button_cell.mm
+++ b/chrome/browser/ui/cocoa/image_button_cell.mm
@@ -5,6 +5,7 @@
#import "chrome/browser/ui/cocoa/image_button_cell.h"
#include "base/logging.h"
+#include "base/mac/mac_util.h"
#import "chrome/browser/themes/theme_service.h"
#import "chrome/browser/ui/cocoa/rect_path_utils.h"
#import "chrome/browser/ui/cocoa/themed_window.h"
@@ -100,10 +101,7 @@ const CGFloat kImageNoFocusAlpha = 0.65;
- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView*)controlView {
[self drawImageWithFrame:cellFrame inView:controlView];
- // Only draw custom focus ring if the 10.7 focus ring APIs are not available.
- // TODO(groby): Remove once we build against the 10.7 SDK.
- if (![self respondsToSelector:@selector(drawFocusRingMaskWithFrame:inView:)])
- [self drawFocusRingWithFrame:cellFrame inView:controlView];
+ [self drawFocusRingWithFrame:cellFrame inView:controlView];
}
- (void)setImageID:(NSInteger)imageID
@@ -137,6 +135,12 @@ const CGFloat kImageNoFocusAlpha = 0.65;
}
- (void)drawFocusRingWithFrame:(NSRect)cellFrame inView:(NSView*)controlView {
+ // Draw custom focus ring only if AppKit won't draw one automatically.
+ // The new focus ring APIs became available with 10.7, but did not get
+ // applied to buttons (only editable text fields) until 10.8.
+ if (base::mac::IsOSMountainLionOrLater())
+ return;
+
if (![self showsFirstResponder])
return;
gfx::ScopedNSGraphicsContextSaveGState scoped_state;
« no previous file with comments | « chrome/browser/ui/cocoa/hover_close_button.mm ('k') | chrome/browser/ui/cocoa/new_tab_button.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698