Bug 716403 - Resize viewport dynamically on Android. r=kats,mfinkle

This causes the viewport size to differ, depending on the length of the page.
This has the effect of pages that size themselves to the size of the window
always having the toolbar visible, making sites like Google Maps more usable.
This commit is contained in:
Chris Lord
2013-03-06 16:56:00 +00:00
parent 41380608cf
commit f818ffed3b
4 changed files with 119 additions and 21 deletions

View File

@@ -909,15 +909,21 @@ class JavaPanZoomController
// Ensure minZoomFactor keeps the page at least as big as the viewport.
if (pageRect.width() > 0) {
float scaleFactor = viewport.width() / pageRect.width();
float pageWidth = pageRect.width() +
viewportMetrics.fixedLayerMarginLeft +
viewportMetrics.fixedLayerMarginRight;
float scaleFactor = viewport.width() / pageWidth;
minZoomFactor = Math.max(minZoomFactor, zoomFactor * scaleFactor);
if (viewport.width() > pageRect.width())
if (viewport.width() > pageWidth)
focusX = 0.0f;
}
if (pageRect.height() > 0) {
float scaleFactor = viewport.height() / pageRect.height();
float pageHeight = pageRect.height() +
viewportMetrics.fixedLayerMarginTop +
viewportMetrics.fixedLayerMarginBottom;
float scaleFactor = viewport.height() / pageHeight;
minZoomFactor = Math.max(minZoomFactor, zoomFactor * scaleFactor);
if (viewport.height() > pageRect.height())
if (viewport.height() > pageHeight)
focusY = 0.0f;
}