if (PR_TRUE == mNavQuirkMode) {          nsAutoString str; char  buffer[10]; switch (tk->mType) { case eCSSToken_Ident: str.SetString(tk->mIdent); break;  case eCSSToken_Number: if (tk->mIntegerValid) { sprintf(buffer, "%06d", tk->mInteger); str.SetString(buffer); } break;  case eCSSToken_Dimension: if (tk->mIdent.Length() <= 6) { sprintf(buffer, "%06.0f", tk->mNumber); nsAutoString temp; temp.SetString(buffer); temp.Right(str, 6 - tk->mIdent.Length()); str.Append(tk->mIdent); } break; } if (NS_HexToRGB(str, &rgba)) { aValue.SetColorValue(rgba); return PR_TRUE; } }
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;  }  // It's not a color  UngetToken();  return PR_FALSE;}