2 This test does the following:</br>
\r
3 1. Navigate to an anchor link. WebKit will ensure that the anchor remains visible as other objects load around it and scripts execute.</br>
\r
4 2. The div containing the anchor link will be scrolled via PageDown. This simulated user action should stop us locking the screen to where the anchor is.</br>
\r
5 3. Force a repaint. If the lock to the anchor was properly released, the scroll caused by the PageDown will not be reverted and parentDiv.scrollTop will be greater than 600px (the offset of the anchor). If we return to the anchor, the test has failed.</br>
\r
6 <a id="startLink" href="#anchor">Go to anchor</a>
\r
7 <div id="console"></div>
\r
8 <div id="parentDiv" style="width:500; height:300; overflow:auto">
\r
9 <div style="height: 600px"></div>
\r
11 <div style="height: 800px"></div>
\r
15 if (window.testRunner) {
\r
16 testRunner.dumpAsText();
\r
17 testRunner.waitUntilDone();
\r
20 if (window.eventSender) {
\r
21 // Lock to the anchor inside the div
\r
22 var target = document.getElementById("startLink");
\r
23 eventSender.mouseMoveTo(target.offsetLeft + 2, target.offsetTop + 2);
\r
24 eventSender.mouseDown();
\r
25 eventSender.mouseUp();
\r
27 // Perform a page down to be handled by div, should release anchor lock
\r
28 var divInfo = document.getElementById("parentDiv");
\r
29 eventSender.mouseMoveTo(divInfo.offsetLeft + 2, divInfo.offsetTop + 2);
\r
30 eventSender.mouseDown();
\r
31 eventSender.keyDown("pageDown");
\r
34 // Force layout. If the scrollbar gets reset during layout, the test has failed
\r
35 document.getElementById("startLink").offsetHeight += 1;
\r
37 var scrollTop = document.getElementById("parentDiv").scrollTop;
\r
38 var line = document.createElement('div');
\r
39 if (scrollTop > 600)
\r
40 line.appendChild(document.createTextNode("PASS: scrollTop is greater than 600px"));
\r
42 line.appendChild(document.createTextNode("FAIL: scrollTop is " + scrollTop+ "px, but should be more than 600px"));
\r
43 document.getElementById('console').appendChild(line);
\r
45 if (window.testRunner)
\r
46 testRunner.notifyDone();
\r
48 </script></body></html>
\r