gecko/layout/reftests/position-dynamic-changes/relative/animate.js
Ehsan Akhgari 2940bf2f84 Bug 157681 - Part 1: Add a test suite to make sure that dynamic changes to the position CSS properties work correctly; r=dbaron
These series of tests attempt to ensure conformance to the CSS 2.1
sections 10.3.7 and 10.6.4.
2012-06-06 00:53:33 -04:00

33 lines
835 B
JavaScript

var rfa = null;
if (window.requestAnimationFrame) {
rfa = requestAnimationFrame;
} else if (window.mozRequestAnimationFrame) {
rfa = mozRequestAnimationFrame;
} else if (window.webkitRequestAnimationFrame) {
rfa = webkitRequestAnimationFrame;
} else if (window.msRequestAnimationFrame) {
rfa = msRequestAnimationFrame;
} else if (window.oRequestAnimationFrame) {
rfa = oRequestAnimationFrame;
}
function animate(params, count) {
rfa(function() {
animateStep(params, count);
});
}
function animateStep(params, count) {
if (!count) {
document.documentElement.removeAttribute("class");
return;
}
var rel = document.getElementById("rel");
for (prop in params) {
rel.style[prop] = (parseInt(rel.style[prop]) + params[prop]) + "px";
}
rfa(function() {
animateStep(params, count - 10);
});
}