nsDOMCSSAttributeDeclaration::ParseDeclaration(const nsString& aDecl,
nsDOMCSSAttributeDeclaration::ParseDeclaration(const nsAReadableString& aDecl,
nsDOMCSSAttributeDeclaration::ParseDeclaration(const nsString& aDecl,                                               PRBool aParseOnlyOneDecl,                                               PRBool aClearOldDecl){  nsICSSDeclaration *decl;  nsresult result = GetCSSDeclaration(&decl, PR_TRUE);  if (NS_SUCCEEDED(result) && (decl)) {    nsICSSLoader* cssLoader = nsnull;    nsICSSParser* cssParser = nsnull;    nsIURI* baseURI = nsnull;    nsIDocument*  doc = nsnull;    result = mContent->GetDocument(doc);    if (NS_SUCCEEDED(result) && (nsnull != doc)) {      doc->GetBaseURL(baseURI);      nsIHTMLContentContainer* htmlContainer;      result = doc->QueryInterface(kIHTMLContentContainerIID, (void**)&htmlContainer);      if (NS_SUCCEEDED(result)) {        result = htmlContainer->GetCSSLoader(cssLoader);        NS_RELEASE(htmlContainer);      }    }    if (cssLoader) {      result = cssLoader->GetParserFor(nsnull, &cssParser);    }    else {      result = NS_NewCSSParser(&cssParser);    }    if (NS_SUCCEEDED(result)) {      PRInt32 hint;      if (doc) {        doc->BeginUpdate();      }      nsCOMPtr<nsICSSDeclaration> declClone;      decl->Clone(*getter_AddRefs(declClone));      if (aClearOldDecl) {        // This should be done with decl->Clear() once such a method exists.        nsAutoString propName;        PRUint32 count, i;        decl->Count(&count);        for (i = 0; i < count; i++) {          decl->GetNthProperty(0, propName);          nsCSSProperty prop = nsCSSProps::LookupProperty(propName);          nsCSSValue val;          decl->RemoveProperty(prop, val);        }      }      result = cssParser->ParseAndAppendDeclaration(aDecl, baseURI, decl,                                                    aParseOnlyOneDecl, &hint);      if (result == NS_CSS_PARSER_DROP_DECLARATION) {        SetCSSDeclaration(declClone);        result = NS_OK;      }      if (doc) {        if (NS_SUCCEEDED(result) && result != NS_CSS_PARSER_DROP_DECLARATION) {          doc->AttributeChanged(mContent, kNameSpaceID_None, nsHTMLAtoms::style, hint);        }        doc->EndUpdate();      }      if (cssLoader) {        cssLoader->RecycleParser(cssParser);      }      else {        NS_RELEASE(cssParser);      }    }    NS_IF_RELEASE(cssLoader);    NS_IF_RELEASE(baseURI);