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

Side by Side Diff: chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm

Issue 1986083003: [Mac][Material Design] Fix toolbar height regression. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" 5 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #import "base/mac/bundle_locations.h" 9 #import "base/mac/bundle_locations.h"
10 #import "base/mac/foundation_util.h" 10 #import "base/mac/foundation_util.h"
(...skipping 1119 matching lines...) Expand 10 before | Expand all | Expand 10 after
1130 } 1130 }
1131 1131
1132 - (int)preferredHeight { 1132 - (int)preferredHeight {
1133 DCHECK(![self isAnimationRunning]); 1133 DCHECK(![self isAnimationRunning]);
1134 1134
1135 if (!barIsEnabled_) 1135 if (!barIsEnabled_)
1136 return 0; 1136 return 0;
1137 1137
1138 CGFloat lineWidth = 0; 1138 CGFloat lineWidth = 0;
1139 BOOL isRetina = NO; 1139 BOOL isRetina = NO;
1140 BOOL reduceHeight = YES; 1140 BOOL reduceHeight = NO;
1141 1141
1142 switch (currentState_) { 1142 switch (currentState_) {
1143 case BookmarkBar::SHOW: 1143 case BookmarkBar::SHOW:
1144 // When on a Retina display and not using Material Design, 1144 // When on a Retina display and not using Material Design,
1145 // -[ToolbarController baseToolbarHeight] reduces the height of the 1145 // -[ToolbarController baseToolbarHeight] reduces the height of the
1146 // toolbar by 1pt. In this case the bookmark bar needs to add 1pt of space 1146 // toolbar by 1pt. In this case the bookmark bar needs to add 1pt of space
1147 // above the bookmark icons in order to maintain the proper distance from 1147 // above the bookmark icons in order to maintain the proper distance from
1148 // toolbar items. See https://crbug.com/326245 . 1148 // toolbar items. See https://crbug.com/326245 .
1149 lineWidth = [[self view] cr_lineWidth]; 1149 lineWidth = [[self view] cr_lineWidth];
1150 isRetina = (lineWidth < 1); 1150 isRetina = (lineWidth < 1);
1151 1151
1152 // If Material Design and Retina, no height adjustment is needed. 1152 // Only adjust the height if Retina and not Material Design.
1153 if (ui::MaterialDesignController::IsModeMaterial() && isRetina) { 1153 reduceHeight =
1154 reduceHeight = NO; 1154 isRetina && !ui::MaterialDesignController::IsModeMaterial();
1155 }
1156 1155
1157 return reduceHeight ? chrome::kBookmarkBarHeight + 1 1156 return reduceHeight ? chrome::kBookmarkBarHeight + 1
1158 : chrome::kBookmarkBarHeight; 1157 : chrome::kBookmarkBarHeight;
1159 case BookmarkBar::DETACHED: 1158 case BookmarkBar::DETACHED:
1160 return chrome::kNTPBookmarkBarHeight; 1159 return chrome::kNTPBookmarkBarHeight;
1161 case BookmarkBar::HIDDEN: 1160 case BookmarkBar::HIDDEN:
1162 return 0; 1161 return 0;
1163 } 1162 }
1164 } 1163 }
1165 1164
(...skipping 1921 matching lines...) Expand 10 before | Expand all | Expand 10 after
3087 - (id<BookmarkButtonControllerProtocol>)controllerForNode: 3086 - (id<BookmarkButtonControllerProtocol>)controllerForNode:
3088 (const BookmarkNode*)node { 3087 (const BookmarkNode*)node {
3089 // See if it's in the bar, then if it is in the hierarchy of visible 3088 // See if it's in the bar, then if it is in the hierarchy of visible
3090 // folder menus. 3089 // folder menus.
3091 if (bookmarkModel_->bookmark_bar_node() == node) 3090 if (bookmarkModel_->bookmark_bar_node() == node)
3092 return self; 3091 return self;
3093 return [folderController_ controllerForNode:node]; 3092 return [folderController_ controllerForNode:node];
3094 } 3093 }
3095 3094
3096 @end 3095 @end
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698