bug 380185 (part 2) - Scrollbars should not try to draw their features if there is not enough space. r=josh sr=roc.

This commit is contained in:
cbarrett@mozilla.com 2007-07-03 13:05:15 -07:00
Родитель f64501fa12
Коммит f131cd226d
1 изменённых файлов: 6 добавлений и 5 удалений

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

@ -402,6 +402,8 @@ nsNativeThemeCocoa::GetScrollbarPressStates(nsIFrame *aFrame, PRInt32 aButtonSta
}
// Both of the following sets of numbers were derived by loading the testcase in
// bmo bug 380185 in Safari and observing its behavior for various heights of scrollbar.
// These magic numbers are the minimum sizes we can draw a scrollbar and still
// have room for everything to display, including the thumb
#define MIN_SCROLLBAR_SIZE_WITH_THUMB 61
@ -432,20 +434,19 @@ nsNativeThemeCocoa::GetScrollbarDrawInfo(HIThemeTrackDrawInfo& aTdi, nsIFrame *a
if (isHorizontal)
aTdi.attributes |= kThemeTrackHorizontal;
aTdi.trackInfo.scrollbar.viewsize = (SInt32)(isHorizontal ? (aRect.size.width) : (aRect.size.height));
PRInt32 longSideLength = (PRInt32)(isHorizontal ? (aRect.size.width) : (aRect.size.height));
aTdi.trackInfo.scrollbar.viewsize = (SInt32)longSideLength;
// Only display the thumb if we have room for it to display. Note that this doesn't
// affect the actual tracking rects Gecko maintains -- this is a purely cosmetic
// change. See bmo bug 380185 for more info.
if ((isHorizontal ? aRect.size.width : aRect.size.height) >=
(isSmall ? MIN_SMALL_SCROLLBAR_SIZE_WITH_THUMB : MIN_SCROLLBAR_SIZE_WITH_THUMB)) {
if (longSideLength >= (isSmall ? MIN_SMALL_SCROLLBAR_SIZE_WITH_THUMB : MIN_SCROLLBAR_SIZE_WITH_THUMB)) {
aTdi.attributes |= kThemeTrackShowThumb;
}
// If we don't have enough room to display *any* features, we're done creating
// this tdi, so return early. Again, this doesn't affect the tracking rects Gecko
// maintains. See bmo bug 380185 for more info.
else if ((isHorizontal ? aRect.size.width : aRect.size.height) <
(isSmall ? MIN_SMALL_SCROLLBAR_SIZE : MIN_SCROLLBAR_SIZE)) {
else if (longSideLength < (isSmall ? MIN_SMALL_SCROLLBAR_SIZE : MIN_SCROLLBAR_SIZE)) {
aTdi.enableState = kThemeTrackNothingToScroll;
return;
}