REPORT_UNEXPECTED_TOKEN();
PRBool CSSParserImpl::ParseColor(PRInt32& aErrorCode, nsCSSValue& aValue){  if (!GetToken(aErrorCode, PR_TRUE)) {    return PR_FALSE;  }  nsCSSToken* tk = &mToken;  nscolor rgba;  switch (tk->mType) {    case eCSSToken_ID:      // #xxyyzz      if (NS_HexToRGB(tk->mIdent, &rgba)) {        aValue.SetColorValue(rgba);        return PR_TRUE;      }      break;    case eCSSToken_Ident:      if (NS_ColorNameToRGB(tk->mIdent, &rgba)) {        aValue.SetStringValue(tk->mIdent, eCSSUnit_String);        return PR_TRUE;      }      else {        nsCSSKeyword keyword = nsCSSKeywords::LookupKeyword(tk->mIdent);        if (eCSSKeyword_UNKNOWN < keyword) { // known keyword          PRInt32 index = SearchKeywordTable(keyword, nsCSSProps::kColorKTable);          if (0 < index) {            aValue.SetIntValue(nsCSSProps::kColorKTable[index], eCSSUnit_Integer);            return PR_TRUE;          }        }      }      break;    case eCSSToken_Function:      if (mToken.mIdent.EqualsIgnoreCase("rgb")) {        // rgb ( component , component , component )        PRUint8 r, g, b;        if (ExpectSymbol(aErrorCode, '(', PR_FALSE) &&            ParseColorComponent(aErrorCode, r, ',') &&            ParseColorComponent(aErrorCode, g, ',') &&            ParseColorComponent(aErrorCode, b, ')')) {          rgba = NS_RGB(r,g,b);          aValue.SetColorValue(rgba);          return PR_TRUE;        }        return PR_FALSE;  // already pushed back      }      break;    default:      break;  }  // try 'xxyyzz' without '#' prefix for compatibility with IE and Nav4x (bug 23236 and 45804)  if (mNavQuirkMode && !IsParsingCompoundProperty()) {  	// - If the string starts with 'a-f', the nsCSSScanner builds the token  	//   as a eCSSToken_Ident and we can parse the string as a 'xxyyzz' RGB color.  	// - If it only contains '0-9' digits, the token is a eCSSToken_Number and it  	//   must be converted back to a 6 characters string to be parsed as a RGB color.  	// - If it starts with '0-9' and contains any 'a-f', the token is a eCSSToken_Dimension,  	//   the mNumber part must be converted back to a string and the mIdent part must be  	//   appended to that string so that the resulting string has 6 characters.		// Note: This is a hack for Nav compatibility. Do not attempt to simplify it		// by hacking into the ncCSSScanner. This would be very bad.		nsAutoString str;		char  buffer[10];		switch (tk->mType) {			case eCSSToken_Ident:				str.Assign(tk->mIdent);				break;			case eCSSToken_Number:				if (tk->mIntegerValid) {					sprintf(buffer, "%06d", tk->mInteger);					str.AssignWithConversion(buffer);				}				break;			case eCSSToken_Dimension:				if (tk->mIdent.Length() <= 6) {					sprintf(buffer, "%06.0f", tk->mNumber);					nsAutoString temp;					temp.AssignWithConversion(buffer);					temp.Right(str, 6 - tk->mIdent.Length());					str.Append(tk->mIdent);				}				break;			default:				// There is a whole bunch of cases that are				// not handled by this switch.  Ignore them.				break;		}	  if (NS_HexToRGB(str, &rgba)) {	    aValue.SetColorValue(rgba);	    return PR_TRUE;	  }  }  // It's not a color  UngetToken();  return PR_FALSE;}