aPresContext->GetTwipsToPixels(&t2p);
t2p = aPresContext->TwipsToPixels();
nsSubDocumentFrame::Reflow(nsIPresContext*          aPresContext,                           nsHTMLReflowMetrics&     aDesiredSize,                           const nsHTMLReflowState& aReflowState,                           nsReflowStatus&          aStatus){  DO_GLOBAL_REFLOW_COUNT("nsSubDocumentFrame", aReflowState.reason);  DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);  // printf("OuterFrame::Reflow %X (%d,%d) \n", this, aReflowState.availableWidth, aReflowState.availableHeight);  NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,     ("enter nsSubDocumentFrame::Reflow: maxSize=%d,%d reason=%d",      aReflowState.availableWidth, aReflowState.availableHeight, aReflowState.reason));  aStatus = NS_FRAME_COMPLETE;  if (IsInline()) {    GetDesiredSize(aPresContext, aReflowState, aDesiredSize); // IFRAME  } else {    aDesiredSize.width  = aReflowState.availableWidth; // FRAME    aDesiredSize.height = aReflowState.availableHeight;  }  nsSize innerSize(aDesiredSize.width, aDesiredSize.height);  nsPoint offset(0,0);  nsMargin border = aReflowState.mComputedBorderPadding;  if (IsInline()) {    offset.x = border.left;    offset.y = border.top;    // 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;  }    // might not have an inner view yet during printing  if (mInnerView) {    nsIViewManager* vm = mInnerView->GetViewManager();    vm->MoveViewTo(mInnerView, offset.x, offset.y);    vm->ResizeView(mInnerView, nsRect(0, 0, innerSize.width, innerSize.height), PR_TRUE);  }  if (aDesiredSize.mComputeMEW) {    aDesiredSize.mMaxElementWidth = aDesiredSize.width;  }  // Determine if we need to repaint our border, background or outline  CheckInvalidateSizeChange(aPresContext, aDesiredSize, aReflowState);  {    // Invalidate the frame    nsRect frameRect = GetRect();    nsRect rect(0, 0, frameRect.width, frameRect.height);    if (!rect.IsEmpty()) {      Invalidate(aPresContext, rect, PR_FALSE);    }  }  PRBool isPaginated;  aPresContext->IsPaginated(&isPaginated);  if (!isPaginated) {    nsCOMPtr<nsIDocShell> docShell;    GetDocShell(getter_AddRefs(docShell));    nsCOMPtr<nsIBaseWindow> baseWindow(do_QueryInterface(docShell));    // resize the sub document    if (baseWindow) {      float t2p;      aPresContext->GetTwipsToPixels(&t2p);      PRInt32 x = 0;      PRInt32 y = 0;            baseWindow->GetPositionAndSize(&x, &y, nsnull, nsnull);      PRInt32 cx = NSToCoordRound(innerSize.width * t2p);      PRInt32 cy = NSToCoordRound(innerSize.height * t2p);      baseWindow->SetPositionAndSize(x, y, cx, cy, PR_FALSE);    }  }  // printf("OuterFrame::Reflow DONE %X (%d,%d), MEW=%d(%d)\n", this,  //        aDesiredSize.width, aDesiredSize.height, aDesiredSize.mMaxElementWidth,  //        aDesiredSize.mComputeMEW);  NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,     ("exit nsSubDocumentFrame::Reflow: size=%d,%d status=%x",      aDesiredSize.width, aDesiredSize.height, aStatus));  NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);  return NS_OK;}