From 7d2d0b1c1beedc328cc72ab7b4d6d194be244c2c Mon Sep 17 00:00:00 2001 From: Hiroyuki Ikezoe Date: Mon, 5 Jul 2021 00:48:42 +0000 Subject: [PATCH] Bug 1705976 - A test that double tapping inside OOP iframe doesn't zoom if the top level document disallows zooming. r=tnikkel Differential Revision: https://phabricator.services.mozilla.com/D119042 --- .../mochitest/apz_test_native_event_utils.js | 10 +++- ..._disallow_doubletap_zoom_inside_oopif.html | 58 +++++++++++++++++++ .../test_group_double_tap_zoom-2.html | 7 +++ 3 files changed, 72 insertions(+), 3 deletions(-) create mode 100644 gfx/layers/apz/test/mochitest/helper_disallow_doubletap_zoom_inside_oopif.html diff --git a/gfx/layers/apz/test/mochitest/apz_test_native_event_utils.js b/gfx/layers/apz/test/mochitest/apz_test_native_event_utils.js index 0626f202fef9..dcf65dd27736 100644 --- a/gfx/layers/apz/test/mochitest/apz_test_native_event_utils.js +++ b/gfx/layers/apz/test/mochitest/apz_test_native_event_utils.js @@ -1455,15 +1455,19 @@ async function pinchZoomOutWithTouchAtCenter() { } // useTouchpad is only currently implemented on macOS -async function doubleTapOn(element, x, y, useTouchpad) { - let transformEndPromise = promiseTransformEnd(); - +function synthesizeDoubleTap(element, x, y, useTouchpad) { if (useTouchpad) { synthesizeNativeTouchpadDoubleTap(element, x, y); } else { synthesizeNativeTap(element, x, y); synthesizeNativeTap(element, x, y); } +} +// useTouchpad is only currently implemented on macOS +async function doubleTapOn(element, x, y, useTouchpad) { + let transformEndPromise = promiseTransformEnd(); + + synthesizeDoubleTap(element, x, y, useTouchpad); // Wait for the APZ:TransformEnd to fire await transformEndPromise; diff --git a/gfx/layers/apz/test/mochitest/helper_disallow_doubletap_zoom_inside_oopif.html b/gfx/layers/apz/test/mochitest/helper_disallow_doubletap_zoom_inside_oopif.html new file mode 100644 index 000000000000..0c92158a24b8 --- /dev/null +++ b/gfx/layers/apz/test/mochitest/helper_disallow_doubletap_zoom_inside_oopif.html @@ -0,0 +1,58 @@ + + + + + + Check that double tapping inside an oop iframe doesn't work if the top + level content document doesn't allow zooming + + + + + + + + + + + + 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 ff430eee3a26..3080b519a445 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 @@ -38,6 +38,11 @@ var disable_default_zoomin_and_doubletap_prefs = [ ["apz.doubletapzoom.defaultzoomin", "1.0"], ]; +var meta_viewport_and_doubletap_prefs = [ + ...doubletap_prefs, + ["dom.meta-viewport.enabled", true], +]; + 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}, @@ -51,6 +56,7 @@ var subtests = [ {"file": "helper_doubletap_zoom_noscroll.html", "prefs": visualviewport_and_doubletap_prefs}, {"file": "helper_doubletap_zoom_square.html", "prefs": visualviewport_and_doubletap_prefs}, {"file": "helper_doubletap_zoom_oopif.html", "prefs": doubletap_prefs}, + {"file": "helper_disallow_doubletap_zoom_inside_oopif.html", "prefs": meta_viewport_and_doubletap_prefs}, ]; if (getPlatform() == "mac") { @@ -67,6 +73,7 @@ if (getPlatform() == "mac") { {"file": "helper_doubletap_zoom_noscroll.html?touchpad", "prefs": visualviewport_and_doubletap_prefs}, {"file": "helper_doubletap_zoom_square.html?touchpad", "prefs": visualviewport_and_doubletap_prefs}, {"file": "helper_doubletap_zoom_oopif.html?touchpad", "prefs": doubletap_prefs}, + {"file": "helper_disallow_doubletap_zoom_inside_oopif.html?touchpad", "prefs": meta_viewport_and_doubletap_prefs}, ); }