Bug 559691 - Don't use viewport metadata scale if it is less than screen width [r=mfinkle]
authorMatt Brubeck <mbrubeck@mozilla.com>
Sat, 17 Apr 2010 00:03:53 -0400
changeset 66149 86ba8d2481aefc94f845163d8c536957fd9e7bb9
parent 66148 9f23fe2aad8bcff5ea86871eb191e8bbe1a17344
child 66150 4399df2f32f1e964558241e89298b8cfbeb40995
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs559691
Bug 559691 - Don't use viewport metadata scale if it is less than screen width [r=mfinkle]
mobile/chrome/content/BrowserView.js
--- a/mobile/chrome/content/BrowserView.js
+++ b/mobile/chrome/content/BrowserView.js
@@ -607,23 +607,25 @@ BrowserView.prototype = {
     return bvs.zoomLevel == bvs.defaultZoomLevel;
   },
 
   getDefaultZoomLevel: function getDefaultZoomLevel() {
     let browser = this._browser;
     if (!browser)
       return 0;
 
+    let pageZoom = this.getPageZoomLevel();
+    let granularity = gPrefService.getIntPref("browser.ui.zoom.pageFitGranularity");
+    pageZoom = BrowserView.Util.adjustZoomLevel(pageZoom, 1 / granularity);
+
     let metaData = Util.getViewportMetadata(browser);
     if (metaData.reason)
-      return metaData.scale;
+      return Math.max(metaData.scale, pageZoom);
 
-    let zl = this.getPageZoomLevel();
-    let granularity = gPrefService.getIntPref("browser.ui.zoom.pageFitGranularity");
-    return BrowserView.Util.adjustZoomLevel(zl, 1 / granularity);
+    return pageZoom;
   },
 
   getPageZoomLevel: function getPageZoomLevel() {
     let bvs = this._browserViewportState;  // browser exists, so bvs must as well
     let w = this.viewportToBrowser(bvs.viewportRect.right);
     let h = this.viewportToBrowser(bvs.viewportRect.bottom);
     return BrowserView.Util.pageZoomLevel(this.getVisibleRect(), w, h);
   },