Fix for 43326. r=ben

git-svn-id: svn://10.0.0.236/trunk@78383 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
hyatt%netscape.com 2000-09-07 10:26:51 +00:00
parent b1873387f5
commit 4ffca0e0e4
4 changed files with 47 additions and 3 deletions

View File

@ -104,6 +104,23 @@ GetImmediateChild(nsIContent* aParent, nsIAtom* aTag, nsIContent** aResult)
return;
}
NS_IMETHODIMP
nsXULTreeFrame::DoLayout(nsBoxLayoutState& aBoxLayoutState)
{
nsXULTreeOuterGroupFrame* treeOuterGroup = nsnull;
GetTreeBody(&treeOuterGroup);
if (treeOuterGroup)
treeOuterGroup->SetLayingOut(PR_TRUE);
nsresult rv = nsBoxFrame::DoLayout(aBoxLayoutState);
if (treeOuterGroup)
treeOuterGroup->SetLayingOut(PR_FALSE);
return rv;
}
NS_IMETHODIMP
nsXULTreeFrame::EnsureRowIsVisible(PRInt32 aRowIndex)
{

View File

@ -39,6 +39,8 @@ public:
NS_DECL_ISUPPORTS
NS_IMETHOD DoLayout(nsBoxLayoutState& aBoxLayoutState);
// nsITreeFrame
NS_IMETHOD EnsureRowIsVisible(PRInt32 aRowIndex);
NS_IMETHOD GetNextItem(nsIDOMElement* aStartItem, PRInt32 aDelta, nsIDOMElement** aResult);

View File

@ -200,6 +200,8 @@ nsXULTreeOuterGroupFrame::Init(nsIPresContext* aPresContext, nsIContent* aConten
{
nsresult rv = nsXULTreeGroupFrame::Init(aPresContext, aContent, aParent, aContext, aPrevInFlow);
mLayingOut = PR_FALSE;
float p2t;
aPresContext->GetScaledPixelsToTwips(&p2t);
mOnePixel = NSIntPixelsToTwips(1, p2t);
@ -252,6 +254,13 @@ nsXULTreeOuterGroupFrame::Init(nsIPresContext* aPresContext, nsIContent* aConten
} // Init
NS_IMETHODIMP
nsXULTreeOuterGroupFrame::DoLayout(nsBoxLayoutState& aBoxLayoutState)
{
nsresult rv = nsXULTreeGroupFrame::DoLayout(aBoxLayoutState);
return rv;
}
PRBool
nsXULTreeOuterGroupFrame::IsFixedRowSize()
{
@ -530,8 +539,13 @@ nsXULTreeOuterGroupFrame::InternalPositionChanged(PRBool aUp, PRInt32 aDelta)
VerticalScroll(mCurrentIndex*mRowHeight);
nsBoxLayoutState state(mPresContext);
MarkDirtyChildren(state);
if (mLayingOut) {
PostReflowCallback();
}
else {
nsBoxLayoutState state(mPresContext);
MarkDirtyChildren(state);
}
return NS_OK;
}
@ -926,7 +940,13 @@ nsXULTreeOuterGroupFrame::EnsureRowIsVisible(PRInt32 aRowIndex)
InternalPositionChanged(up, delta);
// This change has to happen immediately.
PostReflowCallback();
if (mLayingOut) {
PostReflowCallback();
}
else {
nsBoxLayoutState state(mPresContext);
MarkDirtyChildren(state);
}
}
void

View File

@ -106,6 +106,8 @@ public:
NS_IMETHOD Init(nsIPresContext* aPresContext, nsIContent* aContent,
nsIFrame* aParent, nsIStyleContext* aContext, nsIFrame* aPrevInFlow);
NS_IMETHOD DoLayout(nsBoxLayoutState& aBoxLayoutState);
// nsIReflowCallback
NS_IMETHOD ReflowFinished(nsIPresShell* aPresShell, PRBool* aFlushFlag);
@ -139,6 +141,8 @@ public:
void SetRowHeight(PRInt32 aRowHeight);
PRBool IsFixedRowSize();
void SetLayingOut(PRBool aLayingOut) { mLayingOut = aLayingOut; };
nscoord GetYPosition();
nscoord GetAvailableHeight();
NS_IMETHOD GetNumberOfVisibleRows(PRInt32 *aResult) {
@ -223,6 +227,7 @@ protected:
nsTreeLayoutState mTreeLayoutState;
PRBool mReflowCallbackPosted;
PRBool mLayingOut;
}; // class nsXULTreeOuterGroupFrame