From 168d2ef51658bafb9b2bc6f3eafa34e28c22078c Mon Sep 17 00:00:00 2001 From: "dbaron%dbaron.org" Date: Sun, 16 Apr 2006 20:05:30 +0000 Subject: [PATCH] Clamp curpos to between its min and max to fix resizing regression. b=333829 Patch from Hideo Saito . r+sr=dbaron git-svn-id: svn://10.0.0.236/trunk@194481 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/generic/nsGfxScrollFrame.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mozilla/layout/generic/nsGfxScrollFrame.cpp b/mozilla/layout/generic/nsGfxScrollFrame.cpp index 4e4ef538dd5..834db08ad78 100644 --- a/mozilla/layout/generic/nsGfxScrollFrame.cpp +++ b/mozilla/layout/generic/nsGfxScrollFrame.cpp @@ -2395,6 +2395,9 @@ nsGfxScrollFrameInner::LayoutScrollbars(nsBoxLayoutState& aState, NS_PRECONDITION(mVScrollbarBox->IsBoxFrame(), "Must be a box frame!"); nscoord curPosX, curPosY; scrollable->GetScrollPosition(curPosX, curPosY); + // The current position may have become invalid due to min/max changes. + curPosY = PR_MAX(curPosY, minY); + curPosY = PR_MIN(curPosY, maxY); // Scrollbars assume zero is the minimum position, so translate for them. SetScrollbarEnabled(mVScrollbarBox, maxY - minY); SetCoordAttribute(mVScrollbarBox, nsXULAtoms::maxpos, maxY - minY); @@ -2416,6 +2419,9 @@ nsGfxScrollFrameInner::LayoutScrollbars(nsBoxLayoutState& aState, NS_PRECONDITION(mHScrollbarBox->IsBoxFrame(), "Must be a box frame!"); nscoord curPosX, curPosY; scrollable->GetScrollPosition(curPosX, curPosY); + // The current position may have become invalid due to min/max changes. + curPosX = PR_MAX(curPosX, minX); + curPosX = PR_MIN(curPosX, maxX); // Scrollbars assume zero is the minimum position, so translate for them. SetScrollbarEnabled(mHScrollbarBox, maxX - minX); SetCoordAttribute(mHScrollbarBox, nsXULAtoms::maxpos, maxX - minX);