From e47e30f4ce38bb793fa0dd9d71abd19e277bc398 Mon Sep 17 00:00:00 2001 From: "hyatt%netscape.com" Date: Tue, 12 Mar 2002 10:13:05 +0000 Subject: [PATCH] Fix for 122369, XBL form selects show scrollbars when their size=the number of options. This fixes that problem. r=bryner, sr=ben, a=brendan git-svn-id: svn://10.0.0.236/trunk@116388 18797224-902f-48f8-a5cc-f745e15eee43 --- .../base/src/outliner/src/nsOutlinerBodyFrame.cpp | 12 +++++++++--- .../layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp | 12 +++++++++--- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/mozilla/layout/xul/base/src/outliner/src/nsOutlinerBodyFrame.cpp b/mozilla/layout/xul/base/src/outliner/src/nsOutlinerBodyFrame.cpp index 2e1b15dd262..76ff0219dec 100644 --- a/mozilla/layout/xul/base/src/outliner/src/nsOutlinerBodyFrame.cpp +++ b/mozilla/layout/xul/base/src/outliner/src/nsOutlinerBodyFrame.cpp @@ -444,6 +444,7 @@ nsOutlinerBodyFrame::GetPrefSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSiz PRInt32 err; desiredRows = size.ToInteger(&err); mHasFixedRowCount = PR_TRUE; + mPageCount = desiredRows; } else desiredRows = 1; } else { @@ -455,12 +456,13 @@ nsOutlinerBodyFrame::GetPrefSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSiz PRInt32 err; desiredRows = rows.ToInteger(&err); mHasFixedRowCount = PR_TRUE; + mPageCount = desiredRows; } else desiredRows = 0; } aSize.height = GetRowHeight() * desiredRows; - + AddBorderAndPadding(aSize); AddInset(aSize); nsIBox::AddCSSPrefSize(aBoxLayoutState, this, aSize); @@ -572,7 +574,9 @@ nsOutlinerBodyFrame::SetBounds(nsBoxLayoutState& aBoxLayoutState, const nsRect& if (recompute) { mInnerBox = GetInnerBox(); - mPageCount = mRowHeight ? (mInnerBox.height / mRowHeight) : 0; + + if (!mHasFixedRowCount) + mPageCount = mRowHeight ? (mInnerBox.height / mRowHeight) : 0; PRInt32 rowCount; mView->GetRowCount(&rowCount); @@ -1892,7 +1896,9 @@ NS_IMETHODIMP nsOutlinerBodyFrame::Paint(nsIPresContext* aPresContext, PRInt32 oldPageCount = mPageCount; mRowHeight = GetRowHeight(); mInnerBox = GetInnerBox(); - mPageCount = mInnerBox.height/mRowHeight; + + if (!mHasFixedRowCount) + mPageCount = mInnerBox.height/mRowHeight; if (mRowHeight != oldRowHeight || oldPageCount != mPageCount) { // Schedule a ResizeReflow that will update our page count properly. diff --git a/mozilla/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp b/mozilla/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp index 2e1b15dd262..76ff0219dec 100644 --- a/mozilla/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp +++ b/mozilla/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp @@ -444,6 +444,7 @@ nsOutlinerBodyFrame::GetPrefSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSiz PRInt32 err; desiredRows = size.ToInteger(&err); mHasFixedRowCount = PR_TRUE; + mPageCount = desiredRows; } else desiredRows = 1; } else { @@ -455,12 +456,13 @@ nsOutlinerBodyFrame::GetPrefSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSiz PRInt32 err; desiredRows = rows.ToInteger(&err); mHasFixedRowCount = PR_TRUE; + mPageCount = desiredRows; } else desiredRows = 0; } aSize.height = GetRowHeight() * desiredRows; - + AddBorderAndPadding(aSize); AddInset(aSize); nsIBox::AddCSSPrefSize(aBoxLayoutState, this, aSize); @@ -572,7 +574,9 @@ nsOutlinerBodyFrame::SetBounds(nsBoxLayoutState& aBoxLayoutState, const nsRect& if (recompute) { mInnerBox = GetInnerBox(); - mPageCount = mRowHeight ? (mInnerBox.height / mRowHeight) : 0; + + if (!mHasFixedRowCount) + mPageCount = mRowHeight ? (mInnerBox.height / mRowHeight) : 0; PRInt32 rowCount; mView->GetRowCount(&rowCount); @@ -1892,7 +1896,9 @@ NS_IMETHODIMP nsOutlinerBodyFrame::Paint(nsIPresContext* aPresContext, PRInt32 oldPageCount = mPageCount; mRowHeight = GetRowHeight(); mInnerBox = GetInnerBox(); - mPageCount = mInnerBox.height/mRowHeight; + + if (!mHasFixedRowCount) + mPageCount = mInnerBox.height/mRowHeight; if (mRowHeight != oldRowHeight || oldPageCount != mPageCount) { // Schedule a ResizeReflow that will update our page count properly.