diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
commit | 43a97878ce14b72f0981164f87f2e35e14151312 (patch) | |
tree | 620249daf56c0258faa40cbdcf9cfba06de2a846 /testing/web-platform/tests/animation-worklet/resources | |
parent | Initial commit. (diff) | |
download | firefox-upstream.tar.xz firefox-upstream.zip |
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/animation-worklet/resources')
-rw-r--r-- | testing/web-platform/tests/animation-worklet/resources/animator-iframe.html | 44 | ||||
-rw-r--r-- | testing/web-platform/tests/animation-worklet/resources/iframe.html | 9 |
2 files changed, 53 insertions, 0 deletions
diff --git a/testing/web-platform/tests/animation-worklet/resources/animator-iframe.html b/testing/web-platform/tests/animation-worklet/resources/animator-iframe.html new file mode 100644 index 0000000000..f9a5fab9b7 --- /dev/null +++ b/testing/web-platform/tests/animation-worklet/resources/animator-iframe.html @@ -0,0 +1,44 @@ +<!DOCTYPE html> +<style> +.greenbox { + width: 100px; + height: 100px; + background-color: #00ff00; +} +</style> +<script src="/web-animations/testcommon.js"></script> +<script src="../common.js"></script> + +<script id="iframe_worklet" type="text/worklet"> +registerAnimator("iframe_animator", class { + animate(currentTime, effect) { + effect.localTime = 600; + } +}); +registerAnimator("duplicate_animator", class { + animate(currentTime, effect) { + effect.localTime = 800; + } +}); +</script> + +<div id="iframe_target" class="greenbox"></div> + +<script> +runInAnimationWorklet( + document.getElementById('iframe_worklet').textContent +).then(_ => { + const target = document.getElementById('iframe_target'); + // Only create an animation for iframe_animator. + const effect = new KeyframeEffect(target, [{ opacity: 0 }], { duration: 1000 }); + const animation = new WorkletAnimation('iframe_animator', effect); + animation.play(); + + // wait until local times are synced back to the main thread. + waitForAnimationFrameWithCondition(_ => { + return getComputedStyle(target).opacity != '1'; + }).then(_ => { + window.parent.postMessage(getComputedStyle(target).opacity, '*'); + }); + }); +</script> diff --git a/testing/web-platform/tests/animation-worklet/resources/iframe.html b/testing/web-platform/tests/animation-worklet/resources/iframe.html new file mode 100644 index 0000000000..e128fa53e4 --- /dev/null +++ b/testing/web-platform/tests/animation-worklet/resources/iframe.html @@ -0,0 +1,9 @@ +<!DOCTYPE html> +<style> +#iframe_box { + width: 100px; + height: 100px; + background-color: green; +} +</style> +<div id='iframe_box'></div> |