Bug 668195 - Use CoreUI to draw window chrome and toolbars. r=josh
authorMarkus Stange <mstange@themasta.com>
Mon, 08 Aug 2011 16:42:20 +0200
changeset 74394 93c6106409528963bf87dcbba66ddceeaafff6b2
parent 74393 820ac76cec76798d483e2701ef970fc874358215
child 74395 e16df4bfc6e7a54faee6857e652d54bbe594e901
push idunknown
push userunknown
push dateunknown
reviewersjosh
bugs668195
milestone8.0a1
Bug 668195 - Use CoreUI to draw window chrome and toolbars. r=josh
toolkit/library/Makefile.in
widget/src/cocoa/Makefile.in
widget/src/cocoa/nsCocoaWindow.h
widget/src/cocoa/nsCocoaWindow.mm
widget/src/cocoa/nsLookAndFeel.mm
widget/src/cocoa/nsNativeThemeCocoa.mm
widget/src/cocoa/nsNativeThemeColors.h
--- a/toolkit/library/Makefile.in
+++ b/toolkit/library/Makefile.in
@@ -147,16 +147,17 @@ DEFINES += -DIMPL_XREAPI
 EXTRA_DSO_LDOPTS += $(NSPR_LIBS) $(MOZALLOC_LIB)
 
 ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
 CXXFLAGS	+= $(TK_CFLAGS)
 OS_LIBS += \
 	-framework SystemConfiguration \
 	-framework QuickTime \
 	-framework IOKit \
+	-F/System/Library/PrivateFrameworks -framework CoreUI \
 	$(TK_LIBS) \
 	$(NULL)
 endif
 
 ifeq ($(OS_ARCH),Darwin)
 ifdef MOZ_SYDNEYAUDIO
 EXTRA_DSO_LDOPTS += \
 	-framework Carbon \
--- a/widget/src/cocoa/Makefile.in
+++ b/widget/src/cocoa/Makefile.in
@@ -138,9 +138,10 @@ export::
 LOCAL_INCLUDES	= \
 	$(TK_CFLAGS) \
 	-I$(srcdir)/../xpwidgets \
 	$(NULL)
 
 LDFLAGS	+= \
 	-framework QuickTime \
 	-framework IOKit \
+	-F/System/Library/PrivateFrameworks -framework CoreUI \
 	$(NULL)
--- a/widget/src/cocoa/nsCocoaWindow.h
+++ b/widget/src/cocoa/nsCocoaWindow.h
@@ -288,18 +288,16 @@ public:
     nsMenuBarX *GetMenuBar();
 
     // nsIKBStateControl interface
     NS_IMETHOD ResetInputState();
     
     NS_IMETHOD BeginSecureKeyboardInput();
     NS_IMETHOD EndSecureKeyboardInput();
 
-    static void UnifiedShading(void* aInfo, const CGFloat* aIn, CGFloat* aOut);
-
     void SetPopupWindowLevel();
 
     PRBool IsChildInFailingLeftClickThrough(NSView *aChild);
     PRBool ShouldFocusPlugin();
 
     NS_IMETHOD         ReparentNativeWidget(nsIWidget* aNewParent);
 protected:
 
--- a/widget/src/cocoa/nsCocoaWindow.mm
+++ b/widget/src/cocoa/nsCocoaWindow.mm
@@ -1644,36 +1644,16 @@ NS_IMETHODIMP nsCocoaWindow::EndSecureKe
   if (NS_SUCCEEDED(rv)) {
     ::DisableSecureEventInput();
   }
   return rv;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
 }
 
-// Callback used by the default titlebar and toolbar shading.
-// *aIn == 0 at the top of the titlebar/toolbar, *aIn == 1 at the bottom
-/* static */ void
-nsCocoaWindow::UnifiedShading(void* aInfo, const CGFloat* aIn, CGFloat* aOut)
-{
-  UnifiedGradientInfo* info = (UnifiedGradientInfo*)aInfo;
-  // The gradient percentage at the bottom of the titlebar / top of the toolbar
-  float start = info->titlebarHeight / (info->titlebarHeight + info->toolbarHeight - 1);
-  const float startGrey = NativeGreyColorAsFloat(headerStartGrey, info->windowIsMain);
-  const float endGrey = NativeGreyColorAsFloat(headerEndGrey, info->windowIsMain);
-  // *aIn is the gradient percentage of the titlebar or toolbar gradient,
-  // a is the gradient percentage of the whole unified gradient.
-  float a = info->drawTitlebar ? *aIn * start : start + *aIn * (1 - start);
-  float result = (1.0f - a) * startGrey + a * endGrey;
-  aOut[0] = result;
-  aOut[1] = result;
-  aOut[2] = result;
-  aOut[3] = 1.0f;
-}
-
 void nsCocoaWindow::SetPopupWindowLevel()
 {
   // Floating popups are at the floating level and hide when the window is
   // deactivated.
   if (mPopupLevel == ePopupLevelFloating) {
     [mWindow setLevel:NSFloatingWindowLevel];
     [mWindow setHidesOnDeactivate:YES];
   }
@@ -2372,103 +2352,89 @@ static const NSString* kStateShowsToolba
 - (id)initWithWindow:(ToolbarWindow*)aWindow
 {
   if ((self = [super init])) {
     mWindow = aWindow; // weak ref to avoid a cycle
   }
   return self;
 }
 
-// Our pattern width is 1 pixel. CoreGraphics can cache and tile for us.
-static const float sPatternWidth = 1.0f;
-
 static void
-DrawTitlebarGradient(CGContextRef aContext, float aTitlebarHeight,
-                     float aTitlebarOrigin, float aToolbarHeight, BOOL aIsMain)
+DrawNativeTitlebar(CGContextRef aContext, CGRect aTitlebarRect,
+                   float aToolbarHeight, BOOL aIsMain)
 {
-  // Create and draw a CGShading that uses nsCocoaWindow::UnifiedShading() as its callback.
-  CGFunctionCallbacks callbacks = {0, nsCocoaWindow::UnifiedShading, NULL};
-  UnifiedGradientInfo info = { aTitlebarHeight, aToolbarHeight, aIsMain, YES };
-  CGFunctionRef function = CGFunctionCreate(&info, 1, NULL, 4, NULL, &callbacks);
-  CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
-  CGShadingRef shading = CGShadingCreateAxial(colorSpace,
-                                              CGPointMake(0.0f, aTitlebarOrigin + aTitlebarHeight),
-                                              CGPointMake(0.0f, aTitlebarOrigin),
-                                              function, NO, NO);
-  CGColorSpaceRelease(colorSpace);
-  CGFunctionRelease(function);
-  CGContextDrawShading(aContext, shading);
-  CGShadingRelease(shading);
-  // Draw the one pixel border at the bottom of the titlebar.
-  if (aToolbarHeight == 0) {
-    CGRect borderRect = CGRectMake(0.0f, aTitlebarOrigin, sPatternWidth, 1.0f);
-    DrawNativeGreyColorInRect(aContext, headerBorderGrey, borderRect, aIsMain);
-  }
+  int unifiedHeight = aTitlebarRect.size.height + aToolbarHeight;
+  CUIDraw([NSWindow coreUIRenderer], aTitlebarRect, aContext,
+          (CFDictionaryRef)[NSDictionary dictionaryWithObjectsAndKeys:
+            @"kCUIWidgetWindowFrame", @"widget",
+            @"regularwin", @"windowtype",
+            (aIsMain ? @"normal" : @"inactive"), @"state",
+            [NSNumber numberWithInt:unifiedHeight], @"kCUIWindowFrameUnifiedTitleBarHeightKey",
+            [NSNumber numberWithBool:YES], @"kCUIWindowFrameDrawTitleSeparatorKey",
+            nil],
+          nil);
+
+  // At some window widths the call to CUIDraw doesn't draw the top pixel strip.
+  // We don't want to have a flickering transparent line, so we overdraw it.
+  CGContextSetRGBFillColor(aContext, 0.95, 0.95, 0.95, 1);
+  CGContextFillRect(aContext, CGRectMake(0, CGRectGetMaxY(aTitlebarRect) - 1,
+                                         aTitlebarRect.size.width, 1));
 }
 
 // Pattern draw callback for standard titlebar gradients and solid titlebar colors
 static void
-RepeatedPatternDrawCallback(void* aInfo, CGContextRef aContext)
+TitlebarDrawCallback(void* aInfo, CGContextRef aContext)
 {
   ToolbarWindow *window = (ToolbarWindow*)aInfo;
 
   // Remember: this context is NOT flipped, so the origin is in the bottom left.
+  float titlebarWidth = [window frame].size.width;
   float titlebarHeight = [window titlebarHeight];
   float titlebarOrigin = [window frame].size.height - titlebarHeight;
+  NSRect titlebarRect = NSMakeRect(0, titlebarOrigin, titlebarWidth, titlebarHeight);
 
   [NSGraphicsContext saveGraphicsState];
   [NSGraphicsContext setCurrentContext:[NSGraphicsContext graphicsContextWithGraphicsPort:aContext flipped:NO]];
 
-  BOOL isMain = [window isMainWindow];
-  NSColor *titlebarColor = [window titlebarColorForActiveWindow:isMain];
-  if (!titlebarColor) {
-    // If the titlebar color is nil, draw the default titlebar shading.
-    DrawTitlebarGradient(aContext, titlebarHeight, titlebarOrigin,
-                         [window unifiedToolbarHeight], isMain);
+  if ([window drawsContentsIntoWindowFrame]) {
+    NSView* view = [[[window contentView] subviews] lastObject];
+    if (!view || ![view isKindOfClass:[ChildView class]])
+      return;
+
+    // Gecko drawing assumes flippedness, but the current context isn't flipped
+    // (because we're painting into the window's border view, which is not a
+    // ChildView, so it isn't flpped).
+    // So we need to set a flip transform.
+    CGContextScaleCTM(aContext, 1.0f, -1.0f);
+    CGContextTranslateCTM(aContext, 0.0f, -[window frame].size.height);
+
+    NSRect flippedTitlebarRect = NSMakeRect(0, 0, titlebarWidth, titlebarHeight);
+    [(ChildView*)view drawRect:flippedTitlebarRect inTitlebarContext:aContext];
   } else {
-    // If the titlebar color is not nil, just set and draw it normally.
-    [titlebarColor set];
-    NSRectFill(NSMakeRect(0.0f, titlebarOrigin, sPatternWidth, titlebarHeight));
+    BOOL isMain = [window isMainWindow];
+    NSColor *titlebarColor = [window titlebarColorForActiveWindow:isMain];
+    if (!titlebarColor) {
+      // If the titlebar color is nil, draw the default titlebar shading.
+      DrawNativeTitlebar(aContext, NSRectToCGRect(titlebarRect),
+                         [window unifiedToolbarHeight], isMain);
+    } else {
+      // If the titlebar color is not nil, just set and draw it normally.
+      [titlebarColor set];
+      NSRectFill(titlebarRect);
+    }
   }
 
-  // Draw the background color of the window everywhere but where the titlebar is.
-  [[window windowBackgroundColor] set];
-  NSRectFill(NSMakeRect(0.0f, 0.0f, 1.0f, titlebarOrigin));
-
   [NSGraphicsContext restoreGraphicsState];
 }
 
-// Pattern draw callback for "drawsContentsIntoWindowFrame" windows
-static void
-ContentPatternDrawCallback(void* aInfo, CGContextRef aContext)
-{
-  ToolbarWindow *window = (ToolbarWindow*)aInfo;
-
-  NSView* view = [[[window contentView] subviews] lastObject];
-  if (!view || ![view isKindOfClass:[ChildView class]])
-    return;
-
-  // Gecko drawing assumes flippedness, but the current context isn't flipped
-  // (because we're painting into the window's border view, which is not a
-  // ChildView, so it isn't flpped).
-  // So we need to set a flip transform.
-  CGContextScaleCTM(aContext, 1.0f, -1.0f);
-  CGContextTranslateCTM(aContext, 0.0f, -[window frame].size.height);
-
-  NSRect titlebarRect = NSMakeRect(0, 0, [window frame].size.width, [window titlebarHeight]);
-  [(ChildView*)view drawRect:titlebarRect inTitlebarContext:aContext];
-}
-
 - (void)setFill
 {
-  CGPatternDrawPatternCallback cb = [mWindow drawsContentsIntoWindowFrame] ?
-                                      &ContentPatternDrawCallback : &RepeatedPatternDrawCallback;
-  float patternWidth = [mWindow drawsContentsIntoWindowFrame] ? [mWindow frame].size.width : sPatternWidth;
-
-  CGPatternCallbacks callbacks = {0, cb, NULL};
+  float patternWidth = [mWindow frame].size.width;
+
+  CGPatternCallbacks callbacks = {0, &TitlebarDrawCallback, NULL};
   CGPatternRef pattern = CGPatternCreate(mWindow, CGRectMake(0.0f, 0.0f, patternWidth, [mWindow frame].size.height), 
                                          CGAffineTransformIdentity, patternWidth, [mWindow frame].size.height,
                                          kCGPatternTilingConstantSpacing, true, &callbacks);
 
   // Set the pattern as the fill, which is what we were asked to do. All our
   // drawing will take place in the patternDraw callback.
   CGColorSpaceRef patternSpace = CGColorSpaceCreatePattern(NULL);
   CGContextRef context = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
--- a/widget/src/cocoa/nsLookAndFeel.mm
+++ b/widget/src/cocoa/nsLookAndFeel.mm
@@ -242,17 +242,17 @@ nsresult nsLookAndFeel::NativeGetColor(c
     case eColor__moz_html_cellhighlighttext:
       aColor = GetColorFromNSColor([NSColor controlTextColor]);
       break;
     case eColor__moz_dragtargetzone:
       aColor = GetColorFromNSColor([NSColor selectedControlColor]);
       break;
     case eColor__moz_mac_chrome_active:
     case eColor__moz_mac_chrome_inactive: {
-      int grey = NativeGreyColorAsInt(headerEndGrey, (aID == eColor__moz_mac_chrome_active));
+      int grey = NativeGreyColorAsInt(toolbarFillGrey, (aID == eColor__moz_mac_chrome_active));
       aColor = NS_RGB(grey, grey, grey);
     }
       break;
     case eColor__moz_mac_focusring:
       aColor = GetColorFromNSColor([NSColor keyboardFocusIndicatorColor]);
       break;
     case eColor__moz_mac_menushadow:
       aColor = NS_RGB(0xA3,0xA3,0xA3);
--- a/widget/src/cocoa/nsNativeThemeCocoa.mm
+++ b/widget/src/cocoa/nsNativeThemeCocoa.mm
@@ -1591,106 +1591,73 @@ ToolbarCanBeUnified(CGContextRef cgConte
 
 void
 nsNativeThemeCocoa::DrawUnifiedToolbar(CGContextRef cgContext, const HIRect& inBoxRect,
                                        NSWindow* aWindow)
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
 
   float titlebarHeight = [(ToolbarWindow*)aWindow titlebarHeight];
+  float unifiedHeight = titlebarHeight + inBoxRect.size.height;
 
   BOOL isMain = [aWindow isMainWindow] || ![NSView focusView];
 
-  // Draw the gradient
-  UnifiedGradientInfo info = { titlebarHeight, inBoxRect.size.height, isMain, NO };
-  struct CGFunctionCallbacks callbacks = { 0, nsCocoaWindow::UnifiedShading, NULL };
-  CGFunctionRef function = CGFunctionCreate(&info, 1,  NULL, 4, NULL, &callbacks);
-  float srcY = inBoxRect.origin.y;
-  float dstY = srcY + inBoxRect.size.height - 1;
-  CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
-  CGShadingRef shading = CGShadingCreateAxial(colorSpace,
-                                              CGPointMake(0, srcY),
-                                              CGPointMake(0, dstY), function,
-                                              NO, NO);
-  CGColorSpaceRelease(colorSpace);
-  CGFunctionRelease(function);
+  CGContextSaveGState(cgContext);
   CGContextClipToRect(cgContext, inBoxRect);
-  CGContextDrawShading(cgContext, shading);
-  CGShadingRelease(shading);
-
-  // Draw the border at the bottom of the toolbar.
-  CGRect borderRect = CGRectMake(inBoxRect.origin.x, inBoxRect.origin.y +
-                                 inBoxRect.size.height - 1.0f,
-                                 inBoxRect.size.width, 1.0f);
-  DrawNativeGreyColorInRect(cgContext, headerBorderGrey, borderRect, isMain);
+
+  CGRect drawRect = CGRectOffset(inBoxRect, 0, -titlebarHeight);
+  CUIDraw([NSWindow coreUIRenderer], drawRect, cgContext,
+          (CFDictionaryRef)[NSDictionary dictionaryWithObjectsAndKeys:
+            @"kCUIWidgetWindowFrame", @"widget",
+            @"regularwin", @"windowtype",
+            (isMain ? @"normal" : @"inactive"), @"state",
+            [NSNumber numberWithInt:unifiedHeight], @"kCUIWindowFrameUnifiedTitleBarHeightKey",
+            [NSNumber numberWithBool:YES], @"kCUIWindowFrameDrawTitleSeparatorKey",
+            [NSNumber numberWithBool:YES], @"is.flipped",
+            nil],
+          nil);
+
+  CGContextRestoreGState(cgContext);
 
   NS_OBJC_END_TRY_ABORT_BLOCK;
 }
 
-struct GreyGradientInfo {
-  float startGrey;
-  float endGrey;
-};
-
-static void GreyGradientCallback(void* aInfo, const CGFloat* aIn, CGFloat* aOut)
-{
-  GreyGradientInfo* info = static_cast<GreyGradientInfo*>(aInfo);
-  CGFloat result = (1.0f - *aIn) * info->startGrey + *aIn * info->endGrey;
-  aOut[0] = result;
-  aOut[1] = result;
-  aOut[2] = result;
-  aOut[3] = 1.0f;
-}
-
-static void DrawGreyGradient(CGContextRef cgContext, const HIRect& rect,
-                             float startGrey, float endGrey)
-{
-  if (rect.size.height <= 0.0f)
-    return;
-
-  GreyGradientInfo info = { startGrey, endGrey };
-  struct CGFunctionCallbacks callbacks = { 0, GreyGradientCallback, NULL };
-  CGFunctionRef function = CGFunctionCreate(&info, 1,  NULL, 4, NULL, &callbacks);
-  CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
-  CGShadingRef shading = CGShadingCreateAxial(colorSpace,
-                                              CGPointMake(0, CGRectGetMinY(rect)),
-                                              CGPointMake(0, CGRectGetMaxY(rect)),
-                                              function, false, false);
-  CGColorSpaceRelease(colorSpace);
-  CGFunctionRelease(function);
-  CGContextSaveGState(cgContext);
-  CGContextClipToRect(cgContext, rect);
-  CGContextDrawShading(cgContext, shading);
-  CGContextRestoreGState(cgContext);
-  CGShadingRelease(shading);
-}
-
 void
 nsNativeThemeCocoa::DrawStatusBar(CGContextRef cgContext, const HIRect& inBoxRect,
                                   nsIFrame *aFrame)
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
 
   if (inBoxRect.size.height < 2.0f)
     return;
 
   BOOL isMain = [NativeWindowForFrame(aFrame) isMainWindow] || ![NSView focusView];
 
-  // Draw the borders at the top of the statusbar.
-  CGRect rect = CGRectMake(inBoxRect.origin.x, inBoxRect.origin.y,
-                           inBoxRect.size.width, 1.0f);
-  DrawNativeGreyColorInRect(cgContext, statusbarFirstTopBorderGrey, rect, isMain);
-  rect.origin.y += 1.0f;
-  DrawNativeGreyColorInRect(cgContext, statusbarSecondTopBorderGrey, rect, isMain);
-
-  // Draw the gradient.
-  DrawGreyGradient(cgContext, CGRectMake(inBoxRect.origin.x, inBoxRect.origin.y + 2.0f,
-                                         inBoxRect.size.width, inBoxRect.size.height - 2.0f),
-                   NativeGreyColorAsFloat(statusbarGradientStartGrey, isMain),
-                   NativeGreyColorAsFloat(statusbarGradientEndGrey, isMain));
+  CGContextSaveGState(cgContext);
+  CGContextClipToRect(cgContext, inBoxRect);
+
+  // kCUIWidgetWindowFrame draws a complete window frame with both title bar
+  // and bottom bar. We only want the bottom bar, so we extend the draw rect
+  // upwards to make space for the title bar, and then we clip it away.
+  CGRect drawRect = inBoxRect;
+  const int extendUpwards = 40;
+  drawRect.origin.y -= extendUpwards;
+  drawRect.size.height += extendUpwards;
+  CUIDraw([NSWindow coreUIRenderer], drawRect, cgContext,
+          (CFDictionaryRef)[NSDictionary dictionaryWithObjectsAndKeys:
+            @"kCUIWidgetWindowFrame", @"widget",
+            @"regularwin", @"windowtype",
+            (isMain ? @"normal" : @"inactive"), @"state",
+            [NSNumber numberWithInt:inBoxRect.size.height], @"kCUIWindowFrameBottomBarHeightKey",
+            [NSNumber numberWithBool:YES], @"kCUIWindowFrameDrawBottomBarSeparatorKey",
+            [NSNumber numberWithBool:YES], @"is.flipped",
+            nil],
+          nil);
+
+  CGContextRestoreGState(cgContext);
 
   NS_OBJC_END_TRY_ABORT_BLOCK;
 }
 
 static void
 RenderResizer(CGContextRef cgContext, const HIRect& aRenderRect, void* aData)
 {
   HIThemeGrowBoxDrawInfo* drawInfo = (HIThemeGrowBoxDrawInfo*)aData;
@@ -1916,22 +1883,22 @@ nsNativeThemeCocoa::DrawWidgetBackground
 
       // top border
       drawRect.size.height = 1.0f;
       DrawNativeGreyColorInRect(cgContext, toolbarTopBorderGrey, drawRect, isMain);
 
       // background
       drawRect.origin.y += drawRect.size.height;
       drawRect.size.height = macRect.size.height - 2.0f;
-      DrawNativeGreyColorInRect(cgContext, headerEndGrey, drawRect, isMain);
+      DrawNativeGreyColorInRect(cgContext, toolbarFillGrey, drawRect, isMain);
 
       // bottom border
       drawRect.origin.y += drawRect.size.height;
       drawRect.size.height = 1.0f;
-      DrawNativeGreyColorInRect(cgContext, headerBorderGrey, drawRect, isMain);
+      DrawNativeGreyColorInRect(cgContext, toolbarBottomBorderGrey, drawRect, isMain);
     }
       break;
 
     case NS_THEME_TOOLBOX: {
       HIThemeHeaderDrawInfo hdi = { 0, kThemeStateActive, kHIThemeHeaderKindWindow };
       HIThemeDrawHeader(&macRect, &hdi, cgContext, HITHEME_ORIENTATION);
     }
       break;
--- a/widget/src/cocoa/nsNativeThemeColors.h
+++ b/widget/src/cocoa/nsNativeThemeColors.h
@@ -36,53 +36,45 @@
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef nsNativeThemeColors_h_
 #define nsNativeThemeColors_h_
 
 #include "nsToolkit.h"
 #import <Cocoa/Cocoa.h>
 
+extern "C" {
+  typedef CFTypeRef CUIRendererRef;
+  void CUIDraw(CUIRendererRef r, CGRect rect, CGContextRef ctx, CFDictionaryRef options, CFDictionaryRef* result);
+}
+
+@interface NSWindow(CoreUIRendererPrivate)
++ (CUIRendererRef)coreUIRenderer;
+@end
+
 enum ColorName {
-  headerStartGrey,
-  headerEndGrey,
-  headerBorderGrey,
   toolbarTopBorderGrey,
-  statusbarFirstTopBorderGrey,
-  statusbarSecondTopBorderGrey,
-  statusbarGradientStartGrey,
-  statusbarGradientEndGrey
+  toolbarFillGrey,
+  toolbarBottomBorderGrey,
 };
 
 static const int sLeopardThemeColors[][2] = {
   /* { active window, inactive window } */
-  // titlebar and toolbar:
-  { 0xC5, 0xE9 }, // start grey
-  { 0x96, 0xCA }, // end grey
-  { 0x42, 0x89 }, // bottom separator line
+  // toolbar:
   { 0xC0, 0xE2 }, // top separator line
-  // statusbar:
-  { 0x42, 0x86 }, // first top border
-  { 0xD8, 0xEE }, // second top border
-  { 0xBD, 0xE4 }, // gradient start
-  { 0x96, 0xCF }  // gradient end
+  { 0x96, 0xCA }, // fill color
+  { 0x42, 0x89 }, // bottom separator line
 };
 
 static const int sSnowLeopardThemeColors[][2] = {
   /* { active window, inactive window } */
-  // titlebar and toolbar:
-  { 0xD1, 0xEE }, // start grey
-  { 0xA7, 0xD8 }, // end grey
-  { 0x51, 0x99 }, // bottom separator line
+  // toolbar:
   { 0xD0, 0xF1 }, // top separator line
-  // statusbar:
-  { 0x51, 0x99 }, // first top border
-  { 0xE8, 0xF6 }, // second top border
-  { 0xCB, 0xEA }, // gradient start
-  { 0xA7, 0xDE }  // gradient end
+  { 0xA7, 0xD8 }, // fill color
+  { 0x51, 0x99 }, // bottom separator line
 };
 
 __attribute__((unused))
 static int NativeGreyColorAsInt(ColorName name, BOOL isMain)
 {
   if (nsToolkit::OnSnowLeopardOrLater())
     return sSnowLeopardThemeColors[name][isMain ? 0 : 1];