diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:47:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:47:29 +0000 |
commit | 0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d (patch) | |
tree | a31f07c9bcca9d56ce61e9a1ffd30ef350d513aa /layout/reftests/svg/smil/container/deferred-anim-1.xhtml | |
parent | Initial commit. (diff) | |
download | firefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.tar.xz firefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.zip |
Adding upstream version 115.8.0esr.upstream/115.8.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'layout/reftests/svg/smil/container/deferred-anim-1.xhtml')
-rw-r--r-- | layout/reftests/svg/smil/container/deferred-anim-1.xhtml | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/layout/reftests/svg/smil/container/deferred-anim-1.xhtml b/layout/reftests/svg/smil/container/deferred-anim-1.xhtml new file mode 100644 index 0000000000..0df307526f --- /dev/null +++ b/layout/reftests/svg/smil/container/deferred-anim-1.xhtml @@ -0,0 +1,70 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no" ?> +<html xmlns="http://www.w3.org/1999/xhtml" class="reftest-wait"> + <head> + <title>Deferred animation</title> + <!-- + PURPOSE: Although we'd like to disable animation components for those + documents that don't use animation, there's always the possibility that an + animation element will be added via the DOM after the document is loaded. + This test case checks that this case is not neglected. + + OPERATION: There is an un-animated document. Then an <animate> element is + attached to the rectangle by script causing it to move to the right. + + EXPECTED RESULTS: The box begins moving from the center. + --> + <script> + var timeoutID; + + function animate() + { + addAnimation(); + var svg = document.getElementsByTagName('svg')[0]; + var anim = svg.getElementsByTagName('animate')[0]; + // We should pass quickly and fail slowly. + // In the pass case, we'll get an end event almost immediately. + // In the failure case, wait 30s before giving up. + timeoutID = window.setTimeout(giveUp, 30000); + anim.addEventListener('end', finish, true); + } + + function giveUp() { + var svg = document.getElementsByTagName('svg')[0]; + var rect = svg.getElementsByTagName('rect')[0]; + rect.setAttribute("fill", "red"); + var anim = svg.getElementsByTagName('animate')[0]; + anim.parentNode.removeChild(anim); + timeoutID = null; + finish(); + } + + function finish() { + if (timeoutID) { + window.clearTimeout(timeoutID); + timeoutID = null; + } + document.documentElement.removeAttribute('class'); + } + + function addAnimation() + { + const svgns="http://www.w3.org/2000/svg"; + var anim = document.createElementNS(svgns,'animate'); + anim.setAttribute('attributeName','fill'); + anim.setAttribute('from', 'red'); + anim.setAttribute('to','green'); + anim.setAttribute('begin','0s'); + anim.setAttribute('dur','0.001s'); + anim.setAttribute('fill','freeze'); + var target = document.getElementById('target'); + target.appendChild(anim); + } + </script> + </head> + + <body onload="animate()"> + <svg xmlns="http://www.w3.org/2000/svg" width="200px" height="200px"> + <rect width="199" height="199" fill="red" id="target"/> + </svg> + </body> +</html> |