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

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

Issue 2299803003: [Mac][Material Design] Adjust focus ring position of bookmark bar items. (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 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 - (CGFloat)textStartXOffset { 388 - (CGFloat)textStartXOffset {
389 if (!ui::MaterialDesignController::IsModeMaterial()) { 389 if (!ui::MaterialDesignController::IsModeMaterial()) {
390 return [super textStartXOffset]; 390 return [super textStartXOffset];
391 } 391 }
392 return kIconLeftPadding + [[self image] size].width + kIconTextSpacer; 392 return kIconLeftPadding + [[self image] size].width + kIconTextSpacer;
393 } 393 }
394 394
395 - (void)drawFocusRingMaskWithFrame:(NSRect)cellFrame 395 - (void)drawFocusRingMaskWithFrame:(NSRect)cellFrame
396 inView:(NSView*)controlView { 396 inView:(NSView*)controlView {
397 if (ui::MaterialDesignController::IsModeMaterial()) { 397 if (ui::MaterialDesignController::IsModeMaterial()) {
398 // In Material Design we have to move the focus ring over by 2 pts to get it 398 // In Material Design we have to adjust the focus ring slightly for the
399 // to line up with the image. 399 // chevron and regular bookmark icons.
400 if ([self visibleTitle].length > 0) {
401 cellFrame.origin.x += 2;
402 }
403
404 // We also have to nudge the chevron button's focus ring up 2pts.
405 if ([self isOffTheSideButtonCell]) { 400 if ([self isOffTheSideButtonCell]) {
406 cellFrame.origin.y -= 2; 401 cellFrame.origin.y -= 2;
402 } else if ([self visibleTitle].length > 0) {
403 cellFrame.origin.x += 4;
404 }
405 if ([controlView cr_lineWidth] < 1) {
406 cellFrame.origin.y -= 0.5;
407 } 407 }
408 } 408 }
409 [super drawFocusRingMaskWithFrame:cellFrame inView:controlView]; 409 [super drawFocusRingMaskWithFrame:cellFrame inView:controlView];
410 } 410 }
411 411
412 // Override cell drawing to add a submenu arrow like a real menu. 412 // Override cell drawing to add a submenu arrow like a real menu.
413 - (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView*)controlView { 413 - (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView*)controlView {
414 // First draw "everything else". 414 // First draw "everything else".
415 [super drawInteriorWithFrame:cellFrame inView:controlView]; 415 [super drawInteriorWithFrame:cellFrame inView:controlView];
416 416
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 const CGFloat kLineWidth = [controlView cr_lineWidth]; 450 const CGFloat kLineWidth = [controlView cr_lineWidth];
451 if ([self isMaterialDesignButtonType] && ![self isFolderButtonCell] && 451 if ([self isMaterialDesignButtonType] && ![self isFolderButtonCell] &&
452 kLineWidth < 1) { 452 kLineWidth < 1) {
453 return -kLineWidth; 453 return -kLineWidth;
454 } 454 }
455 return 0.0; 455 return 0.0;
456 } 456 }
457 457
458 458
459 @end 459 @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