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

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

Issue 2304643002: [Mac][Material Design] Fix regression in position of chevron icon. (Closed)
Patch Set: Created 4 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 | « 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_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 9c1dd58e4a23f19d72e143276491ca723b9e41d1..bb945ab52c6e52e7fa49f6f4469cdaeab3efc488 100644
--- a/chrome/browser/ui/cocoa/bookmarks/bookmark_button_cell.mm
+++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_button_cell.mm
@@ -54,6 +54,17 @@ const int kDefaultFontSize = 12;
return l10n_util::GetNSString(IDS_ACCNAME_BOOKMARKS_CHEVRON);
}
+- (NSRect)imageRectForBounds:(NSRect)theRect {
+ NSRect imageRect = [super imageRectForBounds:theRect];
+ if (ui::MaterialDesignController::IsModeMaterial()) {
+ // Make sure the chevron icon stays centered. Normally a bookmark bar item
+ // with no label has its icon placed at a fixed x-position.
+ CGFloat totalWidth = NSMaxX(theRect);
+ imageRect.origin.x = (totalWidth - [self image].size.width) / 2;
+ }
+ return imageRect;
+}
+
@end
@interface BookmarkButtonCell(Private)
« 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