Bug 902153 - Ignore input type=range in forms.js. r=yxl
authorJan Jongboom <janjongboom@gmail.com>
Mon, 12 Aug 2013 13:17:29 -0400
changeset 142335 92c9408884258849aa56cdbb092950cbcbc4458f
parent 142334 c8922b30d7b0342a57363dd8dcc21511454c6922
child 142336 635ef1e344176658726bea9c833751215d28bb1f
push id32372
push userryanvm@gmail.com
push dateTue, 13 Aug 2013 01:59:20 +0000
treeherdermozilla-inbound@86b6480829c8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersyxl
bugs902153
milestone26.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 902153 - Ignore input type=range in forms.js. r=yxl
b2g/chrome/content/forms.js
--- a/b2g/chrome/content/forms.js
+++ b/b2g/chrome/content/forms.js
@@ -195,17 +195,18 @@ let FormAssistant = {
     addMessageListener("Forms:SetSelectionRange", this);
     addMessageListener("Forms:ReplaceSurroundingText", this);
     addMessageListener("Forms:GetText", this);
     addMessageListener("Forms:Input:SendKey", this);
     addMessageListener("Forms:GetContext", this);
   },
 
   ignoredInputTypes: new Set([
-    'button', 'file', 'checkbox', 'radio', 'reset', 'submit', 'image'
+    'button', 'file', 'checkbox', 'radio', 'reset', 'submit', 'image',
+    'range'
   ]),
 
   isKeyboardOpened: false,
   selectionStart: -1,
   selectionEnd: -1,
   textBeforeCursor: "",
   textAfterCursor: "",
   scrollIntoViewTimeout: null,
@@ -369,18 +370,20 @@ let FormAssistant = {
             if (this.focusedElement && !FormVisibility.isVisible(this.focusedElement)) {
               this.focusedElement.scrollIntoView(false);
             }
           }.bind(this), RESIZE_SCROLL_DELAY);
         }
         break;
 
       case "input":
-        // When the text content changes, notify the keyboard
-        this.updateSelection();
+        if (this.focusedElement) {
+          // When the text content changes, notify the keyboard
+          this.updateSelection();
+        }
         break;
 
       case "keydown":
         // Don't monitor the text change resulting from key event.
         this._ignoreEditActionOnce = true;
 
         // We use 'setTimeout' to wait until the input element accomplishes the
         // change in selection range.