1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=2100,initial-scale=0.4"/>
<title>Tests that double tap to zoom doesn't work on touch-action: manipulation element in an iframe</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>
iframe {
position: absolute;
top: 0px;
left: 0px;
border: none;
}
</style>
<script>
async function test() {
let useTouchpad = (location.search == "?touchpad");
let iframeURL =
SimpleTest.getTestFileURL("helper_doubletap_zoom_touch_action_manipulation_subframe.html")
.replace(window.location.origin, "https://example.com/");
let iframe = document.querySelector("iframe");
const iframeLoadPromise = promiseOneEvent(iframe, "load", null);
iframe.src = iframeURL;
await iframeLoadPromise;
await SpecialPowers.spawn(iframe, [], async () => {
await content.wrappedJSObject.waitUntilApzStable();
});
var resolution = await getResolution();
ok(resolution > 0,
"The initial_resolution is " + resolution + ", which is some sane value");
// Activate the root scroller in the iframe, otherwise the next touch event
// will be handled by the root content APZC incorrectly on non-Fission
// environments.
await SpecialPowers.spawn(iframe, [], async () => {
await SpecialPowers.DOMWindowUtils.setDisplayPortForElement(
0, 0, 500, 500, content.document.documentElement, 1);
await content.wrappedJSObject.promiseApzFlushedRepaints();
});
await SpecialPowers.spawn(iframe, [useTouchpad], async (aUseTouchpad) => {
await content.wrappedJSObject.synthesizeDoubleTap(
content.document.querySelector("div"), 20, 20, aUseTouchpad);
});
for (let i = 0; i < 10; i++) {
await promiseFrame();
}
// Flush state just in case.
await promiseApzFlushedRepaints();
var prev_resolution = resolution;
resolution = await getResolution();
if (!useTouchpad) {
is(resolution, prev_resolution, "No zoom should happen on touchscreen");
} else {
isnot(resolution, prev_resolution, "Zoom should happen on touchpad");
}
// Send another tap event outside of the area where
// `touch-action: manipulation` is specified so that it will create a new
// touch block to avoid bug 1848062 on Mac.
await synthesizeNativeTap(iframe, 600, 600);
}
waitUntilApzStable()
.then(test)
.then(subtestDone, subtestFailed);
</script>
</head>
<body>
<iframe width="500" height="500"></iframe>
</body>
</html>
|