commit 8bd51d4e30d4ed1201fab6112ac23f6ddc5858c1 Author: Tom Ritter tom@mozilla.com Date: Fri May 24 07:53:11 2019 +0000
Bug 1546832 - Adjust letterboxing to take the FindBar and Devtools into account r=johannh
Differential Revision: https://phabricator.services.mozilla.com/D31639
--HG-- extra : moz-landing-system : lando --- browser/actors/RFPHelperChild.jsm | 5 +++++ browser/components/BrowserGlue.jsm | 4 ++++ toolkit/components/resistfingerprinting/RFPHelper.jsm | 11 ++++++++++- 3 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/browser/actors/RFPHelperChild.jsm b/browser/actors/RFPHelperChild.jsm index 0658d34ee910..90b675efbc93 100644 --- a/browser/actors/RFPHelperChild.jsm +++ b/browser/actors/RFPHelperChild.jsm @@ -27,4 +27,9 @@ class RFPHelperChild extends ActorChild { this.mm.sendAsyncMessage("Letterboxing:ContentSizeUpdated"); } } + receiveMessage(aMessage) { + if (isLetterboxingEnabled) { + this.mm.sendAsyncMessage("Letterboxing:ContentSizeUpdated"); + } + } } diff --git a/browser/components/BrowserGlue.jsm b/browser/components/BrowserGlue.jsm index d22f9512184d..4e851289fbe9 100644 --- a/browser/components/BrowserGlue.jsm +++ b/browser/components/BrowserGlue.jsm @@ -268,6 +268,10 @@ let LEGACY_ACTORS = { events: { resize: {}, }, + messages: [ + "Finder:FindbarOpen", + "Finder:FindbarClose", + ], }, },
diff --git a/toolkit/components/resistfingerprinting/RFPHelper.jsm b/toolkit/components/resistfingerprinting/RFPHelper.jsm index 772b0259432e..a5d5bed86f98 100644 --- a/toolkit/components/resistfingerprinting/RFPHelper.jsm +++ b/toolkit/components/resistfingerprinting/RFPHelper.jsm @@ -406,11 +406,20 @@ class _RFPHelper { let containerWidth = browserContainer.clientWidth; let containerHeight = browserContainer.clientHeight;
+ // 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 + // (but rather is subtracted from the content height.) + let findBar = browserContainer.getElementsByClassName("findbar-container"); + let findBarOffset = findBar.length ? findBar[0].clientHeight + 1 : 0; + let devtools = browserContainer.getElementsByClassName("devtools-toolbox-bottom-iframe"); + let devtoolsOffset = devtools.length ? devtools[0].clientHeight + 1 : 0; + return { contentWidth, contentHeight, containerWidth, - containerHeight, + containerHeight: containerHeight - findBarOffset - devtoolsOffset, }; });