sheet->QueryInterface(kICSSStyleSheetIID, (void**)&cssSheet);
sheet->QueryInterface(NS_GET_IID(nsICSSStyleSheet), (void**)&cssSheet);
DOMCSSDeclarationImpl::ParseDeclaration(const nsAReadableString& 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;    nsICSSStyleSheet* cssSheet = nsnull;    nsIDocument*  owningDoc = nsnull;    nsIStyleSheet* sheet = nsnull;    if (mRule) {      mRule->GetStyleSheet(sheet);      if (sheet) {        sheet->GetURL(baseURI);        sheet->GetOwningDocument(owningDoc);        sheet->QueryInterface(kICSSStyleSheetIID, (void**)&cssSheet);        if (owningDoc) {          nsIHTMLContentContainer* htmlContainer;          result = owningDoc->QueryInterface(kIHTMLContentContainerIID, (void**)&htmlContainer);          if (NS_SUCCEEDED(result)) {            result = htmlContainer->GetCSSLoader(cssLoader);            NS_RELEASE(htmlContainer);          }        }        NS_RELEASE(sheet);      }    }    if (cssLoader) {      result = cssLoader->GetParserFor(nsnull, &cssParser);    }    else {      result = NS_NewCSSParser(&cssParser);    }    if (NS_SUCCEEDED(result)) {      nsCOMPtr<nsICSSDeclaration> declClone;      decl->Clone(*getter_AddRefs(declClone));      NS_ENSURE_TRUE(declClone, NS_ERROR_OUT_OF_MEMORY);      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);        }      }      PRInt32 hint;      result = cssParser->ParseAndAppendDeclaration(aDecl, baseURI, decl,                                                    aParseOnlyOneDecl, &hint);      if (result == NS_CSS_PARSER_DROP_DECLARATION) {        SetCSSDeclaration(declClone);        result = NS_OK;      } else if (NS_SUCCEEDED(result)) {        if (cssSheet) {          cssSheet->SetModified(PR_TRUE);        }        if (owningDoc) {          owningDoc->StyleRuleChanged(cssSheet, mRule, hint);        }      }      if (cssLoader) {        cssLoader->RecycleParser(cssParser);      }      else {        NS_RELEASE(cssParser);      }    }    NS_IF_RELEASE(cssLoader);    NS_IF_RELEASE(baseURI);    NS_IF_RELEASE(cssSheet);    NS_IF_RELEASE(owningDoc);    NS_RELEASE(decl);  }  return result;}