Fix for 51084, sr=waterson

This commit is contained in:
hyatt%netscape.com 2000-09-20 23:10:48 +00:00
parent 57db879fec
commit 87fc282f05
2 changed files with 16 additions and 3 deletions

View File

@ -267,6 +267,20 @@ nsTreeLayout::Layout(nsIBox* aBox, nsBoxLayoutState& aState)
nsXULTreeOuterGroupFrame* outer = (nsXULTreeOuterGroupFrame*) frame;
nsTreeLayoutState state = outer->GetTreeLayoutState();
// Always ensure an accurate scrollview position
// This is an edge case that was caused by the row height
// changing after a scroll had occurred. (Bug #51084)
PRInt32 index;
outer->GetIndexOfFirstVisibleRow(&index);
if (index > 0) {
nscoord pos = outer->GetYPosition();
PRInt32 rowHeight = outer->GetRowHeightTwips();
if (pos != (rowHeight*index)) {
outer->VerticalScroll(rowHeight*index);
outer->Redraw(aState, nsnull, PR_FALSE);
}
}
nsresult rv = LayoutInternal(aBox, aState);
if (NS_FAILED(rv)) return rv;
state = outer->GetTreeLayoutState();

View File

@ -295,9 +295,7 @@ nsXULTreeOuterGroupFrame::SetRowHeight(nscoord aRowHeight)
nsBoxLayoutState state(mPresContext);
MarkDirtyChildren(state);
mTreeLayoutState = eTreeLayoutAbort;
if (mCurrentIndex > 0)
VerticalScroll(mCurrentIndex * mRowHeight);
PostReflowCallback();
}
}
@ -1040,6 +1038,7 @@ nsXULTreeOuterGroupFrame::IndexOfItem(nsIContent* aRoot, nsIContent* aContent,
NS_IMETHODIMP
nsXULTreeOuterGroupFrame::ReflowFinished(nsIPresShell* aPresShell, PRBool* aFlushFlag)
{
// Now dirty the world.s
nsCOMPtr<nsIContent> tree;
mContent->GetParent(*getter_AddRefs(tree));