nsCSSValue  value; if (ParseVariant(aErrorCode, value, aVariantMask, aKeywordTable, aParsedVariant)) { aDeclaration->AppendValue(aPropID, value);
aParsedVariant = 0; if (!GetToken(aErrorCode, PR_TRUE)) { return PR_FALSE; } nsCSSToken* tk = &mToken; if (((aVariantMask & (VARIANT_AHK | VARIANT_NORMAL | VARIANT_NONE)) != 0) && (eCSSToken_Ident == tk->mType)) { char cbuf[KEYWORD_BUFFER_SIZE]; tk->mIdent.ToCString(cbuf, sizeof(cbuf)); PRInt32 keyword = nsCSSKeywords::LookupName(cbuf); if (0 <= keyword) { if ((aVariantMask & VARIANT_AUTO) != 0) { if (KEYWORD_AUTO == keyword) { aValue.SetAutoValue(); aParsedVariant = VARIANT_AUTO; return PR_TRUE; } } if ((aVariantMask & VARIANT_INHERIT) != 0) { if (KEYWORD_INHERIT == keyword) { aValue.SetInheritValue(); aParsedVariant = VARIANT_INHERIT; return PR_TRUE; } } if ((aVariantMask & VARIANT_NONE) != 0) { if (KEYWORD_NONE == keyword) { aValue.SetNoneValue(); aParsedVariant = VARIANT_NONE; return PR_TRUE; } } if ((aVariantMask & VARIANT_NORMAL) != 0) { if (KEYWORD_NORMAL == keyword) { aValue.SetNormalValue(); aParsedVariant = VARIANT_NORMAL; return PR_TRUE; } } if ((aVariantMask & VARIANT_KEYWORD) != 0) { PRInt32 index = SearchKeywordTable(keyword, aKeywordTable); if (0 < index) { aValue.SetIntValue(aKeywordTable[index], eCSSUnit_Enumerated); aParsedVariant = VARIANT_KEYWORD; return PR_TRUE; } } } } if (((aVariantMask & (VARIANT_LENGTH | VARIANT_ANGLE | VARIANT_FREQUENCY | VARIANT_TIME)) != 0) && tk->isDimension()) { return TranslateDimension(aValue, aVariantMask, tk->mNumber, tk->mIdent, aParsedVariant); } if (((aVariantMask & VARIANT_PERCENT) != 0) && (eCSSToken_Percentage == tk->mType)) { aValue.SetPercentValue(tk->mNumber); aParsedVariant = VARIANT_PERCENT;
PRBool CSSParserImpl::ParseVariant(PRInt32& aErrorCode,                                   nsICSSDeclaration* aDeclaration,                                   PRInt32 aPropID,                                   PRInt32 aVariantMask, const PRInt32 aKeywordTable[],                                   PRInt32& aParsedVariant){  nsCSSValue  value;  if (ParseVariant(aErrorCode, value, aVariantMask, aKeywordTable, aParsedVariant)) {    aDeclaration->AppendValue(aPropID, value);    return PR_TRUE;  }  return PR_FALSE;}