else if (aAllocate) { nsCSSDeclaration *decl = new nsCSSDeclaration(); if (!decl) return NS_ERROR_OUT_OF_MEMORY; if (!decl->InitializeEmpty()) { decl->RuleAbort(); return NS_ERROR_OUT_OF_MEMORY; }  nsCOMPtr<nsICSSStyleRule> cssRule; result = NS_NewCSSStyleRule(getter_AddRefs(cssRule), nsnull, decl); if (NS_FAILED(result)) { decl->RuleAbort(); return result; }  result = mContent->SetInlineStyleRule(cssRule, PR_FALSE); if (NS_SUCCEEDED(result)) { *aDecl = decl;
else if (PR_TRUE == aAllocate) { result = NS_NewCSSDeclaration(aDecl); if (NS_OK == result) { result = NS_NewCSSStyleRule(&cssRule, nsCSSSelector()); if (NS_OK == result) { cssRule->SetDeclaration(*aDecl); cssRule->SetWeight(0x7fffffff); rule = (nsIStyleRule *)cssRule; result = mContent->SetHTMLAttribute(nsHTMLAtoms::style, nsHTMLValue(cssRule), PR_FALSE); NS_RELEASE(cssRule); } else { NS_RELEASE(*aDecl); }
nsDOMCSSAttributeDeclaration::GetCSSDeclaration(nsCSSDeclaration **aDecl,                                                PRBool aAllocate){  nsresult result = NS_OK;  *aDecl = nsnull;  if (mContent) {    nsCOMPtr<nsICSSStyleRule> cssRule;    mContent->GetInlineStyleRule(getter_AddRefs(cssRule));    if (cssRule) {      *aDecl = cssRule->GetDeclaration();    }    else if (aAllocate) {      nsCSSDeclaration *decl = new nsCSSDeclaration();      if (!decl)        return NS_ERROR_OUT_OF_MEMORY;      if (!decl->InitializeEmpty()) {        decl->RuleAbort();        return NS_ERROR_OUT_OF_MEMORY;      }      nsCOMPtr<nsICSSStyleRule> cssRule;      result = NS_NewCSSStyleRule(getter_AddRefs(cssRule), nsnull, decl);      if (NS_FAILED(result)) {        decl->RuleAbort();        return result;      }              result = mContent->SetInlineStyleRule(cssRule, PR_FALSE);      if (NS_SUCCEEDED(result)) {        *aDecl = decl;      }    }  }  return result;}