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 id3
push userfelipc@gmail.com
push dateFri, 30 Sep 2011 20:09:13 +0000
reviewerslucasr
bugs672411
milestone9.0a1
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);