Bug 1251001 - Input fields at the bottom of a page do not pan into view when gaining focus. r=botond

This commit is contained in:
Randall Barker 2016-02-24 11:40:14 -08:00
parent 9a285c6d99
commit d94bdf0d3f

View File

@ -3561,6 +3561,14 @@ void AsyncPanZoomController::ZoomToRect(CSSRect aRect, const uint32_t aFlags) {
// Adjust the zoomToRect to a sensible position to prevent overscrolling.
CSSSize sizeAfterZoom = endZoomToMetrics.CalculateCompositedSizeInCssPixels();
// Vertically center the zoomed element in the screen.
if (!zoomOut && (sizeAfterZoom.height > aRect.height)) {
aRect.y -= (sizeAfterZoom.height - aRect.height) * 0.5f;
if (aRect.y < 0.0f) {
aRect.y = 0.0f;
}
}
// If either of these conditions are met, the page will be
// overscrolled after zoomed
if (aRect.y + sizeAfterZoom.height > cssPageRect.height) {
@ -3572,14 +3580,6 @@ void AsyncPanZoomController::ZoomToRect(CSSRect aRect, const uint32_t aFlags) {
aRect.x = aRect.x > 0 ? aRect.x : 0;
}
// Vertically center the zoomed element in the screen.
if (!zoomOut && (sizeAfterZoom.height > aRect.height)) {
aRect.y -= (sizeAfterZoom.height - aRect.height) * 0.5f;
if (aRect.y < 0.0f) {
aRect.y = 0.0f;
}
}
endZoomToMetrics.SetScrollOffset(aRect.TopLeft());
StartAnimation(new ZoomAnimation(