diff --git a/gfx/layers/apz/src/APZInputBridge.cpp b/gfx/layers/apz/src/APZInputBridge.cpp index eb57816f7865..5ffb2f51f426 100644 --- a/gfx/layers/apz/src/APZInputBridge.cpp +++ b/gfx/layers/apz/src/APZInputBridge.cpp @@ -64,6 +64,8 @@ nsEventStatus APZInputBridge::ReceiveInputEvent( // mouse event undergoes (in PositionedEventTargeting.cpp) uses // the IGNORE_ROOT_SCROLL_FRAME flag, which is needed for correct // hit testing in a zoomed-in or zoomed-out state. + // FIXME: bug 1525793 -- this may need to handle zooming or not on a + // per-document basis. if (gfxPrefs::APZAllowZooming()) { mouseEvent.mIgnoreRootScrollFrame = true; } diff --git a/gfx/layers/apz/src/AsyncPanZoomController.cpp b/gfx/layers/apz/src/AsyncPanZoomController.cpp index de936d6dc15f..9698e60bac96 100644 --- a/gfx/layers/apz/src/AsyncPanZoomController.cpp +++ b/gfx/layers/apz/src/AsyncPanZoomController.cpp @@ -1525,6 +1525,8 @@ nsEventStatus AsyncPanZoomController::OnScaleBegin( // For platforms that don't support APZ zooming, dispatch a message to the // content controller, it may want to do something else with this gesture. + // FIXME: bug 1525793 -- this may need to handle zooming or not on a + // per-document basis. if (!gfxPrefs::APZAllowZooming()) { if (RefPtr controller = GetGeckoContentController()) { @@ -1569,6 +1571,8 @@ nsEventStatus AsyncPanZoomController::OnScale(const PinchGestureInput& aEvent) { mY.UpdateWithTouchAtDevicePoint(aEvent.mLocalFocusPoint.y, aEvent.mTime); } + // FIXME: bug 1525793 -- this may need to handle zooming or not on a + // per-document basis. if (!gfxPrefs::APZAllowZooming()) { if (RefPtr controller = GetGeckoContentController()) { @@ -1702,6 +1706,8 @@ nsEventStatus AsyncPanZoomController::OnScaleEnd( return nsEventStatus_eIgnore; } + // FIXME: bug 1525793 -- this may need to handle zooming or not on a + // per-document basis. if (!gfxPrefs::APZAllowZooming()) { if (RefPtr controller = GetGeckoContentController()) { @@ -4074,6 +4080,8 @@ AsyncPanZoomController::GetCurrentAsyncTransformForFixedAdjustment( // Use the layout viewport to adjust fixed position elements if and only if // it's larger than the visual viewport (assuming we're scrolling the RCD-RSF // with apz.allow_zooming enabled). + // FIXME: bug 1525793 -- this may need to handle zooming or not on a + // per-document basis. return (gfxPrefs::APZAllowZooming() && Metrics().IsRootContent() && Metrics().GetVisualViewport().Size() <= Metrics().GetLayoutViewport().Size()) diff --git a/gfx/layers/apz/util/APZCCallbackHelper.cpp b/gfx/layers/apz/util/APZCCallbackHelper.cpp index 66c5c873f2bd..0e7cfd337740 100644 --- a/gfx/layers/apz/util/APZCCallbackHelper.cpp +++ b/gfx/layers/apz/util/APZCCallbackHelper.cpp @@ -307,7 +307,8 @@ void APZCCallbackHelper::UpdateRootFrame(const RepaintRequest& aRequest) { return; } - if (gfxPrefs::APZAllowZooming() && aRequest.GetScrollOffsetUpdated()) { + if (nsLayoutUtils::AllowZoomingForDocument(shell->GetDocument()) && + aRequest.GetScrollOffsetUpdated()) { // If zooming is disabled then we don't really want to let APZ fiddle // with these things. In theory setting the resolution here should be a // no-op, but setting the visual viewport size is bad because it can cause a @@ -671,7 +672,8 @@ static bool PrepareForSetTargetAPZCNotification( nsPoint point = nsLayoutUtils::GetEventCoordinatesRelativeTo( aWidget, aRefPoint, aRootFrame); EnumSet options; - if (gfxPrefs::APZAllowZooming()) { + if (nsLayoutUtils::AllowZoomingForDocument( + aRootFrame->PresShell()->GetDocument())) { // If zooming is enabled, we need IgnoreRootScrollFrame for correct // hit testing. Otherwise, don't use it because it interferes with // hit testing for some purposes such as scrollbar dragging (this will diff --git a/layout/base/MobileViewportManager.cpp b/layout/base/MobileViewportManager.cpp index f47ba33a0d30..3d11d937bdbd 100644 --- a/layout/base/MobileViewportManager.cpp +++ b/layout/base/MobileViewportManager.cpp @@ -506,7 +506,7 @@ void MobileViewportManager::RefreshViewportSize(bool aForceAdjustResolution) { MVM_LOG("%p: Updating properties because %d || %d\n", this, mIsFirstPaint, mMobileViewportSize != viewport); - if (gfxPrefs::APZAllowZooming()) { + if (nsLayoutUtils::AllowZoomingForDocument(mDocument)) { UpdateResolution(viewportInfo, displaySize, viewport, displayWidthChangeRatio, UpdateType::ViewportSize); } else { @@ -545,8 +545,8 @@ void MobileViewportManager::ShrinkToDisplaySizeIfNeeded( return; } - if (!gfxPrefs::APZAllowZooming()) { - // If the APZ is disabled, we don't scale down wider contents to fit them + if (!nsLayoutUtils::AllowZoomingForDocument(mDocument)) { + // If zoom is disabled, we don't scale down wider contents to fit them // into device screen because users won't be able to zoom out the tiny // contents. return; diff --git a/layout/base/PresShell.cpp b/layout/base/PresShell.cpp index 73725fd9e3f4..7125a184bfe4 100644 --- a/layout/base/PresShell.cpp +++ b/layout/base/PresShell.cpp @@ -10502,9 +10502,10 @@ nsresult PresShell::SetIsActive(bool aIsActive) { } void PresShell::UpdateViewportOverridden(bool aAfterInitialization) { - // Determine if we require a MobileViewportManager. - bool needMVM = nsLayoutUtils::ShouldHandleMetaViewport(mDocument) || - gfxPrefs::APZAllowZooming(); + // Determine if we require a MobileViewportManager. This logic is + // equivalent to ShouldHandleMetaViewport, which will check gfxPrefs if + // there are not meta viewport overrides. + bool needMVM = nsLayoutUtils::ShouldHandleMetaViewport(mDocument); if (needMVM == !!mMobileViewportManager) { // Either we've need one and we've already got it, or we don't need one diff --git a/layout/base/TouchManager.cpp b/layout/base/TouchManager.cpp index 9dc60292ded2..a6556aa99e7d 100644 --- a/layout/base/TouchManager.cpp +++ b/layout/base/TouchManager.cpp @@ -114,7 +114,8 @@ nsIFrame* TouchManager::SetupTarget(WidgetTouchEvent* aEvent, // Setting this flag will skip the scrollbars on the root frame from // participating in hit-testing, and we only want that to happen on // zoomable platforms (for now). - if (gfxPrefs::APZAllowZooming()) { + dom::Document* doc = aFrame->PresContext()->Document(); + if (nsLayoutUtils::AllowZoomingForDocument(doc)) { flags |= INPUT_IGNORE_ROOT_SCROLL_FRAME; } diff --git a/layout/base/ZoomConstraintsClient.cpp b/layout/base/ZoomConstraintsClient.cpp index 72214b3dd879..1c6261d6e55e 100644 --- a/layout/base/ZoomConstraintsClient.cpp +++ b/layout/base/ZoomConstraintsClient.cpp @@ -168,10 +168,10 @@ void ZoomConstraintsClient::ScreenSizeChanged() { } static mozilla::layers::ZoomConstraints ComputeZoomConstraintsFromViewportInfo( - const nsViewportInfo& aViewportInfo) { + const nsViewportInfo& aViewportInfo, Document* aDocument) { mozilla::layers::ZoomConstraints constraints; - constraints.mAllowZoom = - aViewportInfo.IsZoomAllowed() && gfxPrefs::APZAllowZooming(); + constraints.mAllowZoom = aViewportInfo.IsZoomAllowed() && + nsLayoutUtils::AllowZoomingForDocument(aDocument); constraints.mAllowDoubleTapZoom = constraints.mAllowZoom && gfxPrefs::APZAllowDoubleTapZooming(); if (constraints.mAllowZoom) { @@ -209,7 +209,7 @@ void ZoomConstraintsClient::RefreshZoomConstraints() { screenSize, PixelCastJustification::LayoutDeviceIsScreenForBounds)); mozilla::layers::ZoomConstraints zoomConstraints = - ComputeZoomConstraintsFromViewportInfo(viewportInfo); + ComputeZoomConstraintsFromViewportInfo(viewportInfo, mDocument); if (mDocument->Fullscreen()) { ZCC_LOG("%p is in fullscreen, disallowing zooming\n", this); diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index 4bf302c64a93..eed51c921738 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -9351,7 +9351,8 @@ static void UpdateDisplayPortMarginsForPendingMetrics( return; } - if (gfxPrefs::APZAllowZooming() && aMetrics.IsRootContent()) { + if (nsLayoutUtils::AllowZoomingForDocument(shell->GetDocument()) && + aMetrics.IsRootContent()) { // See APZCCallbackHelper::UpdateRootFrame for details. float presShellResolution = shell->GetResolution(); if (presShellResolution != aMetrics.GetPresShellResolution()) { diff --git a/widget/cocoa/nsChildView.mm b/widget/cocoa/nsChildView.mm index 84b4b9a2aaeb..9fd78d680d13 100644 --- a/widget/cocoa/nsChildView.mm +++ b/widget/cocoa/nsChildView.mm @@ -3678,6 +3678,7 @@ NSEvent* gLastDragMouseDownEvent = nil; return; } + // FIXME: bug 1525793 -- this may need to handle zooming or not on a per-document basis. if (gfxPrefs::APZAllowZooming()) { NSPoint locationInWindow = nsCocoaUtils::EventLocationForWindow(anEvent, [self window]); ScreenPoint position =