Index: chrome/browser/ui/cocoa/autofill/down_arrow_popup_menu_cell.mm |
diff --git a/chrome/browser/ui/cocoa/autofill/down_arrow_popup_menu_cell.mm b/chrome/browser/ui/cocoa/autofill/down_arrow_popup_menu_cell.mm |
index 18c8fde42320b797605ab4d350060cf73d1e62e2..0c8b46b2af141a89e12f9e842f4e5ff39c8713c4 100644 |
--- a/chrome/browser/ui/cocoa/autofill/down_arrow_popup_menu_cell.mm |
+++ b/chrome/browser/ui/cocoa/autofill/down_arrow_popup_menu_cell.mm |
@@ -8,6 +8,8 @@ |
#include "chrome/browser/ui/cocoa/autofill/autofill_dialog_constants.h" |
+const int kSidePadding = 2.0; |
+ |
@implementation DownArrowPopupMenuCell |
- (NSSize)imageSize { |
@@ -23,20 +25,26 @@ |
NSAttributedString* title = [self attributedTitle]; |
NSSize size = [title size]; |
size.height = std::max(size.height, imageSize.height); |
- size.width += autofill::kButtonGap + imageSize.width; |
+ size.width += 2 * kSidePadding + autofill::kButtonGap + imageSize.width; |
return size; |
} |
- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView*)controlView { |
NSRect imageRect, titleRect; |
+ NSRect contentRect = NSInsetRect(cellFrame, kSidePadding, 0); |
NSDivideRect( |
- cellFrame, &imageRect, &titleRect, [self imageSize].width, NSMaxXEdge); |
- [super drawWithFrame:imageRect inView:controlView]; |
+ contentRect, &imageRect, &titleRect, [self imageSize].width, NSMaxXEdge); |
+ [super drawImageWithFrame:imageRect inView:controlView]; |
NSAttributedString* title = [self attributedTitle]; |
if ([title length]) |
[self drawTitle:title withFrame:titleRect 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:)]) |
+ [super drawFocusRingWithFrame:cellFrame inView:controlView]; |
} |
@end |