Index: LayoutTests/fast/events/drag-and-drop-autoscroll-inner-frame.html |
diff --git a/LayoutTests/fast/events/drag-and-drop-autoscroll-inner-frame.html b/LayoutTests/fast/events/drag-and-drop-autoscroll-inner-frame.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..76ccd3c8812a789793feb5075af7ff3855a5f7a5 |
--- /dev/null |
+++ b/LayoutTests/fast/events/drag-and-drop-autoscroll-inner-frame.html |
@@ -0,0 +1,117 @@ |
+<!DOCTYPE html> |
+<head> |
+<style type="text/css"> |
+#scrollable { |
+ height: 200px; |
+ overflow: auto; |
+ border: solid 3px #cc0000; |
+ font-size: 80px; |
+} |
+</style> |
+<script> |
+ |
+var x, y, middleTermScrollOffset; |
+var iframe, iframeDocument, draggable; |
+ |
+function log(msg) |
+{ |
+ document.getElementById('console').appendChild(document.createTextNode(msg + '\n')); |
+} |
+ |
+function setUpTest() |
+{ |
+ if (!window.eventSender) { |
+ log('Please run within DumpRenderTree'); |
+ return; |
+ } |
+ |
+ window.jsTestIsAsync = true; |
+ setTimeout(testIt, 0); |
+} |
+ |
+function testIt() |
+{ |
+ eventSender.dragMode = false; |
+ |
+ iframe = document.getElementById('scrollable'); |
+ iframeDocument = iframe.contentDocument; |
+ draggable = iframeDocument.getElementById('draggable'); |
+ |
+ iframeDocument.addEventListener("scroll", recordScroll); |
+ |
+ // Grab draggable. |
+ x = iframe.offsetLeft + draggable.offsetLeft + 7; |
+ y = iframe.offsetTop + draggable.offsetTop + 7; |
+ |
+ eventSender.mouseMoveTo(x, y); |
+ eventSender.mouseDown(); |
+ |
+ // Move mouse to the bottom autoscroll border belt. |
+ y = iframe.offsetTop + iframe.offsetHeight - 10; |
+ eventSender.mouseMoveTo(x, y); |
+} |
+ |
+function recordScroll(e) |
+{ |
+ autoscrollTestPart1(); |
+ iframeDocument.removeEventListener("scroll", recordScroll); |
+} |
+ |
+function recordScroll2(e) |
+{ |
+ autoscrollTestPart2(); |
+ iframeDocument.removeEventListener("scroll", recordScroll); |
+} |
+ |
+function autoscrollTestPart1() |
+{ |
+ if (iframe.contentDocument.body.scrollTop == 0) { |
+ testFailed("Autoscroll should have scrolled the iframe downwards, but did not"); |
+ finishTest(); |
+ return; |
+ } |
+ |
+ testPassed("Autoscroll should have scrolled the iframe downwards, and did."); |
+ |
+ middleTermScrollOffset = iframe.contentDocument.body.scrollTop; |
+ iframeDocument.addEventListener("scroll", recordScroll2); |
+ |
+ // Move mouse to the upper autoscroll border belt. |
+ y = iframe.offsetTop + 10; |
+ eventSender.mouseMoveTo(x, y); |
+} |
+ |
+function autoscrollTestPart2() |
+{ |
+ shouldBeTrue("iframe.contentDocument.body.scrollTop < middleTermScrollOffset") |
+ finishTest(); |
+} |
+ |
+function finishTest() |
+{ |
+ eventSender.mouseUp(); |
+ finishJSTest(); |
+} |
+ |
+var successfullyParsed = true; |
+</script> |
+</head> |
+<body> |
+For manual testing, drag and drop "Drop Me" downwards and then upwards. |
+<iframe id="scrollable" src="data:text/html, |
+<p id='draggable' draggable='true' style='cursor: hand;'> |
+ <b>Drag me!</b> |
+</p> |
+Try to drag and drop the text above in the input element at the bottom of this iframe. It should scroll. Then, try the way back. |
+<br><br>more<br>more<br>more<br>more<br>more<br>more<br>more<br>more<br>more<br>more<br>more<br>more<br><input> |
+"></iframe><br> |
+</div> |
+<div id="console"></div> |
+<script src="../js/resources/js-test-pre.js"></script> |
+<script> |
+description('Check autoscroll within an inner frame by drag-and-drop'); |
+setUpTest(); |
+</script> |
+<script src="../js/resources/js-test-post.js"></script> |
+</body> |
+</html> |