Make parsing of tree pseudo-elements do proper parenthesis matching. (Bug 521044) r=bzbarsky

This commit is contained in:
L. David Baron 2009-10-07 20:22:42 -07:00
Родитель 8b0827d149
Коммит bb1f9785ae
1 изменённых файлов: 7 добавлений и 5 удалений

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

@ -3882,20 +3882,22 @@ CSSParserImpl::ParseColorOpacity(PRUint8& aOpacity)
PRBool
CSSParserImpl::ParseTreePseudoElement(nsCSSSelector& aSelector)
{
// The argument to a tree pseudo-element is a sequence of identifiers
// that are either space- or comma-separated. (Was the intent to
// allow only comma-separated? That's not what was done.)
if (ExpectSymbol('(', PR_FALSE)) {
while (!ExpectSymbol(')', PR_TRUE)) {
if (!GetToken(PR_TRUE)) {
return PR_FALSE;
}
else if (eCSSToken_Ident == mToken.mType) {
if (eCSSToken_Ident == mToken.mType) {
nsCOMPtr<nsIAtom> pseudo = do_GetAtom(mToken.mIdent);
aSelector.AddPseudoClass(pseudo);
}
else if (eCSSToken_Symbol == mToken.mType) {
if (!mToken.IsSymbol(','))
return PR_FALSE;
else if (!mToken.IsSymbol(',')) {
SkipUntil(')');
return PR_FALSE;
}
else return PR_FALSE;
}
return PR_TRUE;
}