diff --git a/mobile/android/base/gfx/ViewportMetrics.java b/mobile/android/base/gfx/ViewportMetrics.java index 5afd9df5e482..eee9ead3df97 100644 --- a/mobile/android/base/gfx/ViewportMetrics.java +++ b/mobile/android/base/gfx/ViewportMetrics.java @@ -64,6 +64,7 @@ public class ViewportMetrics { private RectF mViewportRect; private PointF mViewportOffset; private float mZoomFactor; + private boolean mAllowZoom; // A scale from -1,-1 to 1,1 that represents what edge of the displayport // we want the viewport to be biased towards. @@ -79,6 +80,7 @@ public class ViewportMetrics { mViewportOffset = new PointF(0, 0); mZoomFactor = 1.0f; mViewportBias = new PointF(0.0f, 0.0f); + mAllowZoom = true; } public ViewportMetrics(ViewportMetrics viewport) { @@ -88,6 +90,7 @@ public class ViewportMetrics { mViewportOffset = new PointF(offset.x, offset.y); mZoomFactor = viewport.getZoomFactor(); mViewportBias = viewport.mViewportBias; + mAllowZoom = viewport.mAllowZoom; } public ViewportMetrics(JSONObject json) throws JSONException { @@ -101,6 +104,8 @@ public class ViewportMetrics { float offsetY = (float)json.getDouble("offsetY"); float zoom = (float)json.getDouble("zoom"); + mAllowZoom = json.getBoolean("allowZoom"); + mPageSize = new FloatSize(pageWidth, pageHeight); mViewportRect = new RectF(x, y, x + width, y + height); mViewportOffset = new PointF(offsetX, offsetY); @@ -186,6 +191,10 @@ public class ViewportMetrics { return mZoomFactor; } + public boolean getAllowZoom() { + return mAllowZoom; + } + public void setPageSize(FloatSize pageSize) { mPageSize = pageSize; } diff --git a/mobile/android/base/ui/PanZoomController.java b/mobile/android/base/ui/PanZoomController.java index 854efca152e5..81ccfdfafdba 100644 --- a/mobile/android/base/ui/PanZoomController.java +++ b/mobile/android/base/ui/PanZoomController.java @@ -773,6 +773,9 @@ public class PanZoomController if (GeckoApp.mDOMFullScreen) return false; + if (!mController.getViewportMetrics().getAllowZoom()) + return false; + if (mState == PanZoomState.ANIMATED_ZOOM) return false; diff --git a/mobile/android/chrome/content/browser.js b/mobile/android/chrome/content/browser.js index ebb715ec682a..3ecee54872b7 100644 --- a/mobile/android/chrome/content/browser.js +++ b/mobile/android/chrome/content/browser.js @@ -1746,6 +1746,8 @@ Tab.prototype = { pageWidth *= this._viewport.zoom; pageHeight *= this._viewport.zoom; + this._viewport.allowZoom = this.metadata.allowZoom; + /* * Avoid sending page sizes of less than screen size before we hit DOMContentLoaded, because * this causes the page size to jump around wildly during page load. After the page is loaded,