Bug 1573794 [wpt PR 18419] - Use observer for sync bases, a=testonly

Automatic update from web-platform-tests
Use observer for sync bases

Previously sync bases would not be updated if the base element was
swapped out. This has been changed to allow for this. Making events
and sync bases work more uniformly.

This is the first step in changing sync base repeats into actual
sync bases.

Bug: 993702
Change-Id: I1a1b381d094100296a420de8877bb1e57cd9709e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1753004
Commit-Queue: Edvard Thörnros <edvardt@opera.com>
Commit-Queue: Fredrik Söderquist <fs@opera.com>
Reviewed-by: Fredrik Söderquist <fs@opera.com>
Auto-Submit: Edvard Thörnros <edvardt@opera.com>
Cr-Commit-Position: refs/heads/master@{#686838}

--

wpt-commits: 5777568726d1e9d7e3e0cfa6b65497dcca2de229
wpt-pr: 18419
This commit is contained in:
Edvard Thörnros 2019-08-15 14:24:11 +00:00 committed by moz-wptsync-bot
parent ffd3f8aa4c
commit 4086387f37

View File

@ -0,0 +1,44 @@
<!doctype html>
<meta charset="utf-8">
<title>Remove/Add syncbase while animation is running</title>
<link rel="help" href="https://www.w3.org/TR/SMIL3/smil-timing.html#q26">
<link rel="author" title="Edvard Thörnros" href="mailto:edvardt@opera.com">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<svg>
<animate id="anim" attributeName="visibility" to="visible" begin="10s" dur="2s"/>
<rect x="0" y="0" width="0" height="100" fill="#0F0">
<set attributeName="width" fill="freeze" to="100" begin="anim.begin"/>
</rect>
</svg>
<script>
document.querySelector("body").onload = async_test(function(t) {
let svg = document.querySelector("svg");
let rect = document.querySelector("rect");
window.requestAnimationFrame(t.step_func(function() {
window.requestAnimationFrame(t.step_func(function() {
var anim1 = document.getElementById("anim");
anim1.parentNode.removeChild(anim1);
var anim2 = document.createElementNS("http://www.w3.org/2000/svg", "animate");
anim2.setAttribute("id", "anim");
anim2.setAttribute("attributeName", "visibility");
anim2.setAttribute("to", "visible");
anim2.setAttribute("begin", "0s");
anim2.setAttribute("dur", "2s");
svg.appendChild(anim2);
window.requestAnimationFrame(t.step_func(function() {
window.requestAnimationFrame(t.step_func_done(function() {
svg.pauseAnimations();
assert_equals(rect.width.animVal.value, 100, "Sync base triggered");
}));
}));
}));
}));
});
</script>