Bug 558108 - Reduce fuzzy page-fit-zoom threshold and make it a pref [r=mfinkle]
authorMatt Brubeck <mbrubeck@mozilla.com>
Thu, 08 Apr 2010 15:57:05 -0400
changeset 66119 ef3ee6fef78fc7918cbfb75e93bab6777d78365a
parent 66118 3d08d6859f7958cf12028a66c06772a0078a44fc
child 66120 e8a1785de0703ec369dc45856c2eef6b94983c53
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
bugs558108
Bug 558108 - Reduce fuzzy page-fit-zoom threshold and make it a pref [r=mfinkle]
mobile/app/mobile.js
mobile/chrome/content/BrowserView.js
--- a/mobile/app/mobile.js
+++ b/mobile/app/mobile.js
@@ -350,16 +350,19 @@ pref("dom.max_script_run_time", 20);
 pref("browser.console.showInPanel", false);
 
 // kinetic tweakables
 pref("browser.ui.kinetic.updateInterval", 30);
 pref("browser.ui.kinetic.decelerationRate", 20);
 pref("browser.ui.kinetic.speedSensitivity", 80);
 pref("browser.ui.kinetic.swipeLength", 160);
 
+// zooming
+pref("browser.ui.zoom.pageFitGranularity", 10); // don't zoom to fit by less than 1/10.
+
 // Touch radius
 pref("browser.ui.touch.radius", 16);
 
 // plugins
 pref("plugin.disable", true);
 pref("plugin.default_plugin_disabled", true);
 
 // product URLs
--- a/mobile/chrome/content/BrowserView.js
+++ b/mobile/chrome/content/BrowserView.js
@@ -41,17 +41,16 @@
 let Ci = Components.interfaces;
 
 const kBrowserViewZoomLevelMin = 0.2;
 const kBrowserViewZoomLevelMax = 4.0;
 const kBrowserFormZoomLevelMin = 1.0;
 const kBrowserFormZoomLevelMax = 2.0;
 const kBrowserViewZoomLevelPrecision = 10000;
 const kBrowserViewZoomLevelIncrement = 0.1;
-const kBrowserViewZoomLevelPageFitAdjust = 0.2;
 const kBrowserViewPrefetchBeginIdleWait = 1;    // seconds
 const kBrowserViewPrefetchBeginIdleWaitLoading = 10;    // seconds
 const kBrowserViewCacheSize = 6;
 
 /**
  * A BrowserView maintains state of the viewport (browser, zoom level,
  * dimensions) and the visible rectangle into the viewport, for every
  * browser it is given (cf setBrowser()).  In updates to the viewport state,
@@ -608,17 +607,18 @@ BrowserView.prototype = {
 
     let metaData = Util.contentIsHandheld(browser);
     if (metaData.reason == "handheld" || metaData.reason == "doctype")
       return 1;
     else if (metaData.reason == "viewport" && metaData.scale > 0)
       return metaData.scale;
 
     let zl = this.getPageZoomLevel();
-    return BrowserView.Util.adjustZoomLevel(zl, kBrowserViewZoomLevelPageFitAdjust);
+    let granularity = gPrefService.getIntPref("browser.ui.zoom.pageFitGranularity");
+    return BrowserView.Util.adjustZoomLevel(zl, 1 / granularity);
   },
 
   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);
   },