зеркало из https://github.com/mozilla/gecko-dev.git
bug 707571 - user-scalable property of viewport meta tag is ignored r=mbrubeck
--HG-- extra : rebase_source : a4a4d9fb6c61ff91ffb917c1e25b78a6266d7347
This commit is contained in:
Родитель
5c4e387bfa
Коммит
0d1d6df7d2
|
@ -64,6 +64,7 @@ public class ViewportMetrics {
|
||||||
private RectF mViewportRect;
|
private RectF mViewportRect;
|
||||||
private PointF mViewportOffset;
|
private PointF mViewportOffset;
|
||||||
private float mZoomFactor;
|
private float mZoomFactor;
|
||||||
|
private boolean mAllowZoom;
|
||||||
|
|
||||||
// A scale from -1,-1 to 1,1 that represents what edge of the displayport
|
// A scale from -1,-1 to 1,1 that represents what edge of the displayport
|
||||||
// we want the viewport to be biased towards.
|
// we want the viewport to be biased towards.
|
||||||
|
@ -79,6 +80,7 @@ public class ViewportMetrics {
|
||||||
mViewportOffset = new PointF(0, 0);
|
mViewportOffset = new PointF(0, 0);
|
||||||
mZoomFactor = 1.0f;
|
mZoomFactor = 1.0f;
|
||||||
mViewportBias = new PointF(0.0f, 0.0f);
|
mViewportBias = new PointF(0.0f, 0.0f);
|
||||||
|
mAllowZoom = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ViewportMetrics(ViewportMetrics viewport) {
|
public ViewportMetrics(ViewportMetrics viewport) {
|
||||||
|
@ -88,6 +90,7 @@ public class ViewportMetrics {
|
||||||
mViewportOffset = new PointF(offset.x, offset.y);
|
mViewportOffset = new PointF(offset.x, offset.y);
|
||||||
mZoomFactor = viewport.getZoomFactor();
|
mZoomFactor = viewport.getZoomFactor();
|
||||||
mViewportBias = viewport.mViewportBias;
|
mViewportBias = viewport.mViewportBias;
|
||||||
|
mAllowZoom = viewport.mAllowZoom;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ViewportMetrics(JSONObject json) throws JSONException {
|
public ViewportMetrics(JSONObject json) throws JSONException {
|
||||||
|
@ -101,6 +104,8 @@ public class ViewportMetrics {
|
||||||
float offsetY = (float)json.getDouble("offsetY");
|
float offsetY = (float)json.getDouble("offsetY");
|
||||||
float zoom = (float)json.getDouble("zoom");
|
float zoom = (float)json.getDouble("zoom");
|
||||||
|
|
||||||
|
mAllowZoom = json.getBoolean("allowZoom");
|
||||||
|
|
||||||
mPageSize = new FloatSize(pageWidth, pageHeight);
|
mPageSize = new FloatSize(pageWidth, pageHeight);
|
||||||
mViewportRect = new RectF(x, y, x + width, y + height);
|
mViewportRect = new RectF(x, y, x + width, y + height);
|
||||||
mViewportOffset = new PointF(offsetX, offsetY);
|
mViewportOffset = new PointF(offsetX, offsetY);
|
||||||
|
@ -186,6 +191,10 @@ public class ViewportMetrics {
|
||||||
return mZoomFactor;
|
return mZoomFactor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean getAllowZoom() {
|
||||||
|
return mAllowZoom;
|
||||||
|
}
|
||||||
|
|
||||||
public void setPageSize(FloatSize pageSize) {
|
public void setPageSize(FloatSize pageSize) {
|
||||||
mPageSize = pageSize;
|
mPageSize = pageSize;
|
||||||
}
|
}
|
||||||
|
|
|
@ -773,6 +773,9 @@ public class PanZoomController
|
||||||
if (GeckoApp.mDOMFullScreen)
|
if (GeckoApp.mDOMFullScreen)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if (!mController.getViewportMetrics().getAllowZoom())
|
||||||
|
return false;
|
||||||
|
|
||||||
if (mState == PanZoomState.ANIMATED_ZOOM)
|
if (mState == PanZoomState.ANIMATED_ZOOM)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
|
@ -1746,6 +1746,8 @@ Tab.prototype = {
|
||||||
pageWidth *= this._viewport.zoom;
|
pageWidth *= this._viewport.zoom;
|
||||||
pageHeight *= 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
|
* 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,
|
* this causes the page size to jump around wildly during page load. After the page is loaded,
|
||||||
|
|
Загрузка…
Ссылка в новой задаче