Bug 773296 - Part 9: Give nsCSSScanner the ability to remember when it encounters a "var(" token. r=dbaron

This is the first part of handling variable references in regular
properties.  We have the scanner set a flag whenever it returns a "var("
token, so that when we come to the end of parsing a property that
failed, we know that it is because of a variable reference.
This commit is contained in:
Cameron McCormack 2013-12-12 13:09:42 +11:00
Родитель c42a6189e5
Коммит d6b91eb984
2 изменённых файлов: 9 добавлений и 6 удалений

Просмотреть файл

@ -353,6 +353,7 @@ nsCSSScanner::nsCSSScanner(const nsAString& aBuffer, uint32_t aLineNumber)
, mSVGMode(false)
, mRecording(false)
, mSeenBadToken(false)
, mSeenVariableReference(false)
{
MOZ_COUNT_CTOR(nsCSSScanner);
}
@ -721,6 +722,8 @@ nsCSSScanner::ScanIdent(nsCSSToken& aToken)
aToken.mType = eCSSToken_Function;
if (aToken.mIdent.LowerCaseEqualsLiteral("url")) {
NextURL(aToken);
} else if (aToken.mIdent.LowerCaseEqualsLiteral("var")) {
mSeenVariableReference = true;
}
return true;
}

Просмотреть файл

@ -178,13 +178,12 @@ class nsCSSScanner {
}
// Reset or check whether a BAD_URL or BAD_STRING token has been seen.
void ClearSeenBadToken() {
mSeenBadToken = false;
}
void ClearSeenBadToken() { mSeenBadToken = false; }
bool SeenBadToken() const { return mSeenBadToken; }
bool SeenBadToken() const {
return mSeenBadToken;
}
// Reset or check whether a "var(" FUNCTION token has been seen.
void ClearSeenVariableReference() { mSeenVariableReference = false; }
bool SeenVariableReference() const { return mSeenVariableReference; }
// Get the 1-based line number of the last character of
// the most recently processed token.
@ -319,6 +318,7 @@ protected:
bool mSVGMode;
bool mRecording;
bool mSeenBadToken;
bool mSeenVariableReference;
};
#endif /* nsCSSScanner_h___ */