Bug 672411 - Calculate the viewport height correctly for non-scalable pages [r=wesj]

This commit is contained in:
Matt Brubeck 2011-07-29 07:18:50 -07:00
Родитель 456ebe41a9
Коммит 4bd2484a4e
1 изменённых файлов: 6 добавлений и 3 удалений

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

@ -2731,8 +2731,8 @@ Tab.prototype = {
// Make sure the viewport height is not shorter than the window when // Make sure the viewport height is not shorter than the window when
// the page is zoomed out to show its full width. // the page is zoomed out to show its full width.
if (viewportH * this.clampZoomLevel(this.getPageZoomLevel()) < screenH) let minScale = this.clampZoomLevel(this.getPageZoomLevel());
viewportH = Math.max(viewportH, screenH * (browser.contentDocumentWidth / screenW)); viewportH = Math.max(viewportH, screenH / minScale);
if (browser.contentWindowWidth != viewportW || browser.contentWindowHeight != viewportH) if (browser.contentWindowWidth != viewportW || browser.contentWindowHeight != viewportH)
browser.setWindowSize(viewportW, viewportH); browser.setWindowSize(viewportW, viewportH);
@ -2865,10 +2865,13 @@ Tab.prototype = {
}, },
clampZoomLevel: function clampZoomLevel(aScale) { clampZoomLevel: function clampZoomLevel(aScale) {
let md = this.metadata;
if (!this.allowZoom)
return (md && md.defaultZoom) ? md.defaultZoom : this.getPageZoomLevel();
let browser = this._browser; let browser = this._browser;
let bounded = Util.clamp(aScale, ZoomManager.MIN, ZoomManager.MAX); let bounded = Util.clamp(aScale, ZoomManager.MIN, ZoomManager.MAX);
let md = this.metadata;
if (md && md.minZoom) if (md && md.minZoom)
bounded = Math.max(bounded, md.minZoom); bounded = Math.max(bounded, md.minZoom);
if (md && md.maxZoom) if (md && md.maxZoom)