Bug 875287 - font-family: Do not require whitespace between unquoted idents. r=dbaron

When 'font-family' is secified with unquoted identifiers rather than a quoted string, a single space should be inserted between identifier tokens, even if they are separated by a comment rather than a whitespace token.
This commit is contained in:
Simon Sapin 2013-05-30 08:10:02 -04:00
parent 49f0808fda
commit 3d3cc72e20
5 changed files with 40 additions and 12 deletions

View File

@ -0,0 +1,9 @@
<!doctype html>
<style>
@font-face {
font-family: Awesome font;
src: url(../fonts/markA.ttf);
}
p { /* Default font */ }
</style>
<p>A

View File

@ -0,0 +1,9 @@
<!doctype html>
<style>
@font-face {
font-family: Awesome font;
src: url(../fonts/markA.ttf);
}
p { font-family: Awesome font }
</style>
<p>A

View File

@ -0,0 +1,9 @@
<!doctype html>
<style>
@font-face {
font-family: Awesome font;
src: url(../fonts/markA.ttf);
}
p { font-family: Awesome/**/font }
</style>
<p>A

View File

@ -141,6 +141,10 @@ fails-if(cocoaWidget) fails-if(winWidget) HTTP(..) != underline-offset-change-1-
HTTP(..) != 534352-1-extra-cmap-sentinel.html 534352-1-extra-cmap-sentinel-ref.html
HTTP(..) == bug533251.html bug533251-ref.html
# Bug 875287
HTTP(..) == font-familiy-whitespace-1.html font-familiy-whitespace-1-ref.html
HTTP(..) != font-familiy-whitespace-1.html font-familiy-whitespace-1-notref.html
skip-if(B2G) fails-if(Android) HTTP(..) == ivs-1.html ivs-1-ref.html # bug 773482
skip-if(B2G) HTTP(..) == missing-names.html missing-names-ref.html # bug 773482

View File

@ -9005,19 +9005,16 @@ CSSParserImpl::ParseOneFamily(nsAString& aFamily, bool& aOneKeyword)
if (eCSSToken_Ident == tk->mType) {
aOneKeyword = false;
// We had at least another keyword before.
// "If a sequence of identifiers is given as a font family name,
// the computed value is the name converted to a string by joining
// all the identifiers in the sequence by single spaces."
// -- CSS 2.1, section 15.3
// Whitespace tokens do not actually matter,
// identifier tokens can be separated by comments.
aFamily.Append(PRUnichar(' '));
aFamily.Append(tk->mIdent);
} else if (eCSSToken_Whitespace == tk->mType) {
// Lookahead one token and drop whitespace if we are ending the
// font name.
if (!GetToken(true))
break;
UngetToken();
if (eCSSToken_Ident == tk->mType)
aFamily.Append(PRUnichar(' '));
else
break;
} else {
} else if (eCSSToken_Whitespace != tk->mType) {
UngetToken();
break;
}