Bug 1713589. If the double tap default zoom in pref is 1 make sure to fully disable the functionality. r=botond

And then use this to disable the default zoom in in a couple of tests. The tablecell test specifically checks that we don't zoom in on tablecells. The hscrollable test checks that we don't scroll when double tapping and it would like to zoom out.

Differential Revision: https://phabricator.services.mozilla.com/D116457
This commit is contained in:
Timothy Nikkel 2021-06-03 09:51:51 +00:00
Родитель d9bcfd9074
Коммит 632a18be52
2 изменённых файлов: 17 добавлений и 8 удалений

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

@ -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) {

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

@ -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},