fix for #163404. when the height of a tree shrinks, we should ensure that the selected row is still visible. this really comes into play in the mailnews thread pane.

when I show the message pane (after it has been collapsed), the selected message can go out of view.

if the size of the thread pane shrinks because I move the splitter or make the whole window smaller, it can happen as well.

Note Outlook Express does the same thing.

r=varga, sr=bryner.  thanks to martinl for the bug report.
This commit is contained in:
sspitzer%netscape.com 2002-08-22 00:21:20 +00:00
Родитель 4006ecbb3c
Коммит eb537e0075
1 изменённых файлов: 12 добавлений и 1 удалений

Просмотреть файл

@ -634,9 +634,20 @@ nsTreeBodyFrame::ReflowFinished(nsIPresShell* aPresShell, PRBool* aFlushFlag)
PRInt32 rowCount;
mView->GetRowCount(&rowCount);
PRInt32 lastPageTopRow = PR_MAX(0, rowCount - mPageCount);
if (mTopRowIndex >= lastPageTopRow)
if (mTopRowIndex > lastPageTopRow)
ScrollToRow(lastPageTopRow);
// make sure that the current selected item is still
// visible after the tree changes size.
nsCOMPtr<nsITreeSelection> sel;
mView->GetSelection(getter_AddRefs(sel));
if (sel) {
PRInt32 currentIndex;
sel->GetCurrentIndex(&currentIndex);
if (currentIndex != -1)
EnsureRowIsVisible(currentIndex);
}
InvalidateScrollbar();
CheckVerticalOverflow();
}