1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/layout/reftests/position-dynamic-changes/relative/animate.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,32 @@ 1.4 +var rfa = null; 1.5 +if (window.requestAnimationFrame) { 1.6 + rfa = requestAnimationFrame; 1.7 +} else if (window.mozRequestAnimationFrame) { 1.8 + rfa = mozRequestAnimationFrame; 1.9 +} else if (window.webkitRequestAnimationFrame) { 1.10 + rfa = webkitRequestAnimationFrame; 1.11 +} else if (window.msRequestAnimationFrame) { 1.12 + rfa = msRequestAnimationFrame; 1.13 +} else if (window.oRequestAnimationFrame) { 1.14 + rfa = oRequestAnimationFrame; 1.15 +} 1.16 + 1.17 +function animate(params, count) { 1.18 + rfa(function() { 1.19 + animateStep(params, count); 1.20 + }); 1.21 +} 1.22 + 1.23 +function animateStep(params, count) { 1.24 + if (!count) { 1.25 + document.documentElement.removeAttribute("class"); 1.26 + return; 1.27 + } 1.28 + var rel = document.getElementById("rel"); 1.29 + for (prop in params) { 1.30 + rel.style[prop] = (parseInt(rel.style[prop]) + params[prop]) + "px"; 1.31 + } 1.32 + rfa(function() { 1.33 + animateStep(params, count - 10); 1.34 + }); 1.35 +}