Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / touchadjustment / focusout-on-touch.html
blob5932261613f608e09e04d7fc4e11c49d08c146cd
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2 <html>
3 <head>
4 <title>Touch Adjustment : Fake mouse events not delivered when touching on a non-interactable node - bug 91012</title>
5 <style type="text/css">
6 div {
7 width: 400px;
8 height: 400px;
10 </style>
11 <script type="text/javascript">
12 function runTest()
15 WebKit generates fake mouse events on each touch event, here we test if
16 the touch adjustment doesn't caused an early return not firing the fake
17 mouse events used here to unfocus a simple text input.
19 if (!window.eventSender || !window.testRunner)
20 return;
22 testRunner.dumpAsText();
24 // Focus the text field
25 var textInput = document.getElementById("textInput");
26 if (document.activeElement === textInput)
27 alert("FAILED!");
28 textInput.focus();
29 if (document.activeElement != textInput)
30 alert("FAILED!");
32 // Try to lose the focus touching on a non-editable element.
33 var theDiv = document.getElementById("theDiv");
34 var w = theDiv.clientWidth;
35 var h = theDiv.clientHeight;
36 var x = theDiv.offsetLeft + w/2;
37 var y = theDiv.offsetTop + h/2;
39 eventSender.gestureTap(x, y, 10, 10);
41 if (document.activeElement == document.body)
42 alert("PASS!")
43 else
44 alert("FAILED, " + document.activeElement.id + " is focused.");
46 testRunner.notifyDone();
49 </script>
50 </head>
51 <body onload="runTest()">
52 <div id="theDiv">You should see "ALERT: PASS!"</div>
53 <input id="textInput" type="text" value="Touch me please!" />
54 </body>
55 </html>