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

Side by Side Diff: chrome/browser/ui/cocoa/styled_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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/styled_text_field_cell.h" 5 #import "chrome/browser/ui/cocoa/styled_text_field_cell.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "chrome/browser/themes/theme_properties.h" 8 #include "chrome/browser/themes/theme_properties.h"
9 #include "chrome/browser/themes/theme_service.h" 9 #include "chrome/browser/themes/theme_service.h"
10 #import "chrome/browser/ui/cocoa/nsview_additions.h" 10 #import "chrome/browser/ui/cocoa/nsview_additions.h"
(...skipping 17 matching lines...) Expand all
28 return rect_path_utils::RoundedCornerAll; 28 return rect_path_utils::RoundedCornerAll;
29 } 29 }
30 30
31 - (BOOL)shouldDrawBezel { 31 - (BOOL)shouldDrawBezel {
32 return NO; 32 return NO;
33 } 33 }
34 34
35 // Returns the same value as textCursorFrameForFrame, but does not call it 35 // Returns the same value as textCursorFrameForFrame, but does not call it
36 // directly to avoid potential infinite loops. 36 // directly to avoid potential infinite loops.
37 - (NSRect)textFrameForFrame:(NSRect)cellFrame { 37 - (NSRect)textFrameForFrame:(NSRect)cellFrame {
38 return NSInsetRect(cellFrame, 0, [self baselineAdjust]); 38 return NSIntegralRect(NSInsetRect(cellFrame, 0, [self baselineAdjust]));
Scott Hess - ex-Googler 2013/05/22 19:56:37 Does this imply that cellFrame has fractional bits
sail 2013/05/22 20:23:55 Yes, this will be fractional since it's being inse
Scott Hess - ex-Googler 2013/05/22 21:02:36 The NSIntegralRect() means that this will be pushe
39 } 39 }
40 40
41 // Returns the same value as textFrameForFrame, but does not call it directly to 41 // Returns the same value as textFrameForFrame, but does not call it directly to
42 // avoid potential infinite loops. 42 // avoid potential infinite loops.
43 - (NSRect)textCursorFrameForFrame:(NSRect)cellFrame { 43 - (NSRect)textCursorFrameForFrame:(NSRect)cellFrame {
44 return NSInsetRect(cellFrame, 0, [self baselineAdjust]); 44 return NSIntegralRect(NSInsetRect(cellFrame, 0, [self baselineAdjust]));
45 } 45 }
46 46
47 // Override to show the I-beam cursor only in the area given by 47 // Override to show the I-beam cursor only in the area given by
48 // |textCursorFrameForFrame:|. 48 // |textCursorFrameForFrame:|.
49 - (void)resetCursorRect:(NSRect)cellFrame inView:(NSView *)controlView { 49 - (void)resetCursorRect:(NSRect)cellFrame inView:(NSView *)controlView {
50 [super resetCursorRect:[self textCursorFrameForFrame:cellFrame] 50 [super resetCursorRect:[self textCursorFrameForFrame:cellFrame]
51 inView:controlView]; 51 inView:controlView];
52 } 52 }
53 53
54 // For NSTextFieldCell this is the area within the borders. For our 54 // For NSTextFieldCell this is the area within the borders. For our
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 // Draw the focus ring if needed. 151 // Draw the focus ring if needed.
152 if ([self showsFirstResponder]) { 152 if ([self showsFirstResponder]) {
153 NSColor* color = [[NSColor keyboardFocusIndicatorColor] 153 NSColor* color = [[NSColor keyboardFocusIndicatorColor]
154 colorWithAlphaComponent:0.5 / lineWidth]; 154 colorWithAlphaComponent:0.5 / lineWidth];
155 rect_path_utils::FrameRectWithInset(roundedCornerFlags, frame, 0.0, 0.0, 155 rect_path_utils::FrameRectWithInset(roundedCornerFlags, frame, 0.0, 0.0,
156 radius, lineWidth * 2, color); 156 radius, lineWidth * 2, color);
157 } 157 }
158 } 158 }
159 159
160 @end 160 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698