case eReflowReason_Initial: needsReflow = PR_TRUE; break;
nsGfxScrollFrameInner::ReflowFrame(    nsIPresContext*          aPresContext,                               nsHTMLReflowMetrics&     aDesiredSize,                               const nsHTMLReflowState& aReflowState,                               nsReflowStatus&          aStatus,                               nsIFrame*                aFrame,                               const nsSize&            aAvailable,                               const nsSize&            aComputed,                               PRBool&                  aResized,                               nsIFrame*&               aIncrementalChild){      PRBool needsReflow = PR_FALSE;      nsReflowReason reason = aReflowState.reason;      switch(reason)      {         case eReflowReason_Incremental:             if (aIncrementalChild == aFrame) {               needsReflow = PR_TRUE;               aIncrementalChild = nsnull;             } else {               reason = eReflowReason_Resize;               needsReflow = PR_FALSE;             }         break;                  // if its dirty then see if the child we want to reflow is dirty. If it is then         // mark it as needing to be reflowed.         case eReflowReason_Dirty:              // get the frame state to see if it needs reflow              nsFrameState state;              aFrame->GetFrameState(&state);              needsReflow = (state & NS_FRAME_IS_DIRTY) || (state & NS_FRAME_HAS_DIRTY_CHILDREN);         break;         // if the a resize reflow then it doesn't need to be reflowed. Only if the size is different         // from the new size would we actually do a reflow         case eReflowReason_Resize:             needsReflow = PR_FALSE;         break;         default:             needsReflow = PR_TRUE;                   }    nsSize currentSize;    GetFrameSize(aFrame, currentSize);    // if we do not need reflow then    // see if the size it what we already want. If it is then we are done.    if (!needsReflow) {        // get the current size        // if the size is not changing and the frame is not dirty then there        // is nothing to do.        if (currentSize.width == aComputed.width && currentSize.height == aComputed.height) {            aDesiredSize.width = currentSize.width;            aDesiredSize.height = currentSize.height;            return NS_OK;        }    }    aDesiredSize.width = 0;    aDesiredSize.height = 0;    nsHTMLReflowState childReflowState(aPresContext, aReflowState,                                           aFrame, aAvailable);    childReflowState.reason = reason;    childReflowState.mComputedWidth =  aComputed.width;    childReflowState.mComputedHeight = aComputed.height;    // subtract out the childs margin and border if computed    const nsStyleSpacing* spacing;    nsresult rv = aFrame->GetStyleData(eStyleStruct_Spacing,                   (const nsStyleStruct*&) spacing);    NS_ASSERTION(NS_SUCCEEDED(rv), "failed to get spacing");    if (NS_FAILED(rv))        return rv;    // get the margin    nsMargin margin(0,0,0,0);    spacing->GetMargin(margin);        // subtract out the border and padding    if (childReflowState.mComputedWidth != NS_INTRINSICSIZE) {       childReflowState.mComputedWidth -= childReflowState.mComputedBorderPadding.left + childReflowState.mComputedBorderPadding.right;       childReflowState.mComputedWidth -= margin.left + margin.right;       if (childReflowState.mComputedWidth < 0)           childReflowState.mComputedWidth = 0;    }    if (childReflowState.mComputedHeight != NS_INTRINSICSIZE) {       childReflowState.mComputedHeight -= childReflowState.mComputedBorderPadding.top + childReflowState.mComputedBorderPadding.bottom;       childReflowState.mComputedWidth -= margin.top + margin.bottom;       if (childReflowState.mComputedHeight < 0)           childReflowState.mComputedHeight = 0;    }         mOuter->ReflowChild(aFrame, aPresContext, aDesiredSize, childReflowState,                        0, 0, NS_FRAME_NO_MOVE_FRAME, aStatus);    NS_ASSERTION(NS_FRAME_IS_COMPLETE(aStatus), "bad status");    NS_ASSERTION(aDesiredSize.width >= 0 && aDesiredSize.height >= 0,"Error child's size is less than 0!");    // if the frame size change then mark the flag    if (currentSize.width != aDesiredSize.width || currentSize.height != aDesiredSize.height) {       aFrame->SizeTo(aPresContext, aDesiredSize.width, aDesiredSize.height);       aResized = PR_TRUE;    }    aFrame->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED);    // add the margin back in    aDesiredSize.width += margin.left + margin.right;    aDesiredSize.height += margin.top + margin.bottom;    return NS_OK;}