| <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
| <html> |
| <head> |
| <script src="../../../../resources/js-test-pre.js"></script> |
| <script src="resources/gesture-helpers.js"></script> |
| <style type="text/css"> |
| ::-webkit-scrollbar { |
| width: 0px; |
| height: 0px; |
| } |
| |
| #touchtarget { |
| width: 100px; |
| height: 100px; |
| position: absolute; |
| background: white; |
| top: 100px; |
| left: 100px; |
| } |
| |
| #movingbox { |
| width: 100%; |
| height: 100%; |
| position: absolute; |
| word-wrap: break-word; |
| overflow-y: scroll; |
| overflow-x: scroll; |
| display: block; |
| } |
| |
| .greenbox { |
| width: 100px; |
| height: 100px; |
| background: green; |
| padding: 0px; |
| margin: 0px; |
| } |
| |
| .redbox { |
| width: 100px; |
| height: 100px; |
| background: red; |
| padding: 0px; |
| margin: 0px; |
| } |
| |
| td { |
| padding: 0px; |
| } |
| </style> |
| </head> |
| <body style="margin:0" onload="runTest();"> |
| <div id="touchtarget"> |
| <div id="movingbox"> |
| <table border="0" cellspacing="0px" id="table"> |
| <tr> |
| <td><div class="redbox" id="redbox"></div></td> |
| <td><div class="greenbox" id="greenbox_1"></div></td> |
| </tr> |
| <tr> |
| <td><div class="greenbox" id="greenbox_2"></div></td> |
| <td><div class="greenbox" id="greenbox_3"></div></td> |
| </tr> |
| </table> |
| </div> |
| </div> |
| |
| <p id="description"></p> |
| <div id="console"></div> |
| <script type="text/javascript"> |
| |
| var movingdiv; |
| var expectedGesturesTotal = 2; |
| var gesturesOccurred = 0; |
| var scrollAmountX = ['63', '0']; |
| var scrollAmountY = ['62', '0']; |
| var wheelEventsOccurred = 0; |
| var expectedWheelEventsOccurred = ['0', '0']; |
| var scrollEventsOccurred = 0; |
| var expectedScrollEventsOccurred = '1'; |
| var scrolledElement = 'movingdiv' |
| |
| document.onkeypress = function() |
| { |
| debug('received element removing keypress'); |
| var parent = document.getElementById('touchtarget'); |
| movingdiv = document.getElementById('movingbox'); |
| parent.removeChild(movingdiv); |
| return false; |
| } |
| |
| function firstGestureScroll() |
| { |
| debug("first gesture"); |
| eventSender.gestureScrollBegin(195, 195); |
| eventSender.gestureScrollUpdate(-20, -28); |
| eventSender.gestureScrollUpdate(-14, -4); |
| eventSender.gestureScrollUpdate(-29, -30); |
| eventSender.gestureScrollEnd(0, 0); |
| |
| // Wait for layout. |
| checkScrollOffset(); |
| } |
| |
| function secondGestureScroll() |
| { |
| movingdiv.scrollTop = 0; |
| movingdiv.scrollLeft = 0; |
| |
| debug("second gesture"); |
| eventSender.gestureScrollBegin(195, 195); |
| eventSender.gestureScrollUpdate(-20, -28); |
| eventSender.gestureScrollUpdate(-14, -4); |
| |
| // Send a key to delete the target Element. |
| eventSender.keyDown("d", []); |
| |
| eventSender.gestureScrollUpdate(-29, -30); |
| eventSender.gestureScrollEnd(0, 0); |
| |
| // By getting here successfully, the test demonstrates that the implementation |
| // does not crash when a latched Element is removed from the DOM. |
| checkScrollOffset(); |
| } |
| |
| if (window.testRunner) |
| testRunner.waitUntilDone(); |
| |
| function runTest() |
| { |
| movingdiv = document.getElementById('movingbox'); |
| movingdiv.addEventListener("scroll", recordScroll); |
| window.addEventListener("mousewheel", recordWheel); |
| |
| if (window.eventSender) { |
| description('This tests gesture scrolling div which is deleted while latched, ' + |
| 'Square is (mostly) green on pass'); |
| if (checkTestDependencies()) |
| firstGestureScroll(); |
| else |
| exitIfNecessary(); |
| } else { |
| debug("This test requires DumpRenderTree. Touch-scroll the red rect to log."); |
| } |
| } |
| </script> |
| </body> |
| </html> |