Bug 629661 - Find in Page does not reset after it is closed [r=mfinkle]
authorVivien Nicolas <21@vingtetun.org>
Mon, 07 Feb 2011 13:49:37 +0100
changeset 67350 b7c97a621c577cbb077a03c8ff91d7ebec590b4f
parent 67349 b634296c5cc5c13dd01817d2bdb451fb217b0856
child 67351 968686c969dd0a5fb5fbe2c7bb9c09d18545dae3
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs629661
Bug 629661 - Find in Page does not reset after it is closed [r=mfinkle]
mobile/chrome/content/common-ui.js
--- a/mobile/chrome/content/common-ui.js
+++ b/mobile/chrome/content/common-ui.js
@@ -455,32 +455,40 @@ var FindHelperUI = {
 
   get status() {
     return this._status;
   },
 
   set status(val) {
     if (val != this._status) {
       this._status = val;
-      this._textbox.setAttribute("status", val);
+      if (!val)
+        this._textbox.removeAttribute("status");
+      else
+        this._textbox.setAttribute("status", val);
       this.updateCommands(this._textbox.value);
     }
   },
 
   init: function findHelperInit() {
     this._textbox = document.getElementById("find-helper-textbox");
     this._container = document.getElementById("content-navigator");
 
     this._cmdPrevious = document.getElementById(this.commands.previous);
     this._cmdNext = document.getElementById(this.commands.next);
 
     // Listen for form assistant messages from content
     messageManager.addMessageListener("FindAssist:Show", this);
     messageManager.addMessageListener("FindAssist:Hide", this);
 
+    // Listen for composition update, some VKB that does suggestions does not
+    // update directly the content of the field but in this case we want to
+    // search as soon as something is entered in the field
+    this._textbox.addEventListener("text", this, false);
+
     // Listen for events where form assistant should be closed
     document.getElementById("tabs").addEventListener("TabSelect", this, true);
     Elements.browsers.addEventListener("URLChanged", this, true);
   },
 
   receiveMessage: function findHelperReceiveMessage(aMessage) {
     let json = aMessage.json;
     switch(aMessage.name) {
@@ -502,16 +510,25 @@ var FindHelperUI = {
       case "TabSelect":
         this.hide();
         break;
 
       case "URLChanged":
         if (aEvent.detail && aEvent.target == getBrowser())
           this.hide();
         break;
+
+      case "text":
+        if (!this._open)
+          return;
+
+        let evt = document.createEvent("Event");
+        evt.initEvent("input", true, false);
+        this._textbox.dispatchEvent(evt);
+        break;
     }
   },
 
   show: function findHelperShow() {
     this._container.show(this);
     this.search(this._textbox.value);
     this._textbox.select();
     this._textbox.focus();