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

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

Issue 2313113002: [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 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 - (CGFloat)textStartXOffset { 396 - (CGFloat)textStartXOffset {
397 if (!ui::MaterialDesignController::IsModeMaterial()) { 397 if (!ui::MaterialDesignController::IsModeMaterial()) {
398 return [super textStartXOffset]; 398 return [super textStartXOffset];
399 } 399 }
400 return kIconLeftPadding + [[self image] size].width + kIconTextSpacer; 400 return kIconLeftPadding + [[self image] size].width + kIconTextSpacer;
401 } 401 }
402 402
403 - (void)drawFocusRingMaskWithFrame:(NSRect)cellFrame 403 - (void)drawFocusRingMaskWithFrame:(NSRect)cellFrame
404 inView:(NSView*)controlView { 404 inView:(NSView*)controlView {
405 if (ui::MaterialDesignController::IsModeMaterial()) { 405 if (ui::MaterialDesignController::IsModeMaterial()) {
406 // In Material Design we have to move the focus ring over by 2 pts to get it 406 // In Material Design we have to adjust the focus ring slightly for the
407 // to line up with the image. 407 // chevron and regular bookmark icons.
408 if ([self visibleTitle].length > 0) {
409 cellFrame.origin.x += 2;
410 }
411
412 // We also have to nudge the chevron button's focus ring up 2pts.
413 if ([self isOffTheSideButtonCell]) { 408 if ([self isOffTheSideButtonCell]) {
414 cellFrame.origin.y -= 2; 409 cellFrame.origin.y -= 2;
410 } else if ([self visibleTitle].length > 0) {
411 cellFrame.origin.x += 4;
412 }
413 if ([controlView cr_lineWidth] < 1) {
414 cellFrame.origin.y -= 0.5;
415 } 415 }
416 } 416 }
417 [super drawFocusRingMaskWithFrame:cellFrame inView:controlView]; 417 [super drawFocusRingMaskWithFrame:cellFrame inView:controlView];
418 } 418 }
419 419
420 // Override cell drawing to add a submenu arrow like a real menu. 420 // Override cell drawing to add a submenu arrow like a real menu.
421 - (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView*)controlView { 421 - (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView*)controlView {
422 // First draw "everything else". 422 // First draw "everything else".
423 [super drawInteriorWithFrame:cellFrame inView:controlView]; 423 [super drawInteriorWithFrame:cellFrame inView:controlView];
424 424
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 const CGFloat kLineWidth = [controlView cr_lineWidth]; 458 const CGFloat kLineWidth = [controlView cr_lineWidth];
459 if ([self isMaterialDesignButtonType] && ![self isFolderButtonCell] && 459 if ([self isMaterialDesignButtonType] && ![self isFolderButtonCell] &&
460 kLineWidth < 1) { 460 kLineWidth < 1) {
461 return -kLineWidth; 461 return -kLineWidth;
462 } 462 }
463 return 0.0; 463 return 0.0;
464 } 464 }
465 465
466 466
467 @end 467 @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