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

Side by Side Diff: chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.mm

Issue 1997473006: [Material][Mac]Move the Omnibox left icons 1px to the right (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 | chrome/browser/ui/cocoa/omnibox/omnibox_popup_cell.mm » ('j') | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/location_bar/autocomplete_text_field_cell.h" 5 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/mac/foundation_util.h" 10 #include "base/mac/foundation_util.h"
(...skipping 13 matching lines...) Expand all
24 24
25 using extensions::FeatureSwitch; 25 using extensions::FeatureSwitch;
26 26
27 namespace { 27 namespace {
28 28
29 // Matches the clipping radius of |GradientButtonCell|. 29 // Matches the clipping radius of |GradientButtonCell|.
30 const CGFloat kCornerRadius = 3.0; 30 const CGFloat kCornerRadius = 3.0;
31 31
32 // How far to inset the left- and right-hand decorations from the field's 32 // How far to inset the left- and right-hand decorations from the field's
33 // bounds. 33 // bounds.
34 const CGFloat kLeftDecorationXOffset = 5.0;
35 const CGFloat kRightDecorationXOffset = 5.0; 34 const CGFloat kRightDecorationXOffset = 5.0;
35 CGFloat LeftDecorationXOffset() {
36 const CGFloat kLeftDecorationXOffset = 5.0;
37 const CGFloat kLeftMaterialDecorationXOffset = 6.0;
38 return ui::MaterialDesignController::IsModeMaterial()
39 ? kLeftMaterialDecorationXOffset
40 : kLeftDecorationXOffset;
41 }
36 42
37 // The amount of padding on either side reserved for drawing 43 // The amount of padding on either side reserved for drawing
38 // decorations. [Views has |kItemPadding| == 3.] 44 // decorations. [Views has |kItemPadding| == 3.]
39 CGFloat DecorationsHorizontalPad() { 45 CGFloat DecorationsHorizontalPad() {
40 const CGFloat kDecorationHorizontalPad = 3.0; 46 const CGFloat kDecorationHorizontalPad = 3.0;
41 const CGFloat kMaterialDecorationHorizontalPad = 4.0; 47 const CGFloat kMaterialDecorationHorizontalPad = 4.0;
42 return ui::MaterialDesignController::IsModeMaterial() 48 return ui::MaterialDesignController::IsModeMaterial()
43 ? kMaterialDecorationHorizontalPad 49 ? kMaterialDecorationHorizontalPad
44 : kDecorationHorizontalPad; 50 : kDecorationHorizontalPad;
45 } 51 }
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 const std::vector<LocationBarDecoration*>& left_decorations, 140 const std::vector<LocationBarDecoration*>& left_decorations,
135 const std::vector<LocationBarDecoration*>& right_decorations, 141 const std::vector<LocationBarDecoration*>& right_decorations,
136 std::vector<LocationBarDecoration*>* decorations, 142 std::vector<LocationBarDecoration*>* decorations,
137 std::vector<NSRect>* decoration_frames, 143 std::vector<NSRect>* decoration_frames,
138 NSRect* remaining_frame) { 144 NSRect* remaining_frame) {
139 decorations->clear(); 145 decorations->clear();
140 decoration_frames->clear(); 146 decoration_frames->clear();
141 147
142 // Layout |left_decorations| against the LHS. 148 // Layout |left_decorations| against the LHS.
143 CalculatePositionsHelper(frame, left_decorations, NSMinXEdge, 149 CalculatePositionsHelper(frame, left_decorations, NSMinXEdge,
144 kLeftDecorationXOffset, decorations, 150 LeftDecorationXOffset(), decorations,
145 decoration_frames, &frame); 151 decoration_frames, &frame);
146 DCHECK_EQ(decorations->size(), decoration_frames->size()); 152 DCHECK_EQ(decorations->size(), decoration_frames->size());
147 153
148 // Capture the number of visible left-hand decorations. 154 // Capture the number of visible left-hand decorations.
149 const size_t left_count = decorations->size(); 155 const size_t left_count = decorations->size();
150 156
151 // Layout |right_decorations| against the RHS. 157 // Layout |right_decorations| against the RHS.
152 CalculatePositionsHelper(frame, right_decorations, NSMaxXEdge, 158 CalculatePositionsHelper(frame, right_decorations, NSMaxXEdge,
153 kRightDecorationXOffset, decorations, 159 kRightDecorationXOffset, decorations,
154 decoration_frames, &frame); 160 decoration_frames, &frame);
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after
774 780
775 - (void)handleFocusEvent:(NSEvent*)event 781 - (void)handleFocusEvent:(NSEvent*)event
776 ofView:(AutocompleteTextField*)controlView { 782 ofView:(AutocompleteTextField*)controlView {
777 if ([controlView observer]) { 783 if ([controlView observer]) {
778 const bool controlDown = ([event modifierFlags] & NSControlKeyMask) != 0; 784 const bool controlDown = ([event modifierFlags] & NSControlKeyMask) != 0;
779 [controlView observer]->OnSetFocus(controlDown); 785 [controlView observer]->OnSetFocus(controlDown);
780 } 786 }
781 } 787 }
782 788
783 @end 789 @end
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/omnibox/omnibox_popup_cell.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698