Bug 1231517 - part 5, Update scrollToFocusedInput in browser.js to use nsDOMWindowUtils.zoomToFocusedInput when APZ is enabled r=snorp

This commit is contained in:
Randall Barker 2016-01-19 17:46:50 -08:00
parent 1bb772ec45
commit 1060a6ac5a

View File

@ -1776,15 +1776,22 @@ var BrowserApp = {
if (formHelperMode == kFormHelperModeDisabled)
return;
let focused = this.getFocusedInput(aBrowser);
if (focused) {
let shouldZoom = Services.prefs.getBoolPref("formhelper.autozoom");
if (formHelperMode == kFormHelperModeDynamic && this.isTablet)
shouldZoom = false;
// ZoomHelper.zoomToElement will handle not sending any message if this input is already mostly filling the screen
ZoomHelper.zoomToElement(focused, -1, false,
aAllowZoom && shouldZoom && !ViewportHandler.isViewportSpecified(aBrowser.contentWindow));
if (!AppConstants.MOZ_ANDROID_APZ) {
let focused = this.getFocusedInput(aBrowser);
if (focused) {
let shouldZoom = Services.prefs.getBoolPref("formhelper.autozoom");
if (formHelperMode == kFormHelperModeDynamic && this.isTablet)
shouldZoom = false;
// ZoomHelper.zoomToElement will handle not sending any message if this input is already mostly filling the screen
ZoomHelper.zoomToElement(focused, -1, false,
aAllowZoom && shouldZoom && !ViewportHandler.isViewportSpecified(aBrowser.contentWindow));
}
} else {
// Using a timeout to let the viewport propagate to the compositor thread before requesting a pan and zoom animation
// so the element will end up in the middle of the correctly sized viewport. See Bug 1231517.
setTimeout(function(e) {
aBrowser.contentWindow.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils).zoomToFocusedInput();
}, 500);
}
},