summaryrefslogtreecommitdiffstats
path: root/gfx/layers/apz/test/mochitest/helper_bug1414336.html
blob: c0d35db40199a6d03d84e3b397c74c47f384e056 (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
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
85
86
87
88
89
90
91
92
93
94
95
96
97
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1414336
-->
<head>
  <meta charset="utf-8">
  <title>Test for Bug 1414336</title>
  <script src="/tests/SimpleTest/EventUtils.js"></script>
  <script type="text/javascript" src="apz_test_native_event_utils.js"></script>
  <script type="text/javascript" src="apz_test_utils.js"></script>
  <script src="/tests/SimpleTest/paint_listener.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
  <style>
    #target0 {
    width: 200px;
    height: 400px;
    touch-action: auto;
    }
  </style>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1414336">Mozilla Bug 1414336</a>
<p id="display"></p>
<div id="target0">
  <p>Test bug1414336</p>
  <p>Test bug1414336</p>
  <p>Test bug1414336</p>
  <p>Test bug1414336</p>
  <p>Test bug1414336</p>
  <p>Test bug1414336</p>
  <p>Test bug1414336</p>
  <p>Test bug1414336</p>
  <p>Test bug1414336</p>
  <p>Test bug1414336</p>
  <p>Test bug1414336</p>
  <p>Test bug1414336</p>
  <p>Test bug1414336</p>
  <p>Test bug1414336</p>
  <p>Test bug1414336</p>
  <p>Test bug1414336</p>
  <p>Test bug1414336</p>
  <p>Test bug1414336</p>
  <p>Test bug1414336</p>
  <p>Test bug1414336</p>
  <p>Test bug1414336</p>
  <p>Test bug1414336</p>
  <p>Test bug1414336</p>
  <p>Test bug1414336</p>
  <p>Test bug1414336</p>
  <p>Test bug1414336</p>
  <p>Test bug1414336</p>
  <p>Test bug1414336</p>
  <p>Test bug1414336</p>
  <p>Test bug1414336</p>
  <p>Test bug1414336</p>
  <p>Test bug1414336</p>
</div>
<script type="text/javascript">
/** Test for Bug 1414336 */
waitUntilApzStable().then(async () => {
  let target0 = window.document.getElementById("target0");
  let target0_events = ["pointerdown", "pointermove"];

  target0_events.forEach((elem) => {
    target0.addEventListener(elem, (event) => {
      is(event.type, target0_events[0], "receive " + event.type + " on target0");
      target0_events.shift();
    }, { once: true });
  });

  target0.addEventListener("pointercancel", () => {
    ok(false, "Shouldn't receive pointercancel when content prevents default on touchstart");
    // Wait until the event is done processing before we end the subtest,
    // otherwise on Android the pointer events pref is flipped back to false
    // and debug builds will assert.
    setTimeout(subtestDone, 0);
  }, { once: true });

  target0.addEventListener("touchstart", (event) => {
    event.preventDefault();
  }, { once: true });

  target0.addEventListener("pointerup", () => {
    ok(!target0_events.length, " should receive " + target0_events + " on target0");
    // Wait until the event is done processing before we end the subtest,
    // otherwise on Android the pointer events pref is flipped back to false
    // and debug builds will assert.
    setTimeout(subtestDone, 0);
  }, { once: true });

  await synthesizeNativeTouchDrag(target0, 2, 2, 0, 80);
});

</script>
</body>
</html>