summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-values/lh-unit-003.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
commit43a97878ce14b72f0981164f87f2e35e14151312 (patch)
tree620249daf56c0258faa40cbdcf9cfba06de2a846 /testing/web-platform/tests/css/css-values/lh-unit-003.html
parentInitial commit. (diff)
downloadfirefox-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/css/css-values/lh-unit-003.html')
-rw-r--r--testing/web-platform/tests/css/css-values/lh-unit-003.html42
1 files changed, 42 insertions, 0 deletions
diff --git a/testing/web-platform/tests/css/css-values/lh-unit-003.html b/testing/web-platform/tests/css/css-values/lh-unit-003.html
new file mode 100644
index 0000000000..e22a4b95b1
--- /dev/null
+++ b/testing/web-platform/tests/css/css-values/lh-unit-003.html
@@ -0,0 +1,42 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Values and Units Test: lh depending on @font-face</title>
+<link rel="help" href="https://drafts.csswg.org/css-values-4/#font-relative-lengths">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<style>
+ #lh {
+ font-family: customfont;
+ font-size: 20px;
+ width: 10lh;
+ }
+</style>
+<div id="lh">
+ X<br>
+ X<br>
+ X<br>
+ X<br>
+ X<br>
+ X<br>
+ X<br>
+ X<br>
+ X<br>
+ X
+</div>
+<script>
+ test(() => {
+ assert_equals(lh.offsetWidth, lh.offsetHeight);
+ }, "Line-height and lh before @font-face loads");
+
+ let original_size = lh.offsetHeight;
+
+ promise_test(async (t) => {
+ let custom_font = new FontFace("customfont", "url(/css/css-fonts/support/fonts/Rochester.otf)");
+ document.fonts.add(custom_font);
+ await document.fonts.load("20px customfont");
+ assert_not_equals(lh.offsetHeight, original_size,
+ "Test is useless if normal line-height is the same for both the web font and the fallback font");
+ assert_equals(lh.offsetWidth, lh.offsetHeight,
+ "lh and normal line-height both affected");
+ }, "Line-height and lh after @font-face loaded");
+</script>