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

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

Issue 2013523005: [Mac][Material Design] Bring bookmark hover state, etc. up to spec. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix typo, fix chevron button highlight state. Created 4 years, 7 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/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 e38e4a2d6261caba3c685c6d3c5e8f7c47e44907..9a3799ac826631348634e1a02e87d2367e476be7 100644
--- a/chrome/browser/ui/cocoa/bookmarks/bookmark_button_cell.mm
+++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_button_cell.mm
@@ -23,10 +23,17 @@ using bookmarks::BookmarkNode;
namespace {
-const int kHierarchyButtonXMargin = 4;
+// Padding on the right side of the arrow icon.
+const int kHierarchyButtonRightPadding = 4;
+
+// Padding on the left side of the arrow icon.
+int HierarchyButtonLeftPadding() {
+ return ui::MaterialDesignController::IsModeMaterial() ? 11 : 2;
+}
+
const int kIconTextSpacer = 4;
-const int kTextRightPadding = 3;
-const int kIconLeftPadding = 3;
+const int kTextRightPadding = 1;
+const int kIconLeftPadding = 1;
const int kDefaultFontSize = 12;
@@ -330,11 +337,16 @@ const int kDefaultFontSize = 12;
[title sizeWithAttributes:[self titleTextAttributes]].width;
cellSize.width +=
kIconTextSpacer + std::ceil(textWidth) + kTextRightPadding;
+ } else {
+ // Make buttons without visible titles 20pts wide (18 plus padding).
+ cellSize.width = 18;
}
}
if (drawFolderArrow_) {
- cellSize.width += [arrowImage_ size].width + 2 * kHierarchyButtonXMargin;
+ cellSize.width += [arrowImage_ size].width +
+ HierarchyButtonLeftPadding() +
+ kHierarchyButtonRightPadding;
}
return cellSize;
}
@@ -345,7 +357,7 @@ const int kDefaultFontSize = 12;
// left edge, but only if there's a visible title.
if (ui::MaterialDesignController::IsModeMaterial()) {
imageRect.origin.y -= 1;
- if ([[self visibleTitle] length]) {
+ if ([[self visibleTitle] length] > 0) {
imageRect.origin.x += kIconLeftPadding;
}
}
@@ -374,7 +386,7 @@ const int kDefaultFontSize = 12;
imageRect.size = [arrowImage_ size];
const CGFloat kArrowOffset = 1.0; // Required for proper centering.
CGFloat dX =
- NSWidth(cellFrame) - NSWidth(imageRect) - kHierarchyButtonXMargin;
+ NSWidth(cellFrame) - NSWidth(imageRect) - kHierarchyButtonRightPadding;
CGFloat dY = (NSHeight(cellFrame) / 2.0) - (NSHeight(imageRect) / 2.0) +
kArrowOffset;
NSRect drawRect = NSOffsetRect(imageRect, dX, dY);

Powered by Google App Engine
This is Rietveld 408576698