Commit 8bd51d4e authored by Tom Ritter's avatar Tom Ritter Committed by Georg Koppen
Browse files

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
parent 6dfcb949
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -27,4 +27,9 @@ class RFPHelperChild extends ActorChild {
      this.mm.sendAsyncMessage("Letterboxing:ContentSizeUpdated");
    }
  }
  receiveMessage(aMessage) {
    if (isLetterboxingEnabled) {
      this.mm.sendAsyncMessage("Letterboxing:ContentSizeUpdated");
    }
  }
}
+4 −0
Original line number Diff line number Diff line
@@ -268,6 +268,10 @@ let LEGACY_ACTORS = {
      events: {
        resize: {},
      },
      messages: [
        "Finder:FindbarOpen",
        "Finder:FindbarClose",
      ],
    },
  },

+10 −1
Original line number Diff line number Diff line
@@ -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,
      };
    });