if (IsInline()) { GetDesiredSize(aPresContext, aReflowState, aDesiredSize); } else { aDesiredSize.width  = aReflowState.availableWidth; aDesiredSize.height = aReflowState.availableHeight;
nsresult rv = NS_OK;   if (!mCreatingViewer) { nsCOMPtr<nsIContent> content; GetParentContent(*getter_AddRefs(content));  nsAutoString url; PRBool hasURL = GetURL(content, url);     if (!mSubShell) { nsSize  maxSize(aReflowState.availableWidth, aReflowState.availableHeight); rv = CreateDocShell(aPresContext, maxSize); #ifdef INCLUDE_XUL   hasURL = GetURL(content, url); #endif }  if (mSubShell) { mCreatingViewer=PR_TRUE; if (hasURL) {  nsString absURL; TempMakeAbsURL(content, url, absURL);   nsCOMPtr<nsIURI> baseURI, newURI; NS_WITH_SERVICE(nsIScriptSecurityManager, securityManager, NS_SCRIPTSECURITYMANAGER_PROGID, &rv); if (NS_SUCCEEDED(rv)) rv = aPresContext->GetBaseURL(getter_AddRefs(baseURI)); if (NS_SUCCEEDED(rv)) rv = NS_NewURI(getter_AddRefs(newURI), absURL, baseURI); if (NS_SUCCEEDED(rv)) rv = securityManager->CheckLoadURI(baseURI, newURI, PR_FALSE);  if (NS_SUCCEEDED(rv)) { nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(mSubShell)); NS_ENSURE_TRUE(webNav, NS_ERROR_FAILURE); webNav->LoadURI(absURL.GetUnicode()); } } }
nsHTMLFrameOuterFrame::Reflow(nsIPresContext*          aPresContext,                              nsHTMLReflowMetrics&     aDesiredSize,                              const nsHTMLReflowState& aReflowState,                              nsReflowStatus&          aStatus){  //printf("OuterFrame::Reflow %X (%d,%d) \n", this, aReflowState.availableWidth, aReflowState.availableHeight);   NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,     ("enter nsHTMLFrameOuterFrame::Reflow: maxSize=%d,%d reason=%d",      aReflowState.availableWidth, aReflowState.availableHeight, aReflowState.reason));  if (IsInline()) {    GetDesiredSize(aPresContext, aReflowState, aDesiredSize);  } else {    aDesiredSize.width  = aReflowState.availableWidth;    aDesiredSize.height = aReflowState.availableHeight;  }  nsIFrame* firstChild = mFrames.FirstChild();  if (nsnull == firstChild) {    nsCOMPtr<nsIPresShell> shell;    aPresContext->GetShell(getter_AddRefs(shell));    firstChild = new (shell.get()) nsHTMLFrameInnerFrame;    mFrames.SetFrames(firstChild);    // XXX temporary! use style system to get correct style!    firstChild->Init(aPresContext, mContent, this, mStyleContext, nsnull);  }   nsSize innerSize(aDesiredSize.width, aDesiredSize.height);  nsPoint offset(0,0);  if (IsInline() && HasBorder()) {    const nsStyleSpacing* spacing =      (const nsStyleSpacing*)mStyleContext->GetStyleData(eStyleStruct_Spacing);    nsMargin border;    spacing->CalcBorderFor(this, border);    offset.x = border.left;    offset.y = border.right;    // XXX Don't subtract the border!!! The size we are given does not include our    // border! -EDV    //innerSize.width  -= border.left + border.right;    //innerSize.height -= border.top  + border.bottom;    // we now need to add our border in. -EDV    aDesiredSize.width += border.left + border.right;    aDesiredSize.height += border.top + border.bottom;  }  // Reflow the child and get its desired size  nsHTMLReflowMetrics kidMetrics(aDesiredSize.maxElementSize);  nsHTMLReflowState   kidReflowState(aPresContext, aReflowState, firstChild,                                     innerSize);  ReflowChild(firstChild, aPresContext, kidMetrics, kidReflowState,              offset.x, offset.y, 0, aStatus);  NS_ASSERTION(NS_FRAME_IS_COMPLETE(aStatus), "bad status");    // Place and size the child  FinishReflowChild(firstChild, aPresContext, kidMetrics, offset.x, offset.y, 0);  // XXX what should the max-element-size of an iframe be? Shouldn't  // iframe's normally shrink wrap around their content when they  // don't have a specified width/height?  if (nsnull != aDesiredSize.maxElementSize) {    aDesiredSize.maxElementSize->width = aDesiredSize.width;    aDesiredSize.maxElementSize->height = aDesiredSize.height;  }  NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,     ("exit nsHTMLFrameOuterFrame::Reflow: size=%d,%d status=%x",      aDesiredSize.width, aDesiredSize.height, aStatus));  return NS_OK;}