2009-05-12 06:04:58 +04:00
|
|
|
<!DOCTYPE HTML>
|
|
|
|
<html>
|
|
|
|
<!--
|
|
|
|
https://bugzilla.mozilla.org/show_bug.cgi?id=369950
|
|
|
|
-->
|
|
|
|
<head>
|
|
|
|
<title>Test for Bug 369950</title>
|
|
|
|
<script type="application/javascript" src="/MochiKit/MochiKit.js"></script>
|
|
|
|
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
|
|
<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
|
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=369950">Mozilla Bug 369950</a>
|
|
|
|
<p id="display">
|
2009-06-02 19:59:27 +04:00
|
|
|
<iframe id="i" src="bug369950-subframe.xml" width="200" height="100"></iframe>
|
2009-05-12 06:04:58 +04:00
|
|
|
</p>
|
|
|
|
<div id="content" style="display: none">
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<pre id="test">
|
|
|
|
<script type="application/javascript">
|
|
|
|
|
|
|
|
/** Test for Bug 369950 **/
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
|
|
|
|
addLoadEvent(function() {
|
|
|
|
// Can't just run our code here, because we might not have painting
|
|
|
|
// unsuppressed yet. Do it async.
|
|
|
|
SimpleTest.executeSoon(doTheTest);
|
|
|
|
});
|
|
|
|
|
|
|
|
function doTheTest() {
|
2009-05-13 06:37:05 +04:00
|
|
|
// do a layout flush
|
|
|
|
var rect = $("i").getBoundingClientRect();
|
2009-06-02 19:59:27 +04:00
|
|
|
var rect2 = $("i").contentDocument.documentElement.getBoundingClientRect();
|
|
|
|
|
2009-05-13 06:37:05 +04:00
|
|
|
// And do the rest of it later
|
|
|
|
SimpleTest.executeSoon(reallyDoTheTest);
|
|
|
|
}
|
|
|
|
|
|
|
|
function reallyDoTheTest() {
|
2009-05-12 06:04:58 +04:00
|
|
|
var rect = $("i").getBoundingClientRect();
|
|
|
|
var rect2 = $("i").contentDocument.documentElement.getBoundingClientRect();
|
2009-05-13 06:37:05 +04:00
|
|
|
|
2009-05-12 06:04:58 +04:00
|
|
|
// We want coords relative to the iframe, so subtract off rect2.left/top.
|
|
|
|
// 7px is a guess to get us from the bottom of the iframe into the scrollbar
|
|
|
|
// groove for the horizontal scrollbar on the bottom.
|
|
|
|
synthesizeMouse($("i").contentDocument.documentElement,
|
|
|
|
-rect2.left + rect.width / 2, rect.height - rect2.top - 7,
|
|
|
|
{}, $("i").contentWindow);
|
|
|
|
// Scroll is async, so give it time
|
|
|
|
SimpleTest.executeSoon(checkScroll);
|
|
|
|
};
|
|
|
|
|
|
|
|
function checkScroll() {
|
2009-05-13 06:37:05 +04:00
|
|
|
// do a layout flush
|
|
|
|
var rect = $("i").getBoundingClientRect();
|
|
|
|
// And do the rest of it later
|
|
|
|
SimpleTest.executeSoon(reallyCheckScroll);
|
|
|
|
}
|
|
|
|
|
|
|
|
function reallyCheckScroll() {
|
2009-05-12 06:04:58 +04:00
|
|
|
var rect = $("i").getBoundingClientRect();
|
|
|
|
var rect2 = $("i").contentDocument.documentElement.getBoundingClientRect();
|
|
|
|
isnot($("i").contentWindow.scrollX, 0, "Clicking scrollbar should scroll");
|
|
|
|
|
|
|
|
// Not doing things below here, since avoiding the scroll arrows
|
|
|
|
// cross-platform is a huge pain.
|
|
|
|
SimpleTest.finish();
|
|
|
|
return;
|
|
|
|
|
|
|
|
// 8px horizontal offset is a guess to get us into the scr
|
|
|
|
synthesizeMouse($("i").contentDocument.documentElement, -rect2.left + 8,
|
|
|
|
rect.height - rect2.top - 7, {}, $("i").contentWindow);
|
|
|
|
// Scroll is async, so give it time
|
|
|
|
SimpleTest.executeSoon(finishUp);
|
|
|
|
}
|
|
|
|
|
|
|
|
function finishUp() {
|
|
|
|
is($("i").contentWindow.scrollX, 0, "Clicking scrollbar should scroll back");
|
|
|
|
SimpleTest.finish();
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</script>
|
|
|
|
</pre>
|
|
|
|
</body>
|
|
|
|
</html>
|