Bug 1259735 - Guard against a rounding error that could lead to Java having a stale page size, rendering the page unscrollable. r?snorp draft
authorKartikaya Gupta <kgupta@mozilla.com>
Thu, 07 Apr 2016 08:59:14 -0400
changeset 348507 09185de73bbf82bc755849e44763b05bd0988e90
parent 348506 b6683e141c47c022598c0caac3ea8ba8c6236d42
child 517853 bc8cdc5cef7ef66960b831eae7cab11a01911304
push id14829
push userkgupta@mozilla.com
push dateThu, 07 Apr 2016 12:59:49 +0000
reviewerssnorp
bugs1259735
milestone48.0a1
Bug 1259735 - Guard against a rounding error that could lead to Java having a stale page size, rendering the page unscrollable. r?snorp MozReview-Commit-ID: 8s3zmH0LhmU
mobile/android/chrome/content/browser.js
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -3760,18 +3760,18 @@ Tab.prototype = {
        * 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.
        *
        * In the check below, we floor the viewport size because there might be slight rounding errors
        * introduced in the CSS page size due to the conversion to and from app units in Gecko. The
        * error should be no more than one app unit so doing the floor is overkill, but safe in the
        * sense that the extra page size updates that get sent as a result will be mostly harmless.
        */
-      let pageLargerThanScreen = (cssPageRect.width >= Math.floor(viewport.cssWidth))
-                              && (cssPageRect.height >= Math.floor(viewport.cssHeight));
+      let pageLargerThanScreen = (Math.ceil(cssPageRect.width) >= Math.floor(viewport.cssWidth))
+                              && (Math.ceil(cssPageRect.height) >= Math.floor(viewport.cssHeight));
       if (doc.readyState === 'complete' || pageLargerThanScreen) {
         viewport.cssPageLeft = cssPageRect.left;
         viewport.cssPageTop = cssPageRect.top;
         viewport.cssPageRight = cssPageRect.right;
         viewport.cssPageBottom = cssPageRect.bottom;
         /* Transform the page width and height based on the zoom factor. */
         viewport.pageLeft = (viewport.cssPageLeft * viewport.zoom);
         viewport.pageTop = (viewport.cssPageTop * viewport.zoom);