Bug 384336 - Firefox window should be maximized on first run on small screens. r=MattN
authorDão Gottwald <dao@mozilla.com>
Sun, 27 Dec 2015 01:02:23 +0100
changeset 277662 f697cb63c888cd96e5ddfaf8901cb8187e7c840e
parent 277661 10ddceabece05224d104081ba4edf7a4a994c9c4
child 277663 a3271c17e5ac5b08b6886d66c3a26e0afd7d7b0b
push id29828
push usercbook@mozilla.com
push dateMon, 28 Dec 2015 09:23:07 +0000
treeherdermozilla-central@a3271c17e5ac [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMattN
bugs384336
milestone46.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 384336 - Firefox window should be maximized on first run on small screens. r=MattN
browser/base/content/browser.js
devtools/client/animationinspector/test/browser.ini
devtools/client/commandline/test/browser.ini
devtools/client/performance/test/browser.ini
devtools/client/tilt/test/browser_tilt_zoom.js
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -992,45 +992,27 @@ var gBrowserInit = {
     // Certain kinds of automigration rely on this notification to complete
     // their tasks BEFORE the browser window is shown. SessionStore uses it to
     // restore tabs into windows AFTER important parts like gMultiProcessBrowser
     // have been initialized.
     Services.obs.notifyObservers(window, "browser-window-before-show", "");
 
     // Set a sane starting width/height for all resolutions on new profiles.
     if (!document.documentElement.hasAttribute("width")) {
-      let defaultWidth;
-      let defaultHeight;
-
-      // Very small: maximize the window
-      // Portrait  : use about full width and 3/4 height, to view entire pages
-      //             at once (without being obnoxiously tall)
-      // Widescreen: use about half width, to suggest side-by-side page view
-      // Otherwise : use 3/4 height and width
-      if (screen.availHeight <= 600) {
+      const TARGET_WIDTH = 1280;
+      const TARGET_HEIGHT = 1040;
+      let width = Math.min(screen.availWidth * .9, TARGET_WIDTH);
+      let height = Math.min(screen.availHeight * .9, TARGET_HEIGHT);
+
+      document.documentElement.setAttribute("width", width);
+      document.documentElement.setAttribute("height", height);
+
+      if (width < TARGET_WIDTH && height < TARGET_HEIGHT) {
         document.documentElement.setAttribute("sizemode", "maximized");
-        defaultWidth = 610;
-        defaultHeight = 450;
       }
-      else {
-        if (screen.availWidth <= screen.availHeight) {
-          defaultWidth = screen.availWidth * .9;
-          defaultHeight = screen.availHeight * .75;
-        }
-        else if (screen.availWidth >= 2048) {
-          defaultWidth = (screen.availWidth / 2) - 20;
-          defaultHeight = screen.availHeight - 10;
-        }
-        else {
-          defaultWidth = screen.availWidth * .75;
-          defaultHeight = screen.availHeight * .75;
-        }
-      }
-      document.documentElement.setAttribute("width", defaultWidth);
-      document.documentElement.setAttribute("height", defaultHeight);
     }
 
     if (!window.toolbar.visible) {
       // adjust browser UI for popups
       if (gURLBar) {
         gURLBar.setAttribute("readonly", "true");
         gURLBar.setAttribute("enablehistory", "false");
       }
--- a/devtools/client/animationinspector/test/browser.ini
+++ b/devtools/client/animationinspector/test/browser.ini
@@ -8,27 +8,29 @@ support-files =
   doc_modify_playbackRate.html
   doc_negative_animation.html
   doc_simple_animation.html
   head.js
 
 [browser_animation_animated_properties_displayed.js]
 [browser_animation_click_selects_animation.js]
 [browser_animation_controller_exposes_document_currentTime.js]
+skip-if = os == "linux" && !debug # Bug 1234567
 [browser_animation_empty_on_invalid_nodes.js]
 [browser_animation_keyframe_click_to_set_time.js]
 [browser_animation_keyframe_markers.js]
 [browser_animation_mutations_with_same_names.js]
 [browser_animation_panel_exists.js]
 [browser_animation_participate_in_inspector_update.js]
 [browser_animation_playerFronts_are_refreshed.js]
 [browser_animation_playerWidgets_appear_on_panel_init.js]
 [browser_animation_playerWidgets_target_nodes.js]
 [browser_animation_refresh_on_added_animation.js]
 [browser_animation_refresh_on_removed_animation.js]
+skip-if = os == "linux" && !debug # Bug 1227792
 [browser_animation_refresh_when_active.js]
 [browser_animation_running_on_compositor.js]
 [browser_animation_same_nb_of_playerWidgets_and_playerFronts.js]
 [browser_animation_shows_player_on_valid_node.js]
 [browser_animation_target_highlight_select.js]
 [browser_animation_target_highlighter_lock.js]
 [browser_animation_timeline_currentTime.js]
 [browser_animation_timeline_header.js]
--- a/devtools/client/commandline/test/browser.ini
+++ b/devtools/client/commandline/test/browser.ini
@@ -50,16 +50,17 @@ support-files =
  browser_cmd_csscoverage_page2.html
  browser_cmd_csscoverage_page3.html
  browser_cmd_csscoverage_sheetA.css
  browser_cmd_csscoverage_sheetB.css
  browser_cmd_csscoverage_sheetC.css
  browser_cmd_csscoverage_sheetD.css
 [browser_cmd_folder.js]
 [browser_cmd_highlight_01.js]
+skip-if = os == "linux" && debug # Bug 1210208
 [browser_cmd_highlight_02.js]
 [browser_cmd_inject.js]
 support-files =
  browser_cmd_inject.html
 [browser_cmd_csscoverage_util.js]
 [browser_cmd_jsb.js]
 support-files =
   browser_cmd_jsb_script.jsi
--- a/devtools/client/performance/test/browser.ini
+++ b/devtools/client/performance/test/browser.ini
@@ -9,16 +9,17 @@ support-files =
   doc_worker.html
   js_simpleWorker.js
   head.js
 
 [browser_aaa-run-first-leaktest.js]
 [browser_perf-categories-js-calltree.js]
 [browser_perf-clear-01.js]
 [browser_perf-clear-02.js]
+skip-if = os == "linux" # Bug 1230031
 [browser_perf-columns-js-calltree.js]
 [browser_perf-columns-memory-calltree.js]
 [browser_perf-console-record-01.js]
 [browser_perf-console-record-02.js]
 [browser_perf-console-record-03.js]
 [browser_perf-console-record-04.js]
 [browser_perf-console-record-05.js]
 [browser_perf-console-record-06.js]
--- a/devtools/client/tilt/test/browser_tilt_zoom.js
+++ b/devtools/client/tilt/test/browser_tilt_zoom.js
@@ -15,16 +15,35 @@ function test() {
   if (!isWebGLSupported()) {
     aborting();
     info("Skipping controller test because WebGL isn't supported.");
     return;
   }
 
   waitForExplicitFinish();
 
+  if (window.windowState == window.STATE_MAXIMIZED) {
+    registerCleanupFunction(function () {
+      window.maximize();
+    });
+
+    window.addEventListener("resize", function onResize(event) {
+      if (event.target == window) {
+        window.removeEventListener("resize", onResize, false);
+        executeSoon(testTilt);
+      }
+    }, false);
+
+    window.restore();
+  } else {
+    testTilt();
+  }
+}
+
+function testTilt() {
   createTab(function() {
     TiltUtils.setDocumentZoom(window, ZOOM);
 
     createTilt({
       onTiltOpen: function(instance)
       {
         tiltOpened = true;
 
@@ -46,42 +65,47 @@ function test() {
         ok(isApprox(contentWindow.innerHeight * ZOOM, renderer.height, 1),
           "The renderer height wasn't set correctly before the resize.");
 
         ok(isApprox(contentWindow.innerWidth * ZOOM, arcball.width, 1),
           "The arcball width wasn't set correctly before the resize.");
         ok(isApprox(contentWindow.innerHeight * ZOOM, arcball.height, 1),
           "The arcball height wasn't set correctly before the resize.");
 
-
+        window.addEventListener("resize", onResize, false);
         window.resizeBy(-RESIZE * ZOOM, -RESIZE * ZOOM);
 
-        executeSoon(function() {
+        function onResize(event) {
+          if (event.target == window) {
+            window.removeEventListener("resize", onResize, false);
+            executeSoon(afterResize);
+          }
+        }
+
+        function afterResize() {
           ok(isApprox(contentWindow.innerWidth + RESIZE, initialWidth, 1),
             "The content window width wasn't set correctly after the resize.");
           ok(isApprox(contentWindow.innerHeight + RESIZE, initialHeight, 1),
             "The content window height wasn't set correctly after the resize.");
 
           ok(isApprox(contentWindow.innerWidth * ZOOM, renderer.width, 1),
             "The renderer width wasn't set correctly after the resize.");
           ok(isApprox(contentWindow.innerHeight * ZOOM, renderer.height, 1),
             "The renderer height wasn't set correctly after the resize.");
 
           ok(isApprox(contentWindow.innerWidth * ZOOM, arcball.width, 1),
             "The arcball width wasn't set correctly after the resize.");
           ok(isApprox(contentWindow.innerHeight * ZOOM, arcball.height, 1),
             "The arcball height wasn't set correctly after the resize.");
 
-
           window.resizeBy(RESIZE * ZOOM, RESIZE * ZOOM);
 
-
           Services.obs.addObserver(cleanup, DESTROYED, false);
           Tilt.destroy(Tilt.currentWindowId);
-        });
+        }
       }
     }, false, function suddenDeath()
     {
       ok(false, "Tilt could not be initialized properly.");
       cleanup();
     });
   });
 }