nsCOMPtr<nsIPrintPreviewContext> thePrintPreviewContext = do_QueryInterface(aPresContext); if  (thePrintPreviewContext) { nsCOMPtr<nsIWidget> widget; rv = CreateViewAndWidget(aPresContext, getter_AddRefs(widget)); if (NS_FAILED(rv)) {
nsCOMPtr<nsIPresShell> shell; aPresContext->GetShell(getter_AddRefs(shell)); nsIFrame* firstChild = new (shell.get()) nsHTMLFrameInnerFrame; if (firstChild) { mFrames.SetFrames(firstChild);  nsresult rv = NS_OK; nsIStyleContext *innerStyleContext = nsnull; rv = aPresContext->ResolveStyleContextFor(mContent, mStyleContext, PR_FALSE, &innerStyleContext); if (NS_SUCCEEDED(rv)) { rv = firstChild->Init(aPresContext, mContent, this, innerStyleContext, nsnull);  NS_RELEASE(innerStyleContext); } else { NS_WARNING( "Error resolving style for InnerFrame in nsHTMLFrameOuterFrame"); } if (NS_FAILED(rv)){ NS_WARNING( "Error initializing InnerFrame in nsHTMLFrameOuterFrame");
nsHTMLFrameInnerFrame::Init(nsIPresContext*  aPresContext,                            nsIContent*      aContent,                            nsIFrame*        aParent,                            nsIStyleContext* aContext,                            nsIFrame*        aPrevInFlow){  nsresult rv = nsLeafFrame::Init(aPresContext, aContent, aParent, aContext, aPrevInFlow);  if (NS_FAILED(rv))    return rv;  // determine if we are a printcontext  PRBool shouldCreateDoc = PR_TRUE;  nsCOMPtr<nsIPrintContext> thePrinterContext = do_QueryInterface(aPresContext);  if  (thePrinterContext) {    // we are printing    shouldCreateDoc = PR_FALSE;  }  // for print preview we want to create the view and widget but   // we do not want to load the document, it is alerady loaded.  nsCOMPtr<nsIPrintPreviewContext> thePrintPreviewContext = do_QueryInterface(aPresContext);  if  (thePrintPreviewContext) {    nsCOMPtr<nsIWidget> widget;    rv = CreateViewAndWidget(aPresContext, getter_AddRefs(widget));    if (NS_FAILED(rv)) {      return rv;    }    // we are in PrintPreview    shouldCreateDoc = PR_FALSE;  }    if (!mCreatingViewer && shouldCreateDoc) {    // create the web shell    // we do this even if the size is not positive (bug 11762)    // we do this even if there is no src (bug 16218)    if (!mSubShell)      rv = CreateDocShell(aPresContext);    // Whether or not we had to create a webshell, load the document    if (NS_SUCCEEDED(rv)) {      DoLoadURL(aPresContext);    }  }  return NS_OK;}