Bug 404825 - "Bookmark folders in Personal Toolbar" [p=ventnor.bugzilla@yahoo.com.au (Michael Ventnor) r+sr=roc a1.9=schrep]
authorreed@reedloden.com
Thu, 17 Jan 2008 02:24:31 -0800
changeset 10361 97db2a0c7364c32d90904082bfb45e2c0111d0be
parent 10360 394900e3f5d81dc12bcba95d2e69c71b321fc1cd
child 10362 52edd0d6bdb02bbf6556cf726366ac349ad220ba
push idunknown
push userunknown
push dateunknown
bugs404825
milestone1.9b3pre
Bug 404825 - "Bookmark folders in Personal Toolbar" [p=ventnor.bugzilla@yahoo.com.au (Michael Ventnor) r+sr=roc a1.9=schrep]
browser/themes/gnomestripe/browser/browser.css
gfx/public/nsThemeConstants.h
layout/style/nsCSSKeywordList.h
layout/style/nsCSSProps.cpp
toolkit/themes/gnomestripe/global/toolbarbutton.css
widget/src/gtk2/gtk2drawing.c
widget/src/gtk2/gtkdrawing.h
widget/src/gtk2/nsNativeThemeGTK.cpp
--- a/browser/themes/gnomestripe/browser/browser.css
+++ b/browser/themes/gnomestripe/browser/browser.css
@@ -109,16 +109,25 @@ toolbarbutton.bookmark-item[open="true"]
 .bookmark-item > .toolbarbutton-text {
   display: -moz-box !important;
 }
 
 .bookmark-item > .toolbarbutton-menu-dropmarker {
   display: none;
 }
 
+/* Hide icons for the container ("folder") items and use a dropmarker instead */
+.bookmark-item[container] > .toolbarbutton-menu-dropmarker {
+  display: -moz-box !important;
+}
+
+.bookmark-item[container] > .toolbarbutton-icon {
+  display: none !important;
+}
+
 .bookmarks-toolbar-customize {
   display: none;
   max-width: 15em !important;
 }
 
 toolbarpaletteitem[place="toolbar"] .bookmarks-toolbar-customize {
   display: -moz-box;
 }
--- a/gfx/public/nsThemeConstants.h
+++ b/gfx/public/nsThemeConstants.h
@@ -27,18 +27,18 @@
 #define NS_THEME_TOOLBAR                                   12
 
 // A single toolbar button (with no associated dropdown)
 #define NS_THEME_TOOLBAR_BUTTON                            13
 
 // A dual toolbar button (e.g., a Back button with a dropdown)
 #define NS_THEME_TOOLBAR_DUAL_BUTTON                       14
 
-// The dropdown portion of a dual toolbar button
-#define NS_THEME_TOOLBAR_DUAL_BUTTON_DROPDOWN              15
+// The dropdown portion of a toolbar button
+#define NS_THEME_TOOLBAR_BUTTON_DROPDOWN                   15
 
 // A separator.  Can be horizontal or vertical.
 #define NS_THEME_TOOLBAR_SEPARATOR                         16
 
 // The gripper for a toolbar.
 #define NS_THEME_TOOLBAR_GRIPPER                           17
 
 // A splitter.  Can be horizontal or vertical.
--- a/layout/style/nsCSSKeywordList.h
+++ b/layout/style/nsCSSKeywordList.h
@@ -472,17 +472,17 @@ CSS_KEY(checkbox, checkbox)
 CSS_KEY(radio-small, radio_small)
 CSS_KEY(checkbox-small, checkbox_small)
 CSS_KEY(button-bevel, button_bevel)
 CSS_KEY(toolbox, toolbox)
 CSS_KEY(toolbar, toolbar)
 CSS_KEY(toolbarbutton, toolbarbutton)
 CSS_KEY(toolbargripper, toolbargripper)
 CSS_KEY(dualbutton, dualbutton)
-CSS_KEY(dualbutton-dropdown, dualbutton_dropdown)
+CSS_KEY(toolbarbutton-dropdown, toolbarbutton_dropdown)
 CSS_KEY(separator, separator)
 CSS_KEY(splitter, splitter)
 CSS_KEY(statusbar, statusbar)
 CSS_KEY(statusbarpanel, statusbarpanel)
 CSS_KEY(resizerpanel, resizerpanel)
 CSS_KEY(resizer, resizer)
 CSS_KEY(listbox, listbox)
 CSS_KEY(listitem, listitem)
--- a/layout/style/nsCSSProps.cpp
+++ b/layout/style/nsCSSProps.cpp
@@ -183,17 +183,17 @@ const PRInt32 nsCSSProps::kAppearanceKTa
   eCSSKeyword_radio_small,            NS_THEME_RADIO_SMALL,
   eCSSKeyword_checkbox_small,         NS_THEME_CHECKBOX_SMALL,
   eCSSKeyword_button_bevel,           NS_THEME_BUTTON_BEVEL,
   eCSSKeyword_toolbox,                NS_THEME_TOOLBOX,
   eCSSKeyword_toolbar,                NS_THEME_TOOLBAR,
   eCSSKeyword_toolbarbutton,          NS_THEME_TOOLBAR_BUTTON,
   eCSSKeyword_toolbargripper,         NS_THEME_TOOLBAR_GRIPPER,
   eCSSKeyword_dualbutton,             NS_THEME_TOOLBAR_DUAL_BUTTON,
-  eCSSKeyword_dualbutton_dropdown,    NS_THEME_TOOLBAR_DUAL_BUTTON_DROPDOWN,
+  eCSSKeyword_toolbarbutton_dropdown, NS_THEME_TOOLBAR_BUTTON_DROPDOWN,
   eCSSKeyword_separator,              NS_THEME_TOOLBAR_SEPARATOR,
   eCSSKeyword_splitter,               NS_THEME_SPLITTER,
   eCSSKeyword_statusbar,              NS_THEME_STATUSBAR,
   eCSSKeyword_statusbarpanel,         NS_THEME_STATUSBAR_PANEL,
   eCSSKeyword_resizerpanel,           NS_THEME_STATUSBAR_RESIZER_PANEL,
   eCSSKeyword_resizer,                NS_THEME_RESIZER,
   eCSSKeyword_listbox,                NS_THEME_LISTBOX,
   eCSSKeyword_listitem,               NS_THEME_LISTBOX_LISTITEM,
--- a/toolkit/themes/gnomestripe/global/toolbarbutton.css
+++ b/toolkit/themes/gnomestripe/global/toolbarbutton.css
@@ -118,21 +118,24 @@ toolbarbutton[checked="true"]:hover,
 toolbarbutton[checked="true"]:hover:active { 
   color: -moz-buttonhovertext !important;
   background-color: -moz-buttonhoverface !important;
 }
 
 /* ::::: toolbarbutton menu ::::: */
 
 .toolbarbutton-menu-dropmarker {
-  -moz-appearance: none !important;
+  -moz-appearance: toolbarbutton-dropdown !important;
+  list-style-image: none;
+  width: 13px;
+  height: 13px;
   border: none !important;
   background-color: transparent !important;
   padding: 0;
-  width: auto;
+  margin: 2px;
 }
 
 .toolbarbutton-menu-dropmarker[disabled="true"] {
   padding: 0 !important;
 }
 
 /* ::::: toolbarbutton menu-button ::::: */
 
@@ -160,16 +163,18 @@ toolbarbutton[type="menu-button"][disabl
 }
 
 /* .......... dropmarker .......... */
 
 .toolbarbutton-menubutton-dropmarker {
   border: none !important;
   background-color: transparent !important;
   padding: 3px;
-  width: auto;
-  -moz-appearance: dualbutton-dropdown !important;
+  -moz-appearance: toolbarbutton-dropdown !important;
+  list-style-image: none;
+  width: 12px;
+  height: 12px;
 }
 
 .toolbarbutton-menubutton-dropmarker[disabled="true"] {
   padding: 3px !important;
 }
 
--- a/widget/src/gtk2/gtk2drawing.c
+++ b/widget/src/gtk2/gtk2drawing.c
@@ -1426,16 +1426,41 @@ moz_gtk_option_menu_paint(GdkDrawable* d
       gtk_paint_focus (style, drawable, state_type, cliprect, gOptionMenuWidget,
                        "button", x, y,  width, height);
     }
     
     return MOZ_GTK_SUCCESS;
 }
 
 static gint
+moz_gtk_downarrow_paint(GdkDrawable* drawable, GdkRectangle* rect,
+                        GdkRectangle* cliprect, GtkWidgetState* state)
+{
+    GtkStyle* style;
+    GtkStateType state_type = ConvertGtkState(state);
+    GtkShadowType shadow_type = state->active ? GTK_SHADOW_IN : GTK_SHADOW_OUT;
+    GdkRectangle arrow_rect;
+
+    ensure_arrow_widget();
+    style = gArrowWidget->style;
+
+    arrow_rect.x = rect->x + 1 + XTHICKNESS(style);
+    arrow_rect.y = rect->y + 1 + YTHICKNESS(style);
+    arrow_rect.width = MAX(1, rect->width - (arrow_rect.x - rect->x) * 2);
+    arrow_rect.height = MAX(1, rect->height - (arrow_rect.y - rect->y) * 2);
+
+    TSOffsetStyleGCs(style, arrow_rect.x, arrow_rect.y);
+    gtk_paint_arrow(style, drawable, state_type, shadow_type, cliprect,
+                    gArrowWidget, "arrow",  GTK_ARROW_DOWN, TRUE,
+                    arrow_rect.x, arrow_rect.y, arrow_rect.width, arrow_rect.height);
+
+    return MOZ_GTK_SUCCESS;
+}
+
+static gint
 moz_gtk_dropdown_arrow_paint(GdkDrawable* drawable, GdkRectangle* rect,
                              GdkRectangle* cliprect, GtkWidgetState* state,
                              GtkTextDirection direction)
 {
     static gfloat arrow_scaling = 0.7;
     gint real_arrow_padding;
     GdkRectangle arrow_rect, real_arrow_rect;
     GtkStateType state_type = ConvertGtkState(state);
@@ -2379,16 +2404,17 @@ moz_gtk_get_widget_border(GtkThemeWidget
     case MOZ_GTK_TOOLBAR_SEPARATOR:
     case MOZ_GTK_MENUSEPARATOR:
     /* These widgets have no borders.*/
     case MOZ_GTK_SPINBUTTON:
     case MOZ_GTK_TOOLTIP:
     case MOZ_GTK_WINDOW:
     case MOZ_GTK_RESIZER:
     case MOZ_GTK_MENUARROW:
+    case MOZ_GTK_TOOLBARBUTTON_ARROW:
         *left = *top = *right = *bottom = 0;
         return MOZ_GTK_SUCCESS;
     default:
         g_warning("Unsupported widget type: %d", widget);
         return MOZ_GTK_UNKNOWN_WIDGET;
     }
 
     *right = *left = XTHICKNESS(w->style);
@@ -2683,16 +2709,19 @@ moz_gtk_widget_paint(GtkThemeWidgetType 
     case MOZ_GTK_MENUITEM:
         return moz_gtk_menu_item_paint(drawable, rect, cliprect, state, flags,
                                        direction);
         break;
     case MOZ_GTK_MENUARROW:
         return moz_gtk_menu_arrow_paint(drawable, rect, cliprect, state,
                                         direction);
         break;
+    case MOZ_GTK_TOOLBARBUTTON_ARROW:
+        return moz_gtk_downarrow_paint(drawable, rect, cliprect, state);
+        break;
     case MOZ_GTK_CHECKMENUITEM:
     case MOZ_GTK_RADIOMENUITEM:
         return moz_gtk_check_menu_item_paint(drawable, rect, cliprect, state,
                                              (gboolean) flags,
                                              (widget == MOZ_GTK_RADIOMENUITEM),
                                              direction);
         break;
     case MOZ_GTK_SPLITTER_HORIZONTAL:
--- a/widget/src/gtk2/gtkdrawing.h
+++ b/widget/src/gtk2/gtkdrawing.h
@@ -187,16 +187,18 @@ typedef enum {
   /* Paints a GtkExpander */
   MOZ_GTK_EXPANDER,
   /* Paints the background of the menu bar. */
   MOZ_GTK_MENUBAR,
   /* Paints the background of menus, context menus. */
   MOZ_GTK_MENUPOPUP,
   /* Paints the arrow of menuitems that contain submenus */
   MOZ_GTK_MENUARROW,
+  /* Paints an arrow that points down */
+  MOZ_GTK_TOOLBARBUTTON_ARROW,
   /* Paints items of menubar and popups. */
   MOZ_GTK_MENUITEM,
   MOZ_GTK_CHECKMENUITEM,
   MOZ_GTK_RADIOMENUITEM,
   MOZ_GTK_MENUSEPARATOR,
   /* Paints a GtkVPaned separator */
   MOZ_GTK_SPLITTER_HORIZONTAL,
   /* Paints a GtkHPaned separator */
--- a/widget/src/gtk2/nsNativeThemeGTK.cpp
+++ b/widget/src/gtk2/nsNativeThemeGTK.cpp
@@ -461,16 +461,19 @@ nsNativeThemeGTK::GetGtkWidgetAndState(P
   case NS_THEME_DROPDOWN_TEXT:
     return PR_FALSE; // nothing to do, but prevents the bg from being drawn
   case NS_THEME_DROPDOWN_TEXTFIELD:
     aGtkWidgetType = MOZ_GTK_DROPDOWN_ENTRY;
     break;
   case NS_THEME_DROPDOWN_BUTTON:
     aGtkWidgetType = MOZ_GTK_DROPDOWN_ARROW;
     break;
+  case NS_THEME_TOOLBAR_BUTTON_DROPDOWN:
+    aGtkWidgetType = MOZ_GTK_TOOLBARBUTTON_ARROW;
+    break;
   case NS_THEME_CHECKBOX_CONTAINER:
     aGtkWidgetType = MOZ_GTK_CHECKBUTTON_CONTAINER;
     break;
   case NS_THEME_RADIO_CONTAINER:
     aGtkWidgetType = MOZ_GTK_RADIOBUTTON_CONTAINER;
     break;
   case NS_THEME_CHECKBOX_LABEL:
     aGtkWidgetType = MOZ_GTK_CHECKBUTTON_LABEL;
@@ -1161,17 +1164,17 @@ nsNativeThemeGTK::ThemeSupportsWidget(ns
   case NS_THEME_RADIO:
   case NS_THEME_RADIO_SMALL:
   case NS_THEME_CHECKBOX:
   case NS_THEME_CHECKBOX_SMALL:
   case NS_THEME_TOOLBOX: // N/A
   case NS_THEME_TOOLBAR:
   case NS_THEME_TOOLBAR_BUTTON:
   case NS_THEME_TOOLBAR_DUAL_BUTTON: // so we can override the border with 0
-    // case NS_THEME_TOOLBAR_DUAL_BUTTON_DROPDOWN:
+  case NS_THEME_TOOLBAR_BUTTON_DROPDOWN:
   case NS_THEME_TOOLBAR_SEPARATOR:
   case NS_THEME_TOOLBAR_GRIPPER:
   case NS_THEME_STATUSBAR:
   case NS_THEME_STATUSBAR_PANEL:
   case NS_THEME_STATUSBAR_RESIZER_PANEL:
   case NS_THEME_RESIZER:
   case NS_THEME_LISTBOX:
     // case NS_THEME_LISTBOX_LISTITEM: