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

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
24 // Matches the clipping radius of |GradientButtonCell|. 23 // Matches the clipping radius of |GradientButtonCell|.
25 const CGFloat kCornerRadius = 3.0; 24 const CGFloat kCornerRadius = 3.0;
26 25
27 // How far to inset the left-hand decorations from the field's bounds. 26 // How far to inset the left-hand decorations from the field's bounds.
28 const CGFloat kLeftDecorationXOffset = 5.0; 27 const CGFloat kLeftDecorationXOffset = 5.0;
29 28
30 NSString* const kButtonDecorationKey = @"ButtonDecoration"; 29 NSString* const kButtonDecorationKey = @"ButtonDecoration";
31 30
32 // How far to inset the right-hand decorations from the field's bounds. 31 // How far to inset the right-hand decorations from the field's bounds.
33 // TODO(shess): Why is this different from |kLeftDecorationXOffset|? 32 // TODO(shess): Why is this different from |kLeftDecorationXOffset|?
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 } 208 }
210 209
211 } // namespace 210 } // namespace
212 211
213 @interface AutocompleteTextFieldCell () 212 @interface AutocompleteTextFieldCell ()
214 - (CGFloat)textWidth; 213 - (CGFloat)textWidth;
215 @end 214 @end
216 215
217 @implementation AutocompleteTextFieldCell 216 @implementation AutocompleteTextFieldCell
218 217
219 - (CGFloat)baselineAdjust { 218 - (CGFloat)topTextFrameOffset {
220 return kBaselineAdjust; 219 if (chrome::IsInstantExtendedAPIEnabled())
220 return 2.0;
221 return 3.0;
222 }
223
224 - (CGFloat)bottomTextFrameOffset {
225 return 3.0;
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];
230 } 235 }
(...skipping 549 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