From 0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 03:47:29 +0200 Subject: Adding upstream version 115.8.0esr. Signed-off-by: Daniel Baumann --- .../position-dynamic-changes/relative/animate.js | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 layout/reftests/position-dynamic-changes/relative/animate.js (limited to 'layout/reftests/position-dynamic-changes/relative/animate.js') diff --git a/layout/reftests/position-dynamic-changes/relative/animate.js b/layout/reftests/position-dynamic-changes/relative/animate.js new file mode 100644 index 0000000000..38598e1d34 --- /dev/null +++ b/layout/reftests/position-dynamic-changes/relative/animate.js @@ -0,0 +1,30 @@ +var rfa = null; +if (window.requestAnimationFrame) { + rfa = requestAnimationFrame; +} 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); + }); +} -- cgit v1.2.3