diff --git a/layout/generic/nsGfxScrollFrame.cpp b/layout/generic/nsGfxScrollFrame.cpp index b4635de9c1bf..e5bb8124aac9 100644 --- a/layout/generic/nsGfxScrollFrame.cpp +++ b/layout/generic/nsGfxScrollFrame.cpp @@ -566,13 +566,7 @@ nsHTMLScrollFrame::GuessVScrollbarNeeded(const ScrollReflowState& aState) return PR_FALSE; if (mInner.mIsRoot) { - // For viewports, try getting a hint from global history - // as to whether we had a vertical scrollbar last time. - PRBool hint; - nsresult rv = mInner.GetVScrollbarHintFromGlobalHistory(&hint); - if (NS_SUCCEEDED(rv)) - return hint; - // No hint. Assume that there will be a scrollbar; it seems to me + // Assume that there will be a scrollbar; it seems to me // that 'most pages' do have a scrollbar, and anyway, it's cheaper // to do an extra reflow for the pages that *don't* need a // scrollbar (because on average they will have less content). @@ -866,11 +860,6 @@ nsHTMLScrollFrame::Reflow(nsPresContext* aPresContext, if (!InInitialReflow() && !mInner.mHadNonInitialReflow) { mInner.mHadNonInitialReflow = PR_TRUE; - if (mInner.mIsRoot) { - // For viewports, record whether we needed a vertical scrollbar - // after the first non-initial reflow. - mInner.SaveVScrollbarStateToGlobalHistory(); - } } if (mInner.mIsRoot && oldScrolledAreaBounds != newScrolledAreaBounds) { @@ -1297,8 +1286,6 @@ nsGfxScrollFrameInner::nsGfxScrollFrameInner(nsContainerFrame* aOuter, mIsXUL(aIsXUL), mSupppressScrollbarUpdate(PR_FALSE), mSkippedScrollbarLayout(PR_FALSE), - mDidLoadHistoryVScrollbarHint(PR_FALSE), - mHistoryVScrollbarHint(PR_FALSE), mHadNonInitialReflow(PR_FALSE), mHorizontalOverflow(PR_FALSE), mVerticalOverflow(PR_FALSE), @@ -3323,59 +3310,6 @@ static nsIURI* GetDocURI(nsIFrame* aFrame) return doc->GetDocumentURI(); } -void -nsGfxScrollFrameInner::SaveVScrollbarStateToGlobalHistory() -{ - NS_ASSERTION(mIsRoot, "Only use this on viewports"); - - // If the hint is the same as the one we loaded, don't bother - // saving it - if (mDidLoadHistoryVScrollbarHint && - (mHistoryVScrollbarHint == mHasVerticalScrollbar)) - return; - - nsIURI* uri = GetDocURI(mOuter); - if (!uri) - return; - - nsCOMPtr history(do_GetService(NS_GLOBALHISTORY2_CONTRACTID)); - if (!history) - return; - - PRUint32 flags = 0; - if (mHasVerticalScrollbar) { - flags |= NS_GECKO_FLAG_NEEDS_VERTICAL_SCROLLBAR; - } - history->SetURIGeckoFlags(uri, flags); - // if it fails, we don't care -} - -nsresult -nsGfxScrollFrameInner::GetVScrollbarHintFromGlobalHistory(PRBool* aVScrollbarNeeded) -{ - NS_ASSERTION(mIsRoot, "Only use this on viewports"); - NS_ASSERTION(!mDidLoadHistoryVScrollbarHint, - "Should only load a hint once, it can be expensive"); - - nsIURI* uri = GetDocURI(mOuter); - if (!uri) - return NS_ERROR_FAILURE; - - nsCOMPtr history(do_GetService(NS_GLOBALHISTORY2_CONTRACTID)); - if (!history) - return NS_ERROR_FAILURE; - - PRUint32 flags; - nsresult rv = history->GetURIGeckoFlags(uri, &flags); - if (NS_FAILED(rv)) - return rv; - - *aVScrollbarNeeded = (flags & NS_GECKO_FLAG_NEEDS_VERTICAL_SCROLLBAR) != 0; - mDidLoadHistoryVScrollbarHint = PR_TRUE; - mHistoryVScrollbarHint = *aVScrollbarNeeded; - return NS_OK; -} - nsPresState* nsGfxScrollFrameInner::SaveState(nsIStatefulFrame::SpecialStateID aStateID) { diff --git a/layout/generic/nsGfxScrollFrame.h b/layout/generic/nsGfxScrollFrame.h index df8ad46de0c1..598bed4d4f1c 100644 --- a/layout/generic/nsGfxScrollFrame.h +++ b/layout/generic/nsGfxScrollFrame.h @@ -160,8 +160,6 @@ public: nsPresState* SaveState(nsIStatefulFrame::SpecialStateID aStateID); void RestoreState(nsPresState* aState); - void SaveVScrollbarStateToGlobalHistory(); - nsresult GetVScrollbarHintFromGlobalHistory(PRBool* aVScrollbarNeeded); nsIFrame* GetScrolledFrame() const { return mScrolledFrame; } nsIBox* GetScrollbarBox(PRBool aVertical) const { @@ -272,11 +270,7 @@ public: // it might not strictly be needed next time mSupppressScrollbarUpdate is // false. PRPackedBool mSkippedScrollbarLayout:1; - // Did we load a hint from global history - // about whether a vertical scrollbar is required? - PRPackedBool mDidLoadHistoryVScrollbarHint:1; - // The value of the hint loaded - PRPackedBool mHistoryVScrollbarHint:1; + PRPackedBool mHadNonInitialReflow:1; // State used only by PostScrollEvents so we know // which overflow states have changed.