else if (mToken.mIdent.EqualsIgnoreCase("-moz-hsl")) {
else if (mToken.mIdent.EqualsIgnoreCase("hsl")) {
PRBool CSSParserImpl::ParseColor(PRInt32& aErrorCode, nsCSSValue& aValue){  if (!GetToken(aErrorCode, PR_TRUE)) {    REPORT_UNEXPECTED_EOF(NS_LITERAL_STRING("color"));    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;        PRInt32 type = COLOR_TYPE_UNKNOWN;        if (ExpectSymbol(aErrorCode, '(', PR_FALSE) && // this won't fail            ParseColorComponent(aErrorCode, r, type, ',') &&            ParseColorComponent(aErrorCode, g, type, ',') &&            ParseColorComponent(aErrorCode, b, type, ')')) {          aValue.SetColorValue(NS_RGB(r,g,b));          return PR_TRUE;        }        return PR_FALSE;  // already pushed back      }      else if (mToken.mIdent.EqualsIgnoreCase("-moz-rgba")) {        // rgba ( component , component , component , opacity )        PRUint8 r, g, b, a;        PRInt32 type = COLOR_TYPE_UNKNOWN;        if (ExpectSymbol(aErrorCode, '(', PR_FALSE) && // this won't fail            ParseColorComponent(aErrorCode, r, type, ',') &&            ParseColorComponent(aErrorCode, g, type, ',') &&            ParseColorComponent(aErrorCode, b, type, ',') &&            ParseColorOpacity(aErrorCode, a)) {          aValue.SetColorValue(NS_RGBA(r, g, b, a));          return PR_TRUE;        }        return PR_FALSE;  // already pushed back      }      else if (mToken.mIdent.EqualsIgnoreCase("-moz-hsl")) {        // hsl ( hue , saturation , lightness )        // "hue" is a number, "saturation" and "lightness" are percentages.        if (ParseHSLColor(aErrorCode, rgba, ')')) {          aValue.SetColorValue(rgba);          return PR_TRUE;        }        return PR_FALSE;      }      else if (mToken.mIdent.EqualsIgnoreCase("-moz-hsla")) {        // hsla ( hue , saturation , lightness , opacity )        // "hue" is a number, "saturation" and "lightness" are percentages,        // "opacity" is a number.        PRUint8 a;        if (ParseHSLColor(aErrorCode, rgba, ',') &&            ParseColorOpacity(aErrorCode, a)) {          aValue.SetColorValue(NS_RGBA(NS_GET_R(rgba), NS_GET_G(rgba),                                       NS_GET_B(rgba), a));          return PR_TRUE;        }        return PR_FALSE;      }      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[20];    switch (tk->mType) {      case eCSSToken_Ident:        str.Assign(tk->mIdent);        break;      case eCSSToken_Number:        if (tk->mIntegerValid) {          PR_snprintf(buffer, sizeof(buffer), "%06d", tk->mInteger);          str.AssignWithConversion(buffer);        }        break;      case eCSSToken_Dimension:        if (tk->mIdent.Length() <= 6) {          PR_snprintf(buffer, sizeof(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  REPORT_UNEXPECTED_TOKEN(NS_LITERAL_STRING("Expected color but found"));  UngetToken();  return PR_FALSE;}