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 draft
authorMike de Boer <mdeboer@mozilla.com>
Thu, 15 Sep 2016 16:49:19 +0200
changeset 414101 1a8d29794e992b36a42eb2871a7f303df51df303
parent 414100 bef8959dbe9139058d51866db9acd6faae015ea9
child 414106 02e245513b7739f6b65949ca1c177abfb0cd6a3a
push id29582
push usermdeboer@mozilla.com
push dateThu, 15 Sep 2016 14:50:08 +0000
reviewersjaws
bugs1279708
milestone51.0a1
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
toolkit/modules/FinderHighlighter.jsm
--- 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("");
     }