3 <style type=
"text/css">
7 border: solid
3px #cc0000;
13 For manual testing, drag and drop
"Drop Me" downwards and then upwards.
14 <script src=
"../../resources/js-test.js"></script>
17 var x
, y
, middleTermScrollOffset
;
18 var iframe
, iframeDocument
, draggable
;
22 if (!window
.eventSender
) {
23 debug('Please run within DumpRenderTree');
27 iframe
= document
.getElementById('scrollable');
28 // iframes start in readyState complete, but with the about:blank doc, make sure our doc is loaded.
29 if (iframe
.contentWindow
.location
.href
== "about:blank" || iframe
.contentDocument
.readyState
!= "complete")
30 iframe
.onload
= testIt
;
37 eventSender
.dragMode
= false;
39 iframe
= document
.getElementById('scrollable');
40 iframeDocument
= iframe
.contentDocument
;
41 draggable
= iframeDocument
.getElementById('draggable');
43 iframeDocument
.addEventListener("scroll", recordScroll
);
46 x
= iframe
.offsetLeft
+ draggable
.offsetLeft
+ 7;
47 y
= iframe
.offsetTop
+ draggable
.offsetTop
+ 7;
49 eventSender
.mouseMoveTo(x
, y
);
50 eventSender
.mouseDown();
52 // Move mouse to the bottom autoscroll border belt.
53 y
= iframe
.offsetTop
+ iframe
.offsetHeight
- 10;
54 eventSender
.mouseMoveTo(x
, y
);
57 function recordScroll(e
)
59 autoscrollTestPart1();
60 iframeDocument
.removeEventListener("scroll", recordScroll
);
63 function recordScroll2(e
)
65 autoscrollTestPart2();
66 iframeDocument
.removeEventListener("scroll", recordScroll
);
69 function autoscrollTestPart1()
71 if (iframe
.contentDocument
.scrollingElement
.scrollTop
== 0) {
72 testFailed("Autoscroll should have scrolled the iframe downwards, but did not");
77 testPassed("Autoscroll should have scrolled the iframe downwards, and did.");
79 middleTermScrollOffset
= iframe
.contentDocument
.scrollingElement
.scrollTop
;
80 iframeDocument
.addEventListener("scroll", recordScroll2
);
82 // Move mouse to the upper autoscroll border belt.
83 y
= iframe
.offsetTop
+ 10;
84 eventSender
.mouseMoveTo(x
, y
);
87 function autoscrollTestPart2()
89 shouldBeTrue("iframe.contentDocument.scrollingElement.scrollTop < middleTermScrollOffset")
95 eventSender
.mouseUp();
96 document
.body
.removeChild(iframe
);
100 description('Check autoscroll within an inner frame by drag-and-drop');
101 window
.jsTestIsAsync
= true;
102 window
.onload
= setUpTest
;
104 <iframe id=
"scrollable" src=
"data:text/html,
105 <p id='draggable' draggable='true' style='cursor: hand;'>
108 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.
109 <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>