if (mContent) { nsCOMPtr<nsICSSStyleRule> cssRule; mContent->GetInlineStyleRule(getter_AddRefs(cssRule)); if (cssRule) { *aDecl = cssRule->GetDeclaration();
if (nsnull != mContent) { mContent->GetHTMLAttribute(nsHTMLAtoms::style, val); if (eHTMLUnit_ISupports == val.GetUnit()) { rule = (nsIStyleRule*) val.GetISupportsValue(); result = rule->QueryInterface(kICSSStyleRuleIID, (void**)&cssRule); if (NS_OK == result) { *aDecl = cssRule->GetDeclaration(); NS_RELEASE(cssRule); } NS_RELEASE(rule);
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;      }      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;}