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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/cocoa/styled_text_field_cell.mm
diff --git a/chrome/browser/ui/cocoa/styled_text_field_cell.mm b/chrome/browser/ui/cocoa/styled_text_field_cell.mm
index 4cf3f707e81e61e3b938433e59896fab0b19da8c..ad41e7834f867655cba52d70b3ee6edb5fc69abf 100644
--- a/chrome/browser/ui/cocoa/styled_text_field_cell.mm
+++ b/chrome/browser/ui/cocoa/styled_text_field_cell.mm
@@ -14,9 +14,17 @@
#include "ui/gfx/font.h"
#include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h"
+@interface StyledTextFieldCell ()
+- (NSRect)textFrameForFrameInternal:(NSRect)cellFrame;
Scott Hess - ex-Googler 2013/05/23 20:08:02 I would just put this method above the two clients
sail 2013/05/23 20:45:44 Done.
+@end
+
@implementation StyledTextFieldCell
-- (CGFloat)baselineAdjust {
+- (CGFloat)topTextFrameOffset {
+ return 0.0;
+}
+
+- (CGFloat)bottomTextFrameOffset {
return 0.0;
}
@@ -35,13 +43,13 @@
// Returns the same value as textCursorFrameForFrame, but does not call it
// directly to avoid potential infinite loops.
- (NSRect)textFrameForFrame:(NSRect)cellFrame {
- return NSInsetRect(cellFrame, 0, [self baselineAdjust]);
+ return [self textFrameForFrameInternal:cellFrame];
}
// Returns the same value as textFrameForFrame, but does not call it directly to
// avoid potential infinite loops.
- (NSRect)textCursorFrameForFrame:(NSRect)cellFrame {
- return NSInsetRect(cellFrame, 0, [self baselineAdjust]);
+ return [self textFrameForFrameInternal:cellFrame];
}
// Override to show the I-beam cursor only in the area given by
@@ -157,4 +165,12 @@
}
}
+- (NSRect)textFrameForFrameInternal:(NSRect)cellFrame {
+ CGFloat topOffset = [self topTextFrameOffset];
+ NSRect textFrame = cellFrame;
+ textFrame.origin.y += topOffset;
+ textFrame.size.height -= topOffset + [self bottomTextFrameOffset];
+ return textFrame;
+}
+
@end

Powered by Google App Engine
This is Rietveld 408576698