Bug 710835 - Listen for input events instead of composition* events for form autocomplete. r=mfinkle
authorMargaret Leibovic <margaret.leibovic@gmail.com>
Tue, 10 Jan 2012 16:25:23 -0800
changeset 85466 ad341c2f7cdf54d615c39ddb3c3a525626b9537d
parent 85465 d2ff5d57658dc875cb335188a9204e5c26eee19d
child 85467 f78cc74ee58933cefcae2db7032bd5af92b0545d
push id805
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 18:17:35 +0000
treeherdermozilla-aurora@6fb3bf232436 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs710835
milestone12.0a1
Bug 710835 - Listen for input events instead of composition* events for form autocomplete. r=mfinkle
mobile/android/chrome/content/browser.js
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -2563,18 +2563,17 @@ var FormAssistant = {
   // Used to keep track of the element that corresponds to the current
   // autocomplete suggestions
   _currentInputElement: null,
 
   init: function() {
     Services.obs.addObserver(this, "FormAssist:AutoComplete", false);
     Services.obs.addObserver(this, "FormAssist:Closed", false);
 
-    BrowserApp.deck.addEventListener("compositionstart", this, false);
-    BrowserApp.deck.addEventListener("compositionupdate", this, false);
+    BrowserApp.deck.addEventListener("input", this, false);
   },
 
   uninit: function() {
     Services.obs.removeObserver(this, "FormAssist:AutoComplete");
     Services.obs.removeObserver(this, "FormAssist:Closed");
   },
 
   observe: function(aSubject, aTopic, aData) {
@@ -2590,27 +2589,26 @@ var FormAssistant = {
 
       case "FormAssist:Closed":
         this._currentInputElement = null;
         break;
     }
   },
 
   handleEvent: function(aEvent) {
-   switch (aEvent.type) {
-      case "compositionstart":
-      case "compositionupdate":
+    switch (aEvent.type) {
+      case "input":
         let currentElement = aEvent.target;
         if (!this._isAutocomplete(currentElement))
           break;
 
         // Keep track of input element so we can fill it in if the user
         // selects an autocomplete suggestion
         this._currentInputElement = currentElement;
-        let suggestions = this._getAutocompleteSuggestions(aEvent.data, currentElement);
+        let suggestions = this._getAutocompleteSuggestions(currentElement.value, currentElement);
 
         let rect = currentElement.getBoundingClientRect();
         let zoom = BrowserApp.selectedTab.viewport.zoom;
 
         sendMessageToJava({
           gecko: {
             type:  "FormAssist:AutoComplete",
             suggestions: suggestions,