Verified Commit 9f3fab8c authored by ma1's avatar ma1
Browse files

Bug 1556002 - Update initial window size and letterboxing stepping. r=tjr

parent b61725fe
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -53,7 +53,7 @@ function checkForDefaultSetting(
  aRealHeight
) {
  // We can get the rounded size by subtracting twice the margin.
  let targetWidth = aRealWidth - 2 * RFPHelper.steppedRange(aRealWidth);
  let targetWidth = aRealWidth - 2 * RFPHelper.steppedRange(aRealWidth, true);
  let targetHeight = aRealHeight - 2 * RFPHelper.steppedRange(aRealHeight);

  // This platform-specific code is explained in the large comment below.
+13 −10
Original line number Diff line number Diff line
@@ -4,23 +4,26 @@
 *   maximum values.
 */

let targetWidth = Services.prefs.getIntPref("privacy.window.maxInnerWidth");
let targetHeight = Services.prefs.getIntPref("privacy.window.maxInnerHeight");

OpenTest.run([
  {
    settingWidth: 1025,
    settingHeight: 1050,
    targetWidth: 1000,
    targetHeight: 1000,
    settingWidth: targetWidth + 25,
    settingHeight: targetHeight + 50,
    targetWidth,
    targetHeight,
  },
  {
    settingWidth: 9999,
    settingHeight: 9999,
    targetWidth: 1000,
    targetHeight: 1000,
    targetWidth,
    targetHeight,
  },
  {
    settingWidth: 999,
    settingHeight: 999,
    targetWidth: 1000,
    targetHeight: 1000,
    settingWidth: targetWidth - 1,
    settingHeight: targetHeight - 1,
    targetWidth,
    targetHeight,
  },
]);
+15 −6
Original line number Diff line number Diff line
@@ -306,19 +306,28 @@ async function calcMaximumAvailSize(aChromeWidth, aChromeHeight) {
  let availWidth = window.screen.availWidth;
  let availHeight = window.screen.availHeight;

  // Ideally, we would round the window size as 1000x1000. But the available
  // screen space might not suffice. So, we decide the size according to the
  // available screen size.
  let availContentWidth = Math.min(1000, availWidth - chromeUIWidth);
  // Ideally, we would round the window size as
  // privacy.window.maxInnerWidth x privacy.window.maxInnerHeight. But the
  // available screen space might not suffice. So, we decide the size according
  // to the available screen size.
  let maxInnerWidth = Services.prefs.getIntPref("privacy.window.maxInnerWidth");
  let maxInnerHeight = Services.prefs.getIntPref(
    "privacy.window.maxInnerHeight"
  );

  let availContentWidth = Math.min(maxInnerWidth, availWidth - chromeUIWidth);
  let availContentHeight;

  // If it is GTK window, we would consider the system decorations when we
  // calculating avail content height since the system decorations won't be
  // reported when we get available screen dimensions.
  if (AppConstants.MOZ_WIDGET_GTK) {
    availContentHeight = Math.min(1000, -40 + availHeight - chromeUIHeight);
    availContentHeight = Math.min(
      maxInnerHeight,
      -40 + availHeight - chromeUIHeight
    );
  } else {
    availContentHeight = Math.min(1000, availHeight - chromeUIHeight);
    availContentHeight = Math.min(maxInnerHeight, availHeight - chromeUIHeight);
  }

  // Rounded the desire size to the nearest 200x100.
+2 −2
Original line number Diff line number Diff line
@@ -14405,12 +14405,12 @@

- name: privacy.window.maxInnerWidth
  type: int32_t
  value: 1000
  value: 1400
  mirror: always

- name: privacy.window.maxInnerHeight
  type: int32_t
  value: 1000
  value: 900
  mirror: always

- name: privacy.sanitize.useOldClearHistoryDialog
+3 −3
Original line number Diff line number Diff line
@@ -390,14 +390,14 @@ class _RFPHelper {
  /**
   * Given a width or height, returns the appropriate margin to apply.
   */
  steppedRange(aDimension) {
  steppedRange(aDimension, aIsWidth = false) {
    let stepping;
    if (aDimension <= 50) {
      return 0;
    } else if (aDimension <= 500) {
      stepping = 50;
    } else if (aDimension <= 1600) {
      stepping = 100;
      stepping = aIsWidth ? 200 : 100;
    } else {
      stepping = 200;
    }
@@ -473,7 +473,7 @@ class _RFPHelper {
      // stepping size.
      if (!this._letterboxingDimensions.length) {
        result = {
          width: this.steppedRange(aWidth),
          width: this.steppedRange(aWidth, true),
          height: this.steppedRange(aHeight),
        };
        log(