Bug 738641 - Account for rounding errors when reporting page size from JS to Java. r=Cwiiis a=android-only

This commit is contained in:
Kartikaya Gupta 2012-04-30 15:50:50 -04:00
Родитель 86270a58c0
Коммит f207208829
1 изменённых файлов: 6 добавлений и 1 удалений

Просмотреть файл

@ -1934,8 +1934,13 @@ Tab.prototype = {
* 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.
*
* Also, we need to compare the page size returned from getPageSize (in CSS pixels) to the floored
* screen size in CSS pixels because the page size returned from getPageSize may also be floored.
*/
if (doc.readyState === 'complete' || (pageWidth >= gScreenWidth && pageHeight >= gScreenHeight)) {
let pageLargerThanScreen = (cssPageWidth >= Math.floor(viewport.cssWidth))
&& (cssPageHeight >= Math.floor(viewport.cssHeight));
if (doc.readyState === 'complete' || pageLargerThanScreen) {
viewport.cssPageWidth = cssPageWidth;
viewport.cssPageHeight = cssPageHeight;
viewport.pageWidth = pageWidth;