Truly independent web browser
LibWeb: Test monospace font sizes under an animated ancestor
Andreas Kling5c5cc3026302
diff --git a/Tests/LibWeb/Text/expected/css/monospace-follows-animated-ancestor-font.txt b/Tests/LibWeb/Text/expected/css/monospace-follows-animated-ancestor-font.txtnew file mode 100644index 00000000000..bc26f9ed5ed--- /dev/null+++ b/Tests/LibWeb/Text/expected/css/monospace-follows-animated-ancestor-font.txt@@ -0,0 +1,6 @@+no animation: 20px, inheriting 20px, monospace 20px, below 20px+running animation: 30px, inheriting 30px, monospace 20px, below 20px+canceled animation: 20px, inheriting 20px, monospace 20px, below 20px+transition at its start: 20px, inheriting 20px, monospace 40px, below 20px+transition halfway: 30px, inheriting 30px, monospace 40px, below 40px+transition finished: 40px, inheriting 40px, monospace 40px, below 40pxdiff --git a/Tests/LibWeb/Text/input/css/monospace-follows-animated-ancestor-font.html b/Tests/LibWeb/Text/input/css/monospace-follows-animated-ancestor-font.htmlnew file mode 100644index 00000000000..19d5b1238fb--- /dev/null+++ b/Tests/LibWeb/Text/input/css/monospace-follows-animated-ancestor-font.html@@ -0,0 +1,54 @@+<!DOCTYPE html>+<style>+ @keyframes font {+ from, to { font-size: 30px; }+ }+ #ancestor {+ font-size: 20px;+ }+ #ancestor.animated {+ animation: font 1000s linear;+ }+ #ancestor.transitioning {+ transition: font-size 1000s linear;+ }+ #ancestor.moved {+ font-size: 40px;+ }+ .monospace {+ font-family: monospace;+ margin: 0;+ }+</style>+<div id="ancestor">+ <span id="inheriting"></span>+ <span class="monospace" id="monospace"></span>+ <div><span class="monospace" id="below"></span></div>+</div>+<script src="../include.js"></script>+<script>+ function dump(label) {+ const size = id => getComputedStyle(document.getElementById(id)).fontSize;+ println(`${label}: ${size("ancestor")}, inheriting ${size("inheriting")}, monospace ${size("monospace")}, below ${size("below")}`);+ }++ test(() => {+ dump("no animation");+ ancestor.classList.add("animated");+ dump("running animation");+ ancestor.getAnimations()[0].cancel();+ ancestor.classList.remove("animated");+ dump("canceled animation");++ ancestor.classList.add("transitioning");+ getComputedStyle(ancestor).fontSize;+ ancestor.classList.add("moved");+ dump("transition at its start");+ const transition = ancestor.getAnimations()[0];+ transition.pause();+ transition.currentTime = 500000;+ dump("transition halfway");+ transition.finish();+ dump("transition finished");+ });+</script>