Bug 754265 - Add a dedicated API to provide a final complete value different from the matching one, r=Enn sr=gavin

This commit is contained in:
Marco Bonardo 2014-04-18 16:04:19 +02:00
parent 408ccab8db
commit cb09de0d98
31 changed files with 292 additions and 59 deletions

View File

@ -199,6 +199,11 @@ AutoCompleteResult.prototype =
return "";
},
getFinalCompleteValueAt: function(aIndex)
{
return this.getValueAt(aIndex);
},
removeValueAt: function (aRowIndex, aRemoveFromDb) {},
// nsISupports implementation

View File

@ -410,7 +410,7 @@ nsAutoCompleteController::HandleKeyNavigation(uint32_t aKey, bool *_retval)
if (selectedIndex >= 0) {
// A result is selected, so fill in its value
nsAutoString value;
if (NS_SUCCEEDED(GetResultValueAt(selectedIndex, true, value))) {
if (NS_SUCCEEDED(GetResultValueAt(selectedIndex, false, value))) {
input->SetTextValue(value);
input->SelectTextRange(value.Length(), value.Length());
}
@ -481,7 +481,7 @@ nsAutoCompleteController::HandleKeyNavigation(uint32_t aKey, bool *_retval)
if (selectedIndex >= 0) {
// The pop-up is open and has a selection, take its value
nsAutoString value;
if (NS_SUCCEEDED(GetResultValueAt(selectedIndex, true, value))) {
if (NS_SUCCEEDED(GetResultValueAt(selectedIndex, false, value))) {
input->SetTextValue(value);
input->SelectTextRange(value.Length(), value.Length());
}
@ -579,7 +579,7 @@ nsAutoCompleteController::HandleDelete(bool *_retval)
input->GetCompleteDefaultIndex(&shouldComplete);
if (shouldComplete) {
nsAutoString value;
if (NS_SUCCEEDED(GetResultValueAt(index, true, value))) {
if (NS_SUCCEEDED(GetResultValueAt(index, false, value))) {
CompleteValue(value);
}
}
@ -616,7 +616,7 @@ nsAutoCompleteController::GetResultAt(int32_t aIndex, nsIAutoCompleteResult** aR
NS_IMETHODIMP
nsAutoCompleteController::GetValueAt(int32_t aIndex, nsAString & _retval)
{
GetResultLabelAt(aIndex, false, _retval);
GetResultLabelAt(aIndex, _retval);
return NS_OK;
}
@ -624,7 +624,7 @@ nsAutoCompleteController::GetValueAt(int32_t aIndex, nsAString & _retval)
NS_IMETHODIMP
nsAutoCompleteController::GetLabelAt(int32_t aIndex, nsAString & _retval)
{
GetResultLabelAt(aIndex, false, _retval);
GetResultLabelAt(aIndex, _retval);
return NS_OK;
}
@ -662,6 +662,18 @@ nsAutoCompleteController::GetImageAt(int32_t aIndex, nsAString & _retval)
return result->GetImageAt(rowIndex, _retval);
}
NS_IMETHODIMP
nsAutoCompleteController::GetFinalCompleteValueAt(int32_t aIndex,
nsAString & _retval)
{
int32_t rowIndex;
nsIAutoCompleteResult* result;
nsresult rv = GetResultAt(aIndex, &result, &rowIndex);
NS_ENSURE_SUCCESS(rv, rv);
return result->GetFinalCompleteValueAt(rowIndex, _retval);
}
NS_IMETHODIMP
nsAutoCompleteController::SetSearchString(const nsAString &aSearchString)
{
@ -1181,9 +1193,14 @@ nsAutoCompleteController::EnterMatch(bool aIsPopupSelection)
// enter it into the textbox. If completeselectedindex is true, or
// EnterMatch was called via other means, for instance pressing Enter,
// don't fill in the value as it will have already been filled in as
// needed.
if (!completeSelection || aIsPopupSelection)
GetResultValueAt(selectedIndex, true, value);
// needed, unless the final complete value differs.
nsAutoString finalValue, inputValue;
GetResultValueAt(selectedIndex, true, finalValue);
input->GetTextValue(inputValue);
if (!completeSelection || aIsPopupSelection ||
!finalValue.Equals(inputValue)) {
value = finalValue;
}
}
else if (shouldComplete) {
// We usually try to preserve the casing of what user has typed, but
@ -1206,7 +1223,7 @@ nsAutoCompleteController::EnterMatch(bool aIsPopupSelection)
int32_t defaultIndex;
result->GetDefaultIndex(&defaultIndex);
if (defaultIndex >= 0) {
result->GetValueAt(defaultIndex, value);
result->GetFinalCompleteValueAt(defaultIndex, value);
break;
}
}
@ -1549,18 +1566,10 @@ nsAutoCompleteController::GetFinalDefaultCompleteValue(nsAString &_retval)
return NS_ERROR_FAILURE;
}
// Hack: For typeAheadResults allow the comment to be used as the final
// defaultComplete value if provided, otherwise fall back to the usual
// value. This allows to provide a different complete text when the user
// confirms the match. Don't rely on this for production code, since it's a
// temporary solution that needs a dedicated API (bug 754265).
bool isTypeAheadResult = false;
nsAutoString commentValue;
if (NS_SUCCEEDED(result->GetTypeAheadResult(&isTypeAheadResult)) &&
isTypeAheadResult &&
NS_SUCCEEDED(result->GetCommentAt(defaultIndex, commentValue)) &&
!commentValue.IsEmpty()) {
_retval = commentValue;
nsAutoString finalCompleteValue;
rv = result->GetFinalCompleteValueAt(defaultIndex, finalCompleteValue);
if (NS_SUCCEEDED(rv)) {
_retval = finalCompleteValue;
}
MOZ_ASSERT(FindInReadable(inputValue, _retval, nsCaseInsensitiveStringComparator()),
@ -1625,20 +1634,23 @@ nsAutoCompleteController::CompleteValue(nsString &aValue)
}
nsresult
nsAutoCompleteController::GetResultLabelAt(int32_t aIndex, bool aValueOnly, nsAString & _retval)
nsAutoCompleteController::GetResultLabelAt(int32_t aIndex, nsAString & _retval)
{
return GetResultValueLabelAt(aIndex, aValueOnly, false, _retval);
return GetResultValueLabelAt(aIndex, false, false, _retval);
}
nsresult
nsAutoCompleteController::GetResultValueAt(int32_t aIndex, bool aValueOnly, nsAString & _retval)
nsAutoCompleteController::GetResultValueAt(int32_t aIndex, bool aGetFinalValue,
nsAString & _retval)
{
return GetResultValueLabelAt(aIndex, aValueOnly, true, _retval);
return GetResultValueLabelAt(aIndex, aGetFinalValue, true, _retval);
}
nsresult
nsAutoCompleteController::GetResultValueLabelAt(int32_t aIndex, bool aValueOnly,
bool aGetValue, nsAString & _retval)
nsAutoCompleteController::GetResultValueLabelAt(int32_t aIndex,
bool aGetFinalValue,
bool aGetValue,
nsAString & _retval)
{
NS_ENSURE_TRUE(aIndex >= 0 && (uint32_t) aIndex < mRowCount, NS_ERROR_ILLEGAL_VALUE);
@ -1651,12 +1663,14 @@ nsAutoCompleteController::GetResultValueLabelAt(int32_t aIndex, bool aValueOnly,
result->GetSearchResult(&searchResult);
if (searchResult == nsIAutoCompleteResult::RESULT_FAILURE) {
if (aValueOnly)
if (aGetValue)
return NS_ERROR_FAILURE;
result->GetErrorDescription(_retval);
} else if (searchResult == nsIAutoCompleteResult::RESULT_SUCCESS ||
searchResult == nsIAutoCompleteResult::RESULT_SUCCESS_ONGOING) {
if (aGetValue)
if (aGetFinalValue)
result->GetFinalCompleteValueAt(rowIndex, _retval);
else if (aGetValue)
result->GetValueAt(rowIndex, _retval);
else
result->GetLabelAt(rowIndex, _retval);

View File

@ -59,12 +59,11 @@ protected:
nsresult GetResultAt(int32_t aIndex, nsIAutoCompleteResult** aResult,
int32_t* aRowIndex);
nsresult GetResultValueAt(int32_t aIndex, bool aValueOnly,
nsAString & _retval);
nsresult GetResultLabelAt(int32_t aIndex, bool aValueOnly,
nsresult GetResultValueAt(int32_t aIndex, bool aGetFinalValue,
nsAString & _retval);
nsresult GetResultLabelAt(int32_t aIndex, nsAString & _retval);
private:
nsresult GetResultValueLabelAt(int32_t aIndex, bool aValueOnly,
nsresult GetResultValueLabelAt(int32_t aIndex, bool aGetFinalValue,
bool aGetValue, nsAString & _retval);
protected:

View File

@ -90,7 +90,8 @@ NS_IMETHODIMP
nsAutoCompleteSimpleResult::AppendMatch(const nsAString& aValue,
const nsAString& aComment,
const nsAString& aImage,
const nsAString& aStyle)
const nsAString& aStyle,
const nsAString& aFinalCompleteValue)
{
CheckInvariants();
@ -111,6 +112,13 @@ nsAutoCompleteSimpleResult::AppendMatch(const nsAString& aValue,
mImages.RemoveElementAt(mImages.Length() - 1);
return NS_ERROR_OUT_OF_MEMORY;
}
if (!mFinalCompleteValues.AppendElement(aFinalCompleteValue)) {
mValues.RemoveElementAt(mValues.Length() - 1);
mComments.RemoveElementAt(mComments.Length() - 1);
mImages.RemoveElementAt(mImages.Length() - 1);
mStyles.RemoveElementAt(mStyles.Length() - 1);
return NS_ERROR_OUT_OF_MEMORY;
}
return NS_OK;
}
@ -170,6 +178,19 @@ nsAutoCompleteSimpleResult::GetStyleAt(int32_t aIndex, nsAString& _retval)
return NS_OK;
}
NS_IMETHODIMP
nsAutoCompleteSimpleResult::GetFinalCompleteValueAt(int32_t aIndex,
nsAString& _retval)
{
NS_ENSURE_TRUE(aIndex >= 0 && aIndex < int32_t(mFinalCompleteValues.Length()),
NS_ERROR_ILLEGAL_VALUE);
CheckInvariants();
_retval = mFinalCompleteValues[aIndex];
if (_retval.Length() == 0)
_retval = mValues[aIndex];
return NS_OK;
}
NS_IMETHODIMP
nsAutoCompleteSimpleResult::SetListener(nsIAutoCompleteSimpleResultListener* aListener)
{
@ -189,6 +210,7 @@ nsAutoCompleteSimpleResult::RemoveValueAt(int32_t aRowIndex,
mComments.RemoveElementAt(aRowIndex);
mImages.RemoveElementAt(aRowIndex);
mStyles.RemoveElementAt(aRowIndex);
mFinalCompleteValues.RemoveElementAt(aRowIndex);
if (mListener)
mListener->OnValueRemoved(this, removedValue, aRemoveFromDb);

View File

@ -21,6 +21,7 @@ public:
NS_ASSERTION(mValues.Length() == mComments.Length(), "Arrays out of sync");
NS_ASSERTION(mValues.Length() == mImages.Length(), "Arrays out of sync");
NS_ASSERTION(mValues.Length() == mStyles.Length(), "Arrays out of sync");
NS_ASSERTION(mValues.Length() == mFinalCompleteValues.Length(), "Arrays out of sync");
}
NS_DECL_ISUPPORTS
@ -39,6 +40,7 @@ protected:
nsTArray<nsString> mComments;
nsTArray<nsString> mImages;
nsTArray<nsString> mStyles;
nsTArray<nsString> mFinalCompleteValues;
nsString mSearchString;
nsString mErrorDescription;

View File

@ -6,7 +6,7 @@
interface nsIAutoCompleteInput;
[scriptable, uuid(dd2c4489-e4bd-4702-86bc-e1691744e556)]
[scriptable, uuid(ff9f8465-204a-47a6-b3c9-0628b3856684)]
interface nsIAutoCompleteController : nsISupports
{
/*
@ -134,6 +134,12 @@ interface nsIAutoCompleteController : nsISupports
*/
AString getImageAt(in long index);
/*
* For the last completed search, get the final value that should be completed
* when the user confirms the match at the given index
*/
AString getFinalCompleteValueAt(in long index);
/*
* Get / set the current search string. Note, setting will not start searching
*/

View File

@ -4,7 +4,7 @@
#include "nsISupports.idl"
[scriptable, uuid(7b43fad1-c735-4b45-9383-c3f057fed20d)]
[scriptable, uuid(9203c031-c4e7-4537-a4ec-81443d623d5a)]
interface nsIAutoCompleteResult : nsISupports
{
/**
@ -81,6 +81,12 @@ interface nsIAutoCompleteResult : nsISupports
*/
AString getImageAt(in long index);
/**
* Get the final value that should be completed when the user confirms
* the match at the given index.
*/
AString getFinalCompleteValueAt(in long index);
/**
* Remove the value at the given index from the autocomplete results.
* If removeFromDb is set to true, the value should be removed from

View File

@ -14,7 +14,7 @@ interface nsIAutoCompleteSimpleResultListener;
* an array.
*/
[scriptable, uuid(c738dc26-aa71-4561-a3fd-b5a0e4aa80d2)]
[scriptable, uuid(fe8802f9-c2b7-4141-8e5b-280df3f62251)]
interface nsIAutoCompleteSimpleResult : nsIAutoCompleteResult
{
/**
@ -48,12 +48,25 @@ interface nsIAutoCompleteSimpleResult : nsIAutoCompleteResult
void setTypeAheadResult(in boolean aHidden);
/**
* Appends a result item consisting of the given value, comment, image and style.
* This is how you add results. Note: image and style are optional.
* Appends a match consisting of the given value, comment, image, style and
* the value to use for defaultIndex completion.
* @param aValue
* The value to autocomplete to
* @param aComment
* Comment shown in the autocomplete widget to describe this match
* @param aImage
* Image shown in the autocomplete widget for this match.
* @param aStyle
* Describes how to style the match in the autocomplete widget
* @param aFinalCompleteValue
* Value used when the user confirms selecting this match. If not
* provided, aValue will be used.
*/
void appendMatch(in AString aValue, in AString aComment,
[optional] in AString aImage,
[optional] in AString aStyle);
void appendMatch(in AString aValue,
in AString aComment,
[optional] in AString aImage,
[optional] in AString aStyle,
[optional] in AString aFinalCompleteValue);
/**
* Sets a listener for changes in the result.

View File

@ -78,7 +78,8 @@ AutoCompleteResultBase.prototype = {
_values: null,
_comments: [],
_styles: [],
_finalCompleteValues: [],
searchString: "",
searchResult: null,
@ -113,6 +114,10 @@ AutoCompleteResultBase.prototype = {
return "";
},
getFinalCompleteValueAt: function(aIndex) {
return this._finalCompleteValues[aIndex] || this._values[aIndex];
},
removeValueAt: function (aRowIndex, aRemoveFromDb) {},
// nsISupports implementation

View File

@ -123,6 +123,10 @@ AutoCompleteResult.prototype = {
return "";
},
getFinalCompleteValueAt: function(aIndex) {
return this.getValueAt(aIndex);
},
removeValueAt: function (aRowIndex, aRemoveFromDb) {},
// nsISupports implementation

View File

@ -122,6 +122,10 @@ AutoCompleteResult.prototype = {
return "";
},
getFinalCompleteValueAt: function(aIndex) {
return this.getValueAt(aIndex);
},
removeValueAt: function (aRowIndex, aRemoveFromDb) {},
// nsISupports implementation

View File

@ -121,6 +121,10 @@ AutoCompleteResult.prototype = {
return "";
},
getFinalCompleteValueAt: function(aIndex) {
return this.getValueAt(aIndex);
},
removeValueAt: function (aRowIndex, aRemoveFromDb) {},
// nsISupports implementation

View File

@ -110,6 +110,10 @@ AutoCompleteResult.prototype = {
return "";
},
getFinalCompleteValueAt: function(aIndex) {
return this.getValueAt(aIndex);
},
removeValueAt: function (aRowIndex, aRemoveFromDb) {},
// nsISupports implementation

View File

@ -0,0 +1,54 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
function AutoCompleteResult(aValues, aFinalCompleteValues) {
this._values = aValues;
this._finalCompleteValues = aFinalCompleteValues;
}
AutoCompleteResult.prototype = Object.create(AutoCompleteResultBase.prototype);
function AutoCompleteInput(aSearches) {
this.searches = aSearches;
this.popup.selectedIndex = 0;
}
AutoCompleteInput.prototype = Object.create(AutoCompleteInputBase.prototype);
function run_test() {
run_next_test();
}
add_test(function test_handleEnter() {
doSearch("moz", "mozilla.com", "http://www.mozilla.com", function(aController) {
do_check_eq(aController.input.textValue, "moz");
do_check_eq(aController.getFinalCompleteValueAt(0), "http://www.mozilla.com");
aController.handleEnter(false);
do_check_eq(aController.input.textValue, "http://www.mozilla.com");
});
});
function doSearch(aSearchString, aResultValue, aFinalCompleteValue, aOnCompleteCallback) {
let search = new AutoCompleteSearchBase(
"search",
new AutoCompleteResult([ aResultValue ], [ aFinalCompleteValue ])
);
registerAutoCompleteSearch(search);
let controller = Cc["@mozilla.org/autocomplete/controller;1"].
getService(Ci.nsIAutoCompleteController);
// Make an AutoCompleteInput that uses our searches and confirms results.
let input = new AutoCompleteInput([ search.name ]);
input.textValue = aSearchString;
controller.input = input;
controller.startSearch(aSearchString);
input.onSearchComplete = function onSearchComplete() {
aOnCompleteCallback(controller);
// Clean up.
unregisterAutoCompleteSearch(search);
run_next_test();
};
}

View File

@ -0,0 +1,56 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
function AutoCompleteResult(aValues, aFinalCompleteValues) {
this._values = aValues;
this._finalCompleteValues = aFinalCompleteValues;
this.defaultIndex = 0;
}
AutoCompleteResult.prototype = Object.create(AutoCompleteResultBase.prototype);
function AutoCompleteInput(aSearches) {
this.searches = aSearches;
this.popup.selectedIndex = -1;
}
AutoCompleteInput.prototype = Object.create(AutoCompleteInputBase.prototype);
function run_test() {
run_next_test();
}
add_test(function test_handleEnter() {
doSearch("", "mozilla.com", "http://www.mozilla.com", function(aController) {
do_check_eq(aController.input.textValue, "");
do_check_eq(aController.getFinalCompleteValueAt(0), "http://www.mozilla.com");
aController.input.forceComplete = true;
aController.handleEnter(false);
do_check_eq(aController.input.textValue, "http://www.mozilla.com");
});
});
function doSearch(aSearchString, aResultValue, aFinalCompleteValue, aOnCompleteCallback) {
let search = new AutoCompleteSearchBase(
"search",
new AutoCompleteResult([ aResultValue ], [ aFinalCompleteValue ])
);
registerAutoCompleteSearch(search);
let controller = Cc["@mozilla.org/autocomplete/controller;1"].
getService(Ci.nsIAutoCompleteController);
// Make an AutoCompleteInput that uses our searches and confirms results.
let input = new AutoCompleteInput([ search.name ]);
input.textValue = aSearchString;
controller.input = input;
controller.startSearch(aSearchString);
input.onSearchComplete = function onSearchComplete() {
aOnCompleteCallback(controller);
// Clean up.
unregisterAutoCompleteSearch(search);
run_next_test();
};
}

View File

@ -2,11 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
function AutoCompleteResult(aValues, aComments) {
function AutoCompleteResult(aValues, aFinalCompleteValues) {
this._values = aValues;
this._comments = aComments;
this._finalCompleteValues = aFinalCompleteValues;
this.defaultIndex = 0;
this._typeAheadResult = true;
}
AutoCompleteResult.prototype = Object.create(AutoCompleteResultBase.prototype);
@ -37,10 +36,10 @@ add_test(function test_handleEnter() {
});
});
function doSearch(aSearchString, aResultValue, aCommentValue, aOnCompleteCallback) {
function doSearch(aSearchString, aResultValue, aFinalCompleteValue, aOnCompleteCallback) {
let search = new AutoCompleteSearchBase(
"search",
new AutoCompleteResult([ aResultValue ], [ aCommentValue ], 0)
new AutoCompleteResult([ aResultValue ], [ aFinalCompleteValue ])
);
registerAutoCompleteSearch(search);

View File

@ -2,17 +2,16 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
function AutoCompleteTypeAheadResult(aValues, aComments) {
function AutoCompleteTypeAheadResult(aValues, aFinalCompleteValues) {
this._values = aValues;
this._comments = aComments;
this._finalCompleteValues = aFinalCompleteValues;
this.defaultIndex = 0;
this._typeAheadResult = true;
}
AutoCompleteTypeAheadResult.prototype = Object.create(AutoCompleteResultBase.prototype);
function AutoCompleteResult(aValues, aComments) {
function AutoCompleteResult(aValues) {
this._values = aValues;
this._comments = aComments;
}
AutoCompleteResult.prototype = Object.create(AutoCompleteResultBase.prototype);
@ -45,7 +44,7 @@ function doSearch(aSearchString, aOnCompleteCallback) {
let search = new AutoCompleteSearchBase(
"search",
new AutoCompleteResult([ "mozilla.org" ], [ "http://www.mozilla.org" ])
new AutoCompleteResult([ "mozilla.org" ])
);
registerAutoCompleteSearch(search);

View File

@ -121,6 +121,10 @@ AutoCompleteResult.prototype = {
return "";
},
getFinalCompleteValueAt: function(aIndex) {
return this.getValueAt(aIndex);
},
removeValueAt: function (aRowIndex, aRemoveFromDb) {},
// nsISupports implementation

View File

@ -11,6 +11,8 @@ tail =
[test_autocomplete_multiple.js]
[test_badDefaultIndex.js]
[test_completeDefaultIndex_casing.js]
[test_finalCompleteValue.js]
[test_finalCompleteValue_forceComplete.js]
[test_finalDefaultCompleteValue.js]
[test_hiddenResult.js]
[test_immediate_search.js]

View File

@ -172,6 +172,11 @@ NS_IMETHODIMP nsFileResult::GetImageAt(int32_t index, nsAString & aImage)
aImage.Truncate();
return NS_OK;
}
NS_IMETHODIMP nsFileResult::GetFinalCompleteValueAt(int32_t index,
nsAString & aValue)
{
return GetValueAt(index, aValue);
}
NS_IMETHODIMP nsFileResult::RemoveValueAt(int32_t rowIndex, bool removeFromDb)
{

View File

@ -611,6 +611,10 @@ UserAutoCompleteResult.prototype = {
return "";
},
getFinalCompleteValueAt : function (index) {
return this.getValueAt(index);
},
removeValueAt : function (index, removeFromDB) {
if (index < 0 || index >= this.logins.length)
throw "Index out of range.";

View File

@ -1404,9 +1404,7 @@ urlInlineComplete.prototype = {
untrimmedHost = null;
}
// TODO (bug 754265): this is a temporary solution introduced while
// waiting for a propert dedicated API.
ac._result.appendMatch(ac._strippedPrefix + trimmedHost, untrimmedHost);
ac._result.appendMatch(ac._strippedPrefix + trimmedHost, "", "", "", untrimmedHost);
// handleCompletion() will cause the result listener to be called, and
// will display the result in the UI.
@ -1480,9 +1478,7 @@ urlInlineComplete.prototype = {
untrimmedURL = null;
}
// TODO (bug 754265): this is a temporary solution introduced while
// waiting for a propert dedicated API.
ac._result.appendMatch(ac._strippedPrefix + url, untrimmedURL);
ac._result.appendMatch(ac._strippedPrefix + url, "", "", "", untrimmedURL);
// handleCompletion() will cause the result listener to be called, and
// will display the result in the UI.

View File

@ -542,6 +542,13 @@ TagAutoCompleteResult.prototype = {
return null;
},
/**
* Get the image for the result at the given index
*/
getFinalCompleteValueAt: function PTACR_getFinalCompleteValueAt(index) {
return this.getValueAt(index);
},
/**
* Remove the value at the given index from the autocomplete results.
* If removeFromDb is set to true, the value should be removed from

View File

@ -476,6 +476,10 @@ FormAutoCompleteResult.prototype = {
return "";
},
getFinalCompleteValueAt : function (index) {
return this.getValueAt(index);
},
removeValueAt : function (index, removeFromDB) {
this._checkIndexBounds(index);

View File

@ -151,6 +151,15 @@ FormAutoCompleteResult.prototype = {
return "";
},
/**
* Retrieves a result
* @param index the index of the result requested
* @return the result at the specified index
*/
getFinalCompleteValueAt: function(index) {
return this.getValueAt(index);
},
/**
* Removes a result from the resultset
* @param index the index of the result to remove

View File

@ -44,6 +44,7 @@ nsAutoCompleteSimpleResult.prototype = {
getCommentAt: function() { return null; },
getStyleAt: function() { return null; },
getImageAt: function() { return null; },
getFinalCompleteValueAt: function() { return this.getValueAt(); },
getLabelAt: function() { return null; },
removeValueAt: function() {}
};

View File

@ -44,6 +44,7 @@ nsAutoCompleteSimpleResult.prototype = {
getCommentAt: function() { return null; },
getStyleAt: function() { return null; },
getImageAt: function() { return null; },
getFinalCompleteValueAt: function() { return this.getValueAt(); },
getLabelAt: function() { return null; },
removeValueAt: function() {}
};

View File

@ -46,6 +46,7 @@ nsAutoCompleteSimpleResult.prototype = {
getCommentAt: function() { return null; },
getStyleAt: function() { return null; },
getImageAt: function() { return null; },
getFinalCompleteValueAt: function() { return this.getValueAt(); },
getLabelAt: function() { return null; },
removeValueAt: function() {}
};

View File

@ -42,6 +42,7 @@ nsAutoCompleteSimpleResult.prototype = {
getCommentAt: function() { return null; },
getStyleAt: function() { return null; },
getImageAt: function() { return null; },
getFinalCompleteValueAt: function() { return this.getValueAt(); },
getLabelAt: function() { return null; },
removeValueAt: function() {}
};

View File

@ -42,6 +42,7 @@ autoCompleteSimpleResult.prototype = {
getCommentAt: function() { return null; },
getStyleAt: function() { return null; },
getImageAt: function() { return null; },
getFinalCompleteValueAt: function() { return this.getValueAt(); },
getLabelAt: function() { return null; },
removeValueAt: function() {}
};

View File

@ -57,6 +57,7 @@ nsAutoCompleteSimpleResult.prototype = {
getCommentAt: function() { return null; },
getStyleAt: function() { return null; },
getImageAt: function() { return null; },
getFinalCompleteValueAt: function(aIndex) { return this.getValueAt(aIndex); },
getLabelAt: function() { return null; },
removeValueAt: function() {}
};