Bug 740539 - Account for possible mismatch in zoom levels when handling Viewport:PageSize. r=Cwiiis

This commit is contained in:
Kartikaya Gupta 2012-04-01 14:30:35 -04:00
parent 3519b46a3e
commit 7eeadaf018

View File

@ -211,8 +211,12 @@ public class GeckoLayerClient implements GeckoEventResponder,
mLayerController.abortPanZoomAnimation();
break;
case PAGE_SIZE:
// adjust the page dimensions to account for differences in zoom
// between the rendered content (which is what Gecko tells us)
// and our zoom level (which may have diverged).
float scaleFactor = oldMetrics.zoomFactor / messageMetrics.getZoomFactor();
newMetrics = new ViewportMetrics(oldMetrics);
newMetrics.setPageSize(messageMetrics.getPageSize());
newMetrics.setPageSize(messageMetrics.getPageSize().scale(scaleFactor));
break;
}