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

Side by Side Diff: chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.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 #include "chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h" 5 #include "chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h"
6 6
7 #include <Carbon/Carbon.h> // kVK_Return 7 #include <Carbon/Carbon.h> // kVK_Return
8 8
9 #include "base/mac/foundation_util.h" 9 #include "base/mac/foundation_util.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 [field_ setObserver:this]; 148 [field_ setObserver:this];
149 149
150 // Needed so that editing doesn't lose the styling. 150 // Needed so that editing doesn't lose the styling.
151 [field_ setAllowsEditingTextAttributes:YES]; 151 [field_ setAllowsEditingTextAttributes:YES];
152 152
153 // Get the appropriate line height for the font that we use. 153 // Get the appropriate line height for the font that we use.
154 scoped_nsobject<NSLayoutManager> 154 scoped_nsobject<NSLayoutManager>
155 layoutManager([[NSLayoutManager alloc] init]); 155 layoutManager([[NSLayoutManager alloc] init]);
156 [layoutManager setUsesScreenFonts:YES]; 156 [layoutManager setUsesScreenFonts:YES];
157 line_height_ = [layoutManager defaultLineHeightForFont:GetFieldFont()]; 157 line_height_ = [layoutManager defaultLineHeightForFont:GetFieldFont()];
158
159 // Extended instant uses a larger font so increase line height to reduce
160 // clipping.
161 if (chrome::IsInstantExtendedAPIEnabled())
162 line_height_ += 1;
Scott Hess - ex-Googler 2013/05/22 23:39:39 I'm still questioning this guy. I feel like someo
sail 2013/05/23 19:46:32 Replaced this with -[AutocompleteTextFieldCell lin
163
158 DCHECK_GT(line_height_, 0); 164 DCHECK_GT(line_height_, 0);
159 } 165 }
160 166
161 OmniboxViewMac::~OmniboxViewMac() { 167 OmniboxViewMac::~OmniboxViewMac() {
162 // Destroy popup view before this object in case it tries to call us 168 // Destroy popup view before this object in case it tries to call us
163 // back in the destructor. 169 // back in the destructor.
164 popup_view_.reset(); 170 popup_view_.reset();
165 171
166 // Disconnect from |field_|, it outlives this object. 172 // Disconnect from |field_|, it outlives this object.
167 [field_ setObserver:NULL]; 173 [field_ setObserver:NULL];
(...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after
977 983
978 NSUInteger OmniboxViewMac::GetTextLength() const { 984 NSUInteger OmniboxViewMac::GetTextLength() const {
979 return [field_ currentEditor] ? [[[field_ currentEditor] string] length] : 985 return [field_ currentEditor] ? [[[field_ currentEditor] string] length] :
980 [[field_ stringValue] length]; 986 [[field_ stringValue] length];
981 } 987 }
982 988
983 bool OmniboxViewMac::IsCaretAtEnd() const { 989 bool OmniboxViewMac::IsCaretAtEnd() const {
984 const NSRange selection = GetSelectedRange(); 990 const NSRange selection = GetSelectedRange();
985 return NSMaxRange(selection) == GetTextLength(); 991 return NSMaxRange(selection) == GetTextLength();
986 } 992 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698