PRBool shouldCreateDoc = PR_TRUE; nsCOMPtr<nsIPrintContext> thePrinterContext(do_QueryInterface(aPresContext));
nsIView* view = nsnull; GetView(aPresContext, &view); if (!view) {       nsCOMPtr<nsIAtom> contentParentAtom = do_GetAtom("contentParent"); nsIFrame* contentParent = nsnull; nsCOMPtr<nsIPresShell> presShell; aPresContext->GetShell(getter_AddRefs(presShell));
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 (shouldCreateDoc) {    ShowDocShell(aPresContext);  }  return NS_OK;}