Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / css / font-face-src-parsing.html
blob010ff95176bd6647f30233bac176e2ee648d770f
1 <!-- Valid src descriptor rules. -->
2 <style>
3 @font-face {
4 src: url(font.ttf);
6 @font-face {
7 src: url(http://foo/bar/font.ttf);
9 @font-face {
10 src: url(font.svg#id);
12 @font-face {
13 src: url(font.ttf) format("truetype");
15 @font-face {
16 src: url(font.woff) format("woff"), local(font2);
18 @font-face {
19 src: url(font.ttf) format("truetype"), url(font2.ttf);
21 @font-face {
22 src: url(font.ttf), url(font2.ttf) format("truetype");
24 @font-face {
25 src: url(font.ttf), local(font2), url(font3.otf) format("opentype"), local(foo bar);
27 @font-face {
28 src: local(foo);
30 @font-face {
31 src: local(font), local(foo bar);
33 @font-face {
34 src: local("foo");
36 @font-face {
37 src: local("foo bar");
39 </style>
41 <!-- Invalid src descriptor rules. -->
42 <style>
43 @font-face {
44 src: url(font.ttf invalid);
46 @font-face {
47 src: url(font.ttf),;
49 @font-face {
50 src: url(font.ttf), local(font2),;
52 @font-face {
53 src: ,local(font);
55 @font-face {
56 src: url(font.ttf), invalid();
58 @font-face {
59 src: url(foo.ttf) invalid;
62 @font-face {
63 src: url(foo.ttf), invalid;
65 @font-face {
66 src: url(foo.ttf) "invalid";
68 @font-face {
69 src: url(foo.ttf) !important;
71 @font-face {
72 src: initial;
74 @font-face {
75 src: inherit;
77 @font-face {
78 src: unset;
80 </style>
81 <p>Test parsing the src descriptor of @font-face.</p>
83 <p>Valid rules form the stylesheet:</p>
84 <div id="validResult"></div>
86 <p>Expected result for valid rules:</p>
87 <pre id="validExpected">@font-face { src: url(font.ttf); }
88 @font-face { src: url(http://foo/bar/font.ttf); }
89 @font-face { src: url(font.svg#id); }
90 @font-face { src: url(font.ttf) format(truetype); }
91 @font-face { src: url(font.woff) format(woff), local(font2); }
92 @font-face { src: url(font2.ttf); }
93 @font-face { src: url(font2.ttf) format(truetype); }
94 @font-face { src: url(font3.otf) format(opentype), local(foo bar); }
95 @font-face { src: local(foo); }
96 @font-face { src: local(font), local(foo bar); }
97 @font-face { src: local(foo); }
98 @font-face { src: local(foo bar); }
99 </pre>
101 <p>Invalid rules form the stylesheet:</p>
102 <pre id="invalidResult"></pre>
104 <p>Expected result for invalid rules:</p>
105 <pre id="invalidExpected">@font-face { }
106 @font-face { }
107 @font-face { }
108 @font-face { }
109 @font-face { }
110 @font-face { }
111 @font-face { }
112 @font-face { }
113 @font-face { }
114 </pre>
116 <script>
117 if (window.testRunner)
118 testRunner.dumpAsText();
120 var validRules = document.styleSheets[0].cssRules;
121 var result = '';
122 for (var i = 0; i < validRules.length; ++i) {
123 var itemText = validRules.item(i).cssText.replace(/file:.*LayoutTests\/fast\/css\//, '');
124 result += itemText + '\n';
126 document.getElementById('validResult').innerText = result;
128 var invalidRules = document.styleSheets[1].cssRules;
129 result = '';
130 for (var i = 0; i < invalidRules.length; ++i) {
131 var itemText = invalidRules.item(i).cssText.replace(/file:.*LayoutTests\/fast\/css\//, '');
132 result += itemText + '\n';
134 document.getElementById('invalidResult').innerText = result;
135 </script>