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

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

Issue 2208973003: Add some extra height to bookmark bar if the font wants to be larger (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address various nits from code review comments 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 unified diff | Download patch
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 1078 matching lines...) Expand 10 before | Expand all | Expand 10 after
1089 1089
1090 // (Private) 1090 // (Private)
1091 - (BOOL)doBookmarkBarAnimation { 1091 - (BOOL)doBookmarkBarAnimation {
1092 BookmarkBarToolbarView* view = [self controlledView]; 1092 BookmarkBarToolbarView* view = [self controlledView];
1093 if ([self isAnimatingFromState:BookmarkBar::HIDDEN 1093 if ([self isAnimatingFromState:BookmarkBar::HIDDEN
1094 toState:BookmarkBar::SHOW]) { 1094 toState:BookmarkBar::SHOW]) {
1095 [view setShowsDivider:YES]; 1095 [view setShowsDivider:YES];
1096 [view setHidden:NO]; 1096 [view setHidden:NO];
1097 // Height takes into account the extra height we have since the toolbar 1097 // Height takes into account the extra height we have since the toolbar
1098 // only compresses when we're done. 1098 // only compresses when we're done.
1099 [view animateToNewHeight:(chrome::kBookmarkBarHeight - 1099 [view animateToNewHeight:(chrome::kMinimumBookmarkBarHeight -
1100 bookmarks::kBookmarkBarOverlap) 1100 bookmarks::kBookmarkBarOverlap)
1101 duration:kBookmarkBarAnimationDuration]; 1101 duration:kBookmarkBarAnimationDuration];
1102 } else if ([self isAnimatingFromState:BookmarkBar::SHOW 1102 } else if ([self isAnimatingFromState:BookmarkBar::SHOW
1103 toState:BookmarkBar::HIDDEN]) { 1103 toState:BookmarkBar::HIDDEN]) {
1104 [view setShowsDivider:YES]; 1104 [view setShowsDivider:YES];
1105 [view setHidden:NO]; 1105 [view setHidden:NO];
1106 [view animateToNewHeight:0 1106 [view animateToNewHeight:0
1107 duration:kBookmarkBarAnimationDuration]; 1107 duration:kBookmarkBarAnimationDuration];
1108 } else if ([self isAnimatingFromState:BookmarkBar::SHOW 1108 } else if ([self isAnimatingFromState:BookmarkBar::SHOW
1109 toState:BookmarkBar::DETACHED]) { 1109 toState:BookmarkBar::DETACHED]) {
1110 [view setShowsDivider:YES]; 1110 [view setShowsDivider:YES];
1111 [view setHidden:NO]; 1111 [view setHidden:NO];
1112 [view animateToNewHeight:chrome::kNTPBookmarkBarHeight 1112 [view animateToNewHeight:chrome::kNTPBookmarkBarHeight
1113 duration:kBookmarkBarAnimationDuration]; 1113 duration:kBookmarkBarAnimationDuration];
1114 } else if ([self isAnimatingFromState:BookmarkBar::DETACHED 1114 } else if ([self isAnimatingFromState:BookmarkBar::DETACHED
1115 toState:BookmarkBar::SHOW]) { 1115 toState:BookmarkBar::SHOW]) {
1116 [view setShowsDivider:YES]; 1116 [view setShowsDivider:YES];
1117 [view setHidden:NO]; 1117 [view setHidden:NO];
1118 // Height takes into account the extra height we have since the toolbar 1118 // Height takes into account the extra height we have since the toolbar
1119 // only compresses when we're done. 1119 // only compresses when we're done.
1120 [view animateToNewHeight:(chrome::kBookmarkBarHeight - 1120 [view animateToNewHeight:(chrome::kMinimumBookmarkBarHeight -
1121 bookmarks::kBookmarkBarOverlap) 1121 bookmarks::kBookmarkBarOverlap)
1122 duration:kBookmarkBarAnimationDuration]; 1122 duration:kBookmarkBarAnimationDuration];
1123 } else { 1123 } else {
1124 // Oops! An animation we don't know how to handle. 1124 // Oops! An animation we don't know how to handle.
1125 return NO; 1125 return NO;
1126 } 1126 }
1127 1127
1128 return YES; 1128 return YES;
1129 } 1129 }
1130 1130
(...skipping 28 matching lines...) Expand all
1159 // toolbar by 1pt. In this case the bookmark bar needs to add 1pt of space 1159 // toolbar by 1pt. In this case the bookmark bar needs to add 1pt of space
1160 // above the bookmark icons in order to maintain the proper distance from 1160 // above the bookmark icons in order to maintain the proper distance from
1161 // toolbar items. See https://crbug.com/326245 . 1161 // toolbar items. See https://crbug.com/326245 .
1162 lineWidth = [[self view] cr_lineWidth]; 1162 lineWidth = [[self view] cr_lineWidth];
1163 isRetina = (lineWidth < 1); 1163 isRetina = (lineWidth < 1);
1164 1164
1165 // Only adjust the height if Retina and not Material Design. 1165 // Only adjust the height if Retina and not Material Design.
1166 reduceHeight = 1166 reduceHeight =
1167 isRetina && !ui::MaterialDesignController::IsModeMaterial(); 1167 isRetina && !ui::MaterialDesignController::IsModeMaterial();
1168 1168
1169 return reduceHeight ? chrome::kBookmarkBarHeight + 1 1169 return reduceHeight ? chrome::kMinimumBookmarkBarHeight + 1
1170 : chrome::kBookmarkBarHeight; 1170 : chrome::kMinimumBookmarkBarHeight;
1171 case BookmarkBar::DETACHED: 1171 case BookmarkBar::DETACHED:
1172 return chrome::kNTPBookmarkBarHeight; 1172 return chrome::kNTPBookmarkBarHeight;
1173 case BookmarkBar::HIDDEN: 1173 case BookmarkBar::HIDDEN:
1174 return 0; 1174 return 0;
1175 } 1175 }
1176 } 1176 }
1177 1177
1178 // Recursively add the given bookmark node and all its children to 1178 // Recursively add the given bookmark node and all its children to
1179 // menu, one menu item per node. 1179 // menu, one menu item per node.
1180 - (void)addNode:(const BookmarkNode*)child toMenu:(NSMenu*)menu { 1180 - (void)addNode:(const BookmarkNode*)child toMenu:(NSMenu*)menu {
(...skipping 1904 matching lines...) Expand 10 before | Expand all | Expand 10 after
3085 - (id<BookmarkButtonControllerProtocol>)controllerForNode: 3085 - (id<BookmarkButtonControllerProtocol>)controllerForNode:
3086 (const BookmarkNode*)node { 3086 (const BookmarkNode*)node {
3087 // See if it's in the bar, then if it is in the hierarchy of visible 3087 // See if it's in the bar, then if it is in the hierarchy of visible
3088 // folder menus. 3088 // folder menus.
3089 if (bookmarkModel_->bookmark_bar_node() == node) 3089 if (bookmarkModel_->bookmark_bar_node() == node)
3090 return self; 3090 return self;
3091 return [folderController_ controllerForNode:node]; 3091 return [folderController_ controllerForNode:node];
3092 } 3092 }
3093 3093
3094 @end 3094 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698