Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / css / fontfaceset-add-remove.html
blob806b8a58937421205b50b21cef4c60444676f590
1 <html>
2 <head>
3 <script src="../../resources/js-test.js"></script>
4 <style>
5 @font-face {
6 font-family: TestFont;
7 src: local(Arial);
9 @font-face {
10 font-family: Ahem;
11 src: url(../../resources/Ahem.ttf);
13 #test {
14 font-family: TestFont;
16 #arial {
17 font-family: Arial;
19 #ahem {
20 font-family: Ahem;
22 </style>
23 <script>
24 description('Tests that adding/removing a FontFace to/from FontFaceSet trigger font update.');
26 window.jsTestIsAsync = true;
28 function runTest() {
29 ahemFace = new FontFace('TestFont', 'url(../../resources/Ahem.ttf)', {});
30 ahemFace.load().then(verify);
33 function verify() {
34 testElement = document.getElementById('test');
35 arialElement = document.getElementById('arial');
36 ahemElement = document.getElementById('ahem');
38 shouldBe('testElement.offsetWidth', 'arialElement.offsetWidth');
39 document.fonts.add(ahemFace);
40 shouldBe('testElement.offsetWidth', 'ahemElement.offsetWidth');
41 document.fonts.delete(ahemFace);
42 shouldBe('testElement.offsetWidth', 'arialElement.offsetWidth');
43 document.fonts.add(ahemFace);
44 shouldBe('testElement.offsetWidth', 'ahemElement.offsetWidth');
45 document.fonts.clear();
46 shouldBe('testElement.offsetWidth', 'arialElement.offsetWidth');
48 finishJSTest();
50 </script>
51 </head>
52 <body onload="runTest()">
53 <span id="test">abcdefg</span>
54 <span id="arial">abcdefg</span>
55 <span id="ahem">abcdefg</span>
56 </body>
57 </html>