layout/reftests/scrolling/scrolling.js

Wed, 31 Dec 2014 13:27:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 13:27:57 +0100
branch
TOR_BUG_3246
changeset 6
8bccb770b82d
permissions
-rw-r--r--

Ignore runtime configuration files generated during quality assurance.

michael@0 1 var topElements = document.getElementsByClassName("scrollTop");
michael@0 2 if (!topElements.length) {
michael@0 3 topElements = [document.documentElement];
michael@0 4 }
michael@0 5
michael@0 6 var failed = false;
michael@0 7
michael@0 8 function doScroll(d)
michael@0 9 {
michael@0 10 if (failed)
michael@0 11 return;
michael@0 12 for (var i = 0; i < topElements.length; ++i) {
michael@0 13 var e = topElements[i];
michael@0 14 e.scrollTop = d;
michael@0 15 if (e.scrollTop != d) {
michael@0 16 document.documentElement.textContent =
michael@0 17 "Scrolling failed on " + e.tagName + " element, " +
michael@0 18 "tried to scroll to " + d + ", got " + e.scrollTop +
michael@0 19 " (Random number: " + Math.random() + ")";
michael@0 20 failed = true;
michael@0 21 }
michael@0 22 }
michael@0 23 }
michael@0 24
michael@0 25 if (document.location.search == '?ref') {
michael@0 26 doScroll(20);
michael@0 27 } else if (document.location.search == '?up') {
michael@0 28 doScroll(40);
michael@0 29 document.documentElement.setAttribute("class", "reftest-wait");
michael@0 30 window.addEventListener("MozReftestInvalidate", function() {
michael@0 31 document.documentElement.removeAttribute("class");
michael@0 32 doScroll(20);
michael@0 33 }, false);
michael@0 34 } else {
michael@0 35 doScroll(1);
michael@0 36 document.documentElement.setAttribute("class", "reftest-wait");
michael@0 37 window.addEventListener("MozReftestInvalidate", function() {
michael@0 38 document.documentElement.removeAttribute("class");
michael@0 39 doScroll(20);
michael@0 40 }, false);
michael@0 41 }

mercurial