diff --git a/gfx/layers/apz/src/AsyncPanZoomController.cpp b/gfx/layers/apz/src/AsyncPanZoomController.cpp index ef3b529680f6..d7d58acd9ee4 100644 --- a/gfx/layers/apz/src/AsyncPanZoomController.cpp +++ b/gfx/layers/apz/src/AsyncPanZoomController.cpp @@ -5478,6 +5478,9 @@ void AsyncPanZoomController::ZoomToRect(const ZoomTarget& aZoomTarget, MOZ_ASSERT(Metrics().IsRootContent()); MOZ_ASSERT(Metrics().GetZoom().AreScalesSame()); + const float defaultZoomInAmount = + StaticPrefs::apz_doubletapzoom_defaultzoomin(); + ParentLayerRect compositionBounds = Metrics().GetCompositionBounds(); CSSRect cssPageRect = Metrics().GetScrollableRect(); CSSPoint scrollOffset = Metrics().GetVisualScrollOffset(); @@ -5526,7 +5529,8 @@ void AsyncPanZoomController::ZoomToRect(const ZoomTarget& aZoomTarget, } else { if (rect.IsEmpty()) { if (currentZoom == localMinZoom && - (aFlags & ZOOM_IN_IF_CANT_ZOOM_OUT)) { + (aFlags & ZOOM_IN_IF_CANT_ZOOM_OUT) && + (defaultZoomInAmount != 1.f)) { zoomInDefaultAmount = true; } else { zoomOut = true; @@ -5538,14 +5542,14 @@ void AsyncPanZoomController::ZoomToRect(const ZoomTarget& aZoomTarget, // already at min zoom and asked to zoom out further if (!zoomOut && currentZoom == localMinZoom && targetZoom <= localMinZoom && - (aFlags & ZOOM_IN_IF_CANT_ZOOM_OUT)) { + (aFlags & ZOOM_IN_IF_CANT_ZOOM_OUT) && (defaultZoomInAmount != 1.f)) { zoomInDefaultAmount = true; } MOZ_ASSERT(!(zoomInDefaultAmount && zoomOut)); if (zoomInDefaultAmount) { - targetZoom = CSSToParentLayerScale( - currentZoom.scale * StaticPrefs::apz_doubletapzoom_defaultzoomin()); + targetZoom = + CSSToParentLayerScale(currentZoom.scale * defaultZoomInAmount); } if (zoomOut) { diff --git a/gfx/layers/apz/test/mochitest/test_group_double_tap_zoom-2.html b/gfx/layers/apz/test/mochitest/test_group_double_tap_zoom-2.html index 99907e506ffb..bf523c3e46c8 100644 --- a/gfx/layers/apz/test/mochitest/test_group_double_tap_zoom-2.html +++ b/gfx/layers/apz/test/mochitest/test_group_double_tap_zoom-2.html @@ -28,13 +28,18 @@ var logging_and_doubletap_prefs = [ ["apz.test.logging_enabled", true], ]; +var disable_default_zoomin_and_doubletap_prefs = [ + ...doubletap_prefs, + ["apz.doubletapzoom.defaultzoomin", "1.0"], +]; + var subtests = [ {"file": "helper_doubletap_zoom_smooth.html", "prefs": longeranimation_visualviewport_and_doubletap_prefs}, {"file": "helper_doubletap_zoom_fixedpos_overflow.html", "prefs": logging_and_doubletap_prefs}, - {"file": "helper_doubletap_zoom_hscrollable.html", "prefs": doubletap_prefs}, + {"file": "helper_doubletap_zoom_hscrollable.html", "prefs": disable_default_zoomin_and_doubletap_prefs}, {"file": "helper_doubletap_zoom_scrolled_overflowhidden.html", "prefs": doubletap_prefs}, {"file": "helper_doubletap_zoom_shadowdom.html", "prefs": doubletap_prefs}, - {"file": "helper_doubletap_zoom_tablecell.html", "prefs": doubletap_prefs}, + {"file": "helper_doubletap_zoom_tablecell.html", "prefs": disable_default_zoomin_and_doubletap_prefs}, {"file": "helper_doubletap_zoom_gencon.html", "prefs": doubletap_prefs}, {"file": "helper_doubletap_zoom_hscrollable2.html", "prefs": doubletap_prefs}, {"file": "helper_doubletap_zoom_nothing.html", "prefs": doubletap_prefs}, @@ -44,10 +49,10 @@ if (getPlatform() == "mac") { subtests.push( {"file": "helper_doubletap_zoom_smooth.html?touchpad", "prefs": longeranimation_visualviewport_and_doubletap_prefs}, {"file": "helper_doubletap_zoom_fixedpos_overflow.html?touchpad", "prefs": logging_and_doubletap_prefs}, - {"file": "helper_doubletap_zoom_hscrollable.html?touchpad", "prefs": doubletap_prefs}, + {"file": "helper_doubletap_zoom_hscrollable.html?touchpad", "prefs": disable_default_zoomin_and_doubletap_prefs}, {"file": "helper_doubletap_zoom_scrolled_overflowhidden.html?touchpad", "prefs": doubletap_prefs}, {"file": "helper_doubletap_zoom_shadowdom.html?touchpad", "prefs": doubletap_prefs}, - {"file": "helper_doubletap_zoom_tablecell.html?touchpad", "prefs": doubletap_prefs}, + {"file": "helper_doubletap_zoom_tablecell.html?touchpad", "prefs": disable_default_zoomin_and_doubletap_prefs}, {"file": "helper_doubletap_zoom_gencon.html?touchpad", "prefs": doubletap_prefs}, {"file": "helper_doubletap_zoom_hscrollable2.html?touchpad", "prefs": doubletap_prefs}, {"file": "helper_doubletap_zoom_nothing.html?touchpad", "prefs": doubletap_prefs},