Pass whether we're in a string to ParseAndAppendEscape. (Bug 384672, patch 1) r=bzbarsky

This passes true for string tokens and for url() tokens containing
string, since that is what CSS 2.1 chapter 4's tokenization suggests.
This commit is contained in:
L. David Baron 2011-05-03 13:19:18 -07:00
parent f383bf0179
commit 0099793035
2 changed files with 6 additions and 6 deletions

View File

@ -971,7 +971,7 @@ nsCSSScanner::NextURL(nsCSSToken& aToken)
ch = Read();
if (ch < 0) break;
if (ch == CSS_ESCAPE) {
ParseAndAppendEscape(ident);
ParseAndAppendEscape(ident, PR_FALSE);
} else if (IsWhitespace(ch)) {
// Whitespace is allowed at the end of the URL
EatWhiteSpace();
@ -1003,7 +1003,7 @@ nsCSSScanner::NextURL(nsCSSToken& aToken)
void
nsCSSScanner::ParseAndAppendEscape(nsString& aOutput)
nsCSSScanner::ParseAndAppendEscape(nsString& aOutput, PRBool aInString)
{
PRInt32 ch = Peek();
if (ch < 0) {
@ -1076,7 +1076,7 @@ PRBool
nsCSSScanner::GatherIdent(PRInt32 aChar, nsString& aIdent)
{
if (aChar == CSS_ESCAPE) {
ParseAndAppendEscape(aIdent);
ParseAndAppendEscape(aIdent, PR_FALSE);
}
else if (0 < aChar) {
aIdent.Append(aChar);
@ -1103,7 +1103,7 @@ nsCSSScanner::GatherIdent(PRInt32 aChar, nsString& aIdent)
aChar = Read();
if (aChar < 0) break;
if (aChar == CSS_ESCAPE) {
ParseAndAppendEscape(aIdent);
ParseAndAppendEscape(aIdent, PR_FALSE);
} else if (IsIdent(aChar)) {
aIdent.Append(PRUnichar(aChar));
} else {
@ -1367,7 +1367,7 @@ nsCSSScanner::ParseString(PRInt32 aStop, nsCSSToken& aToken)
break;
}
if (ch == CSS_ESCAPE) {
ParseAndAppendEscape(aToken.mIdent);
ParseAndAppendEscape(aToken.mIdent, PR_TRUE);
} else {
aToken.mIdent.Append(ch);
}

View File

@ -215,7 +215,7 @@ protected:
PRBool LookAheadOrEOF(PRUnichar aChar); // expect either aChar or EOF
void EatWhiteSpace();
void ParseAndAppendEscape(nsString& aOutput);
void ParseAndAppendEscape(nsString& aOutput, PRBool aInString);
PRBool ParseIdent(PRInt32 aChar, nsCSSToken& aResult);
PRBool ParseAtKeyword(PRInt32 aChar, nsCSSToken& aResult);
PRBool ParseNumber(PRInt32 aChar, nsCSSToken& aResult);