Bug 928163 - Allow or disallow proper text selection caret display based on HTML <input> type, r=margaret
authorMark Capella <markcapella@twcny.rr.com>
Tue, 22 Oct 2013 18:46:43 -0400
changeset 165577 ced482976ebf0fc5e4f63b97eda101dd503b68e7
parent 165576 1b166374191c0953a1b3846579b98fdb0dc451cc
child 165578 d25a408a3efb519b3ff6a9277e9bd2482439a178
push id3066
push userakeybl@mozilla.com
push dateMon, 09 Dec 2013 19:58:46 +0000
treeherdermozilla-beta@a31a0dce83aa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmargaret
bugs928163
milestone27.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 928163 - Allow or disallow proper text selection caret display based on HTML <input> type, r=margaret
mobile/android/chrome/content/InputWidgetHelper.js
mobile/android/chrome/content/browser.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._isValidInput(aTarget))
+    if (this._uiBusy || !this.hasInputWidget(aTarget))
       return;
 
     this._uiBusy = true;
     this.show(aTarget);
     this._uiBusy = false;
   },
 
   show: function(aElement) {
@@ -55,17 +55,17 @@ var InputWidgetHelper = {
       }
       // Else the user canceled the input.
 
       if (changed)
         this.fireOnChange(aElement);
     }).bind(this));
   },
 
-  _isValidInput: function(aElement) {
+  hasInputWidget: function(aElement) {
     if (!aElement instanceof HTMLInputElement)
       return false;
 
     let type = aElement.getAttribute('type');
     if (type == "date" || type == "datetime" || type == "datetime-local" ||
         type == "week" || type == "month" || type == "time") {
       return true;
     }
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -4303,18 +4303,19 @@ var BrowserEventHandler = {
               [x, y] = this._moveClickPoint(element, x, y);
               element = ElementTouchHelper.anyElementFromPoint(x, y);
             }
 
             this._sendMouseEvent("mousemove", element, x, y);
             this._sendMouseEvent("mousedown", element, x, y);
             this._sendMouseEvent("mouseup",   element, x, y);
 
-            // See if its an input element, and it isn't disabled
+            // See if its an input element, and it isn't disabled, nor handled by Android native dialog
             if (!element.disabled &&
+                !InputWidgetHelper.hasInputWidget(element) &&
                 ((element instanceof HTMLInputElement && element.mozIsTextField(false)) ||
                 (element instanceof HTMLTextAreaElement)))
               SelectionHandler.attachCaret(element);
 
             // scrollToFocusedInput does its own checks to find out if an element should be zoomed into
             BrowserApp.scrollToFocusedInput(BrowserApp.selectedBrowser);
           } catch(e) {
             Cu.reportError(e);