mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-24 03:19:06 +00:00
Move the consumption of beginning whitespace (for all forms) and ending whitespace (for the string form) inside url() into the tokenizer. (Bug 604179, patch 3) r=bzbarsky
This commit is contained in:
parent
34a94f8d55
commit
7366e14023
@ -1316,12 +1316,10 @@ PRBool
|
||||
CSSParserImpl::GetURLInParens(nsString& aURL)
|
||||
{
|
||||
NS_ASSERTION(!mHavePushBack, "mustn't have pushback at this point");
|
||||
do {
|
||||
if (! mScanner.NextURL(mToken)) {
|
||||
// EOF
|
||||
return PR_FALSE;
|
||||
}
|
||||
} while (eCSSToken_WhiteSpace == mToken.mType);
|
||||
if (! mScanner.NextURL(mToken)) {
|
||||
// EOF
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
aURL = mToken.mIdent;
|
||||
|
||||
|
@ -888,6 +888,8 @@ nsCSSScanner::Next(nsCSSToken& aToken)
|
||||
PRBool
|
||||
nsCSSScanner::NextURL(nsCSSToken& aToken)
|
||||
{
|
||||
EatWhiteSpace();
|
||||
|
||||
PRInt32 ch = Read();
|
||||
if (ch < 0) {
|
||||
return PR_FALSE;
|
||||
@ -895,14 +897,19 @@ nsCSSScanner::NextURL(nsCSSToken& aToken)
|
||||
|
||||
// STRING
|
||||
if ((ch == '"') || (ch == '\'')) {
|
||||
return ParseString(ch, aToken);
|
||||
}
|
||||
#ifdef DEBUG
|
||||
PRBool ok =
|
||||
#endif
|
||||
ParseString(ch, aToken);
|
||||
NS_ABORT_IF_FALSE(ok, "ParseString should never fail, "
|
||||
"since there's always something read");
|
||||
|
||||
// WS
|
||||
if (IsWhitespace(ch)) {
|
||||
aToken.mType = eCSSToken_WhiteSpace;
|
||||
aToken.mIdent.Assign(PRUnichar(ch));
|
||||
EatWhiteSpace();
|
||||
NS_ABORT_IF_FALSE(aToken.mType == eCSSToken_String ||
|
||||
aToken.mType == eCSSToken_Bad_String,
|
||||
"unexpected token type");
|
||||
if (NS_LIKELY(aToken.mType == eCSSToken_String)) {
|
||||
EatWhiteSpace();
|
||||
}
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -191,7 +191,7 @@ class nsCSSScanner {
|
||||
// is filled in with the data for the token.
|
||||
PRBool Next(nsCSSToken& aTokenResult);
|
||||
|
||||
// Get the next token that may be a string or unquoted URL or whitespace
|
||||
// Get the next token that may be a string or unquoted URL
|
||||
PRBool NextURL(nsCSSToken& aTokenResult);
|
||||
|
||||
// It's really ugly that we have to expose this, but it's the easiest
|
||||
|
Loading…
x
Reference in New Issue
Block a user