Bug 921343 - Avoid removing selections done by the user when closing the findbar. r=mikedeboer
authorTom Schuster <evilpies@gmail.com>
Tue, 15 Oct 2013 20:02:23 -0400
changeset 165582 95b04871f4ae527ce51a07aeb761f90db1e0d24f
parent 165581 ce633177b0d6dd6d784cc4dea299161f076d8226
child 165583 5126b48adf91390db142ee55bc9c19cc1b9ae801
push id428
push userbbajaj@mozilla.com
push dateTue, 28 Jan 2014 00:16:25 +0000
treeherdermozilla-release@cd72a7ff3a75 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmikedeboer
bugs921343
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 921343 - Avoid removing selections done by the user when closing the findbar. r=mikedeboer
toolkit/content/widgets/findbar.xml
toolkit/modules/Finder.jsm
toolkit/modules/RemoteFinder.jsm
--- a/toolkit/content/widgets/findbar.xml
+++ b/toolkit/content/widgets/findbar.xml
@@ -563,17 +563,17 @@
       <method name="close">
         <body><![CDATA[
           if (this.hidden)
             return;
 
           this.hidden = true;
 
           this.browser.finder.focusContent();
-          this.browser.finder.removeSelection();
+          this.browser.finder.enableSelection();
           this._findField.blur();
 
           this._cancelTimers();
 
           this._findFailedString = null;
         ]]></body>
       </method>
 
--- a/toolkit/modules/Finder.jsm
+++ b/toolkit/modules/Finder.jsm
@@ -97,21 +97,25 @@ Finder.prototype = {
     this._searchString = aWord;
     let found = this._highlight(aHighlight, aWord, null);
     if (found)
       this._notify(Ci.nsITypeAheadFind.FIND_FOUND, false, false);
     else
       this._notify(Ci.nsITypeAheadFind.FIND_NOTFOUND, false, false);
   },
 
+  enableSelection: function() {
+    this._fastFind.setSelectionModeAndRepaint(Ci.nsISelectionController.SELECTION_ON);
+  },
+
   removeSelection: function() {
     let fastFind = this._fastFind;
 
     fastFind.collapseSelection();
-    fastFind.setSelectionModeAndRepaint(Ci.nsISelectionController.SELECTION_ON);
+    this.enableSelection();
 
     this._restoreOriginalOutline();
   },
 
   focusContent: function() {
     let fastFind = this._fastFind;
 
     try {
--- a/toolkit/modules/RemoteFinder.jsm
+++ b/toolkit/modules/RemoteFinder.jsm
@@ -61,16 +61,20 @@ RemoteFinder.prototype = {
   },
 
   highlight: function (aHighlight, aWord) {
     this._browser.messageManager.sendAsyncMessage("Finder:Highlight",
                                                   { highlight: aHighlight,
                                                     word: aWord });
   },
 
+  enableSelection: function () {
+    this._browser.messageManager.sendAsyncMessage("Finder:EnableSelection");
+  },
+
   removeSelection: function () {
     this._browser.messageManager.sendAsyncMessage("Finder:RemoveSelection");
   },
 
   focusContent: function () {
     this._browser.messageManager.sendAsyncMessage("Finder:FocusContent");
   },
 
@@ -93,16 +97,17 @@ function RemoteFinderListener(global) {
 }
 
 RemoteFinderListener.prototype = {
   MESSAGES: [
     "Finder:CaseSensitive",
     "Finder:FastFind",
     "Finder:FindAgain",
     "Finder:Highlight",
+    "Finder:EnableSelection",
     "Finder:RemoveSelection",
     "Finder:FocusContent",
     "Finder:KeyPress"
   ],
 
   onFindResult: function (aResult, aFindBackwards, aLinkURL) {
     let data = { result: aResult, findBackwards: aFindBackwards,
                  linkURL: aLinkURL, searchString: this._finder.searchString };