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

Side by Side Diff: chrome/browser/ui/cocoa/find_bar/find_bar_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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/find_bar/find_bar_text_field_cell.h" 5 #import "chrome/browser/ui/cocoa/find_bar/find_bar_text_field_cell.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/sys_string_conversions.h" 10 #include "base/strings/sys_string_conversions.h"
11 #include "grit/generated_resources.h" 11 #include "grit/generated_resources.h"
12 #include "ui/base/l10n/l10n_util.h" 12 #include "ui/base/l10n/l10n_util.h"
13 13
14 namespace { 14 namespace {
15 15
16 const CGFloat kBaselineAdjust = 1.0;
17
18 // How far to offset the keyword token into the field. 16 // How far to offset the keyword token into the field.
19 const NSInteger kResultsXOffset = 3; 17 const NSInteger kResultsXOffset = 3;
20 18
21 // How much width (beyond text) to add to the keyword token on each 19 // How much width (beyond text) to add to the keyword token on each
22 // side. 20 // side.
23 const NSInteger kResultsTokenInset = 3; 21 const NSInteger kResultsTokenInset = 3;
24 22
25 // How far to shift bounding box of hint down from top of field. 23 // How far to shift bounding box of hint down from top of field.
26 // Assumes -setFlipped:YES. 24 // Assumes -setFlipped:YES.
27 const NSInteger kResultsYOffset = 4; 25 const NSInteger kResultsYOffset = 4;
28 26
29 // How far the editor insets itself, for purposes of determining if 27 // How far the editor insets itself, for purposes of determining if
30 // decorations need to be trimmed. 28 // decorations need to be trimmed.
31 const CGFloat kEditorHorizontalInset = 3.0; 29 const CGFloat kEditorHorizontalInset = 3.0;
32 30
33 // Conveniences to centralize width+offset calculations. 31 // Conveniences to centralize width+offset calculations.
34 CGFloat WidthForResults(NSAttributedString* resultsString) { 32 CGFloat WidthForResults(NSAttributedString* resultsString) {
35 return kResultsXOffset + ceil([resultsString size].width) + 33 return kResultsXOffset + ceil([resultsString size].width) +
36 2 * kResultsTokenInset; 34 2 * kResultsTokenInset;
37 } 35 }
38 36
39 } // namespace 37 } // namespace
40 38
41 @implementation FindBarTextFieldCell 39 @implementation FindBarTextFieldCell
42 40
43 - (CGFloat)baselineAdjust { 41 - (CGFloat)topTextFrameOffset {
44 return kBaselineAdjust; 42 return 1.0;
43 }
44
45 - (CGFloat)bottomTextFrameOffset {
46 return 1.0;
45 } 47 }
46 48
47 - (CGFloat)cornerRadius { 49 - (CGFloat)cornerRadius {
48 return 4.0; 50 return 4.0;
49 } 51 }
50 52
51 - (rect_path_utils::RoundedCornerFlags)roundedCornerFlags { 53 - (rect_path_utils::RoundedCornerFlags)roundedCornerFlags {
52 return rect_path_utils::RoundedCornerLeft; 54 return rect_path_utils::RoundedCornerLeft;
53 } 55 }
54 56
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 [resultsString_.get() drawInRect:infoFrame]; 111 [resultsString_.get() drawInRect:infoFrame];
110 } 112 }
111 113
112 - (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView*)controlView { 114 - (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView*)controlView {
113 if (resultsString_) 115 if (resultsString_)
114 [self drawResultsWithFrame:cellFrame inView:controlView]; 116 [self drawResultsWithFrame:cellFrame inView:controlView];
115 [super drawInteriorWithFrame:cellFrame inView:controlView]; 117 [super drawInteriorWithFrame:cellFrame inView:controlView];
116 } 118 }
117 119
118 @end 120 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698