Bug 898877 - Ensure that viewport resizing behaviour due to dynamic toolbar is consistent. r=Cwiiis

In browser.js were two pieces of code that determined whether or not the CSS viewport
size should include the margins. These two pieces of code were inconsistent in that
one used rounding while the other used a fuzz. Also, one of them subtracted gViewportMargins
from gScreenHeight while the other added them. This patch makes the two pieces of code
consistent, and updates them to use a fuzz so that the CSS viewport is enlarged only
when dealing with pages that are equal to or larger than the screen (with the toolbar hidden).
This commit is contained in:
Kartikaya Gupta 2013-08-16 08:42:32 -04:00
parent 43fc0208a0
commit 0f50be37c3

View File

@ -3276,15 +3276,13 @@ Tab.prototype = {
let remeasureNeeded = false;
if (hasHorizontalMargins) {
let screenWidth = gScreenWidth + gViewportMargins.left + gViewportMargins.right;
let viewportShouldExcludeHorizontalMargins = (Math.round(pageWidth) <= screenWidth);
let viewportShouldExcludeHorizontalMargins = (pageWidth <= gScreenWidth - 0.5);
if (viewportShouldExcludeHorizontalMargins != this.viewportExcludesHorizontalMargins) {
remeasureNeeded = true;
}
}
if (hasVerticalMargins) {
let screenHeight = gScreenHeight + gViewportMargins.top + gViewportMargins.bottom;
let viewportShouldExcludeVerticalMargins = (Math.round(pageHeight) <= screenHeight);
let viewportShouldExcludeVerticalMargins = (pageHeight <= gScreenHeight - 0.5);
if (viewportShouldExcludeVerticalMargins != this.viewportExcludesVerticalMargins) {
remeasureNeeded = true;
}