From 553f82a11654f4906b886e2dd39d28a33f496f40 Mon Sep 17 00:00:00 2001 From: Cameron McCormack Date: Thu, 17 Sep 2015 11:34:04 +1000 Subject: [PATCH] Bug 1203142 - Insert /**/ separate between two adjacent '-' symbols when serializing token streams. r=simon.sapin --- layout/style/nsCSSParser.cpp | 2 +- layout/style/nsCSSScanner.h | 2 +- layout/style/test/test_variable_serialization_computed.html | 6 ++++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/layout/style/nsCSSParser.cpp b/layout/style/nsCSSParser.cpp index 1b776b58a175..054709986e63 100644 --- a/layout/style/nsCSSParser.cpp +++ b/layout/style/nsCSSParser.cpp @@ -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 || diff --git a/layout/style/nsCSSScanner.h b/layout/style/nsCSSScanner.h index 8c09acf1fe86..ef03958c8939 100644 --- a/layout/style/nsCSSScanner.h +++ b/layout/style/nsCSSScanner.h @@ -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, diff --git a/layout/style/test/test_variable_serialization_computed.html b/layout/style/test/test_variable_serialization_computed.html index 328aa4150ec0..c93ae8938737 100644 --- a/layout/style/test/test_variable_serialization_computed.html +++ b/layout/style/test/test_variable_serialization_computed.html @@ -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", " ''"],