Source/WebCore:
[WebKit-https.git] / LayoutTests / fast / events / touch / ios / content-observation / new-content-covers-tap-target.html
1 <html>
2 <head>
3 <title>This tests the case when the new hover content comes on top of the tap target, we update the "node under the mouse" state.</title>
4 <script src="../../../../../resources/basic-gestures.js"></script>
5 <style>
6 #tapthis {
7     width: 400px;
8     height: 400px;
9     border: 1px solid green;
10 }
11
12 #becomesVisible {
13     visibility: hidden;
14     position: absolute;
15     left: 40px;
16     top: 40px;
17     width: 320px;
18     height: 320px;
19     background-color: blue;
20 }
21 </style>
22 <script>
23 async function test() {
24     if (!window.testRunner || !testRunner.runUIScript)
25         return;
26     if (window.internals)
27         internals.settings.setContentChangeObserverEnabled(true);
28
29     testRunner.waitUntilDone();
30     testRunner.dumpAsText();
31
32     let rect = tapthis.getBoundingClientRect();
33     let x = rect.left + rect.width / 2;
34     let y = rect.top + rect.height / 2;
35
36     await tapAtPoint(x, y);
37 }
38 </script>
39 </head>
40 <body onload="test()">
41 <div id=tapthis>PASS if 'mouseout' text is not shown below.</div>
42 <div id=becomesVisible></div>
43 <pre id=result></pre>
44 <script>
45 // 1. Tap -> hover 
46 // 2. hover content comes on top of the tap target
47 // 3. Check if tap target gets mouseout
48 tapthis.addEventListener("mousemove", function( event ) {
49     becomesVisible.style.visibility = "visible";
50 }, false);
51
52 tapthis.addEventListener("mouseout", function( event ) {   
53     result.innerHTML = "mouseout";
54     if (window.testRunner)
55         testRunner.notifyDone();
56 }, false);
57 </script>
58 </body>
59 </html>