2010-06-18 09:18:42 +00:00
|
|
|
var topElements = document.getElementsByClassName("scrollTop");
|
|
|
|
if (!topElements.length) {
|
2011-02-10 08:58:11 +00:00
|
|
|
topElements = [document.documentElement];
|
2010-06-18 09:18:42 +00:00
|
|
|
}
|
|
|
|
|
2011-02-10 08:58:11 +00:00
|
|
|
var failed = false;
|
|
|
|
|
2010-06-18 09:18:42 +00:00
|
|
|
function doScroll(d)
|
|
|
|
{
|
2011-02-10 08:58:11 +00:00
|
|
|
if (failed)
|
|
|
|
return;
|
2010-06-18 09:18:42 +00:00
|
|
|
for (var i = 0; i < topElements.length; ++i) {
|
2011-02-10 08:58:11 +00:00
|
|
|
var e = topElements[i];
|
|
|
|
e.scrollTop = d;
|
|
|
|
if (e.scrollTop != d) {
|
|
|
|
document.documentElement.textContent =
|
|
|
|
"Scrolling failed on " + e.tagName + " element, " +
|
|
|
|
"tried to scroll to " + d + ", got " + e.scrollTop +
|
|
|
|
" (Random number: " + Math.random() + ")";
|
|
|
|
failed = true;
|
|
|
|
}
|
2010-06-18 09:18:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (document.location.search == '?ref') {
|
|
|
|
doScroll(20);
|
2011-06-22 12:11:28 +00:00
|
|
|
} else if (document.location.search == '?up') {
|
|
|
|
doScroll(40);
|
|
|
|
document.documentElement.setAttribute("class", "reftest-wait");
|
|
|
|
window.addEventListener("MozReftestInvalidate", function() {
|
|
|
|
document.documentElement.removeAttribute("class");
|
|
|
|
doScroll(20);
|
|
|
|
}, false);
|
2010-06-18 09:18:42 +00:00
|
|
|
} else {
|
|
|
|
doScroll(1);
|
|
|
|
document.documentElement.setAttribute("class", "reftest-wait");
|
|
|
|
window.addEventListener("MozReftestInvalidate", function() {
|
|
|
|
document.documentElement.removeAttribute("class");
|
|
|
|
doScroll(20);
|
|
|
|
}, false);
|
|
|
|
}
|