Bug 1148590 - Clear existing focus when closing selection. r=capella, a=lmandel
☠☠ backed out by ddebce1c80aa ☠ ☠
authorJim Chen <nchen@mozilla.com>
Wed, 08 Apr 2015 12:25:20 -0400
changeset 265706 a5eb17c5f04a38eb994063eb096ec1ce2149eeed
parent 265705 83dadcb2d604795774d2cac816d168a1ad987be5
child 265707 d05bd1334e25b5115330b5e0c55cee6fb58b1442
push id4718
push userraliiev@mozilla.com
push dateMon, 11 May 2015 18:39:53 +0000
treeherdermozilla-beta@c20c4ef55f08 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscapella, lmandel
bugs1148590
milestone39.0a2
Bug 1148590 - Clear existing focus when closing selection. r=capella, a=lmandel
mobile/android/chrome/content/SelectionHandler.js
--- a/mobile/android/chrome/content/SelectionHandler.js
+++ b/mobile/android/chrome/content/SelectionHandler.js
@@ -380,16 +380,22 @@ var SelectionHandler = {
   startSelection: function sh_startSelection(aElement, aOptions = { mode: SelectionHandler.SELECT_ALL }) {
     // Clear out any existing active selection
     this._closeSelection();
 
     if (this._isNonTextInputElement(aElement)) {
       return this.START_ERROR_NONTEXT_INPUT;
     }
 
+    const focus = Services.focus.focusedWindow;
+    if (focus) {
+      // Make sure any previous focus is cleared.
+      Services.focus.clearFocus(focus);
+    }
+
     this._initTargetInfo(aElement, this.TYPE_SELECTION);
 
     // Perform the appropriate selection method, if we can't determine method, or it fails, return
     let selectionResult = this._performSelection(aOptions);
     if (selectionResult !== this.ERROR_NONE) {
       this._deactivate();
       return selectionResult;
     }