[tbb-commits] [tor-browser/tor-browser-68.2.0esr-9.0-1] Bug 1556017 - Fixing the off-by-one-pixel issue of find bar and devtool iframe for Letterboxing. r=johannh

gk at torproject.org gk at torproject.org
Tue Nov 26 08:52:08 UTC 2019


commit 90e3a224b2e9785dafb51263b0bde349c8681a59
Author: Tim Huang <tihuang at mozilla.com>
Date:   Tue Jun 11 08:53:44 2019 +0000

    Bug 1556017 - Fixing the off-by-one-pixel issue of find bar and devtool iframe for Letterboxing. r=johannh
    
    This patch fixes the off-by-one-pixel issue of Letterboxing. For
    FindBar, it will be created when the user requests it and will be hidden
    if the user close it after that. The problem of the original approach is
    that it only observes the existance of the FindBar element but not the
    fact that whether or not it is visible. So, it will miscalculate the
    offset of FindBar after it has been created and closed.
    
    For devtools, the original approach adds one pixel offset for the
    separator. However, this one pixel offset is not required since there is
    no extra separator outside the devtools iframe. So, we don't need that
    and this patch removes this one pixel for the devtools.
    
    Differential Revision: https://phabricator.services.mozilla.com/D34156
    
    --HG--
    extra : moz-landing-system : lando
---
 toolkit/components/resistfingerprinting/RFPHelper.jsm | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/toolkit/components/resistfingerprinting/RFPHelper.jsm b/toolkit/components/resistfingerprinting/RFPHelper.jsm
index a5d5bed86f98..f73ccf1797b0 100644
--- a/toolkit/components/resistfingerprinting/RFPHelper.jsm
+++ b/toolkit/components/resistfingerprinting/RFPHelper.jsm
@@ -408,12 +408,12 @@ class _RFPHelper {
 
       // If the findbar or devtools are out, we need to subtract their height (plus 1
       // for the separator) from the container height, because we need to adjust our
-      // letterboxing to acount for it; however it is not included in that dimension
+      // letterboxing to account for it; however it is not included in that dimension
       // (but rather is subtracted from the content height.)
-      let findBar = browserContainer.getElementsByClassName("findbar-container");
-      let findBarOffset = findBar.length ? findBar[0].clientHeight + 1 : 0;
+      let findBar = win.gFindBarInitialized ? win.gFindBar : undefined;
+      let findBarOffset = (findBar && !findBar.hidden) ? findBar.clientHeight + 1 : 0;
       let devtools = browserContainer.getElementsByClassName("devtools-toolbox-bottom-iframe");
-      let devtoolsOffset = devtools.length ? devtools[0].clientHeight + 1 : 0;
+      let devtoolsOffset = devtools.length ? devtools[0].clientHeight : 0;
 
       return {
         contentWidth,



More information about the tbb-commits mailing list