diff --git a/layout/generic/nsGfxScrollFrame.cpp b/layout/generic/nsGfxScrollFrame.cpp index a46ffa210494..4dfa793433ea 100644 --- a/layout/generic/nsGfxScrollFrame.cpp +++ b/layout/generic/nsGfxScrollFrame.cpp @@ -5100,15 +5100,15 @@ nsXULScrollFrame::XULLayout(nsBoxLayoutState& aState) // Look at our style do we always have vertical or horizontal scrollbars? if (styles.mHorizontal == NS_STYLE_OVERFLOW_SCROLL) - mHelper.mHasHorizontalScrollbar = true; + mHelper.mHasHorizontalScrollbar = true; if (styles.mVertical == NS_STYLE_OVERFLOW_SCROLL) - mHelper.mHasVerticalScrollbar = true; + mHelper.mHasVerticalScrollbar = true; if (mHelper.mHasHorizontalScrollbar) - AddHorizontalScrollbar(aState, scrollbarBottom); + AddHorizontalScrollbar(aState, scrollbarBottom); if (mHelper.mHasVerticalScrollbar) - AddVerticalScrollbar(aState, scrollbarRight); + AddVerticalScrollbar(aState, scrollbarRight); // layout our the scroll area LayoutScrollArea(aState, oldScrollPosition); @@ -5122,28 +5122,29 @@ nsXULScrollFrame::XULLayout(nsBoxLayoutState& aState) nsRect scrolledRect = mHelper.GetScrolledRect(); // There are two cases to consider - if (scrolledRect.height <= mHelper.mScrollPort.height - || styles.mVertical != NS_STYLE_OVERFLOW_AUTO) { - if (mHelper.mHasVerticalScrollbar) { - // We left room for the vertical scrollbar, but it's not needed; - // remove it. - RemoveVerticalScrollbar(aState, scrollbarRight); + if (scrolledRect.height <= mHelper.mScrollPort.height || + styles.mVertical != NS_STYLE_OVERFLOW_AUTO) { + if (mHelper.mHasVerticalScrollbar) { + // We left room for the vertical scrollbar, but it's not needed; + // remove it. + RemoveVerticalScrollbar(aState, scrollbarRight); + needsLayout = true; + } + } else { + if (!mHelper.mHasVerticalScrollbar) { + // We didn't leave room for the vertical scrollbar, but it turns + // out we needed it + if (AddVerticalScrollbar(aState, scrollbarRight)) { needsLayout = true; } - } else { - if (!mHelper.mHasVerticalScrollbar) { - // We didn't leave room for the vertical scrollbar, but it turns - // out we needed it - if (AddVerticalScrollbar(aState, scrollbarRight)) - needsLayout = true; - } + } } // ok layout at the right size if (needsLayout) { - nsBoxLayoutState resizeState(aState); - LayoutScrollArea(resizeState, oldScrollPosition); - needsLayout = false; + nsBoxLayoutState resizeState(aState); + LayoutScrollArea(resizeState, oldScrollPosition); + needsLayout = false; } } @@ -5160,21 +5161,22 @@ nsXULScrollFrame::XULLayout(nsBoxLayoutState& aState) && styles.mHorizontal == NS_STYLE_OVERFLOW_AUTO) { if (!mHelper.mHasHorizontalScrollbar) { - // no scrollbar? - if (AddHorizontalScrollbar(aState, scrollbarBottom)) - needsLayout = true; + // no scrollbar? + if (AddHorizontalScrollbar(aState, scrollbarBottom)) { + needsLayout = true; + } - // if we added a horizontal scrollbar and we did not have a vertical - // there is a chance that by adding the horizontal scrollbar we will - // suddenly need a vertical scrollbar. Is a special case but its - // important. - //if (!mHasVerticalScrollbar && scrolledRect.height > scrollAreaRect.height - sbSize.height) - // printf("****Gfx Scrollbar Special case hit!!*****\n"); + // if we added a horizontal scrollbar and we did not have a vertical + // there is a chance that by adding the horizontal scrollbar we will + // suddenly need a vertical scrollbar. Is a special case but its + // important. + //if (!mHasVerticalScrollbar && scrolledRect.height > scrollAreaRect.height - sbSize.height) + // printf("****Gfx Scrollbar Special case hit!!*****\n"); } } else { - // if the area is smaller or equal to and we have a scrollbar then - // remove it. + // if the area is smaller or equal to and we have a scrollbar then + // remove it. if (mHelper.mHasHorizontalScrollbar) { RemoveHorizontalScrollbar(aState, scrollbarBottom); needsLayout = true; @@ -5184,9 +5186,9 @@ nsXULScrollFrame::XULLayout(nsBoxLayoutState& aState) // we only need to set the rect. The inner child stays the same size. if (needsLayout) { - nsBoxLayoutState resizeState(aState); - LayoutScrollArea(resizeState, oldScrollPosition); - needsLayout = false; + nsBoxLayoutState resizeState(aState); + LayoutScrollArea(resizeState, oldScrollPosition); + needsLayout = false; } // get the preferred size of the scrollbars