commit-queue@webkit.org | d7e6fa2 | 2013-03-14 05:59:58 +0000 | [diff] [blame] | 1 | <html> |
| 2 | <head> |
mark.lam@apple.com | 104d993 | 2013-09-07 22:20:15 +0000 | [diff] [blame] | 3 | <script src="../../resources/js-test-pre.js"></script> |
commit-queue@webkit.org | d7e6fa2 | 2013-03-14 05:59:58 +0000 | [diff] [blame] | 4 | <style> |
| 5 | body { |
| 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> |
| 20 | description('Test that onloadingdone is fired after style recalculation.'); |
| 21 | |
| 22 | window.jsTestIsAsync = true; |
| 23 | |
| 24 | function runTests() { |
betravis@adobe.com | 044d3f9 | 2014-07-31 21:38:27 +0000 | [diff] [blame] | 25 | document.fonts.onloadingdone = function() { |
commit-queue@webkit.org | d7e6fa2 | 2013-03-14 05:59:58 +0000 | [diff] [blame] | 26 | debug('loadingdone'); |
| 27 | testDiv = document.getElementById('test'); |
| 28 | shouldBeEqualToString('window.getComputedStyle(testDiv, 0).width', '48px'); |
| 29 | }; |
| 30 | |
betravis@adobe.com | 044d3f9 | 2014-07-31 21:38:27 +0000 | [diff] [blame] | 31 | document.fonts.notifyWhenFontsReady(function() { |
commit-queue@webkit.org | d7e6fa2 | 2013-03-14 05:59:58 +0000 | [diff] [blame] | 32 | debug('notifyWhenFontsReady() callback'); |
| 33 | shouldBeEqualToString('window.getComputedStyle(testDiv, 0).width', '48px'); |
| 34 | finishJSTest(); |
| 35 | }); |
| 36 | } |
| 37 | |
betravis@adobe.com | 044d3f9 | 2014-07-31 21:38:27 +0000 | [diff] [blame] | 38 | if (document.fonts) |
commit-queue@webkit.org | d7e6fa2 | 2013-03-14 05:59:58 +0000 | [diff] [blame] | 39 | runTests(); |
| 40 | else { |
betravis@adobe.com | 044d3f9 | 2014-07-31 21:38:27 +0000 | [diff] [blame] | 41 | testFailed('document.fonts does not exist'); |
commit-queue@webkit.org | d7e6fa2 | 2013-03-14 05:59:58 +0000 | [diff] [blame] | 42 | 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.com | 104d993 | 2013-09-07 22:20:15 +0000 | [diff] [blame] | 52 | <script src="../../resources/js-test-post.js"></script> |
commit-queue@webkit.org | d7e6fa2 | 2013-03-14 05:59:58 +0000 | [diff] [blame] | 53 | </body> |
| 54 | </html> |