Bug 828345 - Maintain aspect ratio for clamping scrollport. r=kats

Make sure the clamping scroll-port maintains its aspect ratio on Android. This
fixes fixed position elements appearing to jitter after zooming out beyond the
page boundaries.
This commit is contained in:
Chris Lord 2013-01-10 17:32:44 +00:00
Родитель d88672c543
Коммит c2b8898f87
1 изменённых файлов: 7 добавлений и 2 удалений

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

@ -3116,8 +3116,13 @@ Tab.prototype = {
let viewportHeight = gScreenHeight / zoom;
let [pageWidth, pageHeight] = this.getPageSize(this.browser.contentDocument,
viewportWidth, viewportHeight);
let scrollPortWidth = Math.min(viewportWidth, pageWidth);
let scrollPortHeight = Math.min(viewportHeight, pageHeight);
// Make sure the aspect ratio of the screen is maintained when setting
// the clamping scroll-port size.
let factor = Math.min(viewportWidth / gScreenWidth, pageWidth / gScreenWidth,
viewportHeight / gScreenHeight, pageHeight / gScreenHeight);
let scrollPortWidth = gScreenWidth * factor;
let scrollPortHeight = gScreenHeight * factor;
let win = this.browser.contentWindow;
win.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils).