Bug 30088. Not part of build. Typeaheadfind, fix for repeated character - could get stuck

git-svn-id: svn://10.0.0.236/trunk@125002 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
aaronl%netscape.com 2002-07-11 01:56:20 +00:00
parent 461addf685
commit 8043bb0de2
2 changed files with 7 additions and 6 deletions

View File

@ -671,7 +671,7 @@ nsresult nsTypeAheadFind::FindItNow(PRBool aIsLinksOnly, PRBool aIsFirstVisibleP
// ------------ Get ranges ready ----------------
nsCOMPtr<nsIDOMRange> searchRange, startPointRange, endPointRange, returnRange;
if (NS_FAILED(GetSearchContainers(currentContainer, aIsFirstVisiblePreferred,
if (NS_FAILED(GetSearchContainers(currentContainer, aIsFirstVisiblePreferred, PR_TRUE,
getter_AddRefs(presShell), getter_AddRefs(presContext),
getter_AddRefs(searchRange), getter_AddRefs(startPointRange),
getter_AddRefs(endPointRange))))
@ -743,7 +743,7 @@ nsresult nsTypeAheadFind::FindItNow(PRBool aIsLinksOnly, PRBool aIsFirstVisibleP
do {
if (NS_SUCCEEDED(docShellEnumerator->HasMoreElements(&hasMoreDocShells)) && hasMoreDocShells) {
docShellEnumerator->GetNext(getter_AddRefs(currentContainer));
if (NS_FAILED(GetSearchContainers(currentContainer, aIsFirstVisiblePreferred,
if (NS_FAILED(GetSearchContainers(currentContainer, aIsFirstVisiblePreferred, PR_FALSE,
getter_AddRefs(presShell), getter_AddRefs(presContext),
getter_AddRefs(searchRange), getter_AddRefs(startPointRange),
getter_AddRefs(endPointRange))))
@ -787,7 +787,8 @@ nsresult nsTypeAheadFind::FindItNow(PRBool aIsLinksOnly, PRBool aIsFirstVisibleP
}
nsresult nsTypeAheadFind::GetSearchContainers(nsISupports *aContainer, PRBool aIsFirstVisiblePreferred,
nsresult nsTypeAheadFind::GetSearchContainers(nsISupports *aContainer,
PRBool aIsFirstVisiblePreferred, PRBool aCanUseDocSelection,
nsIPresShell **aPresShell, nsIPresContext **aPresContext,
nsIDOMRange **aSearchRange, nsIDOMRange **aStartPointRange,
nsIDOMRange **aEndPointRange)
@ -831,7 +832,7 @@ nsresult nsTypeAheadFind::GetSearchContainers(nsISupports *aContainer, PRBool aI
// Consider current selection as null if it's not in the currently focused document
nsCOMPtr<nsIDOMRange> currentSelectionRange;
nsCOMPtr<nsIPresShell> selectionPresShell = do_QueryReferent(mFocusedWeakShell);
if (selectionPresShell == *aPresShell)
if (selectionPresShell == *aPresShell && aCanUseDocSelection)
mFocusedDocSelection->GetRangeAt(0, getter_AddRefs(currentSelectionRange));
if (!currentSelectionRange || aIsFirstVisiblePreferred) {
@ -851,7 +852,7 @@ nsresult nsTypeAheadFind::GetSearchContainers(nsISupports *aContainer, PRBool aI
}
if (!startNode)
startNode = rootNode;
startPointRange->SelectNode(startNode);
startPointRange->SetStart(startNode, startOffset);
startPointRange->Collapse(PR_TRUE); // collapse to start
}

View File

@ -132,7 +132,7 @@ protected:
PRBool IsRangeVisible(nsIPresShell *aPresShell, nsIPresContext *aPresContext,
nsIDOMRange *aRange, PRBool aMustBeVisible, nsIDOMRange **aNewRange);
nsresult FindItNow(PRBool aIsLinksOnly, PRBool aIsFirstVisiblePreferred, PRBool aIsBackspace);
nsresult GetSearchContainers(nsISupports *aContainer, PRBool aIsFirstVisiblePreferred,
nsresult GetSearchContainers(nsISupports *aContainer, PRBool aIsFirstVisiblePreferred, PRBool aCanUseDocSelection,
nsIPresShell **aPresShell, nsIPresContext **aPresContext,
nsIDOMRange **aSearchRange, nsIDOMRange **aStartRange, nsIDOMRange **aEndRange);
void DisplayStatus(PRBool aSuccess, PRBool aClearStatus);