nsReflowType reflowType; command->GetType(reflowType);  switch (reflowType) {
switch (command->Type()) {
CanvasFrame::Reflow(nsPresContext*          aPresContext,                    nsHTMLReflowMetrics&     aDesiredSize,                    const nsHTMLReflowState& aReflowState,                    nsReflowStatus&          aStatus){  DO_GLOBAL_REFLOW_COUNT("CanvasFrame", aReflowState.reason);  DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);  NS_FRAME_TRACE_REFLOW_IN("CanvasFrame::Reflow");  //NS_PRECONDITION(!aDesiredSize.mComputeMEW, "unexpected request");  // Initialize OUT parameter  aStatus = NS_FRAME_COMPLETE;  PRBool  isStyleChange = PR_FALSE;  PRBool  isDirtyChildReflow = PR_FALSE;  // Check for an incremental reflow  if (eReflowReason_Incremental == aReflowState.reason) {    // See if we're the target frame    nsHTMLReflowCommand *command = aReflowState.path->mReflowCommand;    if (command) {      // Get the reflow type      nsReflowType reflowType;      command->GetType(reflowType);      switch (reflowType) {      case eReflowType_ReflowDirty:        isDirtyChildReflow = PR_TRUE;        break;      case eReflowType_StyleChanged:        // Remember it's a style change so we can set the reflow reason below        isStyleChange = PR_TRUE;        break;      default:        NS_ASSERTION(PR_FALSE, "unexpected reflow command type");      }    }    else {#ifdef DEBUG      nsReflowPath::iterator iter = aReflowState.path->FirstChild();      NS_ASSERTION(*iter == mFrames.FirstChild(), "unexpected next reflow command frame");#endif    }  }  // Reflow our one and only child frame  nsHTMLReflowMetrics kidDesiredSize(nsnull);  if (mFrames.IsEmpty()) {    // We have no child frame, so return an empty size    aDesiredSize.width = aDesiredSize.height = 0;    aDesiredSize.ascent = aDesiredSize.descent = 0;  } else {    nsIFrame* kidFrame = mFrames.FirstChild();    nsReflowReason reason;    if (isDirtyChildReflow) {      // Note: the only reason the frame would be dirty would be if it had      // just been inserted or appended      reason = eReflowReason_Initial;    } else if (isStyleChange) {      reason = eReflowReason_StyleChange;    } else {      reason = aReflowState.reason;    }    // We must specify an unconstrained available height, because constrained    // is only for when we're paginated...    nsHTMLReflowState kidReflowState(aPresContext, aReflowState, kidFrame,                                     nsSize(aReflowState.availableWidth,                                            NS_UNCONSTRAINEDSIZE),                                     reason);    // Reflow the frame    ReflowChild(kidFrame, aPresContext, kidDesiredSize, kidReflowState,                kidReflowState.mComputedMargin.left, kidReflowState.mComputedMargin.top,                0, aStatus);    // Complete the reflow and position and size the child frame    FinishReflowChild(kidFrame, aPresContext, &kidReflowState, kidDesiredSize,                      kidReflowState.mComputedMargin.left,                      kidReflowState.mComputedMargin.top, 0);    // If the child frame was just inserted, then we're responsible for making sure    // it repaints    if (isDirtyChildReflow) {      // But we have a new child, which will affect our background, so      // invalidate our whole rect.      // Note: Even though we request to be sized to our child's size, our      // scroll frame ensures that we are always the size of the viewport.      // Also note: GetPosition() on a CanvasFrame is always going to return      // (0, 0). We only want to invalidate GetRect() since GetOverflowRect()      // could also include overflow to our top and left (out of the viewport)      // which doesn't need to be painted.      Invalidate(GetRect(), PR_FALSE);    }    // Return our desired size    // First check the combined area    if (NS_FRAME_OUTSIDE_CHILDREN & kidFrame->GetStateBits()) {      // Size ourselves to the size of the overflow area      // XXXbz this ignores overflow up and left      aDesiredSize.width = kidReflowState.mComputedMargin.left +        PR_MAX(kidDesiredSize.mOverflowArea.XMost(),               kidDesiredSize.width + kidReflowState.mComputedMargin.right);      aDesiredSize.height = kidReflowState.mComputedMargin.top +        PR_MAX(kidDesiredSize.mOverflowArea.YMost(),               kidDesiredSize.height + kidReflowState.mComputedMargin.bottom);    } else {      aDesiredSize.width = kidDesiredSize.width +        kidReflowState.mComputedMargin.left +        kidReflowState.mComputedMargin.right;      aDesiredSize.height = kidDesiredSize.height +        kidReflowState.mComputedMargin.top +        kidReflowState.mComputedMargin.bottom;    }    aDesiredSize.ascent = aDesiredSize.height;    aDesiredSize.descent = 0;    // XXX Don't completely ignore NS_FRAME_OUTSIDE_CHILDREN for child frames    // that stick out on the left or top edges...  }  NS_FRAME_TRACE_REFLOW_OUT("CanvasFrame::Reflow", aStatus);  NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);  return NS_OK;}