Chromium Code Reviews| Index: chrome/browser/ui/cocoa/bookmarks/bookmark_button_cell.mm |
| diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_button_cell.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_button_cell.mm |
| index 67f2aa5433f113d3b391ed3f95b5982fa315a21b..9a30ac95dd816f03c1febcf2d12159baa1c2f58c 100644 |
| --- a/chrome/browser/ui/cocoa/bookmarks/bookmark_button_cell.mm |
| +++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_button_cell.mm |
| @@ -7,6 +7,8 @@ |
| #include "base/logging.h" |
| #include "base/strings/sys_string_conversions.h" |
| #include "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_constants.h" |
| +#import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" |
| +#import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_view_cocoa.h" |
|
tapted
2016/06/16 21:04:26
nit: remove these 2 added imports
shrike
2016/06/16 22:52:03
Done.
|
| #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button.h" |
| #import "chrome/browser/ui/cocoa/bookmarks/bookmark_context_menu_cocoa_controller.h" |
| #include "chrome/grit/generated_resources.h" |
| @@ -39,7 +41,19 @@ const int kDefaultFontSize = 12; |
| }; // namespace |
| +@interface OffTheSideButtonCell : BookmarkButtonCell |
| +@end |
| +@implementation OffTheSideButtonCell |
| + |
| +- (BOOL)isOffTheSideButtonCell { |
| + return YES; |
| +} |
| + |
| +@end |
| + |
| @interface BookmarkButtonCell(Private) |
| +// Returns YES if the cell is the offTheSide button cell. |
| +- (BOOL)isOffTheSideButtonCell; |
| - (void)configureBookmarkButtonCell; |
| - (void)applyTextColor; |
| // Returns the title the button cell displays. Note that a button cell can |
| @@ -143,6 +157,10 @@ const int kDefaultFontSize = 12; |
| return NO; |
| } |
| +- (BOOL)isOffTheSideButtonCell { |
| + return NO; |
| +} |
| + |
| // Perform all normal init routines specific to the BookmarkButtonCell. |
| - (void)configureBookmarkButtonCell { |
| [self setButtonType:NSMomentaryPushInButton]; |
| @@ -373,11 +391,17 @@ const int kDefaultFontSize = 12; |
| - (void)drawFocusRingMaskWithFrame:(NSRect)cellFrame |
| inView:(NSView*)controlView { |
| - // In Material Design we have to move the focus ring over by 2 pts to get it |
| - // to line up with the image. |
| - if (ui::MaterialDesignController::IsModeMaterial() && |
| - [self visibleTitle].length > 0) { |
| - cellFrame.origin.x += 2; |
| + if (ui::MaterialDesignController::IsModeMaterial()) { |
| + // In Material Design we have to move the focus ring over by 2 pts to get it |
| + // to line up with the image. |
| + if ([self visibleTitle].length > 0) { |
| + cellFrame.origin.x += 2; |
| + } |
| + |
| + // We also have to nudge the chevron button's focus ring up 2pts. |
| + if ([self isOffTheSideButtonCell]) { |
| + cellFrame.origin.y -= 2; |
| + } |
| } |
| [super drawFocusRingMaskWithFrame:cellFrame inView:controlView]; |
| } |