Bug 1306234 - stop flickering when the background color of the findbar dimmed highlighting mode changes and make sure the color changes if needed when all the ranges have been found as well. r?jaws draft
authorMike de Boer <mdeboer@mozilla.com>
Tue, 11 Oct 2016 11:09:17 +0200
changeset 423499 967cfe6d43521d4c930884eaf3d6e9d8d8ec45f9
parent 423486 140f57dda933663fa1460fa6f3c8d50eadd90cea
child 423504 cbc9ee71c55fe67197ffc3b51765fc085c075ae9
push id31919
push usermdeboer@mozilla.com
push dateTue, 11 Oct 2016 09:09:50 +0000
reviewersjaws
bugs1306234
milestone52.0a1
Bug 1306234 - stop flickering when the background color of the findbar dimmed highlighting mode changes and make sure the color changes if needed when all the ranges have been found as well. r?jaws MozReview-Commit-ID: KAokVKOgSei
toolkit/modules/FinderHighlighter.jsm
--- a/toolkit/modules/FinderHighlighter.jsm
+++ b/toolkit/modules/FinderHighlighter.jsm
@@ -68,16 +68,19 @@ const kModalStyles = {
     ["vertical-align", "top !important"]
   ],
   maskNode: [
     ["background", "rgba(0,0,0,.25)"],
     ["pointer-events", "none"],
     ["position", "absolute"],
     ["z-index", 1]
   ],
+  maskNodeTransition: [
+    ["transition", "background .2s ease-in"]
+  ],
   maskNodeDebug: [
     ["z-index", 2147483646],
     ["top", 0],
     ["left", 0]
   ],
   maskNodeBrightText: [ ["background", "rgba(255,255,255,.25)"] ]
 };
 const kModalOutlineAnim = {
@@ -216,18 +219,20 @@ FinderHighlighter.prototype = {
         finder: this.finder,
         listener: this,
         useCache: true
       };
       if (this.iterator._areParamsEqual(params, dict.lastIteratorParams))
         return this._found;
       if (params) {
         yield this.iterator.start(params);
-        if (this._found)
+        if (this._found) {
           this.finder._outlineLink(true);
+          dict.updateAllRanges = true;
+        }
       }
     } else {
       this.hide(window);
 
       // Removing the highlighting always succeeds, so return true.
       this._found = true;
     }
 
@@ -1097,16 +1102,17 @@ FinderHighlighter.prototype = {
 
     // Make sure the dimmed mask node takes the full width and height that's available.
     let {width, height} = dict.lastWindowDimensions = this._getWindowDimensions(window);
     if (typeof dict.brightText != "boolean" || dict.updateAllRanges)
       this._detectBrightText(dict);
     let maskStyle = this._getStyleString(kModalStyles.maskNode,
       [ ["width", width + "px"], ["height", height + "px"] ],
       dict.brightText ? kModalStyles.maskNodeBrightText : [],
+      paintContent ? kModalStyles.maskNodeTransition : [],
       kDebug ? kModalStyles.maskNodeDebug : []);
     dict.modalHighlightAllMask.setAttributeForElement(kMaskId, "style", maskStyle);
     if (dict.brightText)
       dict.modalHighlightAllMask.setAttributeForElement(kMaskId, "brighttext", "true");
 
     let allRects = [];
     if (paintContent || dict.modalHighlightAllMask) {
       this._updateRangeOutline(dict);