nsRefPtr<nsStyleContext> innerStyleContext = aPresContext->ResolvePseudoStyleContextFor(aContent, nsCSSAnonBoxes::mozAnonymousBlock, mStyleContext);
nsRefPtr<nsStyleContext> innerStyleContext; innerStyleContext = aPresContext->ResolveStyleContextFor(mContent, mStyleContext);
nsHTMLFrameOuterFrame::Init(nsIPresContext*  aPresContext,                            nsIContent*      aContent,                            nsIFrame*        aParent,                            nsStyleContext*  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;  // nsHTMLFrameInnerFrame is going to create a view for its frame  // right away, in the call to Init().  If we need a view for the  // OuterFrame but we wait for the normal view creation path in  // nsCSSFrameConstructor, then we will lose because the InnerFrame's  // view's parent will already have been set to some outer view  // (e.g., the canvas) when it really needs to have the OuterFrame's  // view as its parent. So, create the OuterFrame's view right away  // if we need it, and the InnerFrame's view will get it as the parent.  if (!HasView()) {    // To properly initialize the view we need to know the frame for the content    // that is the parent of content for this frame. This might not be our actual    // frame parent if we are out of flow (e.g., positioned) so our parent frame    // may have been set to some other ancestor.    // We look for a content parent frame in the frame property list, where it    // will have been set by nsCSSFrameConstructor if necessary.    nsCOMPtr<nsIAtom> contentParentAtom = do_GetAtom("contentParent");    nsIFrame* contentParent = nsnull;    nsCOMPtr<nsIPresShell> presShell;    aPresContext->GetShell(getter_AddRefs(presShell));    if (presShell) {      nsCOMPtr<nsIFrameManager> frameManager;      presShell->GetFrameManager(getter_AddRefs(frameManager));      if (frameManager) {        void* value;        rv = frameManager->GetFrameProperty(this,                                           contentParentAtom,                                            NS_IFRAME_MGR_REMOVE_PROP,                                           &value);        if (NS_SUCCEEDED(rv)) {          contentParent = (nsIFrame*)value;        }      }    }      nsHTMLContainerFrame::CreateViewForFrame(this, contentParent, PR_TRUE);  }  nsIView* view = GetView();  if (aParent->GetStyleDisplay()->mDisplay == NS_STYLE_DISPLAY_DECK      && !view->HasWidget()) {    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;    nsRefPtr<nsStyleContext> innerStyleContext      = aPresContext->ResolvePseudoStyleContextFor(aContent,        nsCSSAnonBoxes::mozAnonymousBlock, mStyleContext);    rv = firstChild->Init(aPresContext, mContent, this, innerStyleContext, nsnull);    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;}