Bug 672411 - Minor refactoring of default values for viewport height/width [r=lucasr]
authorMatt Brubeck <mbrubeck@mozilla.com>
Thu, 25 Aug 2011 19:17:50 -0700
changeset 75933 4362a0bf69e026f29318368b44dd26d095125be3
parent 75932 bace24f47138c5767fc97968b7d54061a57b27de
child 75934 373bd41d9e286b059755229995925e183cb23f6a
push id21070
push usermbrubeck@mozilla.com
push dateFri, 26 Aug 2011 16:20:59 +0000
treeherdermozilla-central@e8af0a8c3632 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslucasr
bugs672411
milestone9.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 672411 - Minor refactoring of default values for viewport height/width [r=lucasr]
mobile/chrome/content/browser.js
--- a/mobile/chrome/content/browser.js
+++ b/mobile/chrome/content/browser.js
@@ -2793,24 +2793,20 @@ Tab.prototype = {
       // If (scale * width) < device-width, increase the width (bug 561413).
       let maxInitialZoom = metadata.defaultZoom || metadata.maxZoom;
       if (maxInitialZoom && viewportW)
         viewportW = Math.max(viewportW, screenW / maxInitialZoom);
 
       let validW = viewportW > 0;
       let validH = viewportH > 0;
 
-      if (validW && !validH) {
+      if (!validW)
+        viewportW = validH ? (viewportH * (screenW / screenH)) : Browser.defaultBrowserWidth;
+      if (!validH)
         viewportH = viewportW * (screenH / screenW);
-      } else if (!validW && validH) {
-        viewportW = viewportH * (screenW / screenH);
-      } else if (!validW && !validH) {
-        viewportW = Browser.defaultBrowserWidth;
-        viewportH = Browser.defaultBrowserWidth * (screenH / screenW);
-      }
     }
 
     // Make sure the viewport height is not shorter than the window when
     // the page is zoomed out to show its full width.
     let pageZoomLevel = this.getPageZoomLevel(screenW);
     let minScale = this.clampZoomLevel(pageZoomLevel, pageZoomLevel);
     viewportH = Math.max(viewportH, screenH / minScale);