Bug 715326 - Don't round the page size in browser.js. r=pcwalton
authorKartikaya Gupta <kgupta@mozilla.com>
Thu, 12 Jan 2012 22:47:33 -0500
changeset 85635 fc2e0fc688c6051ffd794bb2f1dd6cd3a4680526
parent 85634 6290daa6518971521834692d8c05b38f9a70412f
child 85636 a18c8d5765eade4826971e2a52cbbd1a10c2d392
push id805
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 18:17:35 +0000
treeherdermozilla-aurora@6fb3bf232436 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspcwalton
bugs715326
milestone12.0a1
Bug 715326 - Don't round the page size in browser.js. r=pcwalton Rounding the page size before sending it to Java serves no real purpose, and introduces rounding errors that I have observed to be up to a couple of pixels, depending on the screen size and page dimensions.
mobile/android/chrome/content/browser.js
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -1496,18 +1496,18 @@ Tab.prototype = {
     if (doc != null) {
       let pageWidth = this._viewport.width, pageHeight = this._viewport.height;
       let body = doc.body || { scrollWidth: pageWidth, scrollHeight: pageHeight };
       let html = doc.documentElement || { scrollWidth: pageWidth, scrollHeight: pageHeight };
       pageWidth = Math.max(body.scrollWidth, html.scrollWidth);
       pageHeight = Math.max(body.scrollHeight, html.scrollHeight);
 
       /* Transform the page width and height based on the zoom factor. */
-      pageWidth = Math.round(pageWidth * this._viewport.zoom);
-      pageHeight = Math.round(pageHeight * this._viewport.zoom);
+      pageWidth *= this._viewport.zoom;
+      pageHeight *= this._viewport.zoom;
 
       /*
        * Avoid sending page sizes of less than screen size before we hit DOMContentLoaded, because
        * this causes the page size to jump around wildly during page load. After the page is loaded,
        * send updates regardless of page size; we'll zoom to fit the content as needed.
        */
       if (doc.readyState === 'complete' || (pageWidth >= gScreenWidth && pageHeight >= gScreenHeight)) {
         this._viewport.pageWidth = pageWidth;