Bug 707132 - Adjust viewport used for meta-viewport calculations [r=mbrubeck]

Calculate the viewport size based on the user-visible content area
and the zoom factor, rather than relying on the screen size, since
the screen size doesn't take into account things like the URL bar
and android chrome that may be visible.
This commit is contained in:
Kartikaya Gupta 2011-12-02 13:11:40 -05:00
parent 244be6ba02
commit 446c9f4861

View File

@ -1293,8 +1293,8 @@ Tab.prototype = {
if (!browser) if (!browser)
return; return;
let screenW = screen.width; let screenW = this._viewport.width;
let screenH = screen.height; let screenH = this._viewport.height;
let viewportW, viewportH; let viewportW, viewportH;
let metadata = this.metadata; let metadata = this.metadata;
@ -1347,7 +1347,7 @@ Tab.prototype = {
if (!this.browser.contentDocument || !this.browser.contentDocument.body) if (!this.browser.contentDocument || !this.browser.contentDocument.body)
return 1.0; return 1.0;
return screen.width / this.browser.contentDocument.body.clientWidth; return this._viewport.width / this.browser.contentDocument.body.clientWidth;
}, },
setBrowserSize: function(aWidth, aHeight) { setBrowserSize: function(aWidth, aHeight) {