blob: a1b16abeeceaf78d71a4bd6b7d352a0ca20ab855 [file] [log] [blame]
commit-queue@webkit.orgd7e6fa22013-03-14 05:59:58 +00001<html>
2<head>
mark.lam@apple.com104d9932013-09-07 22:20:15 +00003<script src="../../resources/js-test-pre.js"></script>
commit-queue@webkit.orgd7e6fa22013-03-14 05:59:58 +00004<style>
5body {
6 font-family: serif;
7}
8@font-face {
9 font-family: 'ahem';
10 src: url(../../resources/Ahem.ttf);
11}
12#test {
13 position: absolute
14}
15#test span {
16 font-family: ahem;
17}
18</style>
19<script>
20description('Test that onloadingdone is fired after style recalculation.');
21
22window.jsTestIsAsync = true;
23
24function runTests() {
betravis@adobe.com044d3f92014-07-31 21:38:27 +000025 document.fonts.onloadingdone = function() {
commit-queue@webkit.orgd7e6fa22013-03-14 05:59:58 +000026 debug('loadingdone');
27 testDiv = document.getElementById('test');
28 shouldBeEqualToString('window.getComputedStyle(testDiv, 0).width', '48px');
29 };
30
betravis@adobe.com044d3f92014-07-31 21:38:27 +000031 document.fonts.notifyWhenFontsReady(function() {
commit-queue@webkit.orgd7e6fa22013-03-14 05:59:58 +000032 debug('notifyWhenFontsReady() callback');
33 shouldBeEqualToString('window.getComputedStyle(testDiv, 0).width', '48px');
34 finishJSTest();
35 });
36}
37
betravis@adobe.com044d3f92014-07-31 21:38:27 +000038if (document.fonts)
commit-queue@webkit.orgd7e6fa22013-03-14 05:59:58 +000039 runTests();
40else {
betravis@adobe.com044d3f92014-07-31 21:38:27 +000041 testFailed('document.fonts does not exist');
commit-queue@webkit.orgd7e6fa22013-03-14 05:59:58 +000042 finishJSTest();
43}
44</script>
45</head>
46<body>
47 <div id=test>
48 <a href="#">
49 <span>aaa</span>
50 </a>
51 </div>
mark.lam@apple.com104d9932013-09-07 22:20:15 +000052 <script src="../../resources/js-test-post.js"></script>
commit-queue@webkit.orgd7e6fa22013-03-14 05:59:58 +000053</body>
54</html>