Bug 1302749 - Adhere to the 'drawOutline' option as passed in by the Finder to decide whether an outline should be visible. r?jaws
MozReview-Commit-ID: 7UGmmxeYUto
--- 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 });
@@ -423,17 +424,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);
@@ -443,17 +444,17 @@ FinderHighlighter.prototype = {
if (!dict.visible)
this.show(window, data.findAgain);
else
this._maybeCreateModalHighlightNodes(window, data.findAgain);
}
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)