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

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

Issue 1900873004: [Mac][Material Design] Add space between icon and text in location bar. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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) 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 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 std::vector<LocationBarDecoration*> decorations; 241 std::vector<LocationBarDecoration*> decorations;
242 std::vector<NSRect> decorationFrames; 242 std::vector<NSRect> decorationFrames;
243 NSRect textFrame = [super textFrameForFrame:cellFrame]; 243 NSRect textFrame = [super textFrameForFrame:cellFrame];
244 CalculatePositionsInFrame(textFrame, leftDecorations_, rightDecorations_, 244 CalculatePositionsInFrame(textFrame, leftDecorations_, rightDecorations_,
245 &decorations, &decorationFrames, &textFrame); 245 &decorations, &decorationFrames, &textFrame);
246 246
247 // The text needs to be slightly higher than its default position to match the 247 // The text needs to be slightly higher than its default position to match the
248 // Material Design spec. It turns out this adjustment is equal to the single 248 // Material Design spec. It turns out this adjustment is equal to the single
249 // pixel line width (so 1 on non-Retina, 0.5 on Retina). Make this adjustment 249 // pixel line width (so 1 on non-Retina, 0.5 on Retina). Make this adjustment
250 // after computing decoration positions because the decorations are already 250 // after computing decoration positions because the decorations are already
251 // correctly positioned. 251 // correctly positioned. The spec also calls for positioning the text 1pt to
252 // the right of its default position.
252 if (ui::MaterialDesignController::IsModeMaterial()) { 253 if (ui::MaterialDesignController::IsModeMaterial()) {
254 textFrame.origin.x += 1;
255 textFrame.size.width -= 1;
253 textFrame.origin.y -= singlePixelLineWidth_; 256 textFrame.origin.y -= singlePixelLineWidth_;
254 } 257 }
255 258
256 // NOTE: This function must closely match the logic in 259 // NOTE: This function must closely match the logic in
257 // |-drawInteriorWithFrame:inView:|. 260 // |-drawInteriorWithFrame:inView:|.
258 261
259 return textFrame; 262 return textFrame;
260 } 263 }
261 264
262 - (NSRect)textCursorFrameForFrame:(NSRect)cellFrame { 265 - (NSRect)textCursorFrameForFrame:(NSRect)cellFrame {
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 767
765 - (void)handleFocusEvent:(NSEvent*)event 768 - (void)handleFocusEvent:(NSEvent*)event
766 ofView:(AutocompleteTextField*)controlView { 769 ofView:(AutocompleteTextField*)controlView {
767 if ([controlView observer]) { 770 if ([controlView observer]) {
768 const bool controlDown = ([event modifierFlags] & NSControlKeyMask) != 0; 771 const bool controlDown = ([event modifierFlags] & NSControlKeyMask) != 0;
769 [controlView observer]->OnSetFocus(controlDown); 772 [controlView observer]->OnSetFocus(controlDown);
770 } 773 }
771 } 774 }
772 775
773 @end 776 @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