Bug 877085: Fix crash when trying to obtain the width of non-disappearing scrollbars. r=smichaud

This commit is contained in:
Stephen Pohl 2013-05-29 13:28:42 -07:00
Родитель 3eabb6ea4b
Коммит 7eaf5d2fa7
1 изменённых файлов: 23 добавлений и 4 удалений

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

@ -2846,11 +2846,7 @@ nsNativeThemeCocoa::GetMinimumWidgetSize(nsRenderingContext* aContext,
aResult->SizeTo(16, 16);
break;
}
// Intentional fallthrough to next case.
}
case NS_THEME_SCROLLBAR_NON_DISAPPEARING:
{
// yeah, i know i'm cheating a little here, but i figure that it
// really doesn't matter if the scrollbar is vertical or horizontal
// and the width metric is a really good metric for every piece
@ -2868,6 +2864,29 @@ nsNativeThemeCocoa::GetMinimumWidgetSize(nsRenderingContext* aContext,
break;
}
case NS_THEME_SCROLLBAR_NON_DISAPPEARING:
{
int32_t themeMetric = kThemeMetricScrollBarWidth;
if (aFrame) {
nsIFrame* scrollbarFrame = GetParentScrollbarFrame(aFrame);
if (scrollbarFrame &&
scrollbarFrame->StyleDisplay()->mAppearance ==
NS_THEME_SCROLLBAR_SMALL) {
// XXX We're interested in the width of non-disappearing scrollbars
// to leave enough space for a dropmarker in non-native styled
// comboboxes (bug 869314). It isn't clear to me if comboboxes can
// ever have small scrollbars.
themeMetric = kThemeMetricSmallScrollBarWidth;
}
}
SInt32 scrollbarWidth = 0;
::GetThemeMetric(themeMetric, &scrollbarWidth);
aResult->SizeTo(scrollbarWidth, scrollbarWidth);
break;
}
case NS_THEME_SCROLLBAR_BUTTON_UP:
case NS_THEME_SCROLLBAR_BUTTON_DOWN:
case NS_THEME_SCROLLBAR_BUTTON_LEFT: