Bug 1296822 - ignore the scrollbar size when nsIDOMWindowUtils.getRootBounds is used when fetching the page size for the findbar. r?jaws draft
authorMike de Boer <mdeboer@mozilla.com>
Sat, 27 Aug 2016 11:43:09 +0200
changeset 406441 4e53581763307ccf837ab3c982a46fb805577b4e
parent 406440 8a5ee41a8b5bbc972641656a6229be0b632f0562
child 529652 c1dd5b5ccde16db196d66550394079f780bb01f7
push id27721
push usermdeboer@mozilla.com
push dateSat, 27 Aug 2016 09:43:44 +0000
reviewersjaws
bugs1296822
milestone51.0a1
Bug 1296822 - ignore the scrollbar size when nsIDOMWindowUtils.getRootBounds is used when fetching the page size for the findbar. r?jaws MozReview-Commit-ID: 8chEDzgNVsL
toolkit/modules/FinderHighlighter.jsm
--- a/toolkit/modules/FinderHighlighter.jsm
+++ b/toolkit/modules/FinderHighlighter.jsm
@@ -625,24 +625,24 @@ FinderHighlighter.prototype = {
     // First we'll try without flushing layout, because it's way faster.
     let dwu = this._getDWU(window);
     let { width, height } = dwu.getRootBounds();
 
     if (!width || !height) {
       // We need a flush after all :'(
       width = window.innerWidth + window.scrollMaxX - window.scrollMinX;
       height = window.innerHeight + window.scrollMaxY - window.scrollMinY;
+
+      let scrollbarHeight = {};
+      let scrollbarWidth = {};
+      dwu.getScrollbarSize(false, scrollbarWidth, scrollbarHeight);
+      width -= scrollbarWidth.value;
+      height -= scrollbarHeight.value;
     }
 
-    let scrollbarHeight = {};
-    let scrollbarWidth = {};
-    dwu.getScrollbarSize(false, scrollbarWidth, scrollbarHeight);
-    width -= scrollbarWidth.value;
-    height -= scrollbarHeight.value;
-
     return { width, height };
   },
 
   /**
    * Utility; fetch the current text contents of a given range.
    *
    * @param  {nsIDOMRange} range Range object to extract the contents from.
    * @return {Array} Snippets of text.