summaryrefslogtreecommitdiffstats
path: root/gfx/layers/apz/test
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:34:42 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:34:42 +0000
commitda4c7e7ed675c3bf405668739c3012d140856109 (patch)
treecdd868dba063fecba609a1d819de271f0d51b23e /gfx/layers/apz/test
parentAdding upstream version 125.0.3. (diff)
downloadfirefox-da4c7e7ed675c3bf405668739c3012d140856109.tar.xz
firefox-da4c7e7ed675c3bf405668739c3012d140856109.zip
Adding upstream version 126.0.upstream/126.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'gfx/layers/apz/test')
-rw-r--r--gfx/layers/apz/test/mochitest/helper_bug1669625.html3
-rw-r--r--gfx/layers/apz/test/mochitest/helper_bug1806400-2.html58
-rw-r--r--gfx/layers/apz/test/mochitest/helper_bug1806400-3.html49
-rw-r--r--gfx/layers/apz/test/mochitest/helper_bug1806400-4.html49
-rw-r--r--gfx/layers/apz/test/mochitest/helper_bug1806400.html54
-rw-r--r--gfx/layers/apz/test/mochitest/helper_hittest_iframe_perspective-4.html86
-rw-r--r--gfx/layers/apz/test/mochitest/helper_hittest_pointerevents_svg.html8
-rw-r--r--gfx/layers/apz/test/mochitest/helper_scrollframe_activation_on_load.html5
-rw-r--r--gfx/layers/apz/test/mochitest/helper_touch_synthesized_mouseevents.html9
-rw-r--r--gfx/layers/apz/test/mochitest/test_group_hittest-3.html1
-rw-r--r--gfx/layers/apz/test/mochitest/test_group_touchevents-5.html18
-rw-r--r--gfx/layers/apz/test/mochitest/test_layerization.html5
-rw-r--r--gfx/layers/apz/test/mochitest/test_scroll_inactive_bug1190112.html3
13 files changed, 333 insertions, 15 deletions
diff --git a/gfx/layers/apz/test/mochitest/helper_bug1669625.html b/gfx/layers/apz/test/mochitest/helper_bug1669625.html
index 95d2a4bc2c..4a91c7f0b6 100644
--- a/gfx/layers/apz/test/mochitest/helper_bug1669625.html
+++ b/gfx/layers/apz/test/mochitest/helper_bug1669625.html
@@ -11,8 +11,7 @@
<script type="application/javascript">
async function test() {
- if (SpecialPowers.getBoolPref("apz.force_disable_desktop_zooming_scrollbars") ||
- getPlatform() == "android") {
+ if (getPlatform() == "android") {
return;
}
diff --git a/gfx/layers/apz/test/mochitest/helper_bug1806400-2.html b/gfx/layers/apz/test/mochitest/helper_bug1806400-2.html
new file mode 100644
index 0000000000..8d2eeca58d
--- /dev/null
+++ b/gfx/layers/apz/test/mochitest/helper_bug1806400-2.html
@@ -0,0 +1,58 @@
+<!DOCTYPE html>
+<html>
+<meta name="viewport" content="width=device-width; initial-scale=0.4">
+<title>Tests that double-tap-to-zoom never activates elements inside a scrollable container</title>
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script src="/tests/SimpleTest/paint_listener.js"></script>
+<script src="apz_test_utils.js"></script>
+<script src="apz_test_native_event_utils.js"></script>
+<style>
+#scrollable {
+ height: 50vh;
+ width: 50vw;
+ background: yellow;
+ overflow: scroll;
+}
+
+#scrollabletarget {
+ height: 200vh;
+ width: 200vh;
+ background: green;
+}
+
+#scrollabletarget:active {
+ background: red;
+}
+
+</style>
+<div id="scrollable">
+ <div id="scrollabletarget">
+ </div>
+</div>
+<script>
+async function test() {
+ ok(!scrollabletarget.matches(":active"), "should not be active initially");
+
+ let rAFID = requestAnimationFrame(function ensureInactive() {
+ let isActive = scrollabletarget.matches(":active");
+ ok(!isActive, "Element activation should never happen!");
+ if (!isActive) {
+ rAFID = requestAnimationFrame(ensureInactive);
+ }
+ });
+
+ await doubleTapOn(scrollabletarget, 50, 50, false /* useTouchpad */);
+
+ cancelAnimationFrame(rAFID);
+}
+
+if (getPlatform() != "mac" && getPlatform() != "android") {
+ ok(true, "Skipping test because double-tap-zoom isn't allowed on " + getPlatform());
+ subtestDone();
+} else {
+ waitUntilApzStable()
+ .then(test)
+ .then(subtestDone, subtestFailed);
+}
+</script>
+</html>
diff --git a/gfx/layers/apz/test/mochitest/helper_bug1806400-3.html b/gfx/layers/apz/test/mochitest/helper_bug1806400-3.html
new file mode 100644
index 0000000000..2e5398119c
--- /dev/null
+++ b/gfx/layers/apz/test/mochitest/helper_bug1806400-3.html
@@ -0,0 +1,49 @@
+<!DOCTYPE html>
+<html>
+<meta name="viewport" content="width=device-width; initial-scale=1.0">
+<title>Tests that :active state is changed on a scrollable container without any touch event listeners</title>
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script src="/tests/SimpleTest/paint_listener.js"></script>
+<script src="apz_test_utils.js"></script>
+<script src="apz_test_native_event_utils.js"></script>
+<style>
+#scrollable {
+ height: 50vh;
+ width: 50vw;
+ background: yellow;
+ overflow: scroll;
+}
+
+#scrollabletarget {
+ height: 200vh;
+ width: 200vh;
+ background: green;
+}
+
+#scrollabletarget:active {
+ background: red;
+}
+
+</style>
+<div id="scrollable">
+ <div id="scrollabletarget">
+ </div>
+</div>
+<script>
+async function test() {
+ ok(!scrollabletarget.matches(":active"), "should not be active initially");
+
+ await synthesizeNativeTap(scrollabletarget, 50, 50);
+
+ // In JS there's no way to ensure `APZStateChange::eStartTouch` notification
+ // has been processed. So we wait for `:active` state change here.
+ await SimpleTest.promiseWaitForCondition(
+ () => scrollabletarget.matches(":active"),
+ "Waiting for :active state change");
+ ok(scrollabletarget.matches(":active"), "should be active");
+}
+waitUntilApzStable()
+.then(test)
+.then(subtestDone, subtestFailed);
+</script>
+</html>
diff --git a/gfx/layers/apz/test/mochitest/helper_bug1806400-4.html b/gfx/layers/apz/test/mochitest/helper_bug1806400-4.html
new file mode 100644
index 0000000000..46fa95b651
--- /dev/null
+++ b/gfx/layers/apz/test/mochitest/helper_bug1806400-4.html
@@ -0,0 +1,49 @@
+<!DOCTYPE html>
+<html>
+<meta name="viewport" content="width=device-width; initial-scale=0.4">
+<title>Tests that double-tap-to-zoom never activates elements inside non scrollable container</title>
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script src="/tests/SimpleTest/paint_listener.js"></script>
+<script src="apz_test_utils.js"></script>
+<script src="apz_test_native_event_utils.js"></script>
+<style>
+#nonscrollabletarget {
+ height: 300px;
+ width: 300px;
+ background: green;
+}
+
+#nonscrollabletarget:active {
+ background: red;
+}
+
+</style>
+<div id="nonscrollabletarget">
+</div>
+<script>
+async function test() {
+ ok(!nonscrollabletarget.matches(":active"), "should not be active initially");
+
+ let rAFID = requestAnimationFrame(function ensureInactive() {
+ let isActive = nonscrollabletarget.matches(":active");
+ ok(!isActive, "Element activation should never happen!");
+ if (!isActive) {
+ rAFID = requestAnimationFrame(ensureInactive);
+ }
+ });
+
+ await doubleTapOn(nonscrollabletarget, 50, 50, false /* useTouchpad */);
+
+ cancelAnimationFrame(rAFID);
+}
+
+if (getPlatform() != "mac" && getPlatform() != "android") {
+ ok(true, "Skipping test because double-tap-zoom isn't allowed on " + getPlatform());
+ subtestDone();
+} else {
+ waitUntilApzStable()
+ .then(test)
+ .then(subtestDone, subtestFailed);
+}
+</script>
+</html>
diff --git a/gfx/layers/apz/test/mochitest/helper_bug1806400.html b/gfx/layers/apz/test/mochitest/helper_bug1806400.html
new file mode 100644
index 0000000000..03be0c8535
--- /dev/null
+++ b/gfx/layers/apz/test/mochitest/helper_bug1806400.html
@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+<html>
+<meta name="viewport" content="width=device-width; initial-scale=1.0">
+<title>Tests that :active state is changed with `touchstart` event listener</title>
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script src="/tests/SimpleTest/paint_listener.js"></script>
+<script src="apz_test_utils.js"></script>
+<script src="apz_test_native_event_utils.js"></script>
+<style>
+ #button {
+ width: 100px;
+ height: 100px;
+ }
+</style>
+<button id="button">Button</button>
+<script>
+async function test() {
+ // Set up an active touchstart event listner.
+ let eventPromise = promiseOneEvent(document.documentElement, "touchstart");
+ await promiseApzFlushedRepaints();
+
+ await synthesizeNativeTouch(button, 10, 10, SpecialPowers.DOMWindowUtils.TOUCH_CONTACT);
+ await eventPromise;
+
+ // In JS there's no way to ensure `APZStateChange::eStartTouch` notification
+ // has been processed. So we wait for `:active` state change here.
+ await SimpleTest.promiseWaitForCondition(
+ () => button.matches(":active"),
+ "Waiting for :active state change");
+ ok(button.matches(":active"), "should be active");
+
+ eventPromise = promiseOneEvent(button, "touchend");
+ await synthesizeNativeTouch(button, 10, 10, SpecialPowers.DOMWindowUtils.TOUCH_REMOVE);
+ await eventPromise;
+
+ // Same as above. We need to wait for not `:active` state here.
+ await SimpleTest.promiseWaitForCondition(
+ () => !button.matches(":active"),
+ "Waiting for :active state change");
+ ok(!button.matches(":active"), "should not be active");
+}
+
+if (getPlatform() == "windows") {
+ // Bug 1875916. On Windows synthesizeNativeTouch(TOUCH_REMOVE) causes
+ // `InjectTouchInput failure` with ERROR_TIMEOUT.
+ ok(true, "Test doesn't need to run on Windows");
+ subtestDone();
+} else {
+ waitUntilApzStable()
+ .then(test)
+ .then(subtestDone, subtestFailed);
+}
+</script>
+</html>
diff --git a/gfx/layers/apz/test/mochitest/helper_hittest_iframe_perspective-4.html b/gfx/layers/apz/test/mochitest/helper_hittest_iframe_perspective-4.html
new file mode 100644
index 0000000000..96ea0d3b09
--- /dev/null
+++ b/gfx/layers/apz/test/mochitest/helper_hittest_iframe_perspective-4.html
@@ -0,0 +1,86 @@
+<!DOCTYPE html>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1888904
+-->
+<head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width; initial-scale=1.0">
+ <title>Test that events are delivered with correct coordinates to an iframe inide a no-op perspective transform</title>
+ <script src="apz_test_native_event_utils.js"></script>
+ <script src="apz_test_utils.js"></script>
+ <script src="/tests/SimpleTest/paint_listener.js"></script>
+ <style>
+ html, body {
+ margin: 0;
+ padding: 0;
+ }
+ iframe {
+ border: 0;
+ background-color: blue;
+ }
+ .modal-dialog {
+ position: absolute;
+ top: 500px;
+ left: 500px;
+ transform: translate(-50%, -50%);
+ border: 1px solid black;
+ }
+ .item {
+ perspective: 1000px;
+ transform: translate3d(0, 0, 0);
+ }
+ .g-recaptcha {
+ transform-origin: 0 0;
+ transform: scale(0.91);
+ }
+ </style>
+</head>
+<body>
+ <div class="modal-dialog">
+ <div class="item">
+ <div class="g-recaptcha">
+ <iframe id="iframe" src="https://example.com/tests/gfx/layers/apz/test/mochitest/helper_hittest_iframe_perspective_child.html"></iframe>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ <script type="application/javascript">
+async function test() {
+ // Wait for iframe to receive content transforms.
+ await SpecialPowers.spawn(iframe, [], async () => {
+ await SpecialPowers.contentTransformsReceived(content.window);
+ });
+
+ let clickCoordsInChild = {
+ offsetX: 0,
+ offsetY: 0
+ };
+ let childMessagePromise = new Promise(resolve => {
+ window.addEventListener("message", event => {
+ let data = JSON.parse(event.data);
+ if ("type" in data && data.type == "got-mouse-down") {
+ clickCoordsInChild = data.coords;
+ resolve();
+ }
+ })
+ });
+ await synthesizeNativeMouseEventWithAPZ({
+ type: "click",
+ target: iframe,
+ offsetX: 100,
+ offsetY: 100
+ });
+ await childMessagePromise;
+ is(clickCoordsInChild.offsetX, 110 /* 100 / 0.91 */, "x coordinate is correct");
+ is(clickCoordsInChild.offsetY, 110 /* 100 / 0.91 */, "y coordinate is correct");
+}
+
+waitUntilApzStable()
+.then(test)
+.then(subtestDone, subtestFailed);
+
+ </script>
+</body>
+</html>
diff --git a/gfx/layers/apz/test/mochitest/helper_hittest_pointerevents_svg.html b/gfx/layers/apz/test/mochitest/helper_hittest_pointerevents_svg.html
index 22b880736d..3b8a7cef3e 100644
--- a/gfx/layers/apz/test/mochitest/helper_hittest_pointerevents_svg.html
+++ b/gfx/layers/apz/test/mochitest/helper_hittest_pointerevents_svg.html
@@ -132,10 +132,10 @@ async function test() {
`bottom left of scroller in testcase ${testId}`);
}
- // With the first two cases (circle masks) both WebRender and non-WebRender
- // emit dispatch-to-content regions for the right side, so for now we just
- // test for that. Eventually WebRender should be able to stop emitting DTC
- // and we can update this test to be more precise in that case.
+ // With the first two cases (circle masks) WebRender emits dispatch-to-content
+ // regions for the right side, so for now we just test for that.
+ // Eventually WebRender should be able to stop emitting DTC
+ // and we can update this test to be more precise.
// For the two rectangular test cases we get precise results rather than
// dispatch-to-content.
if (testId == 1 || testId == 2) {
diff --git a/gfx/layers/apz/test/mochitest/helper_scrollframe_activation_on_load.html b/gfx/layers/apz/test/mochitest/helper_scrollframe_activation_on_load.html
index 1947a89a8f..c3f02d23d9 100644
--- a/gfx/layers/apz/test/mochitest/helper_scrollframe_activation_on_load.html
+++ b/gfx/layers/apz/test/mochitest/helper_scrollframe_activation_on_load.html
@@ -41,9 +41,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1151663
let config = getHitTestConfig();
let heightMultiplier = SpecialPowers.getCharPref("apz.y_stationary_size_multiplier");
- // With WebRender, the effective height multiplier can be reduced
- // for alignment reasons. The reduction should be no more than a
- // factor of two.
+ // The effective height multiplier can be reduced for alignment reasons.
+ // The reduction should be no more than a factor of two.
heightMultiplier /= 2;
info("effective displayport height multipler is " + heightMultiplier);
diff --git a/gfx/layers/apz/test/mochitest/helper_touch_synthesized_mouseevents.html b/gfx/layers/apz/test/mochitest/helper_touch_synthesized_mouseevents.html
index 3930cec3c3..b3d7b4352a 100644
--- a/gfx/layers/apz/test/mochitest/helper_touch_synthesized_mouseevents.html
+++ b/gfx/layers/apz/test/mochitest/helper_touch_synthesized_mouseevents.html
@@ -76,6 +76,13 @@ async function test() {
promiseOneEvent(targetElem, "click"),
];
+ // Create a promise for :active state change since in the case where the
+ // target element is inside a scrollable container, APZ delays :active state
+ // change, it sometimes happens after all the relavant events above.
+ const activePromise = SimpleTest.promiseWaitForCondition(
+ () => targetElem.matches(":active"),
+ "Waiting for :active state change");
+
// Perform a tap gesture
await synthesizeNativeTap(targetElem, 50, 50);
@@ -88,7 +95,7 @@ async function test() {
// The value of ui.touch_activation.duration_ms should be set to
// a large value. If we did not delay sending the synthesized
// mouse events, this test will not timeout.
- await Promise.all(mouseEventPromises);
+ await Promise.all([...mouseEventPromises, activePromise]);
clearTimeout(failTimeout);
diff --git a/gfx/layers/apz/test/mochitest/test_group_hittest-3.html b/gfx/layers/apz/test/mochitest/test_group_hittest-3.html
index f5675ee790..eac0348b89 100644
--- a/gfx/layers/apz/test/mochitest/test_group_hittest-3.html
+++ b/gfx/layers/apz/test/mochitest/test_group_hittest-3.html
@@ -33,6 +33,7 @@ var prefs = [
var subtests = [
{"file": "helper_hittest_iframe_perspective.html", "prefs": prefs},
{"file": "helper_hittest_iframe_perspective-3.html", "prefs": prefs},
+ {"file": "helper_hittest_iframe_perspective-4.html", "prefs": prefs},
];
if (isApzEnabled()) {
diff --git a/gfx/layers/apz/test/mochitest/test_group_touchevents-5.html b/gfx/layers/apz/test/mochitest/test_group_touchevents-5.html
index 0eee77a3ae..e6e4eb40fb 100644
--- a/gfx/layers/apz/test/mochitest/test_group_touchevents-5.html
+++ b/gfx/layers/apz/test/mochitest/test_group_touchevents-5.html
@@ -9,6 +9,12 @@
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript">
+// Increase the tap timeouts so the double-tap is still detected in case of
+// random delays during testing.
+var doubletap_prefs = [
+ ["ui.click_hold_context_menus.delay", 10000],
+ ["apz.max_tap_time", 10000],
+];
var subtests = [
// tests that scrolling doesn't cause extra SchedulePaint calls
@@ -23,6 +29,18 @@ var subtests = [
{"file": "helper_bug1719855.html?prevent=contextmenu"},
{"file": "helper_bug1719855.html"},
{"file": "helper_bug1724759.html"},
+ {"file": "helper_bug1806400.html", "prefs": [
+ // This test uses `SimpleTest.promiseWaitForCondition` which waits for the
+ // given condition up to 3s, to avoid opening context menu during the time
+ // span use a longer `ui.click_hold_context_menus.delay` here.
+ ["ui.click_hold_context_menus.delay", 10000],
+ ["ui.touch_activation.duration_ms", 1000]
+ ]},
+ {"file": "helper_bug1806400-2.html", "prefs": doubletap_prefs},
+ {"file": "helper_bug1806400-3.html", "prefs": [
+ ["ui.touch_activation.duration_ms", 90000]
+ ]},
+ {"file": "helper_bug1806400-4.html", "prefs": doubletap_prefs},
// Add new subtests here. If this starts timing out because it's taking too
// long, create a test_group_touchevents-6.html file. Refer to 1423011#c57
// for more details.
diff --git a/gfx/layers/apz/test/mochitest/test_layerization.html b/gfx/layers/apz/test/mochitest/test_layerization.html
index 0ff76de317..e97971b456 100644
--- a/gfx/layers/apz/test/mochitest/test_layerization.html
+++ b/gfx/layers/apz/test/mochitest/test_layerization.html
@@ -64,9 +64,8 @@ let config = getHitTestConfig();
let activateAllScrollFrames = config.activateAllScrollFrames;
let heightMultiplier = SpecialPowers.getCharPref("apz.y_stationary_size_multiplier");
-// With WebRender, the effective height multiplier can be reduced
-// for alignment reasons. The reduction should be no more than a
-// factor of two.
+// The effective height multiplier can be reduced for alignment reasons.
+// The reduction should be no more than a factor of two.
heightMultiplier /= 2;
info("effective displayport height multipler is " + heightMultiplier);
diff --git a/gfx/layers/apz/test/mochitest/test_scroll_inactive_bug1190112.html b/gfx/layers/apz/test/mochitest/test_scroll_inactive_bug1190112.html
index de54cf93fe..dd18e078b6 100644
--- a/gfx/layers/apz/test/mochitest/test_scroll_inactive_bug1190112.html
+++ b/gfx/layers/apz/test/mochitest/test_scroll_inactive_bug1190112.html
@@ -523,8 +523,7 @@ async function test() {
// Scroll inner again
// Tick the refresh driver once to make sure the compositor has sent the
// updated scroll offset for the outer scroller to WebRender, so that the
- // hit-test in sendWheelAndPaint takes it into account. (This isn't needed
- // if using non-WR layers, but doesn't hurt either).
+ // hit-test in sendWheelAndPaint takes it into account.
var dwu = SpecialPowers.getDOMWindowUtils(window);
dwu.advanceTimeAndRefresh(16);
dwu.restoreNormalRefresh();