| <html> |
| <head> |
| <style> |
| body { |
| height: 2000px; |
| } |
| iframe { |
| position: absolute; |
| top: 800px; |
| } |
| </style> |
| <script src="../../resources/js-test-pre.js"></script> |
| <script> |
| |
| if (window.testRunner) { |
| testRunner.waitUntilDone(); |
| testRunner.dumpAsText(); |
| } |
| |
| function log(msg) |
| { |
| document.getElementById('console').appendChild(document.createTextNode(msg + '\n')); |
| } |
| |
| var verticalScrollOffset; |
| var iframe; |
| |
| function doTest() |
| { |
| document.scrollingElement.scrollTop = 800; |
| if (document.scrollingElement.scrollTop != 800) |
| log("FAILED: failed to scroll by 800px"); |
| |
| iframe = document.getElementById('targetFrame'); |
| |
| var textInIframe = iframe.contentDocument.getElementById('starthere'); |
| var x = iframe.clientLeft + textInIframe.offsetLeft + 7; |
| var y = iframe.clientTop + textInIframe.offsetTop + 7; |
| if (window.eventSender) { |
| eventSender.dragMode = false; |
| eventSender.mouseMoveTo(x, y); |
| eventSender.mouseDown(); |
| eventSender.mouseUp(); |
| } |
| setTimeout(autoscrollTestPart1, 0); |
| } |
| |
| function autoscrollTestPart1() |
| { |
| var mainDocumentTop = document.scrollingElement.scrollTop; |
| if (mainDocumentTop != 800) |
| log("FAILED: Clicking in the iframe scrolled the page (window.scrollTops is " + mainDocumentTop + ")"); |
| |
| if (window.eventSender) { |
| var textInIframe = iframe.contentDocument.getElementById('starthere'); |
| var x = iframe.clientLeft + textInIframe.offsetLeft + 7; |
| var y = iframe.clientTop + textInIframe.offsetTop + 7; |
| eventSender.dragMode = false; |
| eventSender.mouseMoveTo(x, y); |
| eventSender.mouseDown(); |
| eventSender.mouseMoveTo(x + 10, y); |
| } |
| setTimeout(autoscrollTestPart2, 100); |
| } |
| |
| function autoscrollTestPart2() |
| { |
| if (window.eventSender) |
| eventSender.mouseUp(); |
| |
| var mainDocumentTop = document.scrollingElement.scrollTop; |
| if (mainDocumentTop == 800) |
| log("PASSED: selecting in the iframe did not scroll the page."); |
| else |
| log("FAILED: the page autoscrolled (window.scrollTop is " + mainDocumentTop + ")."); |
| |
| if (window.testRunner) |
| testRunner.notifyDone(); |
| } |
| |
| window.addEventListener('load', doTest, false); |
| </script> |
| </head> |
| <body> |
| <iframe id="targetFrame" srcdoc="<!DOCTYPE html><html><body><div id='starthere' style='height:60px; overflow:auto;'>asdf<br>asdf<br>asdf<br>asdf<br>asdf"></iframe> |
| <div id="console"></div> |
| </body> |
| </html> |
| |