From f7b52a47ea9f0008cdaadba5720e24e16c1da008 Mon Sep 17 00:00:00 2001 From: "aaronl%netscape.com" Date: Wed, 10 Jul 2002 07:39:35 +0000 Subject: [PATCH] Bug 30088. Type ahead find extension, fixing timeouts so that are reset on failed matches as well. Not part of build --- extensions/typeaheadfind/nsTypeAheadFind.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/extensions/typeaheadfind/nsTypeAheadFind.cpp b/extensions/typeaheadfind/nsTypeAheadFind.cpp index ef1f0793c1f..de6c0326114 100644 --- a/extensions/typeaheadfind/nsTypeAheadFind.cpp +++ b/extensions/typeaheadfind/nsTypeAheadFind.cpp @@ -564,6 +564,15 @@ NS_IMETHODIMP nsTypeAheadFind::KeyPress(nsIDOMEvent* aEvent) gIsFindingText = PR_TRUE; // prevents listener callbacks from resetting us during typeahead find processing nsresult rv = FindItNow(isLinksOnly, isFirstVisiblePreferred, isBackspace); + + // ------- If accessibility.typeaheadfind.timeout is set, cancel find after specified # milliseconds + if (mTimeoutLength) { + if (!mTimer) + mTimer = do_CreateInstance("@mozilla.org/timer;1"); + if (mTimer) + mTimer->Init(NS_STATIC_CAST(nsITimerCallback*, this), mTimeoutLength); + } + gIsFindingText = PR_FALSE; if (NS_SUCCEEDED(rv)) { @@ -590,13 +599,6 @@ NS_IMETHODIMP nsTypeAheadFind::KeyPress(nsIDOMEvent* aEvent) mFindService->SetFindBackwards(PR_FALSE); } - // ------- If accessibility.typeaheadfind.timeout is set, cancel find after specified # milliseconds - if (mTimeoutLength) { - if (!mTimer) - mTimer = do_CreateInstance("@mozilla.org/timer;1"); - if (mTimer) - mTimer->Init(NS_STATIC_CAST(nsITimerCallback*, this), mTimeoutLength); - } if (mTypeAheadBuffer.Length() == 1) { // If first letter, store where the first find succeeded (mStartFindRange) mStartFindRange = nsnull; nsCOMPtr startFindRange;