Verified Commit f090c1b7 authored by ma1's avatar ma1 Committed by Pier Angelo Vendrame
Browse files

Bug 32308: use direct browser sizing for letterboxing.

parent 7eeeed9d
Loading
Loading
Loading
Loading

browser/actors/RFPHelperChild.jsm

deleted100644 → 0
+0 −27
Original line number Diff line number Diff line
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

var EXPORTED_SYMBOLS = ["RFPHelperChild"];

const { XPCOMUtils } = ChromeUtils.import(
  "resource://gre/modules/XPCOMUtils.jsm"
);

const kPrefLetterboxing = "privacy.resistFingerprinting.letterboxing";

XPCOMUtils.defineLazyPreferenceGetter(
  this,
  "isLetterboxingEnabled",
  kPrefLetterboxing,
  false
);

class RFPHelperChild extends JSWindowActorChild {
  handleEvent(event) {
    if (isLetterboxingEnabled && event.type == "resize") {
      this.sendAsyncMessage("Letterboxing:ContentSizeUpdated");
    }
  }
}
+0 −32
Original line number Diff line number Diff line
1; /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

var EXPORTED_SYMBOLS = ["RFPHelperParent"];

const { XPCOMUtils } = ChromeUtils.import(
  "resource://gre/modules/XPCOMUtils.jsm"
);

const kPrefLetterboxing = "privacy.resistFingerprinting.letterboxing";

XPCOMUtils.defineLazyPreferenceGetter(
  this,
  "isLetterboxingEnabled",
  kPrefLetterboxing,
  false
);

class RFPHelperParent extends JSWindowActorParent {
  receiveMessage(aMessage) {
    if (
      isLetterboxingEnabled &&
      aMessage.name == "Letterboxing:ContentSizeUpdated"
    ) {
      let browser = this.browsingContext.top.embedderElement;
      let window = browser.ownerGlobal;
      window.RFPHelper.contentSizeUpdated(window);
    }
  }
}
+0 −2
Original line number Diff line number Diff line
@@ -80,8 +80,6 @@ FINAL_TARGET_FILES.actors += [
    "PromptParent.jsm",
    "RefreshBlockerChild.jsm",
    "RefreshBlockerParent.jsm",
    "RFPHelperChild.jsm",
    "RFPHelperParent.jsm",
    "ScreenshotsComponentChild.jsm",
    "SearchSERPTelemetryChild.jsm",
    "SearchSERPTelemetryParent.jsm",
+15 −4
Original line number Diff line number Diff line
@@ -102,12 +102,23 @@ body {
  Never modify the following selector without synchronizing
  LETTERBOX_CSS_SELECTOR in RFPHelper.jsm!
**/
.letterboxing .browserStack > browser:not(.exclude-letterboxing) {
  margin: 0; /* to be dynamically set by RFHelper.jsm */
.letterboxing .browserStack:not(.exclude-letterboxing) > browser {
  /* width & height to be dynamically set by RFPHelper.jsm */
  outline: 1px solid var(--chrome-content-separator-color);
}

browser.exclude-letterboxing {
  margin: 0 !important;
.exclude-letterboxing > browser {
  outline: initial;
}

:root:not([inDOMFullscreen]) .letterboxing.letterboxing-ready .browserStack:not(.exclude-letterboxing) {
  place-content: start center;
}

/* extend down the toolbar's colors when letterboxing is enabled */
.letterboxing {
  background-color: var(--toolbar-bgcolor);
  background-image: var(--toolbar-bgimage);
}

#toolbar-menubar[autohide="true"] {
+4 −4
Original line number Diff line number Diff line
@@ -82,7 +82,7 @@ async function test_dynamical_window_rounding(aWindow, aCheckFunc) {
  // We need to wait for the updating the margins for the newly opened tab, or
  // it will affect the following tests.
  let promiseForTheFirstRounding = TestUtils.topicObserved(
    "test:letterboxing:update-margin-finish"
    "test:letterboxing:update-size-finish"
  );

  info("Open a content tab for testing.");
@@ -108,7 +108,7 @@ async function test_dynamical_window_rounding(aWindow, aCheckFunc) {
    let caseString = "Case " + width + "x" + height + ": ";
    // Create a promise for waiting for the margin update.
    let promiseRounding = TestUtils.topicObserved(
      "test:letterboxing:update-margin-finish"
      "test:letterboxing:update-size-finish"
    );

    let { containerWidth, containerHeight } = getContainerSize(tab);
@@ -316,7 +316,7 @@ async function test_findbar(aWindow) {
  );

  let promiseRounding = TestUtils.topicObserved(
    "test:letterboxing:update-margin-finish"
    "test:letterboxing:update-size-finish"
  );

  let findBarOpenPromise = BrowserTestUtils.waitForEvent(
@@ -330,7 +330,7 @@ async function test_findbar(aWindow) {
  ok(true, "Margin updated when findbar opened");

  promiseRounding = TestUtils.topicObserved(
    "test:letterboxing:update-margin-finish"
    "test:letterboxing:update-size-finish"
  );

  let findBarClosePromise = BrowserTestUtils.waitForEvent(
Loading