зеркало из https://github.com/mozilla/pjs.git
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:
Родитель
38a9c2b10c
Коммит
1dcf5820b3
|
@ -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(¤tIndex);
|
||||
if (currentIndex != -1)
|
||||
EnsureRowIsVisible(currentIndex);
|
||||
}
|
||||
|
||||
InvalidateScrollbar();
|
||||
CheckVerticalOverflow();
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче