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

Side by Side Diff: chrome/browser/ui/cocoa/toolbar/toolbar_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 | « chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm ('k') | no next file » | 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/toolbar/toolbar_controller.h" 5 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/mac/bundle_locations.h" 9 #include "base/mac/bundle_locations.h"
10 #include "base/mac/foundation_util.h" 10 #include "base/mac/foundation_util.h"
(...skipping 1050 matching lines...) Expand 10 before | Expand all | Expand 10 after
1061 // Not all lines are drawn at 2x normal height when running on Retina, which 1061 // Not all lines are drawn at 2x normal height when running on Retina, which
1062 // causes the toolbar controls to be visually 1pt too high within the toolbar 1062 // causes the toolbar controls to be visually 1pt too high within the toolbar
1063 // area. It's not possible to adjust the control y-positions by 0.5pt and have 1063 // area. It's not possible to adjust the control y-positions by 0.5pt and have
1064 // them appear 0.5pt lower (they are still drawn at their original locations), 1064 // them appear 0.5pt lower (they are still drawn at their original locations),
1065 // so instead shave off 1pt from the bottom of the toolbar. Note that there's 1065 // so instead shave off 1pt from the bottom of the toolbar. Note that there's
1066 // an offsetting change in -[BookmarkBarController preferredHeight] to 1066 // an offsetting change in -[BookmarkBarController preferredHeight] to
1067 // maintain the proper spacing between bookmark icons and toolbar items. See 1067 // maintain the proper spacing between bookmark icons and toolbar items. See
1068 // https://crbug.com/326245 . 1068 // https://crbug.com/326245 .
1069 const CGFloat kLineWidth = [[self view] cr_lineWidth]; 1069 const CGFloat kLineWidth = [[self view] cr_lineWidth];
1070 const BOOL kIsRetina = (kLineWidth < 1); 1070 const BOOL kIsRetina = (kLineWidth < 1);
1071 BOOL reduceHeight = YES; 1071 BOOL reduceHeight = NO;
1072 1072
1073 // If Material Design and Retina, no height adjustment is needed. 1073 // Only adjust the height if Retina and not Material Design.
1074 if (kIsModeMaterial && kIsRetina) { 1074 reduceHeight = kIsRetina && !kIsModeMaterial;
1075 reduceHeight = NO;
1076 }
1077 1075
1078 return reduceHeight ? kBaseToolbarHeightNormal - 1 1076 return reduceHeight ? kBaseToolbarHeightNormal - 1
1079 : kBaseToolbarHeightNormal; 1077 : kBaseToolbarHeightNormal;
1080 } 1078 }
1081 1079
1082 - (CGFloat)desiredHeightForCompression:(CGFloat)compressByHeight { 1080 - (CGFloat)desiredHeightForCompression:(CGFloat)compressByHeight {
1083 // With no toolbar, just ignore the compression. 1081 // With no toolbar, just ignore the compression.
1084 if (!hasToolbar_) 1082 if (!hasToolbar_)
1085 return NSHeight([locationBar_ frame]); 1083 return NSHeight([locationBar_ frame]);
1086 1084
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
1160 - (void)hideDropURLsIndicatorInView:(NSView*)view { 1158 - (void)hideDropURLsIndicatorInView:(NSView*)view {
1161 // Do nothing. 1159 // Do nothing.
1162 } 1160 }
1163 1161
1164 // (URLDropTargetController protocol) 1162 // (URLDropTargetController protocol)
1165 - (BOOL)isUnsupportedDropData:(id<NSDraggingInfo>)info { 1163 - (BOOL)isUnsupportedDropData:(id<NSDraggingInfo>)info {
1166 return drag_util::IsUnsupportedDropData(profile_, info); 1164 return drag_util::IsUnsupportedDropData(profile_, info);
1167 } 1165 }
1168 1166
1169 @end 1167 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698