<!DOCTYPE html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../../resources/compositor-controls.js"></script>
<div id = "div" style="overflow: auto; width: 1400px">
<table style="height:2000px; width: 1800px">
<tbody>
<tr style="height: 2000px">
<td id="td" style="width: 600px; height: 2000px"></td>
<td id="iframe" style="width: 1200px; height: 2000px">
<iframe style="width: 1000px; height: 2000px" src="resources/middleClickAutoscroll-iframe.html"></iframe>
</td>
</tr>
</tbody>
</table>
</div>
<script>
setAnimationRequiresRaster();
var testIFrame = async_test("Tests that middleClickAutoscroll finds the correct ancestor layoutobject when starting in an iframe, and the latching is correctly implemented.")
testIFrame.step(function() {
if (!window.eventSender)
return;
var iframe = document.getElementById("iframe");
var div = document.getElementById("div");
// Start a rightward middle-click-autoscroll in the iframe inside the right
// td element.
var startx = Math.max(iframe.getBoundingClientRect().left, 10);
var starty = Math.max(iframe.getBoundingClientRect().top, 500);
var endx = startx + 100;
var endy = starty;
var pageScrollTop = window.scrollY;
eventSender.mouseMoveTo(startx, starty);
eventSender.mouseDown(1);
eventSender.mouseMoveTo(endx, endy);
div.onscroll = function() {
assert_not_equals(div.scrollLeft, 0);
eventSender.mouseUp(1);
testIFrame.done();
};
});
</script>