| Index: chrome/browser/cocoa/styled_text_field_cell.mm
|
| diff --git a/chrome/browser/cocoa/styled_text_field_cell.mm b/chrome/browser/cocoa/styled_text_field_cell.mm
|
| index 79b1adf3c4cab665a47f0515e730e03ba21787e1..60418d960e5ce30fab11b27f9318cf2cf55dc989 100644
|
| --- a/chrome/browser/cocoa/styled_text_field_cell.mm
|
| +++ b/chrome/browser/cocoa/styled_text_field_cell.mm
|
| @@ -47,30 +47,46 @@
|
| // incorrect. I know that this affects -drawingRectForBounds:.
|
| - (void)drawWithFrame:(NSRect)cellFrame inView:(NSView*)controlView {
|
| DCHECK([controlView isFlipped]);
|
| - [[NSColor colorWithCalibratedWhite:1.0 alpha:0.25] set];
|
| - NSFrameRectWithWidthUsingOperation(cellFrame, 1, NSCompositeSourceOver);
|
|
|
| // TODO(shess): This inset is also reflected in ToolbarController
|
| // -autocompletePopupPosition.
|
| NSRect frame = NSInsetRect(cellFrame, 0, 1);
|
| - [[self backgroundColor] setFill];
|
| + NSRect midFrame = NSInsetRect(frame, 0.5, 0.5);
|
| NSRect innerFrame = NSInsetRect(frame, 1, 1);
|
| - NSRectFill(innerFrame);
|
|
|
| - NSRect shadowFrame, restFrame;
|
| - NSDivideRect(innerFrame, &shadowFrame, &restFrame, 1, NSMinYEdge);
|
| + // Paint button background image if there is one (otherwise the border won't
|
| + // look right).
|
| + GTMTheme* theme = [controlView gtm_theme];
|
| + NSImage* backgroundImage =
|
| + [theme backgroundImageForStyle:GTMThemeStyleToolBarButton state:YES];
|
| + if (backgroundImage) {
|
| + NSColor* patternColor = [NSColor colorWithPatternImage:backgroundImage];
|
| + [patternColor set];
|
| + // Set the phase to match window.
|
| + NSRect trueRect = [controlView convertRectToBase:cellFrame];
|
| + [[NSGraphicsContext currentContext]
|
| + setPatternPhase:NSMakePoint(NSMinX(trueRect), NSMaxY(trueRect))];
|
| + NSRectFillUsingOperation(midFrame, NSCompositeCopy);
|
| + }
|
| +
|
| + // Draw the outer stroke (over the background).
|
| + BOOL active = [[controlView window] isMainWindow];
|
| + [[theme strokeColorForStyle:GTMThemeStyleToolBarButton state:active] set];
|
| + NSFrameRectWithWidthUsingOperation(frame, 1, NSCompositeSourceOver);
|
|
|
| - BOOL isMainWindow = [[controlView window] isMainWindow];
|
| - GTMTheme *theme = [controlView gtm_theme];
|
| - NSColor* stroke = [theme strokeColorForStyle:GTMThemeStyleToolBarButton
|
| - state:isMainWindow];
|
| - [stroke set];
|
| - NSFrameRectWithWidthUsingOperation(frame, 1.0, NSCompositeSourceOver);
|
| + // Draw the background for the interior.
|
| + [[self backgroundColor] setFill];
|
| + NSRectFill(innerFrame);
|
|
|
| // Draw the shadow.
|
| + NSRect topShadowFrame, leftShadowFrame, restFrame;
|
| + NSDivideRect(innerFrame, &topShadowFrame, &restFrame, 1, NSMinYEdge);
|
| + NSDivideRect(restFrame, &leftShadowFrame, &restFrame, 1, NSMinXEdge);
|
| [[NSColor colorWithCalibratedWhite:0.0 alpha:0.05] setFill];
|
| - NSRectFillUsingOperation(shadowFrame, NSCompositeSourceOver);
|
| + NSRectFillUsingOperation(topShadowFrame, NSCompositeSourceOver);
|
| + NSRectFillUsingOperation(leftShadowFrame, NSCompositeSourceOver);
|
|
|
| + // Draw the focus ring if needed.
|
| if ([self showsFirstResponder]) {
|
| [[[NSColor keyboardFocusIndicatorColor] colorWithAlphaComponent:0.5] set];
|
| NSFrameRectWithWidthUsingOperation(NSInsetRect(frame, 0, 0), 2,
|
|
|