Truly independent web browser
LibWeb: Test a selector match below a shown root past font waits
Andreas Kling7ab8860b8430
diff --git a/Tests/LibWeb/Text/expected/css/selector-match-below-shown-root-past-font-waits.txt b/Tests/LibWeb/Text/expected/css/selector-match-below-shown-root-past-font-waits.txtnew file mode 100644index 00000000000..eb03044a9b2--- /dev/null+++ b/Tests/LibWeb/Text/expected/css/selector-match-below-shown-root-past-font-waits.txt@@ -0,0 +1,2 @@+before: rgb(255, 0, 0)+after: rgb(255, 0, 0)diff --git a/Tests/LibWeb/Text/input/css/selector-match-below-shown-root-past-font-waits.html b/Tests/LibWeb/Text/input/css/selector-match-below-shown-root-past-font-waits.htmlnew file mode 100644index 00000000000..449d760e7fc--- /dev/null+++ b/Tests/LibWeb/Text/input/css/selector-match-below-shown-root-past-font-waits.html@@ -0,0 +1,34 @@+<!DOCTYPE html>+<style>+ span {+ font-size: 1.0371em;+ }+ :nth-child(2n+1) ~ .ancestor #target {+ color: rgb(255, 0, 0);+ }+</style>+<script src="../include.js"></script>+<div><div id="sibling"></div><div id="ancestor" class="ancestor"></div></div>+<script>+ // An element below one shown again is matched anew, however many rounds the styles above it wait on fonts.+ asyncTest(async done => {+ let parent = ancestor;+ for (let i = 0; i < 16; ++i)+ parent = parent.appendChild(document.createElement("span"));+ parent.id = "target";+ const nextFrame = () => new Promise(resolve => requestAnimationFrame(resolve));+ await nextFrame();+ await nextFrame();+ println(`before: ${getComputedStyle(target).color}`);+ sibling.remove();+ document.documentElement.style.display = "none";+ await nextFrame();+ await nextFrame();+ document.documentElement.style.display = "";+ document.documentElement.style.fontSize = "11px";+ await nextFrame();+ await nextFrame();+ println(`after: ${getComputedStyle(target).color}`);+ done();+ });+</script>