nsGfxButtonControlFrame::CreateFrameFor(nsIPresContext*   aPresContext, nsIContent *      aContent, nsIFrame**        aFrame) { nsIFrame * newFrame = nsnull; nsresult rv = NS_ERROR_FAILURE;  if (aFrame) *aFrame = nsnull;  nsCOMPtr<nsIContent> content(do_QueryInterface(mTextContent)); if (aContent == content.get()) { nsCOMPtr<nsIPresShell> shell; aPresContext->GetShell(getter_AddRefs(shell));  nsIFrame * parentFrame = mFrames.FirstChild(); nsCOMPtr<nsIStyleContext> styleContext; parentFrame->GetStyleContext(getter_AddRefs(styleContext));  rv = NS_NewTextFrame(shell, &newFrame); if (NS_FAILED(rv)) { return rv; } if (!newFrame)   { return NS_ERROR_NULL_POINTER; } nsCOMPtr<nsIStyleContext> textStyleContext; rv = aPresContext->ResolvePseudoStyleContextFor(content, nsHTMLAtoms::textPseudo, styleContext, PR_FALSE, getter_AddRefs(textStyleContext)); if (NS_FAILED(rv))     { return rv; } if (!textStyleContext) { return NS_ERROR_NULL_POINTER; }  if (styleContext) {  newFrame->Init(aPresContext, content, parentFrame, textStyleContext, nsnull); newFrame->SetInitialChildList(aPresContext, nsnull, nsnull); rv = NS_OK; } }  if (aFrame) { *aFrame = newFrame; } return rv; }
NS_IMETHOD CreateFrameFor(nsIPresContext*   aPresContext, nsIContent *      aContent, nsIFrame**        aFrame) { if (aFrame) *aFrame = nsnull; return NS_ERROR_FAILURE; }
nsGfxButtonControlFrame::CreateFrameFor(nsIPresContext*   aPresContext,                                        nsIContent *      aContent,                                        nsIFrame**        aFrame){  nsIFrame * newFrame = nsnull;  nsresult rv = NS_ERROR_FAILURE;  if (aFrame)     *aFrame = nsnull;   nsCOMPtr<nsIContent> content(do_QueryInterface(mTextContent));  if (aContent == content.get()) {    nsCOMPtr<nsIPresShell> shell;    aPresContext->GetShell(getter_AddRefs(shell));    nsIFrame * parentFrame = mFrames.FirstChild();    nsCOMPtr<nsIStyleContext> styleContext;    parentFrame->GetStyleContext(getter_AddRefs(styleContext));    rv = NS_NewTextFrame(shell, &newFrame);    if (NS_FAILED(rv)) { return rv; }    if (!newFrame)   { return NS_ERROR_NULL_POINTER; }    nsCOMPtr<nsIStyleContext> textStyleContext;    rv = aPresContext->ResolvePseudoStyleContextFor(content,                                                     nsHTMLAtoms::textPseudo,                                                    styleContext,                                                    PR_FALSE,                                                    getter_AddRefs(textStyleContext));    if (NS_FAILED(rv))     { return rv; }    if (!textStyleContext) { return NS_ERROR_NULL_POINTER; }    if (styleContext) {      // initialize the text frame      newFrame->Init(aPresContext, content, parentFrame, textStyleContext, nsnull);      newFrame->SetInitialChildList(aPresContext, nsnull, nsnull);      rv = NS_OK;    }  }  if (aFrame) {    *aFrame = newFrame;  }  return rv;}