Bug 611555 (2/2) - Add a pref to control reflow zoom [r=mfinkle]
authorMatt Brubeck <mbrubeck@mozilla.com>
Mon, 27 Dec 2010 21:27:36 -0800
changeset 67167 90d212d91d473dabf6274132708819b1805663ef
parent 67166 15c875e62aaf3a95464a24011073087638a19f3b
child 67168 930648b96e3fac43eb29fd241084a2dab413791b
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
bugs611555
Bug 611555 (2/2) - Add a pref to control reflow zoom [r=mfinkle]
mobile/app/mobile.js
mobile/chrome/content/browser.xul
mobile/chrome/content/content.js
mobile/locales/en-US/chrome/preferences.dtd
--- a/mobile/app/mobile.js
+++ b/mobile/app/mobile.js
@@ -14,16 +14,17 @@
  * The Original Code is Mozilla Mobile Browser.
  *
  * The Initial Developer of the Original Code is
  * Mozilla Corporation.
  * Portions created by the Initial Developer are Copyright (C) 2008
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
+ *   Matt Brubeck <mbrubeck@mozilla.com>
  *
  * Alternatively, the contents of this file may be used under the terms of
  * either the GNU General Public License Version 2 or later (the "GPL"), or
  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  * in which case the provisions of the GPL or the LGPL are applicable instead
  * of those above. If you wish to allow use of your version of this file only
  * under the terms of either the GPL or the LGPL, and not to allow others to
  * use your version of this file under the terms of the MPL, indicate your
@@ -369,16 +370,17 @@ pref("browser.console.showInPanel", fals
 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", 5); // don't zoom to fit by less than 1/5 (20%)
 pref("browser.ui.zoom.animationDuration", 200); // ms duration of double-tap zoom animation
+pref("browser.ui.zoom.reflow", true); // Change text wrapping on double-tap
 
 // pinch gesture
 pref("browser.ui.pinch.maxGrowth", 150);     // max pinch distance growth
 pref("browser.ui.pinch.maxShrink", 200);     // max pinch distance shrinkage
 pref("browser.ui.pinch.scalingFactor", 500); // scaling factor for above pinch limits
 
 // Touch radius (area around the touch location to look for target elements),
 // in 1/240-inch pixels:
--- a/mobile/chrome/content/browser.xul
+++ b/mobile/chrome/content/browser.xul
@@ -18,16 +18,17 @@
    - The Initial Developer of the Original Code is
    - Mozilla Corporation.
    - Portions created by the Initial Developer are Copyright (C) 2008
    - the Initial Developer. All Rights Reserved.
    -
    - Contributor(s):
    -   Brad Lassey <blassey@mozilla.com>
    -   Mark Finkle <mfinkle@mozila.com>
+   -   Matt Brubeck <mbrubeck@mozila.com>
    -
    - Alternatively, the contents of this file may be used under the terms of
    - either the GNU General Public License Version 2 or later (the "GPL"), or
    - the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
    - in which case the provisions of the GPL or the LGPL are applicable instead
    - of those above. If you wish to allow use of your version of this file only
    - under the terms of either the GPL or the LGPL, and not to allow others to
    - use your version of this file under the terms of the MPL, indicate your
@@ -469,16 +470,17 @@
                 <settings id="prefs-privacy" label="&privacy.title;">
                   <setting pref="network.cookie.cookieBehavior" title="&allowCookies.title;" type="boolint" on="0" off="2"/>
                   <setting pref="signon.rememberSignons" title="&rememberPasswords.title;" type="bool"/>
                   <setting title="&clearPrivateData2.title;" type="control">
                     <button id="prefs-clear-data" label="&clearPrivateData.button;" command="cmd_sanitize"/>
                   </setting>
                 </settings>
                 <settings id="prefs-content" label="&content.title;">
+                  <setting pref="browser.ui.zoom.reflow" title="&reflowZoom.title;" type="bool"/>
                   <setting pref="permissions.default.image" title="&showImages.title;" type="boolint" on="1" off="2"/>
                   <setting pref="javascript.enabled" type="bool" title="&enableJavaScript.title;"/>
                 </settings>
               </richlistbox>
             </notificationbox>
           </vbox>
 
           <vbox id="console-container" flex="1">
--- a/mobile/chrome/content/content.js
+++ b/mobile/chrome/content/content.js
@@ -503,17 +503,18 @@ Content.prototype = {
       case "Browser:ZoomToPoint": {
         let rect = null;
         let element = elementFromPoint(x, y);
         let win = element.ownerDocument.defaultView;
         while (element && win.getComputedStyle(element,null).display == "inline")
           element = element.parentNode;
         if (element) {
           rect = getBoundingContentRect(element);
-          this._setTextZoom(Math.max(1, rect.width / json.width));
+          if (Services.prefs.getBoolPref("browser.ui.zoom.reflow"))
+            this._setTextZoom(Math.max(1, rect.width / json.width));
         }
         sendAsyncMessage("Browser:ZoomToPoint:Return", { x: x, y: y, rect: rect });
         break;
       }
 
       case "Browser:ResetZoom":
         this._setTextZoom(1);
         break;
--- a/mobile/locales/en-US/chrome/preferences.dtd
+++ b/mobile/locales/en-US/chrome/preferences.dtd
@@ -1,12 +1,13 @@
 <!ENTITY prefsHeader.label                         "Preferences">
 <!ENTITY about.title                               "About &brandShortName;">
 <!ENTITY about.button                              "Go to Page">
 <!ENTITY content.title                             "Content">
+<!ENTITY reflowZoom.title                          "Reformat text on zoom">
 <!ENTITY showImages.title                          "Show images">
 <!ENTITY enableJavaScript.title                    "Enable JavaScript">
 <!ENTITY enablePlugins.title                       "Enable Plugins">
 <!ENTITY privacy.title                             "Privacy &amp; Security">
 <!ENTITY allowCookies.title                        "Allow cookies">
 <!ENTITY clearPrivateData2.title                   "Clear private data">
 <!ENTITY clearPrivateData.button                   "Clear">
 <!ENTITY rememberPasswords.title                   "Remember passwords">