Bug 1305059 - Adhere to the 'drawOutline' option as passed in by the Finder to decide whether an outline should be visible. r?jaws draft
authorMike de Boer <mdeboer@mozilla.com>
Thu, 12 Oct 2017 16:57:26 +0200
changeset 679318 dc197ae9c2d767782cf616655227ba2efc4b3ce0
parent 679317 0e0452d11cf97b1a9a85aa619d2b2353bb4d56cb
child 735574 587798a3f211417538ff774eda77b02de6492d7b
push id84192
push usermdeboer@mozilla.com
push dateThu, 12 Oct 2017 15:03:42 +0000
reviewersjaws
bugs1305059
milestone58.0a1
Bug 1305059 - Adhere to the 'drawOutline' option as passed in by the Finder to decide whether an outline should be visible. r?jaws MozReview-Commit-ID: 2vVAp5HoKTO
toolkit/modules/FinderHighlighter.jsm
--- a/toolkit/modules/FinderHighlighter.jsm
+++ b/toolkit/modules/FinderHighlighter.jsm
@@ -194,22 +194,23 @@ FinderHighlighter.prototype = {
       } catch (ex) {}
     }
   },
 
   /**
    * Toggle highlighting all occurrences of a word in a page. This method will
    * be called recursively for each (i)frame inside a page.
    *
-   * @param {Booolean} highlight Whether highlighting should be turned on
-   * @param {String}   word      Needle to search for and highlight when found
-   * @param {Boolean}  linksOnly Only consider nodes that are links for the search
+   * @param {Booolean} highlight   Whether highlighting should be turned on
+   * @param {String}   word        Needle to search for and highlight when found
+   * @param {Boolean}  linksOnly   Only consider nodes that are links for the search
+   * @param {Boolean}  drawOutline Whether found links should be outlined.
    * @yield {Promise}  that resolves once the operation has finished
    */
-  async highlight(highlight, word, linksOnly) {
+  async highlight(highlight, word, linksOnly, drawOutline) {
     let window = this.finder._getWindow();
     let dict = this.getForWindow(window);
     let controller = this.finder._getSelectionController(window);
     let doc = window.document;
     this._found = false;
 
     if (!controller || !doc || !doc.documentElement) {
       // Without the selection controller,
@@ -232,17 +233,17 @@ FinderHighlighter.prototype = {
           (this._modal && this.iterator._areParamsEqual(params, dict.lastIteratorParams))) {
         return;
       }
 
       if (!this._modal)
         dict.visible = true;
       await this.iterator.start(params);
       if (this._found)
-        this.finder._outlineLink(true);
+        this.finder._outlineLink(drawOutline);
     } else {
       this.hide(window);
 
       // Removing the highlighting always succeeds, so return true.
       this._found = true;
     }
 
     this.notifyFinished({ highlight, found: this._found });
@@ -420,17 +421,17 @@ FinderHighlighter.prototype = {
         dict.previousFoundRange = dict.currentFoundRange;
         dict.currentFoundRange = foundRange;
         let params = this.iterator.params;
         if (dict.visible && this.iterator._areParamsEqual(params, dict.lastIteratorParams))
           return;
         if (!dict.visible && !params)
           params = {word: data.searchString, linksOnly: data.linksOnly};
         if (params)
-          this.highlight(true, params.word, params.linksOnly);
+          this.highlight(true, params.word, params.linksOnly, params.drawOutline);
       }
       return;
     }
 
     dict.animateOutline = true;
     // Immediately finish running animations, if any.
     this._finishOutlineAnimations(dict);
 
@@ -440,17 +441,17 @@ FinderHighlighter.prototype = {
 
       if (!dict.visible)
         this.show(window);
       else
         this._maybeCreateModalHighlightNodes(window);
     }
 
     if (this._highlightAll)
-      this.highlight(true, data.searchString, data.linksOnly);
+      this.highlight(true, data.searchString, data.linksOnly, data.drawOutline);
   },
 
   /**
    * Invalidates the list by clearing the map of highlighted ranges that we
    * keep to build the mask for.
    */
   clear(window = null) {
     if (!window || !window.top)