mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
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:
parent
339f6f9f40
commit
a08a2a3e9e
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user