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

Unified Diff: chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm

Issue 1948963002: [Mac][Material Design] Fix toolbar height on Retina. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix comment. 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
« no previous file with comments | « chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm
diff --git a/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm b/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm
index 2034bc1e880c6e6bba0f549074ec0001c56d2bf1..7e289b053955f090c26b186f9f1382270b13093a 100644
--- a/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm
+++ b/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm
@@ -1055,8 +1055,8 @@ class NotificationBridge : public AppMenuBadgeController::Delegate {
- (CGFloat)baseToolbarHeight {
// Height of the toolbar in pixels when the bookmark bar is closed.
- const CGFloat baseToolbarHeightNormal =
- ui::MaterialDesignController::IsModeMaterial() ? 37 : 35;
+ const bool kIsModeMaterial = ui::MaterialDesignController::IsModeMaterial();
+ const CGFloat kBaseToolbarHeightNormal = kIsModeMaterial ? 37 : 35;
// Not all lines are drawn at 2x normal height when running on Retina, which
// causes the toolbar controls to be visually 1pt too high within the toolbar
@@ -1066,8 +1066,17 @@ class NotificationBridge : public AppMenuBadgeController::Delegate {
// an offsetting change in -[BookmarkBarController preferredHeight] to
// maintain the proper spacing between bookmark icons and toolbar items. See
// https://crbug.com/326245 .
- return [[self view] cr_lineWidth] == 0.5 ? baseToolbarHeightNormal - 1
- : baseToolbarHeightNormal;
+ const CGFloat kLineWidth = [[self view] cr_lineWidth];
+ const BOOL kIsRetina = (kLineWidth < 1);
+ BOOL reduceHeight = YES;
+
+ // If Material Design and Retina, no height adjustment is needed.
+ if (kIsModeMaterial && kIsRetina) {
+ reduceHeight = NO;
+ }
+
+ return reduceHeight ? kBaseToolbarHeightNormal - 1
+ : kBaseToolbarHeightNormal;
}
- (CGFloat)desiredHeightForCompression:(CGFloat)compressByHeight {
« no previous file with comments | « chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698