From 6fb9d09b88a996dbfd614c4ae2d729bc8f95f324 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=83=C2=A9d=C3=83=C2=A9ric=20Wang?= Date: Thu, 17 May 2012 09:37:55 -0400 Subject: [PATCH] Bug 716349 - Prevent invalid metrics for mspace. r=karlt --- layout/mathml/nsMathMLmspaceFrame.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/layout/mathml/nsMathMLmspaceFrame.cpp b/layout/mathml/nsMathMLmspaceFrame.cpp index 9df7e54a5861..001d7fdfd14b 100644 --- a/layout/mathml/nsMathMLmspaceFrame.cpp +++ b/layout/mathml/nsMathMLmspaceFrame.cpp @@ -103,14 +103,13 @@ nsMathMLmspaceFrame::ProcessAttributes(nsPresContext* aPresContext) // default: 0ex // // The default value is "0ex", so unitless values can be ignored. - // XXXfredw Should we forbid negative values? (bugs 411227, 716349) + // We do not allow negative values. See bug 716349. // mHeight = 0; GetAttribute(mContent, mPresentationData.mstyle, nsGkAtoms::height, value); if (!value.IsEmpty()) { - ParseNumericValue(value, &mHeight, - nsMathMLElement::PARSE_ALLOW_NEGATIVE, + ParseNumericValue(value, &mHeight, 0, aPresContext, mStyleContext); } @@ -122,14 +121,13 @@ nsMathMLmspaceFrame::ProcessAttributes(nsPresContext* aPresContext) // default: 0ex // // The default value is "0ex", so unitless values can be ignored. - // XXXfredw Should we forbid negative values? (bugs 411227, 716349) + // We do not allow negative values. See bug 716349. // mDepth = 0; GetAttribute(mContent, mPresentationData.mstyle, nsGkAtoms::depth_, value); if (!value.IsEmpty()) { - ParseNumericValue(value, &mDepth, - nsMathMLElement::PARSE_ALLOW_NEGATIVE, + ParseNumericValue(value, &mDepth, 0, aPresContext, mStyleContext); } } @@ -141,16 +139,18 @@ nsMathMLmspaceFrame::Reflow(nsPresContext* aPresContext, nsReflowStatus& aStatus) { ProcessAttributes(aPresContext); + // nsLineLayout doesn't expect negative widths. + // XXXfredw Negative spaces are not implemented. See bug 717546 mBoundingMetrics = nsBoundingMetrics(); - mBoundingMetrics.width = mWidth; + mBoundingMetrics.width = NS_MAX(0, mWidth); mBoundingMetrics.ascent = mHeight; mBoundingMetrics.descent = mDepth; mBoundingMetrics.leftBearing = 0; - mBoundingMetrics.rightBearing = mWidth; + mBoundingMetrics.rightBearing = mBoundingMetrics.width; aDesiredSize.ascent = mHeight; - aDesiredSize.width = mWidth; + aDesiredSize.width = mBoundingMetrics.width; aDesiredSize.height = aDesiredSize.ascent + mDepth; // Also return our bounding metrics aDesiredSize.mBoundingMetrics = mBoundingMetrics;