Bug 910634 - Disabled <input> should not popup a dialog. r=wesj
authorMantaroh Yoshinaga <mantaroh@gmail.com>
Thu, 26 Feb 2015 02:39:00 -0500
changeset 235337 466d2f2a7b7e51cca2ce024a23baeb8723c8ae76
parent 235336 c3681d12e524822bb2125fb8d801c154618c8ec1
child 235338 e6349d80d3b5f6a25a6bcb620679b7da87a95711
push id57400
push userryanvm@gmail.com
push dateTue, 24 Mar 2015 15:59:13 +0000
treeherdermozilla-inbound@47fa87252df0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswesj
bugs910634
milestone39.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 910634 - Disabled <input> should not popup a dialog. r=wesj
mobile/android/chrome/content/InputWidgetHelper.js
--- a/mobile/android/chrome/content/InputWidgetHelper.js
+++ b/mobile/android/chrome/content/InputWidgetHelper.js
@@ -8,17 +8,17 @@ var InputWidgetHelper = {
 
   handleEvent: function(aEvent) {
     this.handleClick(aEvent.target);
   },
 
   handleClick: function(aTarget) {
     // if we're busy looking at a InputWidget we want to eat any clicks that
     // come to us, but not to process them
-    if (this._uiBusy || !this.hasInputWidget(aTarget))
+    if (this._uiBusy || !this.hasInputWidget(aTarget) || this._isDisabledElement(aTarget))
       return;
 
     this._uiBusy = true;
     this.show(aTarget);
     this._uiBusy = false;
   },
 
   show: function(aElement) {
@@ -76,10 +76,21 @@ var InputWidgetHelper = {
   fireOnChange: function(aElement) {
     let evt = aElement.ownerDocument.createEvent("Events");
     evt.initEvent("change", true, true, aElement.defaultView, 0,
                   false, false,
                   false, false, null);
     setTimeout(function() {
       aElement.dispatchEvent(evt);
     }, 0);
+  },
+
+  _isDisabledElement : function(aElement) {
+    let currentElement = aElement;
+    while (currentElement) {
+      if (currentElement.disabled)
+	return true;
+
+      currentElement = currentElement.parentElement;
+    }
+    return false;
   }
 };