OLD | NEW |
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/themed_window.h" | 10 #import "chrome/browser/ui/cocoa/themed_window.h" |
11 #include "grit/theme_resources.h" | 11 #include "grit/theme_resources.h" |
12 #import "ui/base/cocoa/nsgraphics_context_additions.h" | 12 #import "ui/base/cocoa/nsgraphics_context_additions.h" |
13 #import "ui/base/cocoa/nsview_additions.h" | 13 #import "ui/base/cocoa/nsview_additions.h" |
| 14 #include "ui/base/cocoa/scoped_cg_context_smooth_fonts.h" |
14 #include "ui/gfx/font.h" | 15 #include "ui/gfx/font.h" |
15 #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" | 16 #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" |
16 | 17 |
17 @implementation StyledTextFieldCell | 18 @implementation StyledTextFieldCell |
18 | 19 |
19 - (CGFloat)topTextFrameOffset { | 20 - (CGFloat)topTextFrameOffset { |
20 return 0.0; | 21 return 0.0; |
21 } | 22 } |
22 | 23 |
23 - (CGFloat)bottomTextFrameOffset { | 24 - (CGFloat)bottomTextFrameOffset { |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 [[bezelColor colorWithAlphaComponent:0.5 / lineWidth] set]; | 155 [[bezelColor colorWithAlphaComponent:0.5 / lineWidth] set]; |
155 NSRect bezelRect = NSMakeRect(cellFrame.origin.x, | 156 NSRect bezelRect = NSMakeRect(cellFrame.origin.x, |
156 NSMaxY(cellFrame) - lineWidth, | 157 NSMaxY(cellFrame) - lineWidth, |
157 NSWidth(cellFrame), | 158 NSWidth(cellFrame), |
158 lineWidth); | 159 lineWidth); |
159 bezelRect = NSInsetRect(bezelRect, radius - halfLineWidth, 0.0); | 160 bezelRect = NSInsetRect(bezelRect, radius - halfLineWidth, 0.0); |
160 NSRectFillUsingOperation(bezelRect, NSCompositeSourceOver); | 161 NSRectFillUsingOperation(bezelRect, NSCompositeSourceOver); |
161 } | 162 } |
162 | 163 |
163 // Draw the interior before the focus ring, to make sure nothing overlaps it. | 164 // Draw the interior before the focus ring, to make sure nothing overlaps it. |
| 165 ui::ScopedCGContextSmoothFonts fontSmoothing; |
164 [self drawInteriorWithFrame:cellFrame inView:controlView]; | 166 [self drawInteriorWithFrame:cellFrame inView:controlView]; |
165 | 167 |
166 // Draw the focus ring if needed. | 168 // Draw the focus ring if needed. |
167 if ([self showsFirstResponder]) { | 169 if ([self showsFirstResponder]) { |
168 NSColor* color = [[NSColor keyboardFocusIndicatorColor] | 170 NSColor* color = [[NSColor keyboardFocusIndicatorColor] |
169 colorWithAlphaComponent:0.5 / lineWidth]; | 171 colorWithAlphaComponent:0.5 / lineWidth]; |
170 rect_path_utils::FrameRectWithInset(roundedCornerFlags, frame, 0.0, 0.0, | 172 rect_path_utils::FrameRectWithInset(roundedCornerFlags, frame, 0.0, 0.0, |
171 radius, lineWidth * 2, color); | 173 radius, lineWidth * 2, color); |
172 } | 174 } |
173 } | 175 } |
174 | 176 |
175 @end | 177 @end |
OLD | NEW |