Bug 1203142 - Insert /**/ separate between two adjacent '-' symbols when serializing token streams. r=simon.sapin

This commit is contained in:
Cameron McCormack 2015-09-17 11:34:04 +10:00
parent f0267b0b03
commit 4feb2989f7
3 changed files with 8 additions and 2 deletions

View File

@ -2145,6 +2145,7 @@ SeparatorRequiredBetweenTokens(nsCSSTokenSerializationType aToken1,
aToken2 == eCSSTokenSerialization_URange ||
aToken2 == eCSSTokenSerialization_CDC;
case eCSSTokenSerialization_Symbol_Hash:
case eCSSTokenSerialization_Symbol_Minus:
return aToken2 == eCSSTokenSerialization_Ident ||
aToken2 == eCSSTokenSerialization_Function ||
aToken2 == eCSSTokenSerialization_URL_or_BadURL ||
@ -2153,7 +2154,6 @@ SeparatorRequiredBetweenTokens(nsCSSTokenSerializationType aToken1,
aToken2 == eCSSTokenSerialization_Percentage ||
aToken2 == eCSSTokenSerialization_Dimension ||
aToken2 == eCSSTokenSerialization_URange;
case eCSSTokenSerialization_Symbol_Minus:
case eCSSTokenSerialization_Number:
return aToken2 == eCSSTokenSerialization_Ident ||
aToken2 == eCSSTokenSerialization_Function ||

View File

@ -104,7 +104,7 @@ enum nsCSSTokenType {
// need to insert a "/**/" string between a '|' delim and a '|=' dashmatch
// and between a '/' delim and a '*=' containsmatch.
//
// https://dvcs.w3.org/hg/csswg/raw-file/372e659027a0/css-syntax/Overview.html#serialization
// https://drafts.csswg.org/css-syntax/#serialization
enum nsCSSTokenSerializationType {
eCSSTokenSerialization_Nothing,
eCSSTokenSerialization_Whitespace,

View File

@ -35,6 +35,12 @@ var values = [
["--a: var(--b)var(--c); --b:orange; --c:red;", "--a", " orange/**/red"],
["--a: var(--b)var(--c,red); --b:orange;", "--a", " orange/**/red"],
["--a: var(--b,orange)var(--c); --c:red;", "--a", " orange/**/red"],
["--a: var(--b)-; --b:-;", "--a", " -/**/-"],
["--a: var(--b)--; --b:-;", "--a", " -/**/--"],
["--a: var(--b)--x; --b:-;", "--a", " -/**/--x"],
["--a: var(--b)var(--c); --b:-; --c:-;", "--a", " -/**/-"],
["--a: var(--b)var(--c); --b:--; --c:-;", "--a", " --/**/-"],
["--a: var(--b)var(--c); --b:--x; --c:-;", "--a", " --x/**/-"],
["counter-reset: var(--a)red; --a:orange;", "counter-reset", "orange 0 red 0"],
["--a: var(--b)var(--c); --c:[c]; --b:('ab", "--a", " ('ab')[c]"],
["--a: '", "--a", " ''"],