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
This commit is contained in:
Tim Huang 2019-06-11 08:53:44 +00:00
parent 963b9d833d
commit 00134913e3

View File

@ -372,12 +372,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,