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

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

Issue 2051973002: [Mac][Material Design] Fix MD bookmarks button focus ring regression. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2743
Patch Set: Created 4 years, 6 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 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 {
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
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
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