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); }
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->SetHTMLAttribute(nsHTMLAtoms::style, nsHTMLValue(cssRule), PR_FALSE); if (NS_SUCCEEDED(result)) { *aDecl = decl;
nsDOMCSSAttributeDeclaration::GetCSSDeclaration(nsICSSDeclaration **aDecl,                                                PRBool aAllocate){  nsHTMLValue val;  nsIStyleRule* rule;  nsICSSStyleRule*  cssRule;  nsresult result = NS_OK;  *aDecl = nsnull;  if (nsnull != mContent) {    mContent->GetHTMLAttribute(nsHTMLAtoms::style, val);    if (eHTMLUnit_ISupports == val.GetUnit()) {      rule = (nsIStyleRule*) val.GetISupportsValue();      result = rule->QueryInterface(NS_GET_IID(nsICSSStyleRule), (void**)&cssRule);      if (NS_OK == result) {        *aDecl = cssRule->GetDeclaration();        NS_RELEASE(cssRule);      }      NS_RELEASE(rule);    }    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);        }      }    }  }  return result;}