summaryrefslogtreecommitdiffstats
path: root/gfx/layers/apz/test/mochitest/helper_doubletap_zoom_touch_action_manipulation.html
blob: 20a8bfc1135146a305c74894c4da6cda47b72be5 (plain)
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
<!DOCTYPE HTML>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=2100"/>
  <title>Tests that double tap to zoom doesn't work on touch-action: manipulation element</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>
  <script>

async function test() {
  let useTouchpad = (location.search == "?touchpad");

  var resolution = await getResolution();
  ok(resolution > 0,
     "The initial_resolution is " + resolution + ", which is some sane value");

  // A double tap on the touch-action: manipulation element.
  await synthesizeDoubleTap(document.getElementById("target"), 20, 20, useTouchpad);

  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(target, 200, 200);
}

waitUntilApzStable()
.then(test)
.then(subtestDone, subtestFailed);

  </script>
</head>
<body>

<div id="target" style="width: 100px; height: 100px; touch-action: manipulation;"></div>

</body>
</html>