From 8043bb0de2dcfda4287ec45aa210cf15ed170f3d Mon Sep 17 00:00:00 2001 From: "aaronl%netscape.com" Date: Thu, 11 Jul 2002 01:56:20 +0000 Subject: [PATCH] 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 --- mozilla/extensions/typeaheadfind/nsTypeAheadFind.cpp | 11 ++++++----- mozilla/extensions/typeaheadfind/nsTypeAheadFind.h | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/mozilla/extensions/typeaheadfind/nsTypeAheadFind.cpp b/mozilla/extensions/typeaheadfind/nsTypeAheadFind.cpp index 56d28fc78b1..7f5e5ff79a7 100644 --- a/mozilla/extensions/typeaheadfind/nsTypeAheadFind.cpp +++ b/mozilla/extensions/typeaheadfind/nsTypeAheadFind.cpp @@ -671,7 +671,7 @@ nsresult nsTypeAheadFind::FindItNow(PRBool aIsLinksOnly, PRBool aIsFirstVisibleP // ------------ Get ranges ready ---------------- nsCOMPtr 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 currentSelectionRange; nsCOMPtr 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 } diff --git a/mozilla/extensions/typeaheadfind/nsTypeAheadFind.h b/mozilla/extensions/typeaheadfind/nsTypeAheadFind.h index 03aecab7e0a..7597cbad3a4 100644 --- a/mozilla/extensions/typeaheadfind/nsTypeAheadFind.h +++ b/mozilla/extensions/typeaheadfind/nsTypeAheadFind.h @@ -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);