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

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

Issue 15553008: Instant Extended: Reduce clipping in omnibox (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
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 "base/logging.h" 7 #include "base/logging.h"
8 #include "base/mac/foundation_util.h" 8 #include "base/mac/foundation_util.h"
9 #include "base/mac/mac_logging.h" 9 #include "base/mac/mac_logging.h"
10 #include "chrome/browser/search/search.h"
10 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.h" 11 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.h"
11 #import "chrome/browser/ui/cocoa/location_bar/button_decoration.h" 12 #import "chrome/browser/ui/cocoa/location_bar/button_decoration.h"
12 #import "chrome/browser/ui/cocoa/location_bar/location_bar_decoration.h" 13 #import "chrome/browser/ui/cocoa/location_bar/location_bar_decoration.h"
13 #import "chrome/browser/ui/cocoa/nsview_additions.h" 14 #import "chrome/browser/ui/cocoa/nsview_additions.h"
14 #import "chrome/common/extensions/feature_switch.h" 15 #import "chrome/common/extensions/feature_switch.h"
15 #import "third_party/mozilla/NSPasteboard+Utils.h" 16 #import "third_party/mozilla/NSPasteboard+Utils.h"
16 #import "ui/base/cocoa/tracking_area.h" 17 #import "ui/base/cocoa/tracking_area.h"
17 18
18 using extensions::FeatureSwitch; 19 using extensions::FeatureSwitch;
19 20
20 namespace { 21 namespace {
21 22
22 const CGFloat kBaselineAdjust = 3.0; 23 const CGFloat kBaselineAdjust = 3.0;
23 24
25 const CGFloat kBaselineAdjustInstantExtended = 2.5;
26
24 // Matches the clipping radius of |GradientButtonCell|. 27 // Matches the clipping radius of |GradientButtonCell|.
25 const CGFloat kCornerRadius = 3.0; 28 const CGFloat kCornerRadius = 3.0;
26 29
27 // How far to inset the left-hand decorations from the field's bounds. 30 // How far to inset the left-hand decorations from the field's bounds.
28 const CGFloat kLeftDecorationXOffset = 5.0; 31 const CGFloat kLeftDecorationXOffset = 5.0;
29 32
30 NSString* const kButtonDecorationKey = @"ButtonDecoration"; 33 NSString* const kButtonDecorationKey = @"ButtonDecoration";
31 34
32 // How far to inset the right-hand decorations from the field's bounds. 35 // How far to inset the right-hand decorations from the field's bounds.
33 // TODO(shess): Why is this different from |kLeftDecorationXOffset|? 36 // TODO(shess): Why is this different from |kLeftDecorationXOffset|?
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 213
211 } // namespace 214 } // namespace
212 215
213 @interface AutocompleteTextFieldCell () 216 @interface AutocompleteTextFieldCell ()
214 - (CGFloat)textWidth; 217 - (CGFloat)textWidth;
215 @end 218 @end
216 219
217 @implementation AutocompleteTextFieldCell 220 @implementation AutocompleteTextFieldCell
218 221
219 - (CGFloat)baselineAdjust { 222 - (CGFloat)baselineAdjust {
223 if (chrome::IsInstantExtendedAPIEnabled())
224 return kBaselineAdjustInstantExtended;
Scott Hess - ex-Googler 2013/05/22 19:56:37 No, this shouldn't be here. Your example images c
sail 2013/05/22 20:23:55 -baselineAdjust isn't used to adjust the baseline.
Scott Hess - ex-Googler 2013/05/22 21:02:36 That seems like a good idea, then.
220 return kBaselineAdjust; 225 return kBaselineAdjust;
221 } 226 }
222 227
223 - (CGFloat)cornerRadius { 228 - (CGFloat)cornerRadius {
224 return kCornerRadius; 229 return kCornerRadius;
225 } 230 }
226 231
227 - (CGFloat)edgeWidth { 232 - (CGFloat)edgeWidth {
228 // The omnibox vertical edge width is 1 pixel both in low DPI and high DPI. 233 // The omnibox vertical edge width is 1 pixel both in low DPI and high DPI.
229 return [[self controlView] cr_lineWidth]; 234 return [[self controlView] cr_lineWidth];
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after
780 785
781 - (BOOL)showsFirstResponder { 786 - (BOOL)showsFirstResponder {
782 return [super showsFirstResponder] && !hideFocusState_; 787 return [super showsFirstResponder] && !hideFocusState_;
783 } 788 }
784 789
785 - (CGFloat)textWidth { 790 - (CGFloat)textWidth {
786 return [[self attributedStringValue] size].width; 791 return [[self attributedStringValue] size].width;
787 } 792 }
788 793
789 @end 794 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698