Implement viewport-width-based fast-click heuristic
[WebKit-https.git] / LayoutTests / fast / events / ios / viewport-device-width-at-initial-scale-fast-clicks.html
1 <!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
2
3 <html>
4 <meta name="viewport" content="initial-scale=1.0, width=device-width">
5
6 <head>
7     <script src="../../../resources/js-test-pre.js"></script>
8     <script id="ui-script" type="text/plain">
9         (function() {
10             uiController.didEndZoomingCallback = function() {
11                 uiController.uiScriptComplete("FAIL: Zoomed to scale " + uiController.zoomScale + " when we should only be firing fast clicks.");
12             };
13
14             function fireSuccessiveSingleTaps() {
15                 uiController.singleTapAtPoint(200, 200, fireSuccessiveSingleTaps);
16             }
17             fireSuccessiveSingleTaps();
18         })();
19     </script>
20
21     <script>
22     var clickCount = 0;
23     if (window.testRunner)
24         testRunner.waitUntilDone();
25
26     function getUIScript() {
27         return document.getElementById("ui-script").text;
28     }
29
30     function runTest() {
31         if (testRunner.runUIScript)
32             testRunner.runUIScript(getUIScript(), function(result) { });
33     }
34     function handleClicked() {
35         clickCount++;
36         document.body.appendChild(document.createTextNode("Click!"));
37         document.body.appendChild(document.createElement("br"));
38         if (clickCount == 3)
39             testRunner.notifyDone();
40     }
41     </script>
42
43     <style>
44     body {
45         margin: 0;
46     }
47
48     #target {
49         width: 400px;
50         height: 400px;
51     }
52     </style>
53 </head>
54
55 <body onload="runTest()">
56     <button id="target" onclick="handleClicked()"></button>
57     <p>Repeatedly tapping on the button should fire click events.</p>
58     <p>This test is best run in WebKitTestRunner. If you are running this test manually, verify that tapping the button causes a "Click!" message to appear below, and that click occurred without the regular 350ms delay for double tapping.</p>
59     <script src="../../../resources/js-test-post.js"></script>
60 </body>
61
62 </html>