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

Unified Diff: chrome/browser/ui/cocoa/autofill/down_arrow_popup_menu_cell.mm

Issue 140353002: [rAC, OSX] Fix focus ring drawing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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
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
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/image_button_cell.h » ('j') | chrome/browser/ui/cocoa/image_button_cell.mm » ('J')

Powered by Google App Engine
This is Rietveld 408576698