diff --git a/toolkit/themes/gnomestripe/global/menu.css b/toolkit/themes/gnomestripe/global/menu.css index afe651c6834a..b97bf00e942a 100644 --- a/toolkit/themes/gnomestripe/global/menu.css +++ b/toolkit/themes/gnomestripe/global/menu.css @@ -146,31 +146,12 @@ menulist > menupopup > menu { margin-bottom: 0px; -moz-margin-start: 6px; -moz-margin-end: 0px; - width: 8px; - list-style-image: url("chrome://global/skin/menu/Menu-arrow.png"); + width: 1ex; + height: 1ex; + /* These next two rules are needed to prevent inheritance and thus ugliness */ + list-style-image: none; -moz-image-region: auto; -} - -.menu-right[_moz-menuactive="true"] { - list-style-image: url("chrome://global/skin/menu/Menu-arrow-hover.png"); - -moz-image-region: auto; -} - -.menu-right[disabled="true"] { - list-style-image: url("chrome://global/skin/menu/Menu-arrow-disabled.png"); - -moz-image-region: auto; -} - -.menu-right[chromedir="rtl"] { - list-style-image: url("chrome://global/skin/menu/Menu-arrow-rtl.png"); -} - -.menu-right[chromedir="rtl"][_moz-menuactive="true"] { - list-style-image: url("chrome://global/skin/menu/Menu-arrow-hover-rtl.png"); -} - -.menu-right[chromedir="rtl"][disabled="true"] { - list-style-image: url("chrome://global/skin/menu/Menu-arrow-disabled-rtl.png"); + -moz-appearance: menuarrow; } .menubar-left { diff --git a/widget/src/gtk2/gtk2drawing.c b/widget/src/gtk2/gtk2drawing.c index 1c0e1698d25a..4eb80e78797b 100644 --- a/widget/src/gtk2/gtk2drawing.c +++ b/widget/src/gtk2/gtk2drawing.c @@ -1588,6 +1588,28 @@ moz_gtk_menu_item_paint(GdkDrawable* drawable, GdkRectangle* rect, return MOZ_GTK_SUCCESS; } +static gint +moz_gtk_menu_arrow_paint(GdkDrawable* drawable, GdkRectangle* rect, + GdkRectangle* cliprect, GtkWidgetState* state) +{ + GtkStyle* style; + GtkTextDirection chromedir; + GtkStateType state_type = ConvertGtkState(state); + + ensure_menu_item_widget(); + style = gMenuItemWidget->style; + chromedir = gtk_widget_get_direction(gMenuItemWidget); + + TSOffsetStyleGCs(style, rect->x, rect->y); + gtk_paint_arrow(style, drawable, state_type, + (state_type == GTK_STATE_PRELIGHT) ? GTK_SHADOW_IN : GTK_SHADOW_OUT, + cliprect, gMenuItemWidget, "menuitem", + (chromedir == GTK_TEXT_DIR_LTR) ? GTK_ARROW_RIGHT : GTK_ARROW_LEFT, + TRUE, rect->x, rect->y, rect->width, rect->height); + + return MOZ_GTK_SUCCESS; +} + static gint moz_gtk_check_menu_item_paint(GdkDrawable* drawable, GdkRectangle* rect, GdkRectangle* cliprect, GtkWidgetState* state, @@ -1875,6 +1897,7 @@ moz_gtk_get_widget_border(GtkThemeWidgetType widget, gint* left, gint* top, case MOZ_GTK_TOOLTIP: case MOZ_GTK_WINDOW: case MOZ_GTK_RESIZER: + case MOZ_GTK_MENUARROW: *left = *top = *right = *bottom = 0; return MOZ_GTK_SUCCESS; default: @@ -2064,6 +2087,9 @@ moz_gtk_widget_paint(GtkThemeWidgetType widget, GdkDrawable* drawable, case MOZ_GTK_MENUITEM: return moz_gtk_menu_item_paint(drawable, rect, cliprect, state); break; + case MOZ_GTK_MENUARROW: + return moz_gtk_menu_arrow_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, diff --git a/widget/src/gtk2/gtkdrawing.h b/widget/src/gtk2/gtkdrawing.h index 8715765a5a2b..70f2ff950523 100644 --- a/widget/src/gtk2/gtkdrawing.h +++ b/widget/src/gtk2/gtkdrawing.h @@ -165,6 +165,8 @@ typedef enum { 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 items of menubar and popups. */ MOZ_GTK_MENUITEM, MOZ_GTK_CHECKMENUITEM, diff --git a/widget/src/gtk2/nsNativeThemeGTK.cpp b/widget/src/gtk2/nsNativeThemeGTK.cpp index adbb2b9e3df8..b3dba0ed5223 100644 --- a/widget/src/gtk2/nsNativeThemeGTK.cpp +++ b/widget/src/gtk2/nsNativeThemeGTK.cpp @@ -272,7 +272,8 @@ nsNativeThemeGTK::GetGtkWidgetAndState(PRUint8 aWidgetType, nsIFrame* aFrame, if (aWidgetType == NS_THEME_MENUITEM || aWidgetType == NS_THEME_CHECKMENUITEM || - aWidgetType == NS_THEME_RADIOMENUITEM) { + aWidgetType == NS_THEME_RADIOMENUITEM || + aWidgetType == NS_THEME_MENUARROW) { PRBool isTopLevel = PR_FALSE; nsIMenuFrame *menuFrame; CallQueryInterface(aFrame, &menuFrame); @@ -484,6 +485,9 @@ nsNativeThemeGTK::GetGtkWidgetAndState(PRUint8 aWidgetType, nsIFrame* aFrame, case NS_THEME_MENUITEM: aGtkWidgetType = MOZ_GTK_MENUITEM; break; + case NS_THEME_MENUARROW: + aGtkWidgetType = MOZ_GTK_MENUARROW; + break; case NS_THEME_CHECKMENUITEM: aGtkWidgetType = MOZ_GTK_CHECKMENUITEM; break; @@ -1053,6 +1057,7 @@ nsNativeThemeGTK::ThemeSupportsWidget(nsPresContext* aPresContext, case NS_THEME_MENUBAR: case NS_THEME_MENUPOPUP: case NS_THEME_MENUITEM: + case NS_THEME_MENUARROW: case NS_THEME_CHECKMENUITEM: case NS_THEME_RADIOMENUITEM: case NS_THEME_WINDOW: