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

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

Issue 2315933002: [Mac][Material Design] Fix regression in position of chevron icon. (Closed)
Patch Set: 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
« no previous file with comments | « no previous file | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_button_cell.h" 5 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button_cell.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/strings/sys_string_conversions.h" 8 #include "base/strings/sys_string_conversions.h"
9 #include "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_constants.h" 9 #include "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_constants.h"
10 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button.h" 10 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button.h"
(...skipping 29 matching lines...) Expand all
40 }; // namespace 40 }; // namespace
41 41
42 @interface OffTheSideButtonCell : BookmarkButtonCell 42 @interface OffTheSideButtonCell : BookmarkButtonCell
43 @end 43 @end
44 @implementation OffTheSideButtonCell 44 @implementation OffTheSideButtonCell
45 45
46 - (BOOL)isOffTheSideButtonCell { 46 - (BOOL)isOffTheSideButtonCell {
47 return YES; 47 return YES;
48 } 48 }
49 49
50 - (NSString*)accessibilityTitle {
51 return l10n_util::GetNSString(IDS_ACCNAME_BOOKMARKS_CHEVRON);
52 }
53
54 - (NSRect)imageRectForBounds:(NSRect)theRect {
55 NSRect imageRect = [super imageRectForBounds:theRect];
56 if (ui::MaterialDesignController::IsModeMaterial()) {
57 // Make sure the chevron icon stays centered. Normally a bookmark bar item
58 // with no label has its icon placed at a fixed x-position.
59 CGFloat totalWidth = NSMaxX(theRect);
60 imageRect.origin.x = (totalWidth - [self image].size.width) / 2;
61 }
62 return imageRect;
63 }
64
50 @end 65 @end
51 66
52 @interface BookmarkButtonCell(Private) 67 @interface BookmarkButtonCell(Private)
53 // Returns YES if the cell is the offTheSide button cell. 68 // Returns YES if the cell is the offTheSide button cell.
54 - (BOOL)isOffTheSideButtonCell; 69 - (BOOL)isOffTheSideButtonCell;
55 - (void)configureBookmarkButtonCell; 70 - (void)configureBookmarkButtonCell;
56 - (void)applyTextColor; 71 - (void)applyTextColor;
57 // Returns the title the button cell displays. Note that a button cell can 72 // Returns the title the button cell displays. Note that a button cell can
58 // have a title string assigned but it won't be visible if its image position 73 // have a title string assigned but it won't be visible if its image position
59 // is NSImageOnly. 74 // is NSImageOnly.
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 const CGFloat kLineWidth = [controlView cr_lineWidth]; 458 const CGFloat kLineWidth = [controlView cr_lineWidth];
444 if ([self isMaterialDesignButtonType] && ![self isFolderButtonCell] && 459 if ([self isMaterialDesignButtonType] && ![self isFolderButtonCell] &&
445 kLineWidth < 1) { 460 kLineWidth < 1) {
446 return -kLineWidth; 461 return -kLineWidth;
447 } 462 }
448 return 0.0; 463 return 0.0;
449 } 464 }
450 465
451 466
452 @end 467 @end
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698