Bug 450243: properly clamp zoomLevel to avoid zooming bugs, r=mfinkle
authorGavin Sharp <gavin@mozilla.com>
Tue, 19 Aug 2008 23:32:03 -0400
changeset 64796 f0710295c7c5243bc355b8842aaaee7d2348d8af
parent 64795 8144c98b0263d6bfdcf785fd1e36138158b7ccfd
child 64797 2651e1a74a4c4b780fa07f042e82328bc48df0f3
push id19389
push userffxbld
push dateWed, 06 Apr 2011 21:33:21 +0000
treeherdermozilla-central@8e9f90073a20 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs450243
Bug 450243: properly clamp zoomLevel to avoid zooming bugs, r=mfinkle
mobile/chrome/content/deckbrowser.xml
--- a/mobile/chrome/content/deckbrowser.xml
+++ b/mobile/chrome/content/deckbrowser.xml
@@ -507,18 +507,18 @@
 
       <method name="zoomToElement">
         <parameter name="aElement"/>
         <body><![CDATA[
           const margin = 15;
 
           // scale to the element's width
           var elRect = this._getPagePosition(aElement);
-          this._zoomLevel = Math.max((this.browser.boxObject.width) / (elRect.width + (2 * margin)),
-                                     2);
+          var zoomLevel = this.browser.boxObject.width / (elRect.width + (2 * margin));
+          this._zoomLevel = Math.min(zoomLevel, 10);
 
           // pan to the element
           this._panTo(Math.max(elRect.x - margin, 0),
                       Math.max(0, elRect.y - margin));
         ]]></body>
       </method>
 
       /**