Skip to content

Truly independent web browser

Tests: Add the web font only right before a test’s first read

sideshowbarker5d7cc30690cb
diff --git a/Tests/LibWeb/Text/input/css/input-line-height-after-a-web-font-loads.html b/Tests/LibWeb/Text/input/css/input-line-height-after-a-web-font-loads.html
index 24a46d6e041..095ad6d4c68 100644
--- a/Tests/LibWeb/Text/input/css/input-line-height-after-a-web-font-loads.html
+++ b/Tests/LibWeb/Text/input/css/input-line-height-after-a-web-font-loads.html
@@ -2,10 +2,6 @@
<!-- The used line-height of a single-line input is never smaller than a line-height of normal, which reads the metrics
of its first available font: a web font arriving moves them. -->
<style>
- @font-face {
- font-family: "Tall";
- src: url("../../../Assets/NotoSansEthiopic.woff2");
- }
input {
font-family: "Tall", sans-serif;
font-size: 16px;
@@ -17,7 +13,10 @@
<script>
asyncTest(async done => {
const input = document.getElementById("input");
- const face = [...document.fonts][0];
+ // The face is added only now, so no style pass before the first read can have started its load: A style that
+ // reads a pending face's metrics loads it, and a fast load would land before that read.
+ const face = new FontFace("Tall", 'url("../../../Assets/NotoSansEthiopic.woff2")');
+ document.fonts.add(face);
println(`Before the load: ${getComputedStyle(input).lineHeight}`);
await face.load();
await document.fonts.ready;