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

Side by Side Diff: chrome/browser/cocoa/styled_text_field_cell.mm

Issue 3042014: Conditionally draw a bezel below text fields, used for the omnibox.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 5 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
« no previous file with comments | « chrome/browser/cocoa/styled_text_field_cell.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/cocoa/styled_text_field_cell.h" 5 #import "chrome/browser/cocoa/styled_text_field_cell.h"
6 6
7 #include "app/resource_bundle.h" 7 #include "app/resource_bundle.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "chrome/browser/browser_theme_provider.h" 9 #include "chrome/browser/browser_theme_provider.h"
10 #import "chrome/browser/cocoa/themed_window.h" 10 #import "chrome/browser/cocoa/themed_window.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 @implementation StyledTextFieldCell 78 @implementation StyledTextFieldCell
79 79
80 - (CGFloat)baselineAdjust { 80 - (CGFloat)baselineAdjust {
81 return 0.0; 81 return 0.0;
82 } 82 }
83 83
84 - (CGFloat)cornerRadius { 84 - (CGFloat)cornerRadius {
85 return 0.0; 85 return 0.0;
86 } 86 }
87 87
88 - (BOOL)shouldDrawBezel {
89 return NO;
90 }
91
88 // Returns the same value as textCursorFrameForFrame, but does not call it 92 // Returns the same value as textCursorFrameForFrame, but does not call it
89 // directly to avoid potential infinite loops. 93 // directly to avoid potential infinite loops.
90 - (NSRect)textFrameForFrame:(NSRect)cellFrame { 94 - (NSRect)textFrameForFrame:(NSRect)cellFrame {
91 return NSInsetRect(cellFrame, 0, [self baselineAdjust]); 95 return NSInsetRect(cellFrame, 0, [self baselineAdjust]);
92 } 96 }
93 97
94 // Returns the same value as textFrameForFrame, but does not call it directly to 98 // Returns the same value as textFrameForFrame, but does not call it directly to
95 // avoid potential infinite loops. 99 // avoid potential infinite loops.
96 - (NSRect)textCursorFrameForFrame:(NSRect)cellFrame { 100 - (NSRect)textCursorFrameForFrame:(NSRect)cellFrame {
97 return NSInsetRect(cellFrame, 0, [self baselineAdjust]); 101 return NSInsetRect(cellFrame, 0, [self baselineAdjust]);
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 // outer border line on the bottom and right. The clipping change 163 // outer border line on the bottom and right. The clipping change
160 // will clip the bottom and right edges (and corner). 164 // will clip the bottom and right edges (and corner).
161 { 165 {
162 ScopedSaveGraphicsState state; 166 ScopedSaveGraphicsState state;
163 [RectPathWithInset(frame, 1.0, radius) addClip]; 167 [RectPathWithInset(frame, 1.0, radius) addClip];
164 const NSRect shadowFrame = NSOffsetRect(frame, 0.5, 0.5); 168 const NSRect shadowFrame = NSOffsetRect(frame, 0.5, 0.5);
165 NSColor* shadowShade = [NSColor colorWithCalibratedWhite:0.0 alpha:0.05]; 169 NSColor* shadowShade = [NSColor colorWithCalibratedWhite:0.0 alpha:0.05];
166 FrameRectWithInset(shadowFrame, 0.5, radius - 0.5, 1.0, shadowShade); 170 FrameRectWithInset(shadowFrame, 0.5, radius - 0.5, 1.0, shadowShade);
167 } 171 }
168 172
173 // Draw optional bezel below bottom stroke.
174 if ([self shouldDrawBezel]) {
175 [[NSColor colorWithCalibratedWhite:0.96 alpha:1.0] set];
176 NSRect bezelRect = NSMakeRect(cellFrame.origin.x,
177 NSMaxY(cellFrame) - 0.5,
178 NSWidth(cellFrame),
179 1.0);
180 bezelRect = NSInsetRect(bezelRect, radius - 0.5, 0.0);
181 NSFrameRect(bezelRect);
182 }
183
169 // Draw the focus ring if needed. 184 // Draw the focus ring if needed.
170 if ([self showsFirstResponder]) { 185 if ([self showsFirstResponder]) {
171 NSColor* color = 186 NSColor* color =
172 [[NSColor keyboardFocusIndicatorColor] colorWithAlphaComponent:0.5]; 187 [[NSColor keyboardFocusIndicatorColor] colorWithAlphaComponent:0.5];
173 FrameRectWithInset(frame, 0.0, radius, 2.0, color); 188 FrameRectWithInset(frame, 0.0, radius, 2.0, color);
174 } 189 }
175 190
176 [self drawInteriorWithFrame:cellFrame inView:controlView]; 191 [self drawInteriorWithFrame:cellFrame inView:controlView];
177 } 192 }
178 193
179 @end 194 @end
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/styled_text_field_cell.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698