summaryrefslogtreecommitdiffstats
path: root/gfx/layers/apz/test/mochitest
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:43:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:43:14 +0000
commit8dd16259287f58f9273002717ec4d27e97127719 (patch)
tree3863e62a53829a84037444beab3abd4ed9dfc7d0 /gfx/layers/apz/test/mochitest
parentReleasing progress-linux version 126.0.1-1~progress7.99u1. (diff)
downloadfirefox-8dd16259287f58f9273002717ec4d27e97127719.tar.xz
firefox-8dd16259287f58f9273002717ec4d27e97127719.zip
Merging upstream version 127.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'gfx/layers/apz/test/mochitest')
-rw-r--r--gfx/layers/apz/test/mochitest/helper_doubletap_zoom_textarea.html6
-rw-r--r--gfx/layers/apz/test/mochitest/helper_scroll_over_subframe.html146
-rw-r--r--gfx/layers/apz/test/mochitest/helper_scroll_over_subframe_child.html29
-rw-r--r--gfx/layers/apz/test/mochitest/test_group_double_tap_zoom.html2
-rw-r--r--gfx/layers/apz/test/mochitest/test_group_pointerevents.html9
-rw-r--r--gfx/layers/apz/test/mochitest/test_group_wheelevents.html11
6 files changed, 197 insertions, 6 deletions
diff --git a/gfx/layers/apz/test/mochitest/helper_doubletap_zoom_textarea.html b/gfx/layers/apz/test/mochitest/helper_doubletap_zoom_textarea.html
index 99616d9834..762e1cef69 100644
--- a/gfx/layers/apz/test/mochitest/helper_doubletap_zoom_textarea.html
+++ b/gfx/layers/apz/test/mochitest/helper_doubletap_zoom_textarea.html
@@ -7,6 +7,12 @@
<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>
+ #target {
+ width: 100px;
+ height: 100px;
+ }
+ </style>
<script>
async function test() {
diff --git a/gfx/layers/apz/test/mochitest/helper_scroll_over_subframe.html b/gfx/layers/apz/test/mochitest/helper_scroll_over_subframe.html
new file mode 100644
index 0000000000..21efcbd9d6
--- /dev/null
+++ b/gfx/layers/apz/test/mochitest/helper_scroll_over_subframe.html
@@ -0,0 +1,146 @@
+<!DOCTYPE html>
+<html>
+ <title>A scroll over an iframe should not terminate the wheel transaction</title>
+ <script type="application/javascript" src="apz_test_utils.js"></script>
+ <script type="application/javascript" src="apz_test_native_event_utils.js"></script>
+ <script src="/tests/SimpleTest/paint_listener.js"></script>
+<head>
+<style>
+body {
+ height: 250vh;
+ width: 100%;
+ margin: 0;
+ padding: 0;
+}
+
+#spacer {
+ height: 50px;
+ width: 100vw;
+ background: yellow;
+}
+
+#subframe {
+ width: 80vw;
+ height: 60vh;
+}
+</style>
+</head>
+<body>
+ <div id="spacer"></div>
+ <iframe id="subframe">
+ </iframe>
+</body>
+<script>
+const searchParams = new URLSearchParams(location.search);
+
+async function scrollWithPan() {
+ await NativePanHandler.promiseNativePanEvent(
+ document.scrollingElement,
+ 50,
+ 30,
+ 0,
+ NativePanHandler.delta,
+ NativePanHandler.beginPhase,
+ );
+
+ await NativePanHandler.promiseNativePanEvent(
+ document.scrollingElement,
+ 50,
+ 30,
+ 0,
+ NativePanHandler.delta,
+ NativePanHandler.updatePhase,
+ );
+
+ await NativePanHandler.promiseNativePanEvent(
+ document.scrollingElement,
+ 50,
+ 30,
+ 0,
+ NativePanHandler.delta,
+ NativePanHandler.endPhase,
+ );
+}
+
+async function scrollWithWheel() {
+ await promiseMoveMouseAndScrollWheelOver(document.scrollingElement, 50, 30,
+ false, 100);
+}
+
+async function test() {
+ let iframeURL =
+ SimpleTest.getTestFileURL("helper_scroll_over_subframe_child.html");
+
+ switch (searchParams.get("oop")) {
+ case "true":
+ iframeURL = iframeURL.replace(window.location.origin, "https://example.com/");
+ break;
+ default:
+ break;
+ }
+
+ const iframeLoadPromise = promiseOneEvent(subframe, "load", null);
+ subframe.src = iframeURL;
+ await iframeLoadPromise;
+
+ await SpecialPowers.spawn(subframe, [], async () => {
+ await content.wrappedJSObject.waitUntilApzStable();
+ await SpecialPowers.contentTransformsReceived(content);
+ });
+
+ let childWindowReceivedWheelEvent = false;
+
+ window.addEventListener("message", e => {
+ if (e.data == "child-received-wheel-event") {
+ childWindowReceivedWheelEvent = true;
+ }
+ });
+
+ await SpecialPowers.spawn(subframe, [], () => {
+ let target = content.document.getElementById("target")
+ target.style.backgroundColor = "green";
+ content.getComputedStyle(target).backgroundColor;
+ target.addEventListener("wheel", () => {
+ target.style.backgroundColor = "red";
+ content.getComputedStyle(target).backgroundColor;
+ });
+ return new Promise(resolve => resolve());
+ });
+
+ await promiseFrame();
+
+ let transformEndPromise = promiseTransformEnd();
+
+ // Scroll over the iframe
+ switch (searchParams.get("scroll")) {
+ case "wheel":
+ await scrollWithWheel();
+ break;
+ case "pan":
+ await scrollWithPan();
+ break;
+ default:
+ ok(false, "Unsupported scroll value: " + searchParams.get("scroll"));
+ break;
+ }
+
+ await transformEndPromise;
+
+ // Wait an extra frame to ensure any message from the child has
+ // extra time to be sent to the parent.
+ await promiseFrame();
+
+ let res = await SpecialPowers.spawn(subframe, [], () => {
+ let target = content.document.getElementById("target")
+ return target.style.backgroundColor;
+ });
+
+ await promiseFrame();
+
+ // We should not have fired a wheel event to the element in the iframe
+ ok(!childWindowReceivedWheelEvent, "Child window should not receive wheel events");
+ is(res, "green", "OOP iframe does not halt user scroll of parent");
+}
+waitUntilApzStable().then(test).then(subtestDone, subtestFailed);
+</script>
+</html>
diff --git a/gfx/layers/apz/test/mochitest/helper_scroll_over_subframe_child.html b/gfx/layers/apz/test/mochitest/helper_scroll_over_subframe_child.html
new file mode 100644
index 0000000000..48f03a51d9
--- /dev/null
+++ b/gfx/layers/apz/test/mochitest/helper_scroll_over_subframe_child.html
@@ -0,0 +1,29 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script src="/tests/SimpleTest/paint_listener.js"></script>
+<script src="apz_test_utils.js"></script>
+<style>
+body {
+ margin: 0px;
+}
+
+#target {
+ width: 100%;
+ height: 100vh;
+ background: blue;
+ overflow: scroll;
+}
+</style>
+</head>
+<body>
+<div id="target">
+</div>
+</body>
+<script>
+ window.addEventListener("wheel", () => {
+ window.parent.postMessage("child-received-wheel-event", "*");
+ });
+</script>
+</html>
diff --git a/gfx/layers/apz/test/mochitest/test_group_double_tap_zoom.html b/gfx/layers/apz/test/mochitest/test_group_double_tap_zoom.html
index fe4a0784a9..c1e0351ccb 100644
--- a/gfx/layers/apz/test/mochitest/test_group_double_tap_zoom.html
+++ b/gfx/layers/apz/test/mochitest/test_group_double_tap_zoom.html
@@ -24,12 +24,12 @@ var logging_and_doubletap_prefs = [
var subtests = [
{"file": "helper_doubletap_zoom.html", "prefs": doubletap_prefs},
{"file": "helper_doubletap_zoom_img.html", "prefs": doubletap_prefs},
- {"file": "helper_doubletap_zoom_textarea.html", "prefs": doubletap_prefs},
{"file": "helper_doubletap_zoom_horizontal_center.html", "prefs": doubletap_prefs},
{"file": "helper_doubletap_zoom_bug1702464.html", "prefs": doubletap_prefs},
{"file": "helper_doubletap_zoom_large_overflow.html", "prefs": doubletap_prefs},
{"file": "helper_doubletap_zoom_fixedpos.html", "prefs": logging_and_doubletap_prefs},
{"file": "helper_doubletap_zoom_tallwide.html", "prefs": doubletap_prefs},
+ {"file": "helper_doubletap_zoom_textarea.html", "prefs": doubletap_prefs},
];
if (getPlatform() == "mac") {
diff --git a/gfx/layers/apz/test/mochitest/test_group_pointerevents.html b/gfx/layers/apz/test/mochitest/test_group_pointerevents.html
index 9ec03edd59..8bc0690bfc 100644
--- a/gfx/layers/apz/test/mochitest/test_group_pointerevents.html
+++ b/gfx/layers/apz/test/mochitest/test_group_pointerevents.html
@@ -24,14 +24,13 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1285070
{"file": "helper_bug1682170_pointercancel_on_touchaction_pinchzoom.html",
"prefs": touch_action_prefs},
{"file": "helper_bug1719855_pointercancel_on_touchmove_after_contextmenu_prevented.html"},
+ {"file": "helper_bug1285070.html"},
+ {"file": "helper_bug1299195.html", "prefs": [["dom.meta-viewport.enabled", isMac]]},
];
+
if (getPlatform() != "android") {
// Bug 1858610: these subtests are flaky on Android.
- subtests.push(
- {"file": "helper_bug1285070.html"},
- {"file": "helper_bug1299195.html", "prefs": [["dom.meta-viewport.enabled", isMac]]},
- {"file": "helper_bug1502010_unconsumed_pan.html"}
- )
+ subtests.push({"file": "helper_bug1502010_unconsumed_pan.html"});
}
if (isApzEnabled()) {
diff --git a/gfx/layers/apz/test/mochitest/test_group_wheelevents.html b/gfx/layers/apz/test/mochitest/test_group_wheelevents.html
index 42ce15a247..93746b9f6f 100644
--- a/gfx/layers/apz/test/mochitest/test_group_wheelevents.html
+++ b/gfx/layers/apz/test/mochitest/test_group_wheelevents.html
@@ -20,6 +20,13 @@ var prefs = [
["mousewheel.transaction.timeout", 0],
];
+var wheel_transaction_prefs = [
+ ["dom.event.wheel-event-groups.enabled", true],
+ ["mousewheel.transaction.timeout", 10000],
+ ["apz.test.mac.synth_wheel_input", true],
+ ...getSmoothScrollPrefs("wheel"),
+];
+
// For helper_scroll_over_scrollbar, we need to set a pref to force
// layerization of the scrollbar track to reproduce the bug being fixed.
// Otherwise, the bug only manifests with overlay scrollbars on macOS,
@@ -48,6 +55,10 @@ var subtests = [
prefs: [["general.smoothScroll", false],
["apz.test.mac.synth_wheel_input", true]]},
{"file": "helper_scroll_anchoring_on_wheel.html", prefs: smoothness_prefs},
+ {"file": "helper_scroll_over_subframe.html?scroll=wheel", prefs: wheel_transaction_prefs},
+ {"file": "helper_scroll_over_subframe.html?oop=true&scroll=wheel", prefs: wheel_transaction_prefs},
+ {"file": "helper_scroll_over_subframe.html?scroll=pan", prefs: wheel_transaction_prefs},
+ {"file": "helper_scroll_over_subframe.html?oop=true&scroll=pan", prefs: wheel_transaction_prefs},
];
subtests.push(...buildRelativeScrollSmoothnessVariants("wheel", ["scrollBy", "scrollTo", "scrollTop"]));