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

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

Issue 8792001: A BookmarkBarFolderButtonCell should have the favicon aligned left when no title is provided (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 years 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 | Annotate | Revision Log
« 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/sys_string_conversions.h" 8 #include "base/sys_string_conversions.h"
9 #import "chrome/browser/bookmarks/bookmark_model.h" 9 #import "chrome/browser/bookmarks/bookmark_model.h"
10 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button.h" 10 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button.h"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 size.width += 2; 110 size.width += 2;
111 size.height += 4; 111 size.height += 4;
112 return size; 112 return size;
113 } 113 }
114 114
115 - (void)setBookmarkCellText:(NSString*)title 115 - (void)setBookmarkCellText:(NSString*)title
116 image:(NSImage*)image { 116 image:(NSImage*)image {
117 title = [title stringByReplacingOccurrencesOfString:@"\n" 117 title = [title stringByReplacingOccurrencesOfString:@"\n"
118 withString:@" "]; 118 withString:@" "];
119 title = [title stringByReplacingOccurrencesOfString:@"\r" 119 title = [title stringByReplacingOccurrencesOfString:@"\r"
120 withString:@" "]; 120 withString:@" "];
Ilya Sherman 2011/12/05 23:53:58 nit: Hmm, this isn't relevant to this CL so much a
KushalP 2011/12/13 17:39:06 I'll have a look and see what happens when I remov
121 // If there is no title, squeeze things tight by displaying only the image; by 121 // If there is no title, squeeze things tight by displaying only the image; by
122 // default, Cocoa leaves extra space in an attempt to display an empty title. 122 // default, Cocoa leaves extra space in an attempt to display an empty title.
Ilya Sherman 2011/12/05 23:53:58 nit: This comment should be moved into the "else"
123 if ([title length]) { 123 if ([title length]) {
124 [self setImagePosition:NSImageLeft]; 124 [self setImagePosition:NSImageLeft];
125 [self setTitle:title]; 125 [self setTitle:title];
126 } else if ([self isFolderButtonCell]) {
127 // A folder button cell in the bookmark bar scroll view should have
128 // the favicon aligned to the left.
Ilya Sherman 2011/12/05 23:53:58 nit: "folder button cell" reads as slightly confus
129 [self setImagePosition:NSImageLeft];
126 } else { 130 } else {
127 [self setImagePosition:NSImageOnly]; 131 [self setImagePosition:NSImageOnly];
128 } 132 }
129 133
130 if (image) 134 if (image)
131 [self setImage:image]; 135 [self setImage:image];
132 } 136 }
133 137
134 - (void)setBookmarkNode:(const BookmarkNode*)node { 138 - (void)setBookmarkNode:(const BookmarkNode*)node {
135 [self setRepresentedObject:[NSValue valueWithPointer:node]]; 139 [self setRepresentedObject:[NSValue valueWithPointer:node]];
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 NSRect drawRect = NSOffsetRect(imageRect, dX, dY); 250 NSRect drawRect = NSOffsetRect(imageRect, dX, dY);
247 [arrowImage_ drawInRect:drawRect 251 [arrowImage_ drawInRect:drawRect
248 fromRect:imageRect 252 fromRect:imageRect
249 operation:NSCompositeSourceOver 253 operation:NSCompositeSourceOver
250 fraction:[self isEnabled] ? 1.0 : 0.5 254 fraction:[self isEnabled] ? 1.0 : 0.5
251 neverFlipped:YES]; 255 neverFlipped:YES];
252 } 256 }
253 } 257 }
254 258
255 @end 259 @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