Bug 710835 - Listen for input events instead of composition* events for form autocomplete. r=mfinkle

This commit is contained in:
Margaret Leibovic 2012-01-10 16:25:23 -08:00
parent abd7a3db55
commit c17d0381c8

View File

@ -2568,8 +2568,7 @@ var FormAssistant = {
Services.obs.addObserver(this, "FormAssist:AutoComplete", false); Services.obs.addObserver(this, "FormAssist:AutoComplete", false);
Services.obs.addObserver(this, "FormAssist:Closed", false); Services.obs.addObserver(this, "FormAssist:Closed", false);
BrowserApp.deck.addEventListener("compositionstart", this, false); BrowserApp.deck.addEventListener("input", this, false);
BrowserApp.deck.addEventListener("compositionupdate", this, false);
}, },
uninit: function() { uninit: function() {
@ -2595,9 +2594,8 @@ var FormAssistant = {
}, },
handleEvent: function(aEvent) { handleEvent: function(aEvent) {
switch (aEvent.type) { switch (aEvent.type) {
case "compositionstart": case "input":
case "compositionupdate":
let currentElement = aEvent.target; let currentElement = aEvent.target;
if (!this._isAutocomplete(currentElement)) if (!this._isAutocomplete(currentElement))
break; break;
@ -2605,7 +2603,7 @@ var FormAssistant = {
// Keep track of input element so we can fill it in if the user // Keep track of input element so we can fill it in if the user
// selects an autocomplete suggestion // selects an autocomplete suggestion
this._currentInputElement = currentElement; this._currentInputElement = currentElement;
let suggestions = this._getAutocompleteSuggestions(aEvent.data, currentElement); let suggestions = this._getAutocompleteSuggestions(currentElement.value, currentElement);
let rect = currentElement.getBoundingClientRect(); let rect = currentElement.getBoundingClientRect();
let zoom = BrowserApp.selectedTab.viewport.zoom; let zoom = BrowserApp.selectedTab.viewport.zoom;