summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa/styled_text_field_cell.mm
diff options
context:
space:
mode:
authorpinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-21 19:01:18 +0000
committerpinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-21 19:01:18 +0000
commit03626c0de3fcf0deac6c51585af7accfcffba294 (patch)
treeab386441b8312425635e9530cf427e7f985f3a1f /chrome/browser/cocoa/styled_text_field_cell.mm
parent2afab22c09c10833b834354a69c26f1e6741b05c (diff)
downloadchromium_src-03626c0de3fcf0deac6c51585af7accfcffba294.zip
chromium_src-03626c0de3fcf0deac6c51585af7accfcffba294.tar.gz
chromium_src-03626c0de3fcf0deac6c51585af7accfcffba294.tar.bz2
Conditionally draw a bezel below text fields, used for the omnibox.
BUG=49793 TEST=visual inspection. unit tests shouldn't leak or crash on drawing. Review URL: http://codereview.chromium.org/3042014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@53224 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/styled_text_field_cell.mm')
-rw-r--r--chrome/browser/cocoa/styled_text_field_cell.mm15
1 files changed, 15 insertions, 0 deletions
diff --git a/chrome/browser/cocoa/styled_text_field_cell.mm b/chrome/browser/cocoa/styled_text_field_cell.mm
index 64fc0e4..5289175 100644
--- a/chrome/browser/cocoa/styled_text_field_cell.mm
+++ b/chrome/browser/cocoa/styled_text_field_cell.mm
@@ -85,6 +85,10 @@ private:
return 0.0;
}
+- (BOOL)shouldDrawBezel {
+ return NO;
+}
+
// Returns the same value as textCursorFrameForFrame, but does not call it
// directly to avoid potential infinite loops.
- (NSRect)textFrameForFrame:(NSRect)cellFrame {
@@ -166,6 +170,17 @@ private:
FrameRectWithInset(shadowFrame, 0.5, radius - 0.5, 1.0, shadowShade);
}
+ // Draw optional bezel below bottom stroke.
+ if ([self shouldDrawBezel]) {
+ [[NSColor colorWithCalibratedWhite:0.96 alpha:1.0] set];
+ NSRect bezelRect = NSMakeRect(cellFrame.origin.x,
+ NSMaxY(cellFrame) - 0.5,
+ NSWidth(cellFrame),
+ 1.0);
+ bezelRect = NSInsetRect(bezelRect, radius - 0.5, 0.0);
+ NSRectFill(bezelRect);
+ }
+
// Draw the focus ring if needed.
if ([self showsFirstResponder]) {
NSColor* color =