tonikitoo@webkit.org | 9cbc8db | 2013-08-28 04:35:14 +0000 | [diff] [blame] | 1 | <html> |
| 2 | <head> |
mark.lam@apple.com | 436bf82 | 2013-09-07 23:07:25 +0000 | [diff] [blame] | 3 | <script src="../../resources/js-test-pre.js"></script> |
tonikitoo@webkit.org | 9cbc8db | 2013-08-28 04:35:14 +0000 | [diff] [blame] | 4 | <script> |
| 5 | function log(msg) |
| 6 | { |
| 7 | document.getElementById('console').appendChild(document.createTextNode(msg + '\n')); |
| 8 | } |
| 9 | |
| 10 | var iframe; |
| 11 | var iframeDocument; |
| 12 | var iframeScrollTopAfterAnchor = 0; |
| 13 | |
| 14 | function test() |
| 15 | { |
| 16 | if (window.testRunner) { |
| 17 | testRunner.waitUntilDone(); |
| 18 | testRunner.dumpAsText(); |
| 19 | } |
| 20 | |
| 21 | iframe = document.getElementById('NoScrolliFrame'); |
| 22 | iframeDocument = iframe.contentDocument; |
| 23 | iframeScrollTopAfterAnchor = 0; |
| 24 | |
| 25 | var clickme = iframeDocument.getElementById('clickme'); |
| 26 | var x = iframe.offsetLeft + clickme.offsetLeft + 7; |
| 27 | var y = iframe.offsetTop + clickme.offsetTop + 7; |
| 28 | if (window.eventSender) { |
| 29 | eventSender.dragMode = false; |
| 30 | eventSender.mouseMoveTo(x, y); |
| 31 | eventSender.mouseDown(); |
| 32 | eventSender.mouseUp(); |
| 33 | } |
| 34 | setTimeout(autoscrollTestPart1, 0); |
| 35 | } |
| 36 | |
| 37 | function autoscrollTestPart1() |
| 38 | { |
| 39 | iframeScrollTopAfterAnchor = iframeDocument.body.scrollTop; |
| 40 | if (iframeDocument.body.scrollTop == 0) |
| 41 | log("FAILED: anchor clicking within non-scrollable inner frame failed."); |
| 42 | |
| 43 | if (window.eventSender) { |
| 44 | var textInIframe = iframeDocument.getElementById('textInFrame'); |
| 45 | var x = iframe.offsetLeft + textInIframe.offsetLeft - iframeDocument.body.scrollLeft + 7; |
| 46 | var y = iframe.offsetTop + textInIframe.offsetTop - iframeDocument.body.scrollTop + 7; |
| 47 | eventSender.dragMode = false; |
| 48 | eventSender.mouseMoveTo(x, y); |
| 49 | eventSender.mouseDown(); |
| 50 | eventSender.mouseMoveTo(x, y - 10); |
| 51 | y = iframe.offsetTop; |
| 52 | eventSender.mouseMoveTo(x, y - 5); |
| 53 | } |
| 54 | setTimeout(autoscrollTestPart2, 100); |
| 55 | } |
| 56 | |
| 57 | function autoscrollTestPart2() |
| 58 | { |
| 59 | if (window.eventSender) |
| 60 | eventSender.mouseUp(); |
| 61 | |
| 62 | if (iframeScrollTopAfterAnchor == iframeDocument.body.scrollTop) |
| 63 | log("PASSED: the autoscroll has not happened."); |
| 64 | else |
| 65 | log("FAILED: the autoscroll has happened."); |
| 66 | |
| 67 | if (window.testRunner) |
| 68 | testRunner.notifyDone(); |
| 69 | } |
| 70 | </script> |
| 71 | </head> |
| 72 | <body onload="test()"> |
| 73 | <iframe id="NoScrolliFrame" style="height: 150px; width: 150px" src="resources/big-page-with-overflow-hidden-and-anchor-scroll.html" ></iframe> |
| 74 | <div id="console"></div> |
| 75 | </body> |
| 76 | </html> |
| 77 | |