blob: bb9e868cd2889e1bd13efc81d9840cc5152165d4 [file] [log] [blame]
<!-- Valid src descriptor rules. -->
<style>
@font-face {
src: url(font.ttf);
}
@font-face {
src: url(http://foo/bar/font.ttf);
}
@font-face {
src: url(font.svg#id);
}
@font-face {
src: url(font.ttf) format("truetype");
}
@font-face {
src: url(font.woff) format("woff"), local(font2);
}
@font-face {
src: url(font.ttf) format("truetype"), url(font2.ttf);
}
@font-face {
src: url(font.ttf), url(font2.ttf) format("truetype");
}
@font-face {
src: url(font.ttf), local(font2), url(font3.otf) format("opentype"), local(foo bar);
}
@font-face {
src: local(foo);
}
@font-face {
src: local(font), local(foo bar);
}
@font-face {
src: local("foo");
}
@font-face {
src: local("foo bar");
}
</style>
<!-- Invalid src descriptor rules. -->
<style>
@font-face {
src: url(font.ttf invalid);
}
@font-face {
src: url(font.ttf),;
}
@font-face {
src: url(font.ttf), local(font2),;
}
@font-face {
src: ,local(font);
}
@font-face {
src: url(font.ttf), invalid();
}
@font-face {
src: url(foo.ttf) invalid;
}
@font-face {
src: url(foo.ttf), invalid;
}
@font-face {
src: url(foo.ttf) "invalid";
}
</style>
<p>Test parsing the src descriptor of @font-face.</p>
<p>Valid rules form the stylesheet:</p>
<div id="validResult"></div>
<p>Expected result for valid rules:</p>
<pre id="validExpected">@font-face { src: url(font.ttf); }
@font-face { src: url(http://foo/bar/font.ttf); }
@font-face { src: url(font.svg#id); }
@font-face { src: url(font.ttf) format(truetype); }
@font-face { src: url(font.woff) format(woff), local(font2); }
@font-face { src: url(font2.ttf); }
@font-face { src: url(font2.ttf) format(truetype); }
@font-face { src: url(font3.otf) format(opentype), local(foo bar); }
@font-face { src: local(foo); }
@font-face { src: local(font), local(foo bar); }
@font-face { src: local(foo); }
@font-face { src: local(foo bar); }
</pre>
<p>Invalid rules form the stylesheet:</p>
<pre id="invalidResult"></pre>
<p>Expected result for invalid rules:</p>
<pre id="invalidExpected">@font-face { }
@font-face { }
@font-face { }
@font-face { }
@font-face { }
@font-face { }
@font-face { }
@font-face { }
</pre>
<script>
if (window.testRunner)
testRunner.dumpAsText();
var validRules = document.styleSheets[0].cssRules;
var result = '';
for (var i = 0; i < validRules.length; ++i) {
var itemText = validRules.item(i).cssText.replace(/file:.*LayoutTests\/fast\/css\//, '');
result += itemText + '\n';
}
document.getElementById('validResult').innerText = result;
var invalidRules = document.styleSheets[1].cssRules;
result = '';
for (var i = 0; i < invalidRules.length; ++i) {
var itemText = invalidRules.item(i).cssText;
result += itemText + '\n';
}
document.getElementById('invalidResult').innerText = result;
</script>