diff --git a/mobile/android/chrome/content/browser.js b/mobile/android/chrome/content/browser.js index 6b91cf30ae24..662453d73c75 100644 --- a/mobile/android/chrome/content/browser.js +++ b/mobile/android/chrome/content/browser.js @@ -4024,8 +4024,13 @@ var BrowserEventHandler = { // center the area of interest on the screen. let topPos = scrollTop + drRect.top - (viewport.cssHeight / 2.0); + // Factor in the border and padding + let boundingStyle = window.getComputedStyle(boundingElement); + let leftAdjustment = parseInt(boundingStyle.paddingLeft) + + parseInt(boundingStyle.borderLeftWidth); + rect.type = "Browser:ZoomToRect"; - rect.x = Math.max(viewport.cssPageLeft, rect.x - fudge); + rect.x = Math.max(viewport.cssPageLeft, rect.x - fudge + leftAdjustment); rect.y = Math.max(topPos, viewport.cssPageTop); rect.w = viewport.cssWidth; rect.h = viewport.cssHeight;