Bug 941331 - Leave a margin when double-tap zooming to an element [r=ally]

This commit is contained in:
Matt Brubeck 2013-11-21 17:40:54 -08:00
parent 1a7bdfce00
commit 1374d27179

View File

@ -49,6 +49,8 @@ const kReferenceDpi = 240; // standard "pixel" size used in some preferences
const kStateActive = 0x00000001; // :active pseudoclass for elements
const kZoomToElementMargin = 16; // in px
/*
* getBoundingContentRect
*
@ -402,10 +404,18 @@ let Content = {
_zoomToElement: function(aElement) {
let rect = getBoundingContentRect(aElement);
this._inflateRect(rect, kZoomToElementMargin);
this._zoomToRect(rect);
this._isZoomedIn = true;
},
_inflateRect: function(aRect, aMargin) {
aRect.left -= aMargin;
aRect.top -= aMargin;
aRect.bottom += aMargin;
aRect.right += aMargin;
},
_zoomToRect: function (aRect) {
let utils = Util.getWindowUtils(content);
let viewId = utils.getViewId(content.document.documentElement);