Bug 421814 - Use HITheme to draw backgrounds for groupboxes. r=josh+Mano, sr=roc, a1.9=dsicore.
authorstefanh@inbox.com
Thu, 13 Mar 2008 13:24:29 -0700
changeset 13030 cc46a2297db192f72e4d3b97dc84fb732fe8bc91
parent 13029 268ac3c46f0d47c46227ca25262c13c9e57a708a
child 13031 a995c4943527e68caad2aceded1fc954966f2889
push idunknown
push userunknown
push dateunknown
reviewersjosh, roc
bugs421814
milestone1.9b5pre
Bug 421814 - Use HITheme to draw backgrounds for groupboxes. r=josh+Mano, sr=roc, a1.9=dsicore.
browser/themes/pinstripe/browser/preferences/preferences.css
gfx/public/nsThemeConstants.h
layout/style/nsCSSKeywordList.h
layout/style/nsCSSProps.cpp
toolkit/themes/pinstripe/global/groupbox.css
widget/src/cocoa/nsNativeThemeCocoa.mm
--- a/browser/themes/pinstripe/browser/preferences/preferences.css
+++ b/browser/themes/pinstripe/browser/preferences/preferences.css
@@ -204,19 +204,17 @@ description {
 #downloadFolder {
   -moz-appearance: none;
   background-color: transparent;
   border: none;
   padding: 1px 0px 0px 0px;
 }
 
 prefpane .groupbox-body {
-  border: none !important;
-  -moz-border-radius: 0px !important;
-  background-image: none !important;
+  -moz-appearance: none;
   padding: 8px 4px 4px 4px;
 }
 
 #paneTabs > groupbox {
   margin: 0;
 }
 
 #paneTabs > vbox {
--- a/gfx/public/nsThemeConstants.h
+++ b/gfx/public/nsThemeConstants.h
@@ -189,16 +189,19 @@
 // If the platform supports it, the left/right chunks
 // of the slider thumb
 #define NS_THEME_SCALE_THUMB_START                        115
 #define NS_THEME_SCALE_THUMB_END                          116
 
 // The ticks for a slider.
 #define NS_THEME_SCALE_TICK                               117
 
+// A groupbox
+#define NS_THEME_GROUPBOX                                  149
+
 // A generic container that always repaints on state
 // changes.  This is a hack to make checkboxes and
 // radio buttons work.
 #define NS_THEME_CHECKBOX_CONTAINER                        150
 #define NS_THEME_RADIO_CONTAINER                           151
 
 // The label part of a checkbox or radio button, used for painting
 // a focus outline.
--- a/layout/style/nsCSSKeywordList.h
+++ b/layout/style/nsCSSKeywordList.h
@@ -545,16 +545,17 @@ CSS_KEY(menulist-text, menulisttext)
 CSS_KEY(menulist-textfield, menulisttextfield)
 CSS_KEY(scale-horizontal, scale_horizontal)
 CSS_KEY(scale-vertical, scale_vertical)
 CSS_KEY(scalethumb-horizontal, scalethumb_horizontal)
 CSS_KEY(scalethumb-vertical, scalethumb_vertical)
 CSS_KEY(scalethumbstart, scalethumbstart)
 CSS_KEY(scalethumbend, scalethumbend)
 CSS_KEY(scalethumbtick, scalethumbtick)
+CSS_KEY(groupbox, groupbox)
 CSS_KEY(checkbox-container, checkboxcontainer)
 CSS_KEY(radio-container, radiocontainer)
 CSS_KEY(checkbox-label, checkboxlabel)
 CSS_KEY(radio-label, radiolabel)
 CSS_KEY(button-focus, buttonfocus)
 CSS_KEY(media-toolbox, media_toolbox)
 CSS_KEY(communications-toolbox, communications_toolbox)
 CSS_KEY(browsertabbar-toolbox, browsertabbar_toolbox)
--- a/layout/style/nsCSSProps.cpp
+++ b/layout/style/nsCSSProps.cpp
@@ -242,16 +242,17 @@ const PRInt32 nsCSSProps::kAppearanceKTa
   eCSSKeyword_menulisttextfield,      NS_THEME_DROPDOWN_TEXTFIELD,
   eCSSKeyword_scale_horizontal,       NS_THEME_SCALE_HORIZONTAL,
   eCSSKeyword_scale_vertical,         NS_THEME_SCALE_VERTICAL,
   eCSSKeyword_scalethumb_horizontal,  NS_THEME_SCALE_THUMB_HORIZONTAL,
   eCSSKeyword_scalethumb_vertical,    NS_THEME_SCALE_THUMB_VERTICAL,
   eCSSKeyword_scalethumbstart,        NS_THEME_SCALE_THUMB_START,
   eCSSKeyword_scalethumbend,          NS_THEME_SCALE_THUMB_END,
   eCSSKeyword_scalethumbtick,         NS_THEME_SCALE_TICK,
+  eCSSKeyword_groupbox,               NS_THEME_GROUPBOX,
   eCSSKeyword_checkboxcontainer,      NS_THEME_CHECKBOX_CONTAINER,
   eCSSKeyword_radiocontainer,         NS_THEME_RADIO_CONTAINER,
   eCSSKeyword_checkboxlabel,          NS_THEME_CHECKBOX_LABEL,
   eCSSKeyword_radiolabel,             NS_THEME_RADIO_LABEL,
   eCSSKeyword_buttonfocus,            NS_THEME_BUTTON_FOCUS,
   eCSSKeyword_window,                 NS_THEME_WINDOW,
   eCSSKeyword_dialog,                 NS_THEME_DIALOG,
   eCSSKeyword_menubar,                NS_THEME_MENUBAR,
--- a/toolkit/themes/pinstripe/global/groupbox.css
+++ b/toolkit/themes/pinstripe/global/groupbox.css
@@ -42,32 +42,21 @@
 
 @namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
 
 /* ::::: groupbox ::::: */
 
 groupbox {
   padding: 5px 1px 1px 0px;
   margin: 6px;
-
-}
-
-.groupbox-title {
-	/* border-bottom: 1px solid #858585; */
 }
 
 .groupbox-body {
-  padding: 5px 5px 0px 5px;
-  border: 3px solid transparent;
-  -moz-border-top-colors: #9b9b9b #c8c8c8 #e1e1e1 ;
-  -moz-border-right-colors: #c4c4c4 #e1e1e1 #e4e4e4;
-  -moz-border-bottom-colors: #d6d6d6 #e2e2e2 #e4e4e4;
-  -moz-border-left-colors: #c4c4c4 #e1e1e1 #e4e4e4;
-  background: url("chrome://global/skin/10pct_transparent_grey.png") repeat !important;
-  -moz-border-radius: 3px;
+  -moz-appearance: groupbox;
+  padding: 8px 8px 3px 8px;
   margin: 0px;
 
 }
 
 caption {
   padding: 0px 2px 1px 4px !important;
-  font: menu;
-}
\ No newline at end of file
+  font: caption;
+}
--- a/widget/src/cocoa/nsNativeThemeCocoa.mm
+++ b/widget/src/cocoa/nsNativeThemeCocoa.mm
@@ -1033,16 +1033,22 @@ nsNativeThemeCocoa::DrawWidgetBackground
       break;
 
     case NS_THEME_DROPDOWN_BUTTON:
       DrawButton (cgContext, kThemeArrowButton, macRect, PR_FALSE,
                   IsDisabled(aFrame), kThemeButtonOn,
                   kThemeAdornmentArrowDownArrow, eventState);
       break;
 
+    case NS_THEME_GROUPBOX: {
+      HIThemeGroupBoxDrawInfo gdi = { 0, kThemeStateActive, kHIThemeGroupBoxKindPrimary };
+      HIThemeDrawGroupBox(&macRect, &gdi, cgContext, HITHEME_ORIENTATION);
+      break;
+    }
+
     case NS_THEME_TEXTFIELD:
       // HIThemeSetFill is not available on 10.3
       CGContextSetRGBFillColor(cgContext, 1.0, 1.0, 1.0, 1.0);
       CGContextFillRect(cgContext, macRect);
 
       // XUL textboxes set the native appearance on the containing box, while
       // concrete focus is set on the html:input element within it. We can
       // though, check the focused attribute of xul textboxes in this case.
@@ -1623,16 +1629,17 @@ nsNativeThemeCocoa::WidgetStateChanged(n
     case NS_THEME_PROGRESSBAR_CHUNK_VERTICAL:
     case NS_THEME_PROGRESSBAR:
     case NS_THEME_PROGRESSBAR_VERTICAL:
     case NS_THEME_TOOLTIP:
     case NS_THEME_TAB_PANELS:
     case NS_THEME_TAB_PANEL:
     case NS_THEME_DIALOG:
     case NS_THEME_MENUPOPUP:
+    case NS_THEME_GROUPBOX:
       *aShouldRepaint = PR_FALSE;
       return NS_OK;
   }
 
   // XXXdwh Not sure what can really be done here.  Can at least guess for
   // specific widgets that they're highly unlikely to have certain states.
   // For example, a toolbar doesn't care about any states.
   if (!aAttribute) {
@@ -1690,16 +1697,17 @@ nsNativeThemeCocoa::ThemeSupportsWidget(
     case NS_THEME_TOOLTIP:
     
     case NS_THEME_CHECKBOX:
     case NS_THEME_CHECKBOX_SMALL:
     case NS_THEME_CHECKBOX_CONTAINER:
     case NS_THEME_RADIO:
     case NS_THEME_RADIO_SMALL:
     case NS_THEME_RADIO_CONTAINER:
+    case NS_THEME_GROUPBOX:
     case NS_THEME_BUTTON:
     case NS_THEME_BUTTON_BEVEL:
     case NS_THEME_SPINNER:
     case NS_THEME_TOOLBAR:
     case NS_THEME_STATUSBAR:
     case NS_THEME_TEXTFIELD:
     case NS_THEME_TEXTFIELD_MULTILINE:
     //case NS_THEME_TOOLBOX: