Make nsBoundingMetrics::operator+= handle empty bounds.

b=410132, r+sr+a=roc


git-svn-id: svn://10.0.0.236/trunk@242279 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
karlt+%karlt.net
2008-01-03 04:32:12 +00:00
parent a19113da0c
commit 0d63ec09dc
3 changed files with 15 additions and 19 deletions

View File

@@ -129,7 +129,6 @@ nsMathMLTokenFrame::Reflow(nsPresContext* aPresContext,
aDesiredSize.mBoundingMetrics.Clear();
nsSize availSize(aReflowState.ComputedWidth(), aReflowState.ComputedHeight());
PRInt32 count = 0;
nsIFrame* childFrame = GetFirstChild(nsnull);
while (childFrame) {
// ask our children to compute their bounding metrics
@@ -146,16 +145,12 @@ nsMathMLTokenFrame::Reflow(nsPresContext* aPresContext,
return rv;
}
// origins are used as placeholders to store the child's ascent and descent.
// origins are used as placeholders to store the child's ascent.
childFrame->SetRect(nsRect(0, childDesiredSize.ascent,
childDesiredSize.width, childDesiredSize.height));
// compute and cache the bounding metrics
if (0 == count)
aDesiredSize.mBoundingMetrics = childDesiredSize.mBoundingMetrics;
else
aDesiredSize.mBoundingMetrics += childDesiredSize.mBoundingMetrics;
aDesiredSize.mBoundingMetrics += childDesiredSize.mBoundingMetrics;
count++;
childFrame = childFrame->GetNextSibling();
}

View File

@@ -287,7 +287,6 @@ nsMathMLmfencedFrame::doReflow(nsPresContext* aPresContext,
// XXX The above decision was revisited in bug 121748 and this code can be
// refactored to use nsMathMLContainerFrame::Reflow() at some stage.
PRInt32 count = 0;
nsReflowStatus childStatus;
nsSize availSize(aReflowState.ComputedWidth(), aReflowState.ComputedHeight());
nsIFrame* firstChild = aForFrame->GetFirstChild(nsnull);
@@ -325,10 +324,7 @@ nsMathMLmfencedFrame::doReflow(nsPresContext* aPresContext,
descent = childDescent;
if (ascent < childDesiredSize.ascent)
ascent = childDesiredSize.ascent;
if (0 == count++)
aDesiredSize.mBoundingMetrics = childDesiredSize.mBoundingMetrics;
else
aDesiredSize.mBoundingMetrics += childDesiredSize.mBoundingMetrics;
aDesiredSize.mBoundingMetrics += childDesiredSize.mBoundingMetrics;
childFrame = childFrame->GetNextSibling();
}