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 84410 fc2e0fc688c6051ffd794bb2f1dd6cd3a4680526
parent 84409 6290daa6518971521834692d8c05b38f9a70412f
child 84411 a18c8d5765eade4826971e2a52cbbd1a10c2d392
push id21848
push usermak77@bonardo.net
push dateSat, 14 Jan 2012 09:02:20 +0000
treeherdermozilla-central@27a7f197c6fc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspcwalton
bugs715326
milestone12.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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;