Bug 78940. Fix nsOutlinerRows::First() logic so that we get a good iterator when the rows are empty. r=varga@utcru.sk, sr=hyatt

This commit is contained in:
waterson%netscape.com 2001-05-06 00:01:39 +00:00
parent 794a2200b0
commit 01dd4dd512
2 changed files with 12 additions and 8 deletions

View File

@ -95,10 +95,12 @@ nsOutlinerRows::Last()
// Build up a path along the rightmost edge of the tree
Subtree* current = &mRoot;
while (current && current->Count()) {
result.Push(current, current->Count() - 1);
current = GetSubtreeFor(current, current->Count() - 1);
}
do {
PRInt32 count = current->Count();
PRInt32 last = count - 1;
result.Push(current, last);
current = count ? GetSubtreeFor(current, last) : nsnull;
} while (current);
// Now, at the bottom rightmost leaf, advance us one off the end.
result.mLink[result.mTop].mChildIndex++;

View File

@ -95,10 +95,12 @@ nsOutlinerRows::Last()
// Build up a path along the rightmost edge of the tree
Subtree* current = &mRoot;
while (current && current->Count()) {
result.Push(current, current->Count() - 1);
current = GetSubtreeFor(current, current->Count() - 1);
}
do {
PRInt32 count = current->Count();
PRInt32 last = count - 1;
result.Push(current, last);
current = count ? GetSubtreeFor(current, last) : nsnull;
} while (current);
// Now, at the bottom rightmost leaf, advance us one off the end.
result.mLink[result.mTop].mChildIndex++;