diff --git a/mozilla/gfx/public/nsIRenderingContext.h b/mozilla/gfx/public/nsIRenderingContext.h index f0edbef7042..cf4d7107823 100644 --- a/mozilla/gfx/public/nsIRenderingContext.h +++ b/mozilla/gfx/public/nsIRenderingContext.h @@ -890,15 +890,20 @@ struct nsBoundingMetrics { } /* Append another bounding metrics */ - /* Notice that leftBearing is not set. The user must set leftBearing on - initialization and (repeatedly) use this operator to append - other bounding metrics on the right. - */ void operator += (const nsBoundingMetrics& bm) { - if (ascent < bm.ascent) ascent = bm.ascent; - if (descent < bm.descent) descent = bm.descent; - rightBearing = PR_MAX(rightBearing, width + bm.rightBearing); + if (ascent + descent == 0 && rightBearing - leftBearing == 0) { + ascent = bm.ascent; + descent = bm.descent; + leftBearing = width + bm.leftBearing; + rightBearing = width + bm.rightBearing; + } + else { + if (ascent < bm.ascent) ascent = bm.ascent; + if (descent < bm.descent) descent = bm.descent; + leftBearing = PR_MIN(leftBearing, width + bm.leftBearing); + rightBearing = PR_MAX(rightBearing, width + bm.rightBearing); + } width += bm.width; } }; diff --git a/mozilla/layout/mathml/base/src/nsMathMLTokenFrame.cpp b/mozilla/layout/mathml/base/src/nsMathMLTokenFrame.cpp index 5935eb3c5b4..8bc3f470005 100644 --- a/mozilla/layout/mathml/base/src/nsMathMLTokenFrame.cpp +++ b/mozilla/layout/mathml/base/src/nsMathMLTokenFrame.cpp @@ -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(); } diff --git a/mozilla/layout/mathml/base/src/nsMathMLmfencedFrame.cpp b/mozilla/layout/mathml/base/src/nsMathMLmfencedFrame.cpp index 17b42239b57..91009c63a13 100644 --- a/mozilla/layout/mathml/base/src/nsMathMLmfencedFrame.cpp +++ b/mozilla/layout/mathml/base/src/nsMathMLmfencedFrame.cpp @@ -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(); }