Bug 1186004 - Add a pref to enable/disable APZ zooming behaviour. r=botond

This commit is contained in:
Kartikaya Gupta 2015-07-22 23:42:08 -04:00
Родитель e8f514329a
Коммит 7b9f833a48
8 изменённых файлов: 22 добавлений и 7 удалений

Просмотреть файл

@ -1040,7 +1040,10 @@ pref("security.exthelperapp.disable_background_handling", true);
pref("osfile.reset_worker_delay", 5000);
// APZC preferences.
//
#ifdef MOZ_WIDGET_GONK
pref("apz.allow_zooming", true);
#endif
// Gaia relies heavily on scroll events for now, so lets fire them
// more often than the default value (100).
pref("apz.asyncscroll.throttle", 40);

Просмотреть файл

@ -7906,14 +7906,14 @@ nsDocument::GetViewportInfo(const ScreenIntSize& aDisplaySize)
return nsViewportInfo(aDisplaySize,
defaultScale,
/*allowZoom*/false,
/*allowDoubleTapZoom*/ true);
/*allowDoubleTapZoom*/ false);
}
if (!gfxPrefs::MetaViewportEnabled()) {
return nsViewportInfo(aDisplaySize,
defaultScale,
/*allowZoom*/ false,
/*allowDoubleTapZoom*/ true);
/*allowDoubleTapZoom*/ false);
}
// In cases where the width of the CSS viewport is less than or equal to the width

Просмотреть файл

@ -34,6 +34,9 @@ class MOZ_STACK_CLASS nsViewportInfo
mAllowZoom(aAllowZoom),
mAllowDoubleTapZoom(aAllowDoubleTapZoom)
{
// Don't allow double-tap zooming unless zooming is also allowed
MOZ_ASSERT(mAllowZoom || !mAllowDoubleTapZoom);
mSize = mozilla::ScreenSize(aDisplaySize) / mDefaultZoom;
mozilla::CSSToLayoutDeviceScale pixelRatio(1.0f);
mMinZoom = pixelRatio * kViewportMinScale;
@ -56,6 +59,9 @@ class MOZ_STACK_CLASS nsViewportInfo
mAllowZoom(aAllowZoom),
mAllowDoubleTapZoom(aAllowDoubleTapZoom)
{
// Don't allow double-tap zooming unless zooming is also allowed
MOZ_ASSERT(mAllowZoom || !mAllowDoubleTapZoom);
ConstrainViewportValues();
}

Просмотреть файл

@ -135,6 +135,7 @@ private:
// The apz prefs are explained in AsyncPanZoomController.cpp
DECL_GFX_PREF(Live, "apz.allow_checkerboarding", APZAllowCheckerboarding, bool, true);
DECL_GFX_PREF(Live, "apz.allow_zooming", APZAllowZooming, bool, false);
DECL_GFX_PREF(Live, "apz.asyncscroll.throttle", APZAsyncScrollThrottleTime, int32_t, 100);
DECL_GFX_PREF(Live, "apz.asyncscroll.timeout", APZAsyncScrollTimeout, int32_t, 300);
DECL_GFX_PREF(Live, "apz.axis_lock.breakout_angle", APZAxisBreakoutAngle, float, float(M_PI / 8.0) /* 22.5 degrees */);

Просмотреть файл

@ -114,7 +114,11 @@ MobileViewportManager::UpdateResolution(const nsViewportInfo& aViewportInfo,
/ mPresShell->GetPresContext()->AppUnitsPerDevPixel());
LayoutDeviceToLayerScale res(nsLayoutUtils::GetResolution(mPresShell));
#if defined(MOZ_WIDGET_GONK) || defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WIDGET_UIKIT)
if (!gfxPrefs::APZAllowZooming()) {
return ViewTargetAs<ScreenPixel>(cssToDev * res / ParentLayerToLayerScale(1),
PixelCastJustification::ScreenIsParentLayerForRoot);
}
if (mIsFirstPaint) {
CSSToScreenScale defaultZoom = aViewportInfo.GetDefaultZoom();
MVM_LOG("%p: default zoom from viewport is %f\n", this, defaultZoom.scale);
@ -173,7 +177,6 @@ MobileViewportManager::UpdateResolution(const nsViewportInfo& aViewportInfo,
nsLayoutUtils::SetResolutionAndScaleTo(mPresShell, newRes.scale);
res = newRes;
}
#endif
return ViewTargetAs<ScreenPixel>(cssToDev * res / ParentLayerToLayerScale(1),
PixelCastJustification::ScreenIsParentLayerForRoot);

Просмотреть файл

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

Просмотреть файл

@ -547,6 +547,7 @@ pref("layers.offmainthreadcomposition.enabled", true);
pref("layers.async-video.enabled", true);
#ifdef MOZ_ANDROID_APZ
pref("layers.async-pan-zoom.enabled", true);
pref("apz.allow_zooming", true);
#endif
pref("layers.progressive-paint", true);
pref("layers.low-precision-buffer", true);

Просмотреть файл

@ -516,6 +516,7 @@ pref("layout.event-regions.enabled", false);
// APZ preferences. For documentation/details on what these prefs do, check
// gfx/layers/apz/src/AsyncPanZoomController.cpp.
pref("apz.allow_checkerboarding", true);
pref("apz.allow_zooming", false);
pref("apz.asyncscroll.throttle", 100);
pref("apz.asyncscroll.timeout", 300);