Bug 969929 - GeckEditable loses data ... TextSelection using action bar SelectALL. r=wesj, a=sledru
authorMark Capella <markcapella@twcny.rr.com>
Wed, 19 Feb 2014 22:19:43 -0500
changeset 234615 27e269db5ea7f76638f6d30a51f500b8c8562062
parent 234614 25f3945e7e7c59eb68861027d2020976ed8b825d
child 234616 1d3379354e094ea249bae65a23851c0733c8f66e
push id208
push userryanvm@gmail.com
push dateMon, 23 Feb 2015 15:44:39 +0000
treeherdermozilla-b2g37_v2_2@09dafeb43234 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswesj, sledru
bugs969929
milestone28.0
Bug 969929 - GeckEditable loses data ... TextSelection using action bar SelectALL. r=wesj, a=sledru
mobile/android/chrome/content/SelectionHandler.js
--- a/mobile/android/chrome/content/SelectionHandler.js
+++ b/mobile/android/chrome/content/SelectionHandler.js
@@ -447,16 +447,20 @@ var SelectionHandler = {
     this._positionHandles();
 
     this._sendMessage("TextSelection:ShowHandles", [this.HANDLE_TYPE_MIDDLE]);
   },
 
   _initTargetInfo: function sh_initTargetInfo(aElement) {
     this._targetElement = aElement;
     if (aElement instanceof Ci.nsIDOMNSEditableElement) {
+      // Blur the targetElement to force IME code to undo previous style compositions
+      // (visible underlines / etc generated by autoCorrection, autoSuggestion)
+      aElement.blur();
+      // Ensure targetElement is now focused normally
       aElement.focus();
     }
 
     this._contentWindow = aElement.ownerDocument.defaultView;
     this._isRTL = (this._contentWindow.getComputedStyle(aElement, "").direction == "rtl");
 
     this._addObservers();
     this._contentWindow.addEventListener("pagehide", this, false);