nsresult nsLeafFrame::DoReflow(nsPresContext* aPresContext, nsHTMLReflowMetrics& aMetrics, const nsHTMLReflowState& aReflowState, nsReflowStatus& aStatus) { NS_ASSERTION(aReflowState.ComputedWidth() != NS_UNCONSTRAINEDSIZE, "Shouldn't have unconstrained stuff here " "Thanks to the rules of reflow"); NS_ASSERTION(NS_INTRINSICSIZE != aReflowState.ComputedHeight(), "Shouldn't have unconstrained stuff here " "thanks to ComputeAutoSize"); aMetrics.Width() = aReflowState.ComputedWidth(); aMetrics.Height() = aReflowState.ComputedHeight(); AddBordersAndPadding(aReflowState, aMetrics); aStatus = NS_FRAME_COMPLETE; NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS, ("exit nsLeafFrame::DoReflow: size=%d,%d", aMetrics.Width(), aMetrics.Height())); NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aMetrics); aMetrics.SetOverflowAreasToDesiredBounds(); return NS_OK; }
NS_IMETHODIMP nsLeafFrame::Reflow(nsPresContext* aPresContext, nsHTMLReflowMetrics& aMetrics, const nsHTMLReflowState& aReflowState, nsReflowStatus& aStatus) { DO_GLOBAL_REFLOW_COUNT("nsLeafFrame", aReflowState.reason); NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS, ("enter nsLeafFrame::Reflow: aMaxSize=%d,%d", aReflowState.availableWidth, aReflowState.availableHeight)); NS_PRECONDITION(mState & NS_FRAME_IN_REFLOW, "frame is not in reflow"); // XXX add in code to check for width/height being set via css // and if set use them instead of calling GetDesiredSize. GetDesiredSize(aPresContext, aReflowState, aMetrics); nsMargin borderPadding; AddBordersAndPadding(aPresContext, aReflowState, aMetrics, borderPadding); if (aMetrics.mComputeMEW) { aMetrics.SetMEWToActualWidth(aReflowState.mStylePosition->mWidth.GetUnit()); } aStatus = NS_FRAME_COMPLETE; NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS, ("exit nsLeafFrame::Reflow: size=%d,%d", aMetrics.width, aMetrics.height)); NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aMetrics); return NS_OK; }