From bd15a1287b0dcf2c63610ab21979cd0d5d640b6d Mon Sep 17 00:00:00 2001 From: Kartikaya Gupta Date: Thu, 3 Sep 2015 10:30:40 -0400 Subject: [PATCH] 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 --- layout/base/ZoomConstraintsClient.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/layout/base/ZoomConstraintsClient.cpp b/layout/base/ZoomConstraintsClient.cpp index f110e123b06b..48ee0755e62a 100644 --- a/layout/base/ZoomConstraintsClient.cpp +++ b/layout/base/ZoomConstraintsClient.cpp @@ -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; }