| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> |
| <html> |
| <head> |
| <title>Touch Adjustment : Fake mouse events not delivered when touching on a non-interactable node - bug 91012</title> |
| <style type="text/css"> |
| div { |
| width: 400px; |
| height: 400px; |
| } |
| </style> |
| <script type="text/javascript"> |
| function runTest() |
| { |
| /* |
| WebKit generates fake mouse events on each touch event, here we test if |
| the touch adjustment doesn't caused an early return not firing the fake |
| mouse events used here to unfocus a simple text input. |
| */ |
| if (!window.eventSender || !window.testRunner) |
| return; |
| |
| testRunner.dumpAsText(); |
| |
| // Focus the text field |
| var textInput = document.getElementById("textInput"); |
| if (document.activeElement === textInput) |
| alert("FAILED!"); |
| textInput.focus(); |
| if (document.activeElement != textInput) |
| alert("FAILED!"); |
| |
| // Try to lose the focus touching on a non-editable element. |
| var theDiv = document.getElementById("theDiv"); |
| var w = theDiv.clientWidth; |
| var h = theDiv.clientHeight; |
| var x = theDiv.offsetLeft + w/2; |
| var y = theDiv.offsetTop + h/2; |
| |
| eventSender.gestureTap(x, y, 10, 10); |
| |
| if (document.activeElement == document.body) |
| alert("PASS!") |
| else |
| alert("FAILED, " + document.activeElement.id + " is focused."); |
| |
| testRunner.notifyDone(); |
| } |
| |
| </script> |
| </head> |
| <body onload="runTest()"> |
| <div id="theDiv">You should see "ALERT: PASS!"</div> |
| <input id="textInput" type="text" value="Touch me please!" /> |
| </body> |
| </html> |