Bug 646015 - Update autocomplete suggestions as you type on device [r=mfinkle]

This commit is contained in:
Vivien Nicolas 2011-03-29 16:40:33 +02:00
parent 43daf24b79
commit 336377498c

View File

@ -69,6 +69,11 @@ function FormAssistant() {
addMessageListener("FormAssist:AutoComplete", this);
addMessageListener("Content:SetWindowSize", this);
/* Listen text events in order to update the autocomplete suggestions as soon
* a key is entered on device
*/
addEventListener("text", this, false);
addEventListener("keypress", this, true);
addEventListener("keyup", this, false);
addEventListener("focus", this, true);
@ -331,6 +336,11 @@ FormAssistant.prototype = {
this.currentIndex = focusedIndex;
break;
case "text":
if (this._isAutocomplete(aEvent.target))
sendAsyncMessage("FormAssist:AutoComplete", this._getJSON());
break;
// key processing inside a select element are done during the keypress
// handler, preventing this one to be fired cancel the selection change
case "keypress":