Bug 168634. Type Ahead Find should prefer visible match. r=kyle, sr=bzbarsky

This commit is contained in:
aaronl%netscape.com 2002-09-26 07:49:46 +00:00
Родитель 5713d4df02
Коммит c94ebf612b
6 изменённых файлов: 7 добавлений и 148 удалений

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

@ -1,19 +0,0 @@
<?xml version="1.0"?>
<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:chrome="http://www.mozilla.org/rdf/chrome#">
<!-- list all the packages being supplied -->
<RDF:Seq about="urn:mozilla:package:root">
<RDF:li resource="urn:mozilla:package:typeaheadfind"/>
</RDF:Seq>
<!-- package information -->
<RDF:Description about="urn:mozilla:package:typeaheadfind"
chrome:displayName="Type Ahead Find"
chrome:author="mozilla.org"
chrome:name="typeaheadfind"
chrome:localeVersion="1.2a">
</RDF:Description>
</RDF:RDF>

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

@ -1,19 +0,0 @@
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is Mozilla Communicator client code, released
# March 31, 1998.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998-1999 Netscape Communications Corporation. All
# Rights Reserved.
typeaheadfind.js

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

@ -1,42 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 2001
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Aaron Leventhal <aaronl@netscape.com> (original author)
*
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
pref("accessibility.typeaheadfind", true);
pref("accessibility.typeaheadfind.linksonly", true);
pref("accessibility.typeaheadfind.startlinksonly", false);
pref("accessibility.typeaheadfind.timeout", 5000);

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

@ -1,61 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Original Author: Aaron Leventhal (aaronl@netscape.com)
* Contributors:
*
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var gVersion = "0.1";
var err = initInstall("Type Ahead Find", "typeaheadfind", gVersion);
logComment("initInstall: " + err);
var fProgram = getFolder("Program");
logComment("fProgram: " + fProgram);
err = addDirectory("", gVersion, "bin", fProgram, "", true);
logComment("addDirectory: " + err);
// Register chrome
registerChrome(LOCALE | DELAYED_CHROME, getFolder("Chrome","typeaheadfind.jar"), "locale/en-US/typeaheadfind/");
if (getLastError() == SUCCESS) {
err = performInstall();
logComment("performInstall: " + err);
} else {
cancelInstall(err);
}

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

@ -137,7 +137,7 @@ nsTypeAheadFind::nsTypeAheadFind():
mLiteralTextSearchOnly(PR_FALSE), mDontTryExactMatch(PR_FALSE),
mLinksOnlyManuallySet(PR_FALSE), mIsFindingText(PR_FALSE),
mIsMenuBarActive(PR_FALSE), mIsMenuPopupActive(PR_FALSE),
mBadKeysSinceMatch(0),
mIsFirstVisiblePreferred(PR_FALSE), mBadKeysSinceMatch(0),
mRepeatingMode(eRepeatingNone), mTimeoutLength(0)
{
NS_INIT_ISUPPORTS();
@ -578,7 +578,6 @@ nsTypeAheadFind::KeyPress(nsIDOMEvent* aEvent)
return NS_OK;
}
PRBool isFirstVisiblePreferred = PR_FALSE;
PRBool isBackspace = PR_FALSE; // When backspace is pressed
// ------------- Escape pressed ---------------------
@ -726,8 +725,8 @@ nsTypeAheadFind::KeyPress(nsIDOMEvent* aEvent)
// If true, we will scan from top left of visible area
// If false, we will scan from start of selection
isFirstVisiblePreferred = !mCaretBrowsingOn && isSelectionCollapsed;
if (isFirstVisiblePreferred) {
mIsFirstVisiblePreferred = !mCaretBrowsingOn && isSelectionCollapsed;
if (mIsFirstVisiblePreferred) {
// Get focused content from esm. If it's null, the document is focused.
// If not, make sure the selection is in sync with the focus, so we can
// start our search from there.
@ -743,7 +742,7 @@ nsTypeAheadFind::KeyPress(nsIDOMEvent* aEvent)
if (focusedContent) {
mIsFindingText = PR_TRUE; // prevent selection listener from calling CancelFind()
esm->MoveCaretToFocus();
isFirstVisiblePreferred = PR_FALSE;
mIsFirstVisiblePreferred = PR_FALSE;
}
}
}
@ -764,14 +763,14 @@ nsTypeAheadFind::KeyPress(nsIDOMEvent* aEvent)
// Regular find, not repeated char find
// Prefer to find exact match
rv = FindItNow(PR_FALSE, mLinksOnly, isFirstVisiblePreferred, isBackspace);
rv = FindItNow(PR_FALSE, mLinksOnly, mIsFirstVisiblePreferred, isBackspace);
}
#ifndef NO_LINK_CYCLE_ON_SAME_CHAR
if (NS_FAILED(rv) && !mLiteralTextSearchOnly &&
mRepeatingMode == eRepeatingChar) {
mDontTryExactMatch = PR_TRUE; // Repeated character find mode
rv = FindItNow(PR_TRUE, PR_TRUE, isFirstVisiblePreferred, isBackspace);
rv = FindItNow(PR_TRUE, PR_TRUE, mIsFirstVisiblePreferred, isBackspace);
}
#endif
}

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

@ -174,6 +174,7 @@ protected:
PRPackedBool mIsFindingText;
PRPackedBool mIsMenuBarActive;
PRPackedBool mIsMenuPopupActive;
PRPackedBool mIsFirstVisiblePreferred;
PRInt32 mBadKeysSinceMatch;
PRInt32 mRepeatingMode;
PRInt32 mTimeoutLength; // time in ms before find is automatically cancelled