Fix places where I missed clamping negative calc() to 0. (Bug 585715) r=bzbarsky a2.0=blocking2.0:beta6

This commit is contained in:
L. David Baron 2010-09-09 08:21:46 -07:00
parent 2842b50861
commit 99e16ca9a9
10 changed files with 168 additions and 97 deletions

View File

@ -799,6 +799,18 @@ public:
}
static PRBool IsPaddingZero(const nsStyleCoord &aCoord)
{
return (aCoord.GetUnit() == eStyleUnit_Coord &&
aCoord.GetCoordValue() == 0) ||
(aCoord.GetUnit() == eStyleUnit_Percent &&
aCoord.GetPercentValue() == 0.0) ||
(aCoord.IsCalcUnit() &&
// clamp negative calc() to 0
nsRuleNode::ComputeCoordPercentCalc(aCoord, nscoord_MAX) <= 0 &&
nsRuleNode::ComputeCoordPercentCalc(aCoord, 0) <= 0);
}
static PRBool IsMarginZero(const nsStyleCoord &aCoord)
{
return (aCoord.GetUnit() == eStyleUnit_Coord &&
aCoord.GetCoordValue() == 0) ||

View File

@ -629,7 +629,8 @@ nsContainerFrame::DoInlineIntrinsicWidth(nsIRenderingContext *aRenderingContext,
// border.
if (!GetPrevContinuation()) {
aData->currentLine +=
GetCoord(stylePadding->mPadding.Get(startSide), 0) +
// clamp negative calc() to 0
NS_MAX(GetCoord(stylePadding->mPadding.Get(startSide), 0), 0) +
styleBorder->GetActualBorderWidth(startSide) +
GetCoord(styleMargin->mMargin.Get(startSide), 0);
}
@ -670,7 +671,8 @@ nsContainerFrame::DoInlineIntrinsicWidth(nsIRenderingContext *aRenderingContext,
// the endSide border.
if (!lastInFlow->GetNextContinuation()) {
aData->currentLine +=
GetCoord(stylePadding->mPadding.Get(endSide), 0) +
// clamp negative calc() to 0
NS_MAX(GetCoord(stylePadding->mPadding.Get(endSide), 0), 0) +
styleBorder->GetActualBorderWidth(endSide) +
GetCoord(styleMargin->mMargin.Get(endSide), 0);
}

View File

@ -3249,7 +3249,8 @@ static void
AddCoord(const nsStyleCoord& aStyle,
nsIRenderingContext* aRenderingContext,
nsIFrame* aFrame,
nscoord* aCoord, float* aPercent)
nscoord* aCoord, float* aPercent,
PRBool aClampNegativeToZero)
{
if (!aStyle.IsCoordPercentCalcUnit()) {
return;
@ -3258,6 +3259,11 @@ AddCoord(const nsStyleCoord& aStyle,
LengthPercentPairWithMinMaxCalcOps ops;
LengthPercentPairWithMinMaxCalcOps::result_type pair =
css::ComputeCalc(aStyle, ops);
if (aClampNegativeToZero) {
// This is far from ideal when one is negative and one is positive.
pair.mLength = NS_MAX(pair.mLength, 0);
pair.mPercent = NS_MAX(pair.mPercent, 0.0f);
}
*aCoord += pair.mLength;
*aPercent += pair.mPercent;
}
@ -3273,15 +3279,15 @@ nsFrame::IntrinsicWidthOffsets(nsIRenderingContext* aRenderingContext)
// comment above LengthPercentPairWithMinMaxCalcOps.
const nsStyleMargin *styleMargin = GetStyleMargin();
AddCoord(styleMargin->mMargin.GetLeft(), aRenderingContext, this,
&result.hMargin, &result.hPctMargin);
&result.hMargin, &result.hPctMargin, PR_FALSE);
AddCoord(styleMargin->mMargin.GetRight(), aRenderingContext, this,
&result.hMargin, &result.hPctMargin);
&result.hMargin, &result.hPctMargin, PR_FALSE);
const nsStylePadding *stylePadding = GetStylePadding();
AddCoord(stylePadding->mPadding.GetLeft(), aRenderingContext, this,
&result.hPadding, &result.hPctPadding);
&result.hPadding, &result.hPctPadding, PR_TRUE);
AddCoord(stylePadding->mPadding.GetRight(), aRenderingContext, this,
&result.hPadding, &result.hPctPadding);
&result.hPadding, &result.hPctPadding, PR_TRUE);
const nsStyleBorder *styleBorder = GetStyleBorder();
result.hBorder += styleBorder->GetActualBorderWidth(NS_SIDE_LEFT);

View File

@ -2187,21 +2187,22 @@ nsCSSOffsetState::ComputePadding(nscoord aContainingBlockWidth)
const nsStylePadding *stylePadding = frame->GetStylePadding();
if (!stylePadding->GetPadding(mComputedPadding)) {
// We have to compute the value
mComputedPadding.left = nsLayoutUtils::
// clamp negative calc() results to 0
mComputedPadding.left = NS_MAX(0, nsLayoutUtils::
ComputeWidthDependentValue(aContainingBlockWidth,
stylePadding->mPadding.GetLeft());
mComputedPadding.right = nsLayoutUtils::
stylePadding->mPadding.GetLeft()));
mComputedPadding.right = NS_MAX(0, nsLayoutUtils::
ComputeWidthDependentValue(aContainingBlockWidth,
stylePadding->mPadding.GetRight());
stylePadding->mPadding.GetRight()));
// According to the CSS2 spec, percentages are calculated with respect to
// containing block width for padding-top and padding-bottom
mComputedPadding.top = nsLayoutUtils::
mComputedPadding.top = NS_MAX(0, nsLayoutUtils::
ComputeWidthDependentValue(aContainingBlockWidth,
stylePadding->mPadding.GetTop());
mComputedPadding.bottom = nsLayoutUtils::
stylePadding->mPadding.GetTop()));
mComputedPadding.bottom = NS_MAX(0, nsLayoutUtils::
ComputeWidthDependentValue(aContainingBlockWidth,
stylePadding->mPadding.GetBottom());
stylePadding->mPadding.GetBottom()));
frame->Properties().Set(nsIFrame::UsedPaddingProperty(),
new nsMargin(mComputedPadding));

View File

@ -97,7 +97,7 @@ static inline PRBool
IsMarginZero(const nsStyleCoord &aCoord)
{
return aCoord.GetUnit() == eStyleUnit_Auto ||
nsLayoutUtils::IsPaddingZero(aCoord);
nsLayoutUtils::IsMarginZero(aCoord);
}
/* virtual */ PRBool

View File

@ -762,7 +762,7 @@ nsComputedDOMStyle::DoGetColumnWidth(nsIDOMCSSValue** aValue)
// XXX fix the auto case. When we actually have a column frame, I think
// we should return the computed column width.
SetValueToCoord(val, GetStyleColumn()->mColumnWidth);
SetValueToCoord(val, GetStyleColumn()->mColumnWidth, PR_TRUE);
NS_ADDREF(*aValue = val);
return NS_OK;
@ -778,7 +778,7 @@ nsComputedDOMStyle::DoGetColumnGap(nsIDOMCSSValue** aValue)
if (column->mColumnGap.GetUnit() == eStyleUnit_Normal) {
val->SetAppUnits(GetStyleFont()->mFont.size);
} else {
SetValueToCoord(val, GetStyleColumn()->mColumnGap);
SetValueToCoord(val, GetStyleColumn()->mColumnGap, PR_TRUE);
}
NS_ADDREF(*aValue = val);
@ -1010,9 +1010,9 @@ nsComputedDOMStyle::DoGetMozTransformOrigin(nsIDOMCSSValue **aValue)
/* Now, get the values. */
const nsStyleDisplay* display = GetStyleDisplay();
SetValueToCoord(width, display->mTransformOrigin[0],
SetValueToCoord(width, display->mTransformOrigin[0], PR_FALSE,
&nsComputedDOMStyle::GetFrameBoundsWidthForTransform);
SetValueToCoord(height, display->mTransformOrigin[1],
SetValueToCoord(height, display->mTransformOrigin[1], PR_FALSE,
&nsComputedDOMStyle::GetFrameBoundsHeightForTransform);
/* Store things as a value list, fail if we can't get one. */
@ -1570,7 +1570,7 @@ nsComputedDOMStyle::GetImageRectString(nsIURI* aURI,
delete valueList;
return NS_ERROR_OUT_OF_MEMORY;
}
SetValueToCoord(valSide, aCropRect.Get(side));
SetValueToCoord(valSide, aCropRect.Get(side), PR_FALSE);
}
nsAutoString argumentString;
@ -2128,7 +2128,7 @@ nsComputedDOMStyle::DoGetMarkerOffset(nsIDOMCSSValue** aValue)
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
SetValueToCoord(val, GetStyleContent()->mMarkerOffset);
SetValueToCoord(val, GetStyleContent()->mMarkerOffset, PR_FALSE);
NS_ADDREF(*aValue = val);
return NS_OK;
@ -2262,7 +2262,7 @@ nsComputedDOMStyle::GetEllipseRadii(const nsStyleCorners& aRadius,
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
SetValueToCoord(val, radiusX,
SetValueToCoord(val, radiusX, PR_TRUE,
&nsComputedDOMStyle::GetFrameBorderRectWidth);
NS_ADDREF(*aValue = val);
@ -2286,9 +2286,9 @@ nsComputedDOMStyle::GetEllipseRadii(const nsStyleCorners& aRadius,
return NS_ERROR_OUT_OF_MEMORY;
}
SetValueToCoord(valX, radiusX,
SetValueToCoord(valX, radiusX, PR_TRUE,
&nsComputedDOMStyle::GetFrameBorderRectWidth);
SetValueToCoord(valY, radiusY,
SetValueToCoord(valY, radiusY, PR_TRUE,
&nsComputedDOMStyle::GetFrameBorderRectWidth);
NS_ADDREF(*aValue = valueList);
@ -2403,7 +2403,7 @@ nsComputedDOMStyle::DoGetZIndex(nsIDOMCSSValue** aValue)
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
SetValueToCoord(val, GetStylePosition()->mZIndex);
SetValueToCoord(val, GetStylePosition()->mZIndex, PR_FALSE);
NS_ADDREF(*aValue = val);
return NS_OK;
@ -2521,7 +2521,7 @@ nsComputedDOMStyle::DoGetLineHeight(nsIDOMCSSValue** aValue)
if (GetLineHeightCoord(lineHeight)) {
val->SetAppUnits(lineHeight);
} else {
SetValueToCoord(val, GetStyleText()->mLineHeight,
SetValueToCoord(val, GetStyleText()->mLineHeight, PR_TRUE,
nsnull, nsCSSProps::kLineHeightKTable);
}
@ -2535,7 +2535,7 @@ nsComputedDOMStyle::DoGetVerticalAlign(nsIDOMCSSValue** aValue)
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
SetValueToCoord(val, GetStyleTextReset()->mVerticalAlign,
SetValueToCoord(val, GetStyleTextReset()->mVerticalAlign, PR_FALSE,
&nsComputedDOMStyle::GetLineHeightCoord,
nsCSSProps::kVerticalAlignKTable);
@ -2590,7 +2590,7 @@ nsComputedDOMStyle::DoGetTextIndent(nsIDOMCSSValue** aValue)
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
SetValueToCoord(val, GetStyleText()->mTextIndent,
SetValueToCoord(val, GetStyleText()->mTextIndent, PR_FALSE,
&nsComputedDOMStyle::GetCBContentWidth);
NS_ADDREF(*aValue = val);
@ -2637,7 +2637,7 @@ nsComputedDOMStyle::DoGetLetterSpacing(nsIDOMCSSValue** aValue)
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
SetValueToCoord(val, GetStyleText()->mLetterSpacing);
SetValueToCoord(val, GetStyleText()->mLetterSpacing, PR_FALSE);
NS_ADDREF(*aValue = val);
return NS_OK;
@ -2960,8 +2960,7 @@ nsComputedDOMStyle::DoGetBorderImage(nsIDOMCSSValue** aValue)
delete valueList;
return NS_ERROR_OUT_OF_MEMORY;
}
SetValueToCoord(valSplit, border->mBorderImageSplit.Get(side), nsnull,
nsnull);
SetValueToCoord(valSplit, border->mBorderImageSplit.Get(side), PR_TRUE);
}
// copy of border-width
@ -3332,14 +3331,14 @@ nsComputedDOMStyle::DoGetHeight(nsIDOMCSSValue** aValue)
nscoord minHeight =
StyleCoordToNSCoord(positionData->mMinHeight,
&nsComputedDOMStyle::GetCBContentHeight, 0);
&nsComputedDOMStyle::GetCBContentHeight, 0, PR_TRUE);
nscoord maxHeight =
StyleCoordToNSCoord(positionData->mMaxHeight,
&nsComputedDOMStyle::GetCBContentHeight,
nscoord_MAX);
nscoord_MAX, PR_TRUE);
SetValueToCoord(val, positionData->mHeight, nsnull, nsnull,
SetValueToCoord(val, positionData->mHeight, PR_TRUE, nsnull, nsnull,
minHeight, maxHeight);
}
@ -3374,14 +3373,14 @@ nsComputedDOMStyle::DoGetWidth(nsIDOMCSSValue** aValue)
nscoord minWidth =
StyleCoordToNSCoord(positionData->mMinWidth,
&nsComputedDOMStyle::GetCBContentWidth, 0);
&nsComputedDOMStyle::GetCBContentWidth, 0, PR_TRUE);
nscoord maxWidth =
StyleCoordToNSCoord(positionData->mMaxWidth,
&nsComputedDOMStyle::GetCBContentWidth,
nscoord_MAX);
nscoord_MAX, PR_TRUE);
SetValueToCoord(val, positionData->mWidth, nsnull,
SetValueToCoord(val, positionData->mWidth, PR_TRUE, nsnull,
nsCSSProps::kWidthKTable, minWidth, maxWidth);
}
@ -3395,7 +3394,7 @@ nsComputedDOMStyle::DoGetMaxHeight(nsIDOMCSSValue** aValue)
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
SetValueToCoord(val, GetStylePosition()->mMaxHeight,
SetValueToCoord(val, GetStylePosition()->mMaxHeight, PR_TRUE,
&nsComputedDOMStyle::GetCBContentHeight);
NS_ADDREF(*aValue = val);
@ -3408,7 +3407,7 @@ nsComputedDOMStyle::DoGetMaxWidth(nsIDOMCSSValue** aValue)
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
SetValueToCoord(val, GetStylePosition()->mMaxWidth,
SetValueToCoord(val, GetStylePosition()->mMaxWidth, PR_TRUE,
&nsComputedDOMStyle::GetCBContentWidth,
nsCSSProps::kWidthKTable);
@ -3422,7 +3421,7 @@ nsComputedDOMStyle::DoGetMinHeight(nsIDOMCSSValue** aValue)
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
SetValueToCoord(val, GetStylePosition()->mMinHeight,
SetValueToCoord(val, GetStylePosition()->mMinHeight, PR_TRUE,
&nsComputedDOMStyle::GetCBContentHeight);
NS_ADDREF(*aValue = val);
@ -3435,7 +3434,7 @@ nsComputedDOMStyle::DoGetMinWidth(nsIDOMCSSValue** aValue)
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
SetValueToCoord(val, GetStylePosition()->mMinWidth,
SetValueToCoord(val, GetStylePosition()->mMinWidth, PR_TRUE,
&nsComputedDOMStyle::GetCBContentWidth,
nsCSSProps::kWidthKTable);
@ -3611,7 +3610,7 @@ nsComputedDOMStyle::GetRelativeOffset(mozilla::css::Side aSide,
baseGetter = &nsComputedDOMStyle::GetCBContentHeight;
}
val->SetAppUnits(sign * StyleCoordToNSCoord(coord, baseGetter, 0));
val->SetAppUnits(sign * StyleCoordToNSCoord(coord, baseGetter, 0, PR_FALSE));
NS_ADDREF(*aValue = val);
return NS_OK;
@ -3624,7 +3623,7 @@ nsComputedDOMStyle::GetStaticOffset(mozilla::css::Side aSide, nsIDOMCSSValue** a
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
SetValueToCoord(val, GetStylePosition()->mOffset.Get(aSide));
SetValueToCoord(val, GetStylePosition()->mOffset.Get(aSide), PR_FALSE);
NS_ADDREF(*aValue = val);
return NS_OK;
@ -3637,7 +3636,7 @@ nsComputedDOMStyle::GetPaddingWidthFor(mozilla::css::Side aSide, nsIDOMCSSValue*
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
if (!mInnerFrame) {
SetValueToCoord(val, GetStylePadding()->mPadding.Get(aSide));
SetValueToCoord(val, GetStylePadding()->mPadding.Get(aSide), PR_TRUE);
} else {
AssertFlushedPendingReflows();
@ -3778,7 +3777,7 @@ nsComputedDOMStyle::GetMarginWidthFor(mozilla::css::Side aSide, nsIDOMCSSValue**
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
if (!mInnerFrame) {
SetValueToCoord(val, GetStyleMargin()->mMargin.Get(aSide));
SetValueToCoord(val, GetStyleMargin()->mMargin.Get(aSide), PR_FALSE);
} else {
AssertFlushedPendingReflows();
@ -3854,6 +3853,7 @@ private:
void
nsComputedDOMStyle::SetValueToCoord(nsROCSSPrimitiveValue* aValue,
const nsStyleCoord& aCoord,
PRBool aClampNegativeCalc,
PercentageBaseGetter aPercentageBaseGetter,
const PRInt32 aTable[],
nscoord aMinAppUnits,
@ -3914,11 +3914,21 @@ nsComputedDOMStyle::SetValueToCoord(nsROCSSPrimitiveValue* aValue,
nscoord percentageBase;
if (!aCoord.CalcHasPercent()) {
nscoord val = nsRuleNode::ComputeCoordPercentCalc(aCoord, 0);
if (aClampNegativeCalc && val < 0) {
NS_ABORT_IF_FALSE(aCoord.IsCalcUnit(),
"parser should have rejected value");
val = 0;
}
aValue->SetAppUnits(NS_MAX(aMinAppUnits, NS_MIN(val, aMaxAppUnits)));
} else if (aPercentageBaseGetter &&
(this->*aPercentageBaseGetter)(percentageBase)) {
nscoord val =
nsRuleNode::ComputeCoordPercentCalc(aCoord, percentageBase);
if (aClampNegativeCalc && val < 0) {
NS_ABORT_IF_FALSE(aCoord.IsCalcUnit(),
"parser should have rejected value");
val = 0;
}
aValue->SetAppUnits(NS_MAX(aMinAppUnits, NS_MIN(val, aMaxAppUnits)));
} else {
nsAutoString tmp;
@ -3936,7 +3946,8 @@ nsComputedDOMStyle::SetValueToCoord(nsROCSSPrimitiveValue* aValue,
nscoord
nsComputedDOMStyle::StyleCoordToNSCoord(const nsStyleCoord& aCoord,
PercentageBaseGetter aPercentageBaseGetter,
nscoord aDefaultValue)
nscoord aDefaultValue,
PRBool aClampNegativeCalc)
{
NS_PRECONDITION(aPercentageBaseGetter, "Must have a percentage base getter");
if (aCoord.GetUnit() == eStyleUnit_Coord) {
@ -3945,7 +3956,14 @@ nsComputedDOMStyle::StyleCoordToNSCoord(const nsStyleCoord& aCoord,
if (aCoord.GetUnit() == eStyleUnit_Percent || aCoord.IsCalcUnit()) {
nscoord percentageBase;
if ((this->*aPercentageBaseGetter)(percentageBase)) {
return nsRuleNode::ComputeCoordPercentCalc(aCoord, percentageBase);
nscoord result =
nsRuleNode::ComputeCoordPercentCalc(aCoord, percentageBase);
if (aClampNegativeCalc && result < 0) {
NS_ABORT_IF_FALSE(aCoord.IsCalcUnit(),
"parser should have rejected value");
result = 0;
}
return result;
}
// Fall through to returning aDefaultValue if we have no percentage base.
}
@ -4191,7 +4209,7 @@ nsComputedDOMStyle::DoGetStrokeDasharray(nsIDOMCSSValue** aValue)
return NS_ERROR_OUT_OF_MEMORY;
}
SetValueToCoord(dash, svg->mStrokeDasharray[i]);
SetValueToCoord(dash, svg->mStrokeDasharray[i], PR_TRUE);
}
NS_ADDREF(*aValue = valueList);
@ -4204,7 +4222,7 @@ nsComputedDOMStyle::DoGetStrokeDashoffset(nsIDOMCSSValue** aValue)
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
SetValueToCoord(val, GetStyleSVG()->mStrokeDashoffset);
SetValueToCoord(val, GetStyleSVG()->mStrokeDashoffset, PR_FALSE);
NS_ADDREF(*aValue = val);
return NS_OK;
@ -4216,7 +4234,7 @@ nsComputedDOMStyle::DoGetStrokeWidth(nsIDOMCSSValue** aValue)
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
SetValueToCoord(val, GetStyleSVG()->mStrokeWidth);
SetValueToCoord(val, GetStyleSVG()->mStrokeWidth, PR_TRUE);
NS_ADDREF(*aValue = val);
return NS_OK;

View File

@ -428,6 +428,7 @@ private:
*/
void SetValueToCoord(nsROCSSPrimitiveValue* aValue,
const nsStyleCoord& aCoord,
PRBool aClampNegativeCalc,
PercentageBaseGetter aPercentageBaseGetter = nsnull,
const PRInt32 aTable[] = nsnull,
nscoord aMinAppUnits = nscoord_MIN,
@ -441,7 +442,8 @@ private:
*/
nscoord StyleCoordToNSCoord(const nsStyleCoord& aCoord,
PercentageBaseGetter aPercentageBaseGetter,
nscoord aDefaultValue);
nscoord aDefaultValue,
PRBool aClampNegativeCalc);
PRBool GetCBContentWidth(nscoord& aWidth);
PRBool GetCBContentHeight(nscoord& aWidth);

View File

@ -344,7 +344,9 @@ void nsStylePadding::RecalcData()
{
if (IsFixedData(mPadding, PR_FALSE)) {
NS_FOR_CSS_SIDES(side) {
mCachedPadding.side(side) = CalcCoord(mPadding.Get(side), nsnull, 0);
// Clamp negative calc() to 0.
mCachedPadding.side(side) =
NS_MAX(CalcCoord(mPadding.Get(side), nsnull, 0), 0);
}
mHasCachedPadding = PR_TRUE;
}

View File

@ -164,7 +164,7 @@ var gCSSProperties = {
type: CSS_TYPE_TRUE_SHORTHAND,
prerequisites: { "width": "200px", "height": "100px", "display": "inline-block"},
subproperties: [ "-moz-border-radius-bottomleft", "-moz-border-radius-bottomright", "-moz-border-radius-topleft", "-moz-border-radius-topright" ],
initial_values: [ "0", "0px", "0px 0 0 0px" ], /* 0% ? */
initial_values: [ "0", "0px", "0%", "0px 0 0 0px", "-moz-calc(-2px)", "-moz-calc(-1%)", "-moz-calc(0px) -moz-calc(0pt) -moz-calc(0%) -moz-calc(0em)" ],
other_values: [ "3%", "1px", "2em", "3em 2px", "2pt 3% 4em", "2px 2px 2px 2px", // circular
"3% / 2%", "1px / 4px", "2em / 1em", "3em 2px / 2px 3em", "2pt 3% 4em / 4pt 1% 5em", "2px 2px 2px 2px / 4px 4px 4px 4px", "1pt / 2pt 3pt", "4pt 5pt / 3pt", // elliptical
"-moz-calc(2px)",
@ -186,7 +186,7 @@ var gCSSProperties = {
inherited: false,
type: CSS_TYPE_LONGHAND,
prerequisites: { "width": "200px", "height": "100px", "display": "inline-block"},
initial_values: [ "0", "0px" ], /* 0% ? */
initial_values: [ "0", "0px", "0%", "-moz-calc(-2px)", "-moz-calc(-1%)" ],
other_values: [ "3%", "1px", "2em", // circular
"3% 2%", "1px 4px", "2em 2pt", // elliptical
"-moz-calc(2px)",
@ -206,7 +206,7 @@ var gCSSProperties = {
inherited: false,
type: CSS_TYPE_LONGHAND,
prerequisites: { "width": "200px", "height": "100px", "display": "inline-block"},
initial_values: [ "0", "0px" ], /* 0% ? */
initial_values: [ "0", "0px", "0%", "-moz-calc(-2px)", "-moz-calc(-1%)" ],
other_values: [ "3%", "1px", "2em", // circular
"3% 2%", "1px 4px", "2em 2pt", // elliptical
"-moz-calc(2px)",
@ -226,7 +226,7 @@ var gCSSProperties = {
inherited: false,
type: CSS_TYPE_LONGHAND,
prerequisites: { "width": "200px", "height": "100px", "display": "inline-block"},
initial_values: [ "0", "0px" ], /* 0% ? */
initial_values: [ "0", "0px", "0%", "-moz-calc(-2px)", "-moz-calc(-1%)" ],
other_values: [ "3%", "1px", "2em", // circular
"3% 2%", "1px 4px", "2em 2pt", // elliptical
"-moz-calc(2px)",
@ -246,7 +246,7 @@ var gCSSProperties = {
inherited: false,
type: CSS_TYPE_LONGHAND,
prerequisites: { "width": "200px", "height": "100px", "display": "inline-block"},
initial_values: [ "0", "0px" ], /* 0% ? */
initial_values: [ "0", "0px", "0%", "-moz-calc(-2px)", "-moz-calc(-1%)" ],
other_values: [ "3%", "1px", "2em", // circular
"3% 2%", "1px 4px", "2em 2pt", // elliptical
"-moz-calc(2px)",
@ -377,6 +377,8 @@ var gCSSProperties = {
"2px -moz-min(2px,0.2em)",
"blue 2px -moz-min(2px,0.2em)",
"2px -moz-min(2px,0.2em) blue",
"-moz-calc(-2px) -moz-calc(-2px)",
"-2px -2px",
"-moz-calc(2px) -moz-calc(2px)",
"-moz-calc(2px) -moz-calc(2px) -moz-calc(2px)",
"-moz-calc(2px) -moz-calc(2px) -moz-calc(2px) -moz-calc(2px)"
@ -623,9 +625,10 @@ var gCSSProperties = {
get_computed: logical_box_prop_get_computed,
/* no subproperties */
/* auto may or may not be initial */
initial_values: [ "0", "0px", "0%", "0em", "0ex" ],
initial_values: [ "0", "0px", "0%", "0em", "0ex", "-moz-calc(0pt)", "-moz-calc(0% + 0px)" ],
other_values: [ "1px", "3em",
"-moz-calc(2px)",
"-moz-calc(-2px)",
"-moz-calc(50%)",
"-moz-calc(3*25px)",
"-moz-calc(25px*3)",
@ -641,9 +644,10 @@ var gCSSProperties = {
get_computed: logical_box_prop_get_computed,
/* no subproperties */
/* auto may or may not be initial */
initial_values: [ "0", "0px", "0%", "0em", "0ex" ],
initial_values: [ "0", "0px", "0%", "0em", "0ex", "-moz-calc(0pt)", "-moz-calc(0% + 0px)" ],
other_values: [ "1px", "3em",
"-moz-calc(2px)",
"-moz-calc(-2px)",
"-moz-calc(50%)",
"-moz-calc(3*25px)",
"-moz-calc(25px*3)",
@ -658,7 +662,7 @@ var gCSSProperties = {
type: CSS_TYPE_TRUE_SHORTHAND,
prerequisites: { "width": "200px", "height": "100px", "display": "inline-block"},
subproperties: [ "-moz-outline-radius-bottomleft", "-moz-outline-radius-bottomright", "-moz-outline-radius-topleft", "-moz-outline-radius-topright" ],
initial_values: [ "0", "0px", "0%" ],
initial_values: [ "0", "0px", "0%", "-moz-calc(-2px)", "-moz-calc(-1%)", "-moz-calc(0px) -moz-calc(0pt) -moz-calc(0%) -moz-calc(0em)" ],
other_values: [ "3%", "1px", "2em", "3em 2px", "2pt 3% 4em", "2px 2px 2px 2px", // circular
"3% / 2%", "1px / 4px", "2em / 1em", "3em 2px / 2px 3em", "2pt 3% 4em / 4pt 1% 5em", "2px 2px 2px 2px / 4px 4px 4px 4px", "1pt / 2pt 3pt", "4pt 5pt / 3pt", // elliptical
"-moz-calc(2px)",
@ -680,7 +684,7 @@ var gCSSProperties = {
inherited: false,
type: CSS_TYPE_LONGHAND,
prerequisites: { "width": "200px", "height": "100px", "display": "inline-block"},
initial_values: [ "0", "0px", "0%" ],
initial_values: [ "0", "0px", "0%", "-moz-calc(-2px)", "-moz-calc(-1%)", "-moz-calc(0px)" ],
other_values: [ "3%", "1px", "2em", // circular
"3% 2%", "1px 4px", "2em 2pt", // elliptical
"-moz-calc(2px)",
@ -700,7 +704,7 @@ var gCSSProperties = {
inherited: false,
type: CSS_TYPE_LONGHAND,
prerequisites: { "width": "200px", "height": "100px", "display": "inline-block"},
initial_values: [ "0", "0px", "0%" ],
initial_values: [ "0", "0px", "0%", "-moz-calc(-2px)", "-moz-calc(-1%)", "-moz-calc(0px)" ],
other_values: [ "3%", "1px", "2em", // circular
"3% 2%", "1px 4px", "2em 2pt", // elliptical
"-moz-calc(2px)",
@ -720,7 +724,7 @@ var gCSSProperties = {
inherited: false,
type: CSS_TYPE_LONGHAND,
prerequisites: { "width": "200px", "height": "100px", "display": "inline-block"},
initial_values: [ "0", "0px", "0%" ],
initial_values: [ "0", "0px", "0%", "-moz-calc(-2px)", "-moz-calc(-1%)", "-moz-calc(0px)" ],
other_values: [ "3%", "1px", "2em", // circular
"3% 2%", "1px 4px", "2em 2pt", // elliptical
"-moz-calc(2px)",
@ -740,7 +744,7 @@ var gCSSProperties = {
inherited: false,
type: CSS_TYPE_LONGHAND,
prerequisites: { "width": "200px", "height": "100px", "display": "inline-block"},
initial_values: [ "0", "0px", "0%" ],
initial_values: [ "0", "0px", "0%", "-moz-calc(-2px)", "-moz-calc(-1%)", "-moz-calc(0px)" ],
other_values: [ "3%", "1px", "2em", // circular
"3% 2%", "1px 4px", "2em 2pt", // elliptical
"-moz-calc(2px)",
@ -761,7 +765,7 @@ var gCSSProperties = {
type: CSS_TYPE_SHORTHAND_AND_LONGHAND,
get_computed: logical_box_prop_get_computed,
/* no subproperties */
initial_values: [ "0", "0px", "0%", "0em", "0ex" ],
initial_values: [ "0", "0px", "0%", "0em", "0ex", "-moz-calc(0pt)", "-moz-calc(0% + 0px)", "-moz-calc(-3px)", "-moz-calc(-1%)" ],
other_values: [ "1px", "3em",
"-moz-calc(2px)",
"-moz-calc(50%)",
@ -778,7 +782,7 @@ var gCSSProperties = {
type: CSS_TYPE_SHORTHAND_AND_LONGHAND,
get_computed: logical_box_prop_get_computed,
/* no subproperties */
initial_values: [ "0", "0px", "0%", "0em", "0ex" ],
initial_values: [ "0", "0px", "0%", "0em", "0ex", "-moz-calc(0pt)", "-moz-calc(0% + 0px)", "-moz-calc(-3px)", "-moz-calc(-1%)" ],
other_values: [ "1px", "3em",
"-moz-calc(2px)",
"-moz-calc(50%)",
@ -1475,6 +1479,7 @@ var gCSSProperties = {
initial_values: [ "auto" ],
other_values: [ "32px", "-3em", "12%",
"-moz-calc(2px)",
"-moz-calc(-2px)",
"-moz-calc(50%)",
"-moz-calc(3*25px)",
"-moz-calc(25px*3)",
@ -1720,6 +1725,7 @@ var gCSSProperties = {
domProp: "height",
inherited: false,
type: CSS_TYPE_LONGHAND,
/* FIXME: test zero, and test calc clamping */
initial_values: [ " auto" ],
/* computed value tests for height test more with display:block */
prerequisites: { "display": "block" },
@ -1751,6 +1757,7 @@ var gCSSProperties = {
initial_values: [ "auto" ],
other_values: [ "32px", "-3em", "12%",
"-moz-calc(2px)",
"-moz-calc(-2px)",
"-moz-calc(50%)",
"-moz-calc(3*25px)",
"-moz-calc(25px*3)",
@ -1855,9 +1862,10 @@ var gCSSProperties = {
inherited: false,
type: CSS_TYPE_LONGHAND,
/* XXX testing auto has prerequisites */
initial_values: [ "0", "0px", "0%" ],
initial_values: [ "0", "0px", "0%", "-moz-calc(0pt)", "-moz-calc(0% + 0px)" ],
other_values: [ "1px", "2em", "5%",
"-moz-calc(2px)",
"-moz-calc(-2px)",
"-moz-calc(50%)",
"-moz-calc(3*25px)",
"-moz-calc(25px*3)",
@ -1872,9 +1880,10 @@ var gCSSProperties = {
type: CSS_TYPE_SHORTHAND_AND_LONGHAND,
/* no subproperties */
/* XXX testing auto has prerequisites */
initial_values: [ "0", "0px", "0%" ],
initial_values: [ "0", "0px", "0%", "-moz-calc(0pt)", "-moz-calc(0% + 0px)" ],
other_values: [ "1px", "2em", "5%", ".5px", "+32px", "+.789px", "-.328px", "+0.56px", "-0.974px", "237px", "-289px", "-056px", "1987.45px", "-84.32px",
"-moz-calc(2px)",
"-moz-calc(-2px)",
"-moz-calc(50%)",
"-moz-calc(3*25px)",
"-moz-calc(25px*3)",
@ -1889,9 +1898,10 @@ var gCSSProperties = {
type: CSS_TYPE_SHORTHAND_AND_LONGHAND,
/* no subproperties */
/* XXX testing auto has prerequisites */
initial_values: [ "0", "0px", "0%" ],
initial_values: [ "0", "0px", "0%", "-moz-calc(0pt)", "-moz-calc(0% + 0px)" ],
other_values: [ "1px", "2em", "5%",
"-moz-calc(2px)",
"-moz-calc(-2px)",
"-moz-calc(50%)",
"-moz-calc(3*25px)",
"-moz-calc(25px*3)",
@ -1905,9 +1915,10 @@ var gCSSProperties = {
inherited: false,
type: CSS_TYPE_LONGHAND,
/* XXX testing auto has prerequisites */
initial_values: [ "0", "0px", "0%" ],
initial_values: [ "0", "0px", "0%", "-moz-calc(0pt)", "-moz-calc(0% + 0px)" ],
other_values: [ "1px", "2em", "5%",
"-moz-calc(2px)",
"-moz-calc(-2px)",
"-moz-calc(50%)",
"-moz-calc(3*25px)",
"-moz-calc(25px*3)",
@ -1942,6 +1953,8 @@ var gCSSProperties = {
initial_values: [ "none" ],
other_values: [ "30px", "50%", "0",
"-moz-calc(2px)",
"-moz-calc(-2px)",
"-moz-calc(0)",
"-moz-calc(50%)",
"-moz-calc(3*25px)",
"-moz-calc(25px*3)",
@ -1958,6 +1971,8 @@ var gCSSProperties = {
initial_values: [ "none" ],
other_values: [ "30px", "50%", "0", "-moz-max-content", "-moz-min-content", "-moz-fit-content", "-moz-available",
"-moz-calc(2px)",
"-moz-calc(-2px)",
"-moz-calc(0)",
"-moz-calc(50%)",
"-moz-calc(3*25px)",
"-moz-calc(25px*3)",
@ -1971,7 +1986,7 @@ var gCSSProperties = {
inherited: false,
type: CSS_TYPE_LONGHAND,
prerequisites: { "display": "block" },
initial_values: [ "0" ],
initial_values: [ "0", "-moz-calc(0em)", "-moz-calc(-2px)", "-moz-calc(-1%)" ],
other_values: [ "30px", "50%",
"-moz-calc(2px)",
"-moz-calc(50%)",
@ -1987,7 +2002,7 @@ var gCSSProperties = {
inherited: false,
type: CSS_TYPE_LONGHAND,
prerequisites: { "display": "block" },
initial_values: [ "0" ],
initial_values: [ "0", "-moz-calc(0em)", "-moz-calc(-2px)", "-moz-calc(-1%)" ],
other_values: [ "30px", "50%", "-moz-max-content", "-moz-min-content", "-moz-fit-content", "-moz-available",
"-moz-calc(2px)",
"-moz-calc(50%)",
@ -2098,7 +2113,7 @@ var gCSSProperties = {
inherited: false,
type: CSS_TYPE_TRUE_SHORTHAND,
subproperties: [ "padding-top", "padding-right", "padding-bottom", "padding-left" ],
initial_values: [ "0", "0px 0 0em", "0% 0px 0em 0pt" ],
initial_values: [ "0", "0px 0 0em", "0% 0px 0em 0pt", "-moz-calc(0) -moz-calc(0em) -moz-calc(-2px) -moz-calc(-1%)" ],
other_values: [ "3px 0", "2em 4px 2pt", "1em 2em 3px 4px" ],
invalid_values: []
},
@ -2106,7 +2121,7 @@ var gCSSProperties = {
domProp: "paddingBottom",
inherited: false,
type: CSS_TYPE_LONGHAND,
initial_values: [ "0", "0px", "0%" ],
initial_values: [ "0", "0px", "0%", "-moz-calc(0pt)", "-moz-calc(0% + 0px)", "-moz-calc(-3px)", "-moz-calc(-1%)" ],
other_values: [ "1px", "2em", "5%",
"-moz-calc(2px)",
"-moz-calc(50%)",
@ -2122,7 +2137,7 @@ var gCSSProperties = {
inherited: false,
type: CSS_TYPE_SHORTHAND_AND_LONGHAND,
/* no subproperties */
initial_values: [ "0", "0px", "0%" ],
initial_values: [ "0", "0px", "0%", "-moz-calc(0pt)", "-moz-calc(0% + 0px)", "-moz-calc(-3px)", "-moz-calc(-1%)" ],
other_values: [ "1px", "2em", "5%",
"-moz-calc(2px)",
"-moz-calc(50%)",
@ -2138,7 +2153,7 @@ var gCSSProperties = {
inherited: false,
type: CSS_TYPE_SHORTHAND_AND_LONGHAND,
/* no subproperties */
initial_values: [ "0", "0px", "0%" ],
initial_values: [ "0", "0px", "0%", "-moz-calc(0pt)", "-moz-calc(0% + 0px)", "-moz-calc(-3px)", "-moz-calc(-1%)" ],
other_values: [ "1px", "2em", "5%",
"-moz-calc(2px)",
"-moz-calc(50%)",
@ -2153,7 +2168,7 @@ var gCSSProperties = {
domProp: "paddingTop",
inherited: false,
type: CSS_TYPE_LONGHAND,
initial_values: [ "0", "0px", "0%" ],
initial_values: [ "0", "0px", "0%", "-moz-calc(0pt)", "-moz-calc(0% + 0px)", "-moz-calc(-3px)", "-moz-calc(-1%)" ],
other_values: [ "1px", "2em", "5%",
"-moz-calc(2px)",
"-moz-calc(50%)",
@ -2289,6 +2304,7 @@ var gCSSProperties = {
initial_values: [ "auto" ],
other_values: [ "32px", "-3em", "12%",
"-moz-calc(2px)",
"-moz-calc(-2px)",
"-moz-calc(50%)",
"-moz-calc(3*25px)",
"-moz-calc(25px*3)",
@ -2395,9 +2411,10 @@ var gCSSProperties = {
domProp: "textIndent",
inherited: true,
type: CSS_TYPE_LONGHAND,
initial_values: [ "0" ],
initial_values: [ "0", "-moz-calc(3em - 5em + 2px + 2em - 2px)" ],
other_values: [ "2em", "5%", "-10px",
"-moz-calc(2px)",
"-moz-calc(-2px)",
"-moz-calc(50%)",
"-moz-calc(3*25px)",
"-moz-calc(25px*3)",
@ -2420,6 +2437,8 @@ var gCSSProperties = {
"2px -moz-min(2px,0.2em)",
"blue 2px -moz-min(2px,0.2em)",
"2px -moz-min(2px,0.2em) blue",
"-moz-calc(-2px) -moz-calc(-2px)",
"-2px -2px",
"-moz-calc(2px) -moz-calc(2px)",
"-moz-calc(2px) -moz-calc(2px) -moz-calc(2px)",
],
@ -2445,6 +2464,7 @@ var gCSSProperties = {
initial_values: [ "auto" ],
other_values: [ "32px", "-3em", "12%",
"-moz-calc(2px)",
"-moz-calc(-2px)",
"-moz-calc(50%)",
"-moz-calc(3*25px)",
"-moz-calc(25px*3)",
@ -2509,6 +2529,7 @@ var gCSSProperties = {
initial_values: [ "baseline" ],
other_values: [ "sub", "super", "top", "text-top", "middle", "bottom", "text-bottom", "15%", "3px", "0.2em", "-5px", "-3%",
"-moz-calc(2px)",
"-moz-calc(-2px)",
"-moz-calc(50%)",
"-moz-calc(3*25px)",
"-moz-calc(25px*3)",

View File

@ -47,25 +47,32 @@ var gBadComputed = {
var gBadComputedNoFrame = {
// These are probably bogus tests...
"-moz-outline-radius": [ "0%" ],
"-moz-outline-radius-bottomleft": [ "0%" ],
"-moz-outline-radius-bottomright": [ "0%" ],
"-moz-outline-radius-topleft": [ "0%" ],
"-moz-outline-radius-topright": [ "0%" ],
"-moz-margin-end": [ "0%" ],
"-moz-margin-start": [ "0%" ],
"-moz-padding-end": [ "0%" ],
"-moz-padding-start": [ "0%" ],
"-moz-border-radius": [ "0%", "-moz-calc(-1%)", "-moz-calc(0px) -moz-calc(0pt) -moz-calc(0%) -moz-calc(0em)" ],
"-moz-border-radius-bottomleft": [ "0%", "-moz-calc(-1%)" ],
"-moz-border-radius-bottomright": [ "0%", "-moz-calc(-1%)" ],
"-moz-border-radius-topleft": [ "0%", "-moz-calc(-1%)" ],
"-moz-border-radius-topright": [ "0%", "-moz-calc(-1%)" ],
"-moz-margin-end": [ "0%", "-moz-calc(0% + 0px)", "-moz-calc(-1%)" ],
"-moz-margin-start": [ "0%", "-moz-calc(0% + 0px)", "-moz-calc(-1%)" ],
"-moz-outline-radius": [ "0%", "-moz-calc(-1%)", "-moz-calc(0px) -moz-calc(0pt) -moz-calc(0%) -moz-calc(0em)" ],
"-moz-outline-radius-bottomleft": [ "0%", "-moz-calc(-1%)" ],
"-moz-outline-radius-bottomright": [ "0%", "-moz-calc(-1%)" ],
"-moz-outline-radius-topleft": [ "0%", "-moz-calc(-1%)" ],
"-moz-outline-radius-topright": [ "0%", "-moz-calc(-1%)" ],
"-moz-padding-end": [ "0%", "-moz-calc(0% + 0px)", "-moz-calc(-1%)" ],
"-moz-padding-start": [ "0%", "-moz-calc(0% + 0px)", "-moz-calc(-1%)" ],
"margin": [ "0% 0px 0em 0pt" ],
"margin-bottom": [ "0%" ],
"margin-left": [ "0%" ],
"margin-right": [ "0%" ],
"margin-top": [ "0%" ],
"padding": [ "0% 0px 0em 0pt" ],
"padding-bottom": [ "0%" ],
"padding-left": [ "0%" ],
"padding-right": [ "0%" ],
"padding-top": [ "0%" ],
"margin-bottom": [ "0%", "-moz-calc(0% + 0px)" ],
"margin-left": [ "0%", "-moz-calc(0% + 0px)" ],
"margin-right": [ "0%", "-moz-calc(0% + 0px)" ],
"margin-top": [ "0%", "-moz-calc(0% + 0px)" ],
"min-height": [ "-moz-calc(-1%)" ],
"min-width": [ "-moz-calc(-1%)" ],
"padding": [ "0% 0px 0em 0pt", "-moz-calc(0) -moz-calc(0em) -moz-calc(-2px) -moz-calc(-1%)" ],
"padding-bottom": [ "0%", "-moz-calc(0% + 0px)", "-moz-calc(-1%)" ],
"padding-left": [ "0%", "-moz-calc(0% + 0px)", "-moz-calc(-1%)" ],
"padding-right": [ "0%", "-moz-calc(0% + 0px)", "-moz-calc(-1%)" ],
"padding-top": [ "0%", "-moz-calc(0% + 0px)", "-moz-calc(-1%)" ],
};
function xfail_value(property, value, is_initial, has_frame) {