diff --git a/dom/base/nsDOMWindowUtils.cpp b/dom/base/nsDOMWindowUtils.cpp index 08f94bb33950..05e34c69f6e8 100644 --- a/dom/base/nsDOMWindowUtils.cpp +++ b/dom/base/nsDOMWindowUtils.cpp @@ -2317,26 +2317,3 @@ nsDOMWindowUtils::GetPlugins(JSContext* cx, jsval* aPlugins) *aPlugins = OBJECT_TO_JSVAL(jsPlugins); return NS_OK; } - -NS_IMETHODIMP -nsDOMWindowUtils::SetScrollPositionClampingScrollPortSize(float aWidth, float aHeight) -{ - if (!IsUniversalXPConnectCapable()) { - return NS_ERROR_DOM_SECURITY_ERR; - } - - if (!(aWidth >= 0.0 && aHeight >= 0.0)) { - return NS_ERROR_ILLEGAL_VALUE; - } - - nsIPresShell* presShell = GetPresShell(); - if (!presShell) { - return NS_ERROR_FAILURE; - } - - presShell->SetScrollPositionClampingScrollPortSize( - nsPresContext::CSSPixelsToAppUnits(aWidth), - nsPresContext::CSSPixelsToAppUnits(aHeight)); - - return NS_OK; -} diff --git a/dom/interfaces/base/nsIDOMWindowUtils.idl b/dom/interfaces/base/nsIDOMWindowUtils.idl index f88eee4e447b..a86f14081ae0 100644 --- a/dom/interfaces/base/nsIDOMWindowUtils.idl +++ b/dom/interfaces/base/nsIDOMWindowUtils.idl @@ -70,7 +70,7 @@ interface nsIDOMFile; interface nsIFile; interface nsIDOMTouch; -[scriptable, uuid(66a68858-df38-40e1-a792-fda04ebcc084)] +[scriptable, uuid(c7f303a1-4f7b-4d38-a192-c3f0e25dadb1)] interface nsIDOMWindowUtils : nsISupports { /** @@ -1110,12 +1110,4 @@ interface nsIDOMWindowUtils : nsISupports { */ [implicit_jscontext] readonly attribute jsval plugins; - - /** - * Set the scrollport size for the purposes of clamping scroll positions for - * the root scroll frame of this document to be (aWidth,aHeight) in CSS pixels. - * - * The caller of this method must have UniversalXPConnect privileges. - */ - void setScrollPositionClampingScrollPortSize(in float aWidth, in float aHeight); }; diff --git a/layout/base/nsIPresShell.h b/layout/base/nsIPresShell.h index 512e77d974e1..2e4b4119cbf3 100644 --- a/layout/base/nsIPresShell.h +++ b/layout/base/nsIPresShell.h @@ -1265,15 +1265,6 @@ public: // clears that capture. static void ClearMouseCapture(nsIFrame* aFrame); - void SetScrollPositionClampingScrollPortSize(nscoord aWidth, nscoord aHeight); - bool IsScrollPositionClampingScrollPortSizeSet() { - return mScrollPositionClampingScrollPortSizeSet; - } - nsSize GetScrollPositionClampingScrollPortSize() { - NS_ASSERTION(mScrollPositionClampingScrollPortSizeSet, "asking for scroll port when its not set?"); - return mScrollPositionClampingScrollPortSize; - } - protected: friend class nsRefreshDriver; @@ -1324,8 +1315,6 @@ protected: bool mSuppressInterruptibleReflows; - bool mScrollPositionClampingScrollPortSizeSet; - // A list of weak frames. This is a pointer to the last item in the list. nsWeakFrame* mWeakFrames; @@ -1344,8 +1333,6 @@ protected: float mXResolution; float mYResolution; - nsSize mScrollPositionClampingScrollPortSize; - static nsIContent* gKeyDownTarget; }; diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index 5f8c6a159abf..edd4e6bd7b3a 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -831,8 +831,6 @@ PresShell::PresShell() mYResolution = 1.0; mViewportOverridden = false; - mScrollPositionClampingScrollPortSizeSet = false; - static bool addedSynthMouseMove = false; if (!addedSynthMouseMove) { Preferences::AddBoolVarCache(&sSynthMouseMove, @@ -9149,10 +9147,3 @@ PresShell::SizeOfTextRuns(nsMallocSizeOfFun aMallocSizeOf) const /* clear = */false); } -void -nsIPresShell::SetScrollPositionClampingScrollPortSize(nscoord aWidth, nscoord aHeight) -{ - mScrollPositionClampingScrollPortSizeSet = true; - mScrollPositionClampingScrollPortSize.width = aWidth; - mScrollPositionClampingScrollPortSize.height = aHeight; -} diff --git a/layout/generic/nsGfxScrollFrame.cpp b/layout/generic/nsGfxScrollFrame.cpp index 980a6a8b7681..7c8de465176c 100644 --- a/layout/generic/nsGfxScrollFrame.cpp +++ b/layout/generic/nsGfxScrollFrame.cpp @@ -1645,7 +1645,7 @@ Clamp(nscoord aLower, nscoord aVal, nscoord aUpper) nsPoint nsGfxScrollFrameInner::ClampScrollPosition(const nsPoint& aPt) const { - nsRect range = GetScrollRangeForClamping(); + nsRect range = GetScrollRange(); return nsPoint(Clamp(range.x, aPt.x, range.XMost()), Clamp(range.y, aPt.y, range.YMost())); } @@ -1971,7 +1971,7 @@ nsGfxScrollFrameInner::RestrictToDevPixels(const nsPoint& aPt, // pixels. But we also need to make sure that our position remains // inside the allowed region. if (aShouldClamp) { - nsRect scrollRange = GetScrollRangeForClamping(); + nsRect scrollRange = GetScrollRange(); *aPtDevPx = nsIntPoint(ClampInt(scrollRange.x, aPt.x, scrollRange.XMost(), appUnitsPerDevPixel), ClampInt(scrollRange.y, aPt.y, scrollRange.YMost(), appUnitsPerDevPixel)); } else { @@ -2326,16 +2326,10 @@ AlignToDevPixelRoundingToZero(nscoord aVal, PRInt32 aAppUnitsPerDevPixel) nsRect nsGfxScrollFrameInner::GetScrollRange() const -{ - return GetScrollRange(mScrollPort.width, mScrollPort.height); -} - -nsRect -nsGfxScrollFrameInner::GetScrollRange(nscoord aWidth, nscoord aHeight) const { nsRect range = GetScrolledRect(); - range.width -= aWidth; - range.height -= aHeight; + range.width -= mScrollPort.width; + range.height -= mScrollPort.height; nsPresContext* presContext = mOuter->PresContext(); PRInt32 appUnitsPerDevPixel = presContext->AppUnitsPerDevPixel(); @@ -2348,17 +2342,6 @@ nsGfxScrollFrameInner::GetScrollRange(nscoord aWidth, nscoord aHeight) const return range; } -nsRect -nsGfxScrollFrameInner::GetScrollRangeForClamping() const -{ - nsIPresShell* presShell = mOuter->PresContext()->PresShell(); - if (presShell->IsScrollPositionClampingScrollPortSizeSet()) { - nsSize size = presShell->GetScrollPositionClampingScrollPortSize(); - return GetScrollRange(size.width, size.height); - } - return GetScrollRange(); -} - static void AdjustForWholeDelta(PRInt32 aDelta, nscoord* aCoord) { diff --git a/layout/generic/nsGfxScrollFrame.h b/layout/generic/nsGfxScrollFrame.h index c0f679f6c957..28b73bca44a6 100644 --- a/layout/generic/nsGfxScrollFrame.h +++ b/layout/generic/nsGfxScrollFrame.h @@ -178,12 +178,7 @@ public: return pt; } nsRect GetScrollRange() const; - // Get the scroll range assuming the scrollport has size (aWidth, aHeight). - nsRect GetScrollRange(nscoord aWidth, nscoord aHeight) const; -protected: - nsRect GetScrollRangeForClamping() const; -public: nsPoint RestrictToDevPixels(const nsPoint& aPt, nsIntPoint* aPtDevPx, bool aShouldClamp) const; nsPoint ClampScrollPosition(const nsPoint& aPt) const; static void AsyncScrollCallback(nsITimer *aTimer, void* anInstance);