Bug 1078373 - Use the scrollPositionClampingScrollPortSize when computing whether or not to show the scrollbar. r=tn
--- a/layout/generic/nsGfxScrollFrame.cpp
+++ b/layout/generic/nsGfxScrollFrame.cpp
@@ -346,40 +346,41 @@ nsHTMLScrollFrame::TryLayout(ScrollReflo
desiredInsideBorderSize.width = vScrollbarDesiredWidth +
std::max(aKidMetrics->Width(), hScrollbarMinWidth);
desiredInsideBorderSize.height = hScrollbarDesiredHeight +
std::max(aKidMetrics->Height(), vScrollbarMinHeight);
aState->mInsideBorderSize =
ComputeInsideBorderSize(aState, desiredInsideBorderSize);
nsSize scrollPortSize = nsSize(std::max(0, aState->mInsideBorderSize.width - vScrollbarDesiredWidth),
std::max(0, aState->mInsideBorderSize.height - hScrollbarDesiredHeight));
+ nsSize visualScrollPortSize = mHelper.GetScrollPositionClampingScrollPortSize();
if (!aForce) {
nsRect scrolledRect =
mHelper.GetScrolledRectInternal(aState->mContentsOverflowAreas.ScrollableOverflow(),
scrollPortSize);
nscoord oneDevPixel = aState->mBoxState.PresContext()->DevPixelsToAppUnits(1);
// If the style is HIDDEN then we already know that aAssumeHScroll is false
if (aState->mStyles.mHorizontal != NS_STYLE_OVERFLOW_HIDDEN) {
bool wantHScrollbar =
aState->mStyles.mHorizontal == NS_STYLE_OVERFLOW_SCROLL ||
- scrolledRect.XMost() >= scrollPortSize.width + oneDevPixel ||
+ scrolledRect.XMost() >= visualScrollPortSize.width + oneDevPixel ||
scrolledRect.x <= -oneDevPixel;
if (scrollPortSize.width < hScrollbarMinSize.width)
wantHScrollbar = false;
if (wantHScrollbar != aAssumeHScroll)
return false;
}
// If the style is HIDDEN then we already know that aAssumeVScroll is false
if (aState->mStyles.mVertical != NS_STYLE_OVERFLOW_HIDDEN) {
bool wantVScrollbar =
aState->mStyles.mVertical == NS_STYLE_OVERFLOW_SCROLL ||
- scrolledRect.YMost() >= scrollPortSize.height + oneDevPixel ||
+ scrolledRect.YMost() >= visualScrollPortSize.height + oneDevPixel ||
scrolledRect.y <= -oneDevPixel;
if (scrollPortSize.height < vScrollbarMinSize.height)
wantVScrollbar = false;
if (wantVScrollbar != aAssumeVScroll)
return false;
}
}