Bug 460899 - Change -moz-appearance: toolbar on Mac OS X to draw dark chrome toolbars, r=roc
authorMarkus Stange <mstange@themasta.com>
Thu, 11 Dec 2008 15:48:13 +0100
changeset 22676 f02f7315ca88eb719c0b0b5b87df6ae6c678a309
parent 22675 58f409bbc149cefa514dc21dc7dc2d23586e9852
child 22677 2963a0f2c388f1c467b71a4614e1d193e405ec91
push idunknown
push userunknown
push dateunknown
reviewersroc
bugs460899
milestone1.9.2a1pre
Bug 460899 - Change -moz-appearance: toolbar on Mac OS X to draw dark chrome toolbars, r=roc
widget/src/cocoa/nsNativeThemeCocoa.mm
widget/src/cocoa/nsNativeThemeColors.h
--- a/widget/src/cocoa/nsNativeThemeCocoa.mm
+++ b/widget/src/cocoa/nsNativeThemeCocoa.mm
@@ -1528,17 +1528,36 @@ nsNativeThemeCocoa::DrawWidgetBackground
       HIThemeDrawSeparator(&macRect, &sdi, cgContext, HITHEME_ORIENTATION);
     }
       break;
 
     case NS_THEME_MOZ_MAC_UNIFIED_TOOLBAR:
       DrawUnifiedToolbar(cgContext, macRect, aFrame);
       break;
 
-    case NS_THEME_TOOLBAR:
+    case NS_THEME_TOOLBAR: {
+      BOOL isMain = [NativeWindowForFrame(aFrame) isMainWindow];
+
+      // top border
+      [NativeGreyColorAsNSColor(toolbarTopBorderGrey, isMain) set];
+      NSRectFill(NSMakeRect(macRect.origin.x, macRect.origin.y,
+                            macRect.size.width, 1.0f));
+
+      // background
+      [NativeGreyColorAsNSColor(headerEndGrey, isMain) set];
+      NSRectFill(NSMakeRect(macRect.origin.x, macRect.origin.y + 1.0f,
+                            macRect.size.width, macRect.size.height - 2.0f));
+
+      // bottom border
+      [NativeGreyColorAsNSColor(headerBorderGrey, isMain) set];
+      NSRectFill(NSMakeRect(macRect.origin.x, macRect.origin.y +
+                            macRect.size.height - 1.0f, macRect.size.width, 1.0f));
+    }
+      break;
+
     case NS_THEME_TOOLBOX:
     case NS_THEME_STATUSBAR: {
       HIThemeHeaderDrawInfo hdi = { 0, kThemeStateActive, kHIThemeHeaderKindWindow };
       HIThemeDrawHeader(&macRect, &hdi, cgContext, HITHEME_ORIENTATION);
     }
       break;
       
     case NS_THEME_DROPDOWN:
--- a/widget/src/cocoa/nsNativeThemeColors.h
+++ b/widget/src/cocoa/nsNativeThemeColors.h
@@ -38,25 +38,27 @@
 #ifndef nsNativeThemeColors_h_
 #define nsNativeThemeColors_h_
 
 #import <Cocoa/Cocoa.h>
 
 enum ColorName {
   headerStartGrey,
   headerEndGrey,
-  headerBorderGrey
+  headerBorderGrey,
+  toolbarTopBorderGrey
 };
 
 static const int sLeopardThemeColors[][2] = {
   /* { active window, inactive window } */
   // unified titlebar and toolbar gradient:
   { 0xC5, 0xE9 }, // start grey
   { 0x96, 0xCA }, // end grey
-  { 0x42, 0x89 }  // separator line
+  { 0x42, 0x89 }, // separator line
+  { 0xC0, 0xE2 }  // top separator line of a toolbar
 };
 
 
 static int NativeGreyColorAsInt(ColorName name, BOOL isMain)
 {
   return sLeopardThemeColors[name][isMain ? 0 : 1];
 }