Bug 1197824 - Constrain the min/max zoom if zooming is not allowed. r=botond

In the C++ APZ implementation this has no effect, because the min/max zoom values
are never even read if zooming is not allowed. When this is hooked up to the
Java implementation though, the code expects the min/max zoom values to be
equal to the default zoom values in the case where zooming is not allowed. This
behaviour change therefore facilitates hooking up the ZoomConstraintsClient
to the Java pan/zoom controller implementation, which happens in a future patch.

--HG--
extra : commitid : BYbR5yWXpjc
This commit is contained in:
Kartikaya Gupta 2015-09-03 10:30:40 -04:00
parent 411981b8eb
commit bd15a1287b

View File

@ -153,8 +153,13 @@ ComputeZoomConstraintsFromViewportInfo(const nsViewportInfo& aViewportInfo)
mozilla::layers::ZoomConstraints constraints;
constraints.mAllowZoom = aViewportInfo.IsZoomAllowed() && gfxPrefs::APZAllowZooming();
constraints.mAllowDoubleTapZoom = aViewportInfo.IsDoubleTapZoomAllowed() && gfxPrefs::APZAllowZooming();
constraints.mMinZoom.scale = aViewportInfo.GetMinZoom().scale;
constraints.mMaxZoom.scale = aViewportInfo.GetMaxZoom().scale;
if (constraints.mAllowZoom) {
constraints.mMinZoom.scale = aViewportInfo.GetMinZoom().scale;
constraints.mMaxZoom.scale = aViewportInfo.GetMaxZoom().scale;
} else {
constraints.mMinZoom.scale = aViewportInfo.GetDefaultZoom().scale;
constraints.mMaxZoom.scale = aViewportInfo.GetDefaultZoom().scale;
}
return constraints;
}