summaryrefslogtreecommitdiffstats
path: root/layout/reftests/svg/smil/container/deferred-anim-1.xhtml
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /layout/reftests/svg/smil/container/deferred-anim-1.xhtml
parentInitial commit. (diff)
downloadfirefox-esr-upstream.tar.xz
firefox-esr-upstream.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--layout/reftests/svg/smil/container/deferred-anim-1.xhtml70
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>