Bug 1279708 - update the geometry of all ranges upon the next dimmed mask repaint in the case of a 'findAgain' update, because the page may have scrolled. r?jaws
MozReview-Commit-ID: 24yJELk5amc
--- a/toolkit/modules/FinderHighlighter.jsm
+++ b/toolkit/modules/FinderHighlighter.jsm
@@ -420,16 +420,19 @@ FinderHighlighter.prototype = {
return;
}
let fontStyle = this._getRangeFontStyle(foundRange);
if (typeof dict.brightText == "undefined") {
dict.brightText = this._isColorBright(fontStyle.color);
}
+ if (data.findAgain)
+ dict.updateAllRanges = true;
+
if (!dict.visible)
this.show(window);
else
this._maybeCreateModalHighlightNodes(window);
this._updateRangeOutline(dict, textContent, fontStyle);
}
@@ -1025,20 +1028,20 @@ FinderHighlighter.prototype = {
if (paintContent || dict.modalHighlightAllMask) {
this._updateRangeOutline(dict);
this._updateDynamicRangesRects(dict);
// Create a DOM node for each rectangle representing the ranges we found.
let maskContent = [];
const rectStyle = this._getStyleString(kModalStyles.maskRect,
dict.brightText ? kModalStyles.maskRectBrightText : []);
for (let [range, rects] of dict.modalHighlightRectsMap) {
+ if (dict.updateAllRanges)
+ rects = this._updateRangeRects(range);
if (this._checkOverlap(dict.currentFoundRange, range))
continue;
- if (dict.updateAllRanges)
- rects = this._updateRangeRects(range);
for (let rect of rects) {
maskContent.push(`<div xmlns="${kNSHTML}" style="${rectStyle}; top: ${rect.y}px;
left: ${rect.x}px; height: ${rect.height}px; width: ${rect.width}px;"></div>`);
}
}
dict.updateAllRanges = false;
maskNode.innerHTML = maskContent.join("");
}