From 1ecbf501ece14709ffdcf295de737676c844bd6d Mon Sep 17 00:00:00 2001 From: "joshmoz%gmail.com" Date: Fri, 18 May 2007 03:04:05 +0000 Subject: [PATCH] don't put a dropmarker in comboboxes if nsITheme says not to. b=370282 r/sr=roc git-svn-id: svn://10.0.0.236/trunk@226601 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/gfx/public/nsITheme.h | 5 +++++ .../layout/forms/nsComboboxControlFrame.cpp | 20 ++++++++++++------- mozilla/widget/src/cocoa/nsNativeThemeCocoa.h | 1 + .../widget/src/cocoa/nsNativeThemeCocoa.mm | 6 ++++++ mozilla/widget/src/gtk2/nsNativeThemeGTK.cpp | 6 ++++++ mozilla/widget/src/gtk2/nsNativeThemeGTK.h | 2 ++ .../widget/src/windows/nsNativeThemeWin.cpp | 6 ++++++ mozilla/widget/src/windows/nsNativeThemeWin.h | 2 ++ 8 files changed, 41 insertions(+), 7 deletions(-) diff --git a/mozilla/gfx/public/nsITheme.h b/mozilla/gfx/public/nsITheme.h index 4d35fab41ba..a21a1736c5a 100644 --- a/mozilla/gfx/public/nsITheme.h +++ b/mozilla/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/mozilla/layout/forms/nsComboboxControlFrame.cpp b/mozilla/layout/forms/nsComboboxControlFrame.cpp index e05a5ee0c94..3b5ca356522 100644 --- a/mozilla/layout/forms/nsComboboxControlFrame.cpp +++ b/mozilla/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/mozilla/widget/src/cocoa/nsNativeThemeCocoa.h b/mozilla/widget/src/cocoa/nsNativeThemeCocoa.h index 8f746403c8a..850ccdb61fd 100644 --- a/mozilla/widget/src/cocoa/nsNativeThemeCocoa.h +++ b/mozilla/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/mozilla/widget/src/cocoa/nsNativeThemeCocoa.mm b/mozilla/widget/src/cocoa/nsNativeThemeCocoa.mm index 2bf23de56df..dc0631a8389 100644 --- a/mozilla/widget/src/cocoa/nsNativeThemeCocoa.mm +++ b/mozilla/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/mozilla/widget/src/gtk2/nsNativeThemeGTK.cpp b/mozilla/widget/src/gtk2/nsNativeThemeGTK.cpp index 6badca9bef4..cb3dfce3e32 100644 --- a/mozilla/widget/src/gtk2/nsNativeThemeGTK.cpp +++ b/mozilla/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/mozilla/widget/src/gtk2/nsNativeThemeGTK.h b/mozilla/widget/src/gtk2/nsNativeThemeGTK.h index 202708f9da9..82183eef055 100644 --- a/mozilla/widget/src/gtk2/nsNativeThemeGTK.h +++ b/mozilla/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/mozilla/widget/src/windows/nsNativeThemeWin.cpp b/mozilla/widget/src/windows/nsNativeThemeWin.cpp index 2f1a84c31b0..e02c1dd83fb 100644 --- a/mozilla/widget/src/windows/nsNativeThemeWin.cpp +++ b/mozilla/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/mozilla/widget/src/windows/nsNativeThemeWin.h b/mozilla/widget/src/windows/nsNativeThemeWin.h index df4eeab0f5f..00be2578ffe 100644 --- a/mozilla/widget/src/windows/nsNativeThemeWin.h +++ b/mozilla/widget/src/windows/nsNativeThemeWin.h @@ -83,6 +83,8 @@ public: PRBool ThemeDrawsFocusForWidget(nsPresContext* aPresContext, nsIFrame* aFrame, PRUint8 aWidgetType); + PRBool ThemeNeedsComboboxDropmarker(); + nsNativeThemeWin(); virtual ~nsNativeThemeWin();