diff --git a/gfx/public/nsITheme.h b/gfx/public/nsITheme.h index 4d35fab41ba7..a21a1736c5a9 100644 --- a/gfx/public/nsITheme.h +++ b/gfx/public/nsITheme.h @@ -151,6 +151,11 @@ public: virtual PRBool ThemeDrawsFocusForWidget(nsPresContext* aPresContext, nsIFrame* aFrame, PRUint8 aWidgetType)=0; + + /** + * Should we insert a dropmarker inside of combobox button? + */ + virtual PRBool ThemeNeedsComboboxDropmarker()=0; }; NS_DEFINE_STATIC_IID_ACCESSOR(nsITheme, NS_ITHEME_IID) diff --git a/layout/forms/nsComboboxControlFrame.cpp b/layout/forms/nsComboboxControlFrame.cpp index e05a5ee0c948..3b5ca3565224 100644 --- a/layout/forms/nsComboboxControlFrame.cpp +++ b/layout/forms/nsComboboxControlFrame.cpp @@ -653,15 +653,21 @@ nsComboboxControlFrame::Reflow(nsPresContext* aPresContext, // Get the width of the vertical scrollbar. That will be the width of the // dropdown button. - nsIScrollableFrame* scrollable; - CallQueryInterface(mListControlFrame, &scrollable); - NS_ASSERTION(scrollable, "List must be a scrollable frame"); - nsBoxLayoutState bls(PresContext(), aReflowState.rendContext); - nscoord buttonWidth = scrollable->GetDesiredScrollbarSizes(&bls).LeftRight(); - - if (buttonWidth > aReflowState.ComputedWidth()) { + nscoord buttonWidth; + const nsStyleDisplay *disp = GetStyleDisplay(); + if (IsThemed(disp) && !aPresContext->GetTheme()->ThemeNeedsComboboxDropmarker()) { buttonWidth = 0; } + else { + nsIScrollableFrame* scrollable; + CallQueryInterface(mListControlFrame, &scrollable); + NS_ASSERTION(scrollable, "List must be a scrollable frame"); + nsBoxLayoutState bls(PresContext(), aReflowState.rendContext); + buttonWidth = scrollable->GetDesiredScrollbarSizes(&bls).LeftRight(); + if (buttonWidth > aReflowState.ComputedWidth()) { + buttonWidth = 0; + } + } mDisplayWidth = aReflowState.ComputedWidth() - buttonWidth; diff --git a/widget/src/cocoa/nsNativeThemeCocoa.h b/widget/src/cocoa/nsNativeThemeCocoa.h index 8f746403c8a5..850ccdb61fda 100644 --- a/widget/src/cocoa/nsNativeThemeCocoa.h +++ b/widget/src/cocoa/nsNativeThemeCocoa.h @@ -84,6 +84,7 @@ public: PRBool ThemeSupportsWidget(nsPresContext* aPresContext, nsIFrame* aFrame, PRUint8 aWidgetType); PRBool WidgetIsContainer(PRUint8 aWidgetType); PRBool ThemeDrawsFocusForWidget(nsPresContext* aPresContext, nsIFrame* aFrame, PRUint8 aWidgetType); + PRBool ThemeNeedsComboboxDropmarker(); protected: diff --git a/widget/src/cocoa/nsNativeThemeCocoa.mm b/widget/src/cocoa/nsNativeThemeCocoa.mm index 2bf23de56df8..dc0631a83893 100644 --- a/widget/src/cocoa/nsNativeThemeCocoa.mm +++ b/widget/src/cocoa/nsNativeThemeCocoa.mm @@ -1393,3 +1393,9 @@ nsNativeThemeCocoa::ThemeDrawsFocusForWidget(nsPresContext* aPresContext, nsIFra return PR_FALSE; } + +PRBool +nsNativeThemeCocoa::ThemeNeedsComboboxDropmarker() +{ + return PR_FALSE; +} diff --git a/widget/src/gtk2/nsNativeThemeGTK.cpp b/widget/src/gtk2/nsNativeThemeGTK.cpp index 6badca9bef43..cb3dfce3e325 100644 --- a/widget/src/gtk2/nsNativeThemeGTK.cpp +++ b/widget/src/gtk2/nsNativeThemeGTK.cpp @@ -1072,3 +1072,9 @@ nsNativeThemeGTK::ThemeDrawsFocusForWidget(nsPresContext* aPresContext, nsIFrame { return PR_FALSE; } + +PRBool +nsNativeThemeGTK::ThemeNeedsComboboxDropmarker() +{ + return PR_TRUE; +} diff --git a/widget/src/gtk2/nsNativeThemeGTK.h b/widget/src/gtk2/nsNativeThemeGTK.h index 202708f9da90..82183eef0550 100644 --- a/widget/src/gtk2/nsNativeThemeGTK.h +++ b/widget/src/gtk2/nsNativeThemeGTK.h @@ -90,6 +90,8 @@ public: NS_IMETHOD_(PRBool) ThemeDrawsFocusForWidget(nsPresContext* aPresContext, nsIFrame* aFrame, PRUint8 aWidgetType); + PRBool ThemeNeedsComboboxDropmarker(); + nsNativeThemeGTK(); virtual ~nsNativeThemeGTK(); diff --git a/widget/src/windows/nsNativeThemeWin.cpp b/widget/src/windows/nsNativeThemeWin.cpp index 2f1a84c31b04..e02c1dd83fb2 100644 --- a/widget/src/windows/nsNativeThemeWin.cpp +++ b/widget/src/windows/nsNativeThemeWin.cpp @@ -1289,6 +1289,12 @@ nsNativeThemeWin::ThemeDrawsFocusForWidget(nsPresContext* aPresContext, nsIFrame return PR_FALSE; } +PRBool +nsNativeThemeWin::ThemeNeedsComboboxDropmarker() +{ + return PR_TRUE; +} + /* Windows 9x/NT/2000/Classic XP Theme Support */ PRBool diff --git a/widget/src/windows/nsNativeThemeWin.h b/widget/src/windows/nsNativeThemeWin.h index df4eeab0f5fb..00be2578ffe1 100644 --- a/widget/src/windows/nsNativeThemeWin.h +++ b/widget/src/windows/nsNativeThemeWin.h @@ -83,6 +83,8 @@ public: PRBool ThemeDrawsFocusForWidget(nsPresContext* aPresContext, nsIFrame* aFrame, PRUint8 aWidgetType); + PRBool ThemeNeedsComboboxDropmarker(); + nsNativeThemeWin(); virtual ~nsNativeThemeWin();