Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 364 return imageRect; | 364 return imageRect; |
| 365 } | 365 } |
| 366 | 366 |
| 367 - (CGFloat)textStartXOffset { | 367 - (CGFloat)textStartXOffset { |
| 368 if (!ui::MaterialDesignController::IsModeMaterial()) { | 368 if (!ui::MaterialDesignController::IsModeMaterial()) { |
| 369 return [super textStartXOffset]; | 369 return [super textStartXOffset]; |
| 370 } | 370 } |
| 371 return kIconLeftPadding + [[self image] size].width + kIconTextSpacer; | 371 return kIconLeftPadding + [[self image] size].width + kIconTextSpacer; |
| 372 } | 372 } |
| 373 | 373 |
| 374 - (void)drawFocusRingMaskWithFrame:(NSRect)cellFrame | |
| 375 inView:(NSView *)controlView { | |
|
Avi (use Gerrit)
2016/06/02 23:26:16
no space left of the *
shrike
2016/06/02 23:59:35
Done.
| |
| 376 // In Material Design we have to move the focus ring over by 2 pts to get it | |
| 377 // to line up with the image. | |
| 378 if (ui::MaterialDesignController::IsModeMaterial() && | |
| 379 [self visibleTitle].length > 0) { | |
| 380 cellFrame.origin.x += 2; | |
| 381 } | |
| 382 [super drawFocusRingMaskWithFrame:cellFrame inView:controlView]; | |
| 383 } | |
| 384 | |
| 374 // Override cell drawing to add a submenu arrow like a real menu. | 385 // Override cell drawing to add a submenu arrow like a real menu. |
| 375 - (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView*)controlView { | 386 - (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView*)controlView { |
| 376 // First draw "everything else". | 387 // First draw "everything else". |
| 377 [super drawInteriorWithFrame:cellFrame inView:controlView]; | 388 [super drawInteriorWithFrame:cellFrame inView:controlView]; |
| 378 | 389 |
| 379 // If asked to do so, and if a folder, draw the arrow. | 390 // If asked to do so, and if a folder, draw the arrow. |
| 380 if (!drawFolderArrow_) | 391 if (!drawFolderArrow_) |
| 381 return; | 392 return; |
| 382 BookmarkButton* button = static_cast<BookmarkButton*>([self controlView]); | 393 BookmarkButton* button = static_cast<BookmarkButton*>([self controlView]); |
| 383 DCHECK([button respondsToSelector:@selector(isFolder)]); | 394 DCHECK([button respondsToSelector:@selector(isFolder)]); |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 412 const CGFloat kLineWidth = [controlView cr_lineWidth]; | 423 const CGFloat kLineWidth = [controlView cr_lineWidth]; |
| 413 if ([self tag] == kMaterialStandardButtonTypeWithLimitedClickFeedback && | 424 if ([self tag] == kMaterialStandardButtonTypeWithLimitedClickFeedback && |
| 414 ![self isFolderButtonCell] && kLineWidth < 1) { | 425 ![self isFolderButtonCell] && kLineWidth < 1) { |
| 415 return -kLineWidth; | 426 return -kLineWidth; |
| 416 } | 427 } |
| 417 return 0.0; | 428 return 0.0; |
| 418 } | 429 } |
| 419 | 430 |
| 420 | 431 |
| 421 @end | 432 @end |
| OLD | NEW |