if (NS_CONTENT_ATTR_NOT_THERE == GetAttr(kNameSpaceID_None, nsHTMLAtoms::bgcolor, aBgColor)) { nsresult result = NS_OK;
if (rv == NS_CONTENT_ATTR_NOT_THERE) {
nsHTMLBodyElement::GetBgColor(nsAString& aBgColor){  // If we don't have an attribute, find the actual color used for  // (generally from the user agent style sheet) for compatibility  if (NS_CONTENT_ATTR_NOT_THERE == GetAttr(kNameSpaceID_None, nsHTMLAtoms::bgcolor, aBgColor)) {    nsresult result = NS_OK;    if (mDocument) {      // Make sure the presentation is up-to-date      result = mDocument->FlushPendingNotifications();      if (NS_FAILED(result)) {        return result;      }    }    nsCOMPtr<nsIPresContext> context;    result = GetPresContext(this, getter_AddRefs(context));    if (NS_FAILED(result)) {      return result;    }        nsCOMPtr<nsIPresShell> shell;    result = context->GetShell(getter_AddRefs(shell));    if (NS_FAILED(result)) {      return result;    }        nsIFrame* frame;    result = shell->GetPrimaryFrameFor(this, &frame);    if (NS_FAILED(result)) {      return result;    }    if (frame) {      const nsStyleBackground* StyleBackground;      result = frame->GetStyleData(eStyleStruct_Background,                                   (const nsStyleStruct*&)StyleBackground);      if (NS_FAILED(result)) {        return result;      }      nsHTMLValue value(StyleBackground->mBackgroundColor);      ColorToString(value, aBgColor);    }  }  return NS_OK;}