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");
nsCOMPtr<nsIPrintPreviewContext> thePrintPreviewContext = do_QueryInterface(aPresContext); if  (thePrintPreviewContext) { nsCOMPtr<nsIWidget> widget; rv = CreateViewAndWidget(aPresContext, getter_AddRefs(widget)); if (NS_FAILED(rv)) {
nsHTMLFrameOuterFrame::Init(nsIPresContext*  aPresContext,                            nsIContent*      aContent,                            nsIFrame*        aParent,                            nsIStyleContext* aContext,                            nsIFrame*        aPrevInFlow){  mPresContext = aPresContext;  // determine if we are a <frame> or <iframe>  if (aContent) {    nsCOMPtr<nsIDOMHTMLFrameElement> frameElem = do_QueryInterface(aContent);    mIsInline = frameElem ? PR_FALSE : PR_TRUE;  }  nsresult rv =  nsHTMLFrameOuterFrameSuper::Init(aPresContext, aContent, aParent,                                                  aContext, aPrevInFlow);  if (NS_FAILED(rv))    return rv;  const nsStyleDisplay* disp;  aParent->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)disp));  if (disp->mDisplay == NS_STYLE_DISPLAY_DECK) {    nsIView* view = nsnull;    GetView(aPresContext, &view);    if (!view) {      nsHTMLContainerFrame::CreateViewForFrame(aPresContext,this,mStyleContext,nsnull,PR_TRUE);       GetView(aPresContext, &view);    }    nsCOMPtr<nsIWidget> widget;    view->GetWidget(*getter_AddRefs(widget));    if (!widget)      view->CreateWidget(kCChildCID);     }  nsCOMPtr<nsIPresShell> shell;  aPresContext->GetShell(getter_AddRefs(shell));  nsIFrame* firstChild = new (shell.get()) nsHTMLFrameInnerFrame;  if (firstChild) {    mFrames.SetFrames(firstChild);    // Resolve the style context for the inner frame    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);      // have to release the context: Init does its own AddRef...      NS_RELEASE(innerStyleContext);    } else {      NS_WARNING( "Error resolving style for InnerFrame in nsHTMLFrameOuterFrame");    }    if (NS_FAILED(rv)){      NS_WARNING( "Error initializing InnerFrame in nsHTMLFrameOuterFrame");      return rv;    }  } else {    NS_WARNING("no memory allocating inner frame in nsHTMLFrameOuterFrame");    return NS_ERROR_OUT_OF_MEMORY;  }  return NS_OK;}