Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/l10n_util_mac.h" | 7 #include "app/l10n_util_mac.h" |
| 8 #include "app/mac/nsimage_cache.h" | 8 #include "app/mac/nsimage_cache.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/sys_string_conversions.h" | 10 #include "base/sys_string_conversions.h" |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 224 [super drawInteriorWithFrame:cellFrame inView:controlView]; | 224 [super drawInteriorWithFrame:cellFrame inView:controlView]; |
| 225 | 225 |
| 226 // If asked to do so, and if a folder, draw the arrow. | 226 // If asked to do so, and if a folder, draw the arrow. |
| 227 if (!drawFolderArrow_) | 227 if (!drawFolderArrow_) |
| 228 return; | 228 return; |
| 229 BookmarkButton* button = static_cast<BookmarkButton*>([self controlView]); | 229 BookmarkButton* button = static_cast<BookmarkButton*>([self controlView]); |
| 230 DCHECK([button respondsToSelector:@selector(isFolder)]); | 230 DCHECK([button respondsToSelector:@selector(isFolder)]); |
| 231 if ([button isFolder]) { | 231 if ([button isFolder]) { |
| 232 NSRect imageRect = NSZeroRect; | 232 NSRect imageRect = NSZeroRect; |
| 233 imageRect.size = [arrowImage_ size]; | 233 imageRect.size = [arrowImage_ size]; |
| 234 const CGFloat kArrowOffset = 1.0; // Required for proper centering. | |
| 234 NSRect drawRect = NSOffsetRect(imageRect, | 235 NSRect drawRect = NSOffsetRect(imageRect, |
| 235 NSWidth(cellFrame) - NSWidth(imageRect), | 236 NSWidth(cellFrame) - NSWidth(imageRect), |
| 236 (NSHeight(cellFrame) / 2.0) - | 237 (NSHeight(cellFrame) / 2.0) - |
| 237 (NSHeight(imageRect) / 2.0)); | 238 (NSHeight(imageRect) / 2.0) + kArrowOffset); |
|
mafv
2011/01/19 22:39:39
It may just be the codereview system, but the inde
mrossetti
2011/01/20 01:41:42
Done.
| |
| 238 [arrowImage_ drawInRect:drawRect | 239 [arrowImage_ drawInRect:drawRect |
| 239 fromRect:imageRect | 240 fromRect:imageRect |
| 240 operation:NSCompositeSourceOver | 241 operation:NSCompositeSourceOver |
| 241 fraction:[self isEnabled] ? 1.0 : 0.5 | 242 fraction:[self isEnabled] ? 1.0 : 0.5 |
| 242 neverFlipped:YES]; | 243 neverFlipped:YES]; |
| 243 } | 244 } |
| 244 } | 245 } |
| 245 | 246 |
| 246 @end | 247 @end |
| OLD | NEW |