don't put a dropmarker in comboboxes if nsITheme says not to. b=370282 r/sr=roc

This commit is contained in:
joshmoz@gmail.com 2007-05-17 20:04:04 -07:00
Родитель 680e341a85
Коммит 79ffe0b1d1
8 изменённых файлов: 41 добавлений и 7 удалений

Просмотреть файл

@ -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)

Просмотреть файл

@ -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;

Просмотреть файл

@ -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:

Просмотреть файл

@ -1393,3 +1393,9 @@ nsNativeThemeCocoa::ThemeDrawsFocusForWidget(nsPresContext* aPresContext, nsIFra
return PR_FALSE;
}
PRBool
nsNativeThemeCocoa::ThemeNeedsComboboxDropmarker()
{
return PR_FALSE;
}

Просмотреть файл

@ -1072,3 +1072,9 @@ nsNativeThemeGTK::ThemeDrawsFocusForWidget(nsPresContext* aPresContext, nsIFrame
{
return PR_FALSE;
}
PRBool
nsNativeThemeGTK::ThemeNeedsComboboxDropmarker()
{
return PR_TRUE;
}

Просмотреть файл

@ -90,6 +90,8 @@ public:
NS_IMETHOD_(PRBool) ThemeDrawsFocusForWidget(nsPresContext* aPresContext,
nsIFrame* aFrame, PRUint8 aWidgetType);
PRBool ThemeNeedsComboboxDropmarker();
nsNativeThemeGTK();
virtual ~nsNativeThemeGTK();

Просмотреть файл

@ -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

Просмотреть файл

@ -83,6 +83,8 @@ public:
PRBool ThemeDrawsFocusForWidget(nsPresContext* aPresContext, nsIFrame* aFrame, PRUint8 aWidgetType);
PRBool ThemeNeedsComboboxDropmarker();
nsNativeThemeWin();
virtual ~nsNativeThemeWin();