Bug 557474 - Do not allow lspace as a pseudounit. r=karlt

This commit is contained in:
Jonathan Hage 2011-07-03 09:53:17 +02:00
Родитель 8a2e796345
Коммит 1ad17ada67
2 изменённых файлов: 10 добавлений и 17 удалений

Просмотреть файл

@ -62,8 +62,7 @@
#define NS_MATHML_PSEUDO_UNIT_WIDTH 2 #define NS_MATHML_PSEUDO_UNIT_WIDTH 2
#define NS_MATHML_PSEUDO_UNIT_HEIGHT 3 #define NS_MATHML_PSEUDO_UNIT_HEIGHT 3
#define NS_MATHML_PSEUDO_UNIT_DEPTH 4 #define NS_MATHML_PSEUDO_UNIT_DEPTH 4
#define NS_MATHML_PSEUDO_UNIT_LSPACE 5 #define NS_MATHML_PSEUDO_UNIT_NAMEDSPACE 5
#define NS_MATHML_PSEUDO_UNIT_NAMEDSPACE 6
nsIFrame* nsIFrame*
NS_NewMathMLmpaddedFrame(nsIPresShell* aPresShell, nsStyleContext* aContext) NS_NewMathMLmpaddedFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
@ -254,7 +253,6 @@ nsMathMLmpaddedFrame::ParseAttribute(nsString& aString,
else if (unit.EqualsLiteral("width")) aPseudoUnit = NS_MATHML_PSEUDO_UNIT_WIDTH; else if (unit.EqualsLiteral("width")) aPseudoUnit = NS_MATHML_PSEUDO_UNIT_WIDTH;
else if (unit.EqualsLiteral("height")) aPseudoUnit = NS_MATHML_PSEUDO_UNIT_HEIGHT; else if (unit.EqualsLiteral("height")) aPseudoUnit = NS_MATHML_PSEUDO_UNIT_HEIGHT;
else if (unit.EqualsLiteral("depth")) aPseudoUnit = NS_MATHML_PSEUDO_UNIT_DEPTH; else if (unit.EqualsLiteral("depth")) aPseudoUnit = NS_MATHML_PSEUDO_UNIT_DEPTH;
else if (unit.EqualsLiteral("lspace")) aPseudoUnit = NS_MATHML_PSEUDO_UNIT_LSPACE;
else if (!gotPercent) { // percentage can only apply to a pseudo-unit else if (!gotPercent) { // percentage can only apply to a pseudo-unit
// see if the unit is a named-space // see if the unit is a named-space
@ -297,7 +295,6 @@ void
nsMathMLmpaddedFrame::UpdateValue(PRInt32 aSign, nsMathMLmpaddedFrame::UpdateValue(PRInt32 aSign,
PRInt32 aPseudoUnit, PRInt32 aPseudoUnit,
const nsCSSValue& aCSSValue, const nsCSSValue& aCSSValue,
nscoord aLeftSpace,
const nsBoundingMetrics& aBoundingMetrics, const nsBoundingMetrics& aBoundingMetrics,
nscoord& aValueToUpdate) const nscoord& aValueToUpdate) const
{ {
@ -319,10 +316,6 @@ nsMathMLmpaddedFrame::UpdateValue(PRInt32 aSign,
scaler = aBoundingMetrics.descent; scaler = aBoundingMetrics.descent;
break; break;
case NS_MATHML_PSEUDO_UNIT_LSPACE:
scaler = aLeftSpace;
break;
default: default:
// if we ever reach here, it would mean something is wrong // if we ever reach here, it would mean something is wrong
// somewhere with the setup and/or the caller // somewhere with the setup and/or the caller
@ -415,25 +408,26 @@ nsMathMLmpaddedFrame::Place(nsRenderingContext& aRenderingContext,
pseudoUnit = (mWidthPseudoUnit == NS_MATHML_PSEUDO_UNIT_ITSELF) pseudoUnit = (mWidthPseudoUnit == NS_MATHML_PSEUDO_UNIT_ITSELF)
? NS_MATHML_PSEUDO_UNIT_WIDTH : mWidthPseudoUnit; ? NS_MATHML_PSEUDO_UNIT_WIDTH : mWidthPseudoUnit;
UpdateValue(mWidthSign, pseudoUnit, mWidth, UpdateValue(mWidthSign, pseudoUnit, mWidth,
lspace, mBoundingMetrics, width); mBoundingMetrics, width);
// update "height" (this is the ascent in the terminology of the REC) // update "height" (this is the ascent in the terminology of the REC)
pseudoUnit = (mHeightPseudoUnit == NS_MATHML_PSEUDO_UNIT_ITSELF) pseudoUnit = (mHeightPseudoUnit == NS_MATHML_PSEUDO_UNIT_ITSELF)
? NS_MATHML_PSEUDO_UNIT_HEIGHT : mHeightPseudoUnit; ? NS_MATHML_PSEUDO_UNIT_HEIGHT : mHeightPseudoUnit;
UpdateValue(mHeightSign, pseudoUnit, mHeight, UpdateValue(mHeightSign, pseudoUnit, mHeight,
lspace, mBoundingMetrics, height); mBoundingMetrics, height);
// update "depth" (this is the descent in the terminology of the REC) // update "depth" (this is the descent in the terminology of the REC)
pseudoUnit = (mDepthPseudoUnit == NS_MATHML_PSEUDO_UNIT_ITSELF) pseudoUnit = (mDepthPseudoUnit == NS_MATHML_PSEUDO_UNIT_ITSELF)
? NS_MATHML_PSEUDO_UNIT_DEPTH : mDepthPseudoUnit; ? NS_MATHML_PSEUDO_UNIT_DEPTH : mDepthPseudoUnit;
UpdateValue(mDepthSign, pseudoUnit, mDepth, UpdateValue(mDepthSign, pseudoUnit, mDepth,
lspace, mBoundingMetrics, depth); mBoundingMetrics, depth);
// update lspace -- should be *last* because lspace is overwritten!! // update lspace
pseudoUnit = (mLeftSpacePseudoUnit == NS_MATHML_PSEUDO_UNIT_ITSELF) if (mLeftSpacePseudoUnit != NS_MATHML_PSEUDO_UNIT_ITSELF) {
? NS_MATHML_PSEUDO_UNIT_LSPACE : mLeftSpacePseudoUnit; pseudoUnit = mLeftSpacePseudoUnit;
UpdateValue(mLeftSpaceSign, pseudoUnit, mLeftSpace, UpdateValue(mLeftSpaceSign, pseudoUnit, mLeftSpace,
lspace, mBoundingMetrics, lspace); mBoundingMetrics, lspace);
}
// do the padding now that we have everything // do the padding now that we have everything
// The idea here is to maintain the invariant that <mpadded>...</mpadded> (i.e., // The idea here is to maintain the invariant that <mpadded>...</mpadded> (i.e.,

Просмотреть файл

@ -109,7 +109,6 @@ private:
UpdateValue(PRInt32 aSign, UpdateValue(PRInt32 aSign,
PRInt32 aPseudoUnit, PRInt32 aPseudoUnit,
const nsCSSValue& aCSSValue, const nsCSSValue& aCSSValue,
nscoord aLeftSpace,
const nsBoundingMetrics& aBoundingMetrics, const nsBoundingMetrics& aBoundingMetrics,
nscoord& aValueToUpdate) const; nscoord& aValueToUpdate) const;
}; };