PRInt32& aChangeHint)
nsChangeHint& aChangeHint)
CSSParserImpl::ParseDeclaration(PRInt32& aErrorCode,                                nsCSSDeclaration* aDeclaration,                                PRBool aCheckForBraces,                                PRInt32& aChangeHint){  // Get property name  nsCSSToken* tk = &mToken;  nsAutoString propertyName;  for (;;) {    if (!GetToken(aErrorCode, PR_TRUE)) {      if (aCheckForBraces) {        REPORT_UNEXPECTED_EOF(                           NS_LITERAL_STRING("';' or '}' to end declaration"));      }      return PR_FALSE;    }    if (eCSSToken_Ident == tk->mType) {      propertyName = tk->mIdent;      // grab the ident before the ExpectSymbol trashes the token      if (!ExpectSymbol(aErrorCode, ':', PR_TRUE)) {        REPORT_UNEXPECTED_TOKEN(NS_LITERAL_STRING("Expected ':' but found"));        REPORT_UNEXPECTED(NS_LITERAL_STRING("Declaration dropped."));        OUTPUT_ERROR();        return PR_FALSE;      }      break;    }    if (tk->IsSymbol(';')) {      // dangling semicolons are skipped      continue;    }    if (!tk->IsSymbol('}')) {      REPORT_UNEXPECTED_TOKEN(        NS_LITERAL_STRING("Expected declaration but found"));      REPORT_UNEXPECTED(NS_LITERAL_STRING("Skipped to next declaration."));      OUTPUT_ERROR();    }    // Not a declaration...    UngetToken();    return PR_FALSE;  }  // Map property name to it's ID and then parse the property  nsCSSProperty propID = nsCSSProps::LookupProperty(propertyName);  if (eCSSProperty_UNKNOWN == propID) { // unknown property    REPORT_UNEXPECTED(NS_LITERAL_STRING("Unknown property '") +                       propertyName +                       NS_LITERAL_STRING("'.  Declaration dropped."));    OUTPUT_ERROR();    return PR_FALSE;  }  if (! ParseProperty(aErrorCode, aDeclaration, propID, aChangeHint)) {    // XXX Much better to put stuff in the value parsers instead...    REPORT_UNEXPECTED(      NS_LITERAL_STRING("Error in parsing value for property '") +      propertyName +      NS_LITERAL_STRING("'.  Declaration dropped."));    OUTPUT_ERROR();    return PR_FALSE;  }  CLEAR_ERROR();  // See if the declaration is followed by a "!important" declaration  PRBool isImportant = PR_FALSE;  if (!GetToken(aErrorCode, PR_TRUE)) {    if (aCheckForBraces) {      // Premature eof is not ok when proper termination is mandated      REPORT_UNEXPECTED_EOF(NS_LITERAL_STRING("end of declaration"));      return PR_FALSE;    }    return PR_TRUE;  }  else {    if (eCSSToken_Symbol == tk->mType) {      if ('!' == tk->mSymbol) {        // Look for important ident        if (!GetToken(aErrorCode, PR_TRUE)) {          // Premature eof is not ok          REPORT_UNEXPECTED_EOF(NS_LITERAL_STRING("important"));          return PR_FALSE;        }        if ((eCSSToken_Ident != tk->mType) ||            !tk->mIdent.EqualsIgnoreCase("important")) {          REPORT_UNEXPECTED_TOKEN(            NS_LITERAL_STRING("Expected 'important' but found"));          OUTPUT_ERROR();          UngetToken();          return PR_FALSE;        }        isImportant = PR_TRUE;      }      else {        // Not a !important declaration        UngetToken();      }    }    else {      // Not a !important declaration      UngetToken();    }  }  if (PR_TRUE == isImportant) {    aDeclaration->SetValueImportant(propID);  }  // Make sure valid property declaration is terminated with either a  // semicolon or a right-curly-brace (when aCheckForBraces is true).  // When aCheckForBraces is false, proper termination is either  // semicolon or EOF.  if (!GetToken(aErrorCode, PR_TRUE)) {    if (aCheckForBraces) {      // Premature eof is not ok      REPORT_UNEXPECTED_EOF(NS_LITERAL_STRING("';' or '}' to end declaration"));      return PR_FALSE;    }    return PR_TRUE;  }   if (eCSSToken_Symbol == tk->mType) {    if (';' == tk->mSymbol) {      return PR_TRUE;    }    if (!aCheckForBraces) {      // If we didn't hit eof and we didn't see a semicolon then the      // declaration is not properly terminated.      REPORT_UNEXPECTED_TOKEN(        NS_LITERAL_STRING("Expected ';' to terminate declaration but found"));      REPORT_UNEXPECTED(NS_LITERAL_STRING("Declaration dropped."));      OUTPUT_ERROR();      return PR_FALSE;    }    if ('}' == tk->mSymbol) {      UngetToken();      return PR_TRUE;    }  }  REPORT_UNEXPECTED_TOKEN(    aCheckForBraces      ? NS_LITERAL_STRING("Expected ';' or '}' to terminate declaration but found")      : NS_LITERAL_STRING("Expected ';' to terminate declaration but found"));  REPORT_UNEXPECTED(NS_LITERAL_STRING("Declaration dropped."));  OUTPUT_ERROR();  return PR_FALSE;}