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

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

Issue 3140009: [Mac] Fix aesthetic issues with themes given the new TopChrome changes.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 4 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/gradient_button_cell.mm ('k') | chrome/browser/cocoa/tab_strip_view.mm » ('j') | 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 - (void)drawWithFrame:(NSRect)cellFrame inView:(NSView*)controlView { 122 - (void)drawWithFrame:(NSRect)cellFrame inView:(NSView*)controlView {
123 DCHECK([controlView isFlipped]); 123 DCHECK([controlView isFlipped]);
124 124
125 // TODO(shess): This inset is also reflected by |kFieldVisualInset| 125 // TODO(shess): This inset is also reflected by |kFieldVisualInset|
126 // in autocomplete_popup_view_mac.mm. 126 // in autocomplete_popup_view_mac.mm.
127 const NSRect frame = NSInsetRect(cellFrame, 0, 1); 127 const NSRect frame = NSInsetRect(cellFrame, 0, 1);
128 const CGFloat radius = [self cornerRadius]; 128 const CGFloat radius = [self cornerRadius];
129 129
130 // Paint button background image if there is one (otherwise the border won't 130 // Paint button background image if there is one (otherwise the border won't
131 // look right). 131 // look right).
132 ThemeProvider* themeProvider = [[controlView window] themeProvider]; 132 BrowserThemeProvider* themeProvider =
133 static_cast<BrowserThemeProvider*>([[controlView window] themeProvider]);
133 if (themeProvider) { 134 if (themeProvider) {
134 NSColor* backgroundImageColor = 135 NSColor* backgroundImageColor =
135 themeProvider->GetNSImageColorNamed(IDR_THEME_BUTTON_BACKGROUND, false); 136 themeProvider->GetNSImageColorNamed(IDR_THEME_BUTTON_BACKGROUND, false);
136 if (backgroundImageColor) { 137 if (backgroundImageColor) {
137 // Set the phase to match window. 138 // Set the phase to match window.
138 NSRect trueRect = [controlView convertRect:cellFrame toView:nil]; 139 NSRect trueRect = [controlView convertRect:cellFrame toView:nil];
139 NSPoint midPoint = NSMakePoint(NSMinX(trueRect), NSMaxY(trueRect)); 140 NSPoint midPoint = NSMakePoint(NSMinX(trueRect), NSMaxY(trueRect));
140 [[NSGraphicsContext currentContext] setPatternPhase:midPoint]; 141 [[NSGraphicsContext currentContext] setPatternPhase:midPoint];
141 142
142 // NOTE(shess): This seems like it should be using a 0.0 inset, 143 // NOTE(shess): This seems like it should be using a 0.0 inset,
(...skipping 21 matching lines...) Expand all
164 // will clip the bottom and right edges (and corner). 165 // will clip the bottom and right edges (and corner).
165 { 166 {
166 ScopedSaveGraphicsState state; 167 ScopedSaveGraphicsState state;
167 [RectPathWithInset(frame, 1.0, radius) addClip]; 168 [RectPathWithInset(frame, 1.0, radius) addClip];
168 const NSRect shadowFrame = NSOffsetRect(frame, 0.5, 0.5); 169 const NSRect shadowFrame = NSOffsetRect(frame, 0.5, 0.5);
169 NSColor* shadowShade = [NSColor colorWithCalibratedWhite:0.0 alpha:0.05]; 170 NSColor* shadowShade = [NSColor colorWithCalibratedWhite:0.0 alpha:0.05];
170 FrameRectWithInset(shadowFrame, 0.5, radius - 0.5, 1.0, shadowShade); 171 FrameRectWithInset(shadowFrame, 0.5, radius - 0.5, 1.0, shadowShade);
171 } 172 }
172 173
173 // Draw optional bezel below bottom stroke. 174 // Draw optional bezel below bottom stroke.
174 if ([self shouldDrawBezel]) { 175 if ([self shouldDrawBezel] && themeProvider &&
175 [[NSColor colorWithCalibratedWhite:0.96 alpha:1.0] set]; 176 themeProvider->UsingDefaultTheme()) {
177
178 [themeProvider->GetNSColor(
179 BrowserThemeProvider::COLOR_TOOLBAR_BEZEL, true) set];
176 NSRect bezelRect = NSMakeRect(cellFrame.origin.x, 180 NSRect bezelRect = NSMakeRect(cellFrame.origin.x,
177 NSMaxY(cellFrame) - 0.5, 181 NSMaxY(cellFrame) - 0.5,
178 NSWidth(cellFrame), 182 NSWidth(cellFrame),
179 1.0); 183 1.0);
180 bezelRect = NSInsetRect(bezelRect, radius - 0.5, 0.0); 184 bezelRect = NSInsetRect(bezelRect, radius - 0.5, 0.0);
181 NSRectFill(bezelRect); 185 NSRectFill(bezelRect);
182 } 186 }
183 187
184 // Draw the focus ring if needed. 188 // Draw the focus ring if needed.
185 if ([self showsFirstResponder]) { 189 if ([self showsFirstResponder]) {
186 NSColor* color = 190 NSColor* color =
187 [[NSColor keyboardFocusIndicatorColor] colorWithAlphaComponent:0.5]; 191 [[NSColor keyboardFocusIndicatorColor] colorWithAlphaComponent:0.5];
188 FrameRectWithInset(frame, 0.0, radius, 2.0, color); 192 FrameRectWithInset(frame, 0.0, radius, 2.0, color);
189 } 193 }
190 194
191 [self drawInteriorWithFrame:cellFrame inView:controlView]; 195 [self drawInteriorWithFrame:cellFrame inView:controlView];
192 } 196 }
193 197
194 @end 198 @end
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/gradient_button_cell.mm ('k') | chrome/browser/cocoa/tab_strip_view.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698