Bug 969929 - GeckEditable loses data ... TextSelection using action bar SelectALL, r=wesj
authorMark Capella <markcapella@twcny.rr.com>
Wed, 19 Feb 2014 22:19:43 -0500
changeset 170018 415e5d63cc3399e0e8aa5f8f56e795819c800d25
parent 170017 a10bb6a9da93110816ccce2fd0bf5249fae4a011
child 170019 1d91384b87772dbb08238e6c6d0765e2eac5ed2a
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
reviewerswesj
bugs969929
milestone30.0a1
Bug 969929 - GeckEditable loses data ... TextSelection using action bar SelectALL, r=wesj
mobile/android/chrome/content/SelectionHandler.js
--- a/mobile/android/chrome/content/SelectionHandler.js
+++ b/mobile/android/chrome/content/SelectionHandler.js
@@ -523,16 +523,20 @@ var SelectionHandler = {
 
     this._sendMessage("TextSelection:ShowHandles", [this.HANDLE_TYPE_MIDDLE]);
   },
 
   // Target initialization for both TYPE_CURSOR and TYPE_SELECTION
   _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();
   },