nsIFrame* nextFrame;
ViewportFrame::Reflow(nsIPresContext&          aPresContext,                      nsHTMLReflowMetrics&     aDesiredSize,                      const nsHTMLReflowState& aReflowState,                      nsReflowStatus&          aStatus){  NS_FRAME_TRACE_REFLOW_IN("ViewportFrame::Reflow");  NS_PRECONDITION(nsnull == aDesiredSize.maxElementSize, "unexpected request");  // Initialize OUT parameter  aStatus = NS_FRAME_COMPLETE;  // Check for an incremental reflow  if (eReflowReason_Incremental == aReflowState.reason) {    // See if we're the target frame    nsIFrame* targetFrame;    aReflowState.reflowCommand->GetTarget(targetFrame);    if (this == targetFrame) {      // The viewport does not support being the target of an incremental      // reflow command      NS_ASSERTION(PR_FALSE, "unexpected reflow command target");    } else {      nsIFrame* nextFrame;      // Get the next frame in the reflow chain      aReflowState.reflowCommand->GetNext(nextFrame);      NS_ASSERTION(nextFrame == mFrames.FirstChild(), "unexpected next reflow command frame");    }  }  // Reflow our one and only child frame  if (mFrames.NotEmpty()) {    nsIFrame*           kidFrame = mFrames.FirstChild();    nsHTMLReflowMetrics desiredSize(nsnull);    nsSize              availableSpace(aReflowState.availableWidth,                                       aReflowState.availableHeight);    nsHTMLReflowState   kidReflowState(aPresContext, kidFrame,                                       aReflowState, availableSpace);    // Reflow the frame    nsIHTMLReflow* htmlReflow;    if (NS_OK == kidFrame->QueryInterface(kIHTMLReflowIID, (void**)&htmlReflow)) {      kidReflowState.computedHeight = aReflowState.availableHeight;      ReflowChild(kidFrame, aPresContext, desiredSize, kidReflowState,                  aStatus);          nsRect  rect(0, 0, desiredSize.width, desiredSize.height);      kidFrame->SetRect(rect);      // XXX We should resolve the details of who/when DidReflow()      // notifications are sent...      htmlReflow->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED);    }  }  // Return the max size as our desired size  aDesiredSize.width = aReflowState.availableWidth;  aDesiredSize.height = aReflowState.availableHeight;  aDesiredSize.ascent = aReflowState.availableHeight;  aDesiredSize.descent = 0;  NS_FRAME_TRACE_REFLOW_OUT("ViewportFrame::Reflow", aStatus);  return NS_OK;}