Bug 178305. Typeaheadfind autowrap broken. r=kyle, sr=bz

This commit is contained in:
aaronl%netscape.com 2002-11-06 02:40:38 +00:00
Родитель 129ee000fe
Коммит a602d3e4ec
1 изменённых файлов: 21 добавлений и 17 удалений

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

@ -1182,14 +1182,6 @@ nsTypeAheadFind::FindItNow(nsIPresShell *aPresShell,
&& hasMoreDocShells) { && hasMoreDocShells) {
docShellEnumerator->GetNext(getter_AddRefs(currentContainer)); docShellEnumerator->GetNext(getter_AddRefs(currentContainer));
NS_ASSERTION(currentContainer, "HasMoreElements lied to us!"); NS_ASSERTION(currentContainer, "HasMoreElements lied to us!");
if (NS_FAILED(GetSearchContainers(currentContainer,
aIsRepeatingSameChar,
aIsFirstVisiblePreferred, PR_FALSE,
getter_AddRefs(presShell),
getter_AddRefs(presContext)))) {
return NS_ERROR_FAILURE;
}
currentDocShell = do_QueryInterface(currentContainer); currentDocShell = do_QueryInterface(currentContainer);
if (currentDocShell) { if (currentDocShell) {
@ -1203,19 +1195,30 @@ nsTypeAheadFind::FindItNow(nsIPresShell *aPresShell,
getter_AddRefs(docShellEnumerator)); getter_AddRefs(docShellEnumerator));
} while (docShellEnumerator); // ==== end second inner while === } while (docShellEnumerator); // ==== end second inner while ===
PRBool continueLoop = PR_FALSE;
if (currentDocShell != startingDocShell) { if (currentDocShell != startingDocShell) {
continue; // Try next document continueLoop = PR_TRUE; // Try next document
} }
else if (!hasWrapped || aIsFirstVisiblePreferred) {
// Finished searching through docshells: // Finished searching through docshells:
// If aFirstVisiblePreferred == PR_TRUE, we may need to go through all // If aFirstVisiblePreferred == PR_TRUE, we may need to go through all
// docshells twice -once to look for visible matches, the second time // docshells twice -once to look for visible matches, the second time
// for any match // for any match
if (!hasWrapped || aIsFirstVisiblePreferred) {
aIsFirstVisiblePreferred = PR_FALSE; aIsFirstVisiblePreferred = PR_FALSE;
hasWrapped = PR_TRUE; hasWrapped = PR_TRUE;
continueLoop = PR_TRUE; // Go through all docs again
}
continue; // Go through all docs again if (continueLoop) {
if (NS_FAILED(GetSearchContainers(currentContainer,
aIsRepeatingSameChar,
aIsFirstVisiblePreferred, PR_FALSE,
getter_AddRefs(presShell),
getter_AddRefs(presContext)))) {
return NS_ERROR_FAILURE;
}
continue;
} }
// ------------- Failed -------------- // ------------- Failed --------------
@ -1323,9 +1326,10 @@ nsTypeAheadFind::GetSearchContainers(nsISupports *aContainer,
// We need to set the start point this way, other methods haven't worked // We need to set the start point this way, other methods haven't worked
mStartPointRange->SelectNode(startNode); mStartPointRange->SelectNode(startNode);
mStartPointRange->SetStart(startNode, startOffset); mStartPointRange->SetStart(startNode, startOffset);
mStartPointRange->Collapse(PR_TRUE); // collapse to start
} }
mStartPointRange->Collapse(PR_TRUE); // collapse to start
*aPresShell = presShell; *aPresShell = presShell;
NS_ADDREF(*aPresShell); NS_ADDREF(*aPresShell);