min-width/height should not affect computed max-width or max-height. Both ofthem should affect computed width and height, though. Bug 371042, r+sr=dbaron

This commit is contained in:
bzbarsky@mit.edu 2007-04-23 00:04:33 -07:00
parent e53440116d
commit fe52a23803
3 changed files with 291 additions and 81 deletions

View File

@ -2177,10 +2177,19 @@ nsComputedDOMStyle::GetHeight(nsIDOMCSSValue** aValue)
val->SetAppUnits(mFrame->GetContentRect().height);
} else {
// Just return the value in the style context
// XXXbz if not mFrame, why aren't we including the min-height the
// way max-height does?
SetValueToCoord(val, GetStylePosition()->mHeight);
const nsStylePosition *positionData = GetStylePosition();
nscoord minHeight =
StyleCoordToNSCoord(positionData->mMinHeight,
&nsComputedDOMStyle::GetCBContentHeight, 0);
nscoord maxHeight =
StyleCoordToNSCoord(positionData->mMaxHeight,
&nsComputedDOMStyle::GetCBContentHeight,
nscoord_MAX);
SetValueToCoord(val, positionData->mHeight, nsnull, nsnull,
minHeight, maxHeight);
}
return CallQueryInterface(val, aValue);
@ -2209,10 +2218,19 @@ nsComputedDOMStyle::GetWidth(nsIDOMCSSValue** aValue)
val->SetAppUnits(mFrame->GetContentRect().width);
} else {
// Just return the value in the style context
// XXXbz if not mFrame, why aren't we including the min-width the
// way max-width does?
SetValueToCoord(val, GetStylePosition()->mWidth);
const nsStylePosition *positionData = GetStylePosition();
nscoord minWidth =
StyleCoordToNSCoord(positionData->mMinWidth,
&nsComputedDOMStyle::GetCBContentWidth, 0);
nscoord maxWidth =
StyleCoordToNSCoord(positionData->mMaxWidth,
&nsComputedDOMStyle::GetCBContentWidth,
nscoord_MAX);
SetValueToCoord(val, positionData->mWidth, nsnull, nsnull,
minWidth, maxWidth);
}
return CallQueryInterface(val, aValue);
@ -2224,15 +2242,8 @@ nsComputedDOMStyle::GetMaxHeight(nsIDOMCSSValue** aValue)
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
const nsStylePosition *positionData = GetStylePosition();
nscoord minHeight =
StyleCoordToNSCoord(positionData->mMinHeight,
&nsComputedDOMStyle::GetCBContentHeight);
SetValueToCoord(val, positionData->mMaxHeight,
&nsComputedDOMStyle::GetCBContentHeight,
nsnull, minHeight);
SetValueToCoord(val, GetStylePosition()->mMaxHeight,
&nsComputedDOMStyle::GetCBContentHeight);
return CallQueryInterface(val, aValue);
}
@ -2243,15 +2254,8 @@ nsComputedDOMStyle::GetMaxWidth(nsIDOMCSSValue** aValue)
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
const nsStylePosition *positionData = GetStylePosition();
nscoord minWidth =
StyleCoordToNSCoord(positionData->mMinWidth,
&nsComputedDOMStyle::GetCBContentWidth);
SetValueToCoord(val, positionData->mMaxWidth,
&nsComputedDOMStyle::GetCBContentWidth,
nsnull, minWidth);
SetValueToCoord(val, GetStylePosition()->mMaxWidth,
&nsComputedDOMStyle::GetCBContentWidth);
return CallQueryInterface(val, aValue);
}
@ -2699,10 +2703,11 @@ nsComputedDOMStyle::GetBorderStyleFor(PRUint8 aSide, nsIDOMCSSValue** aValue)
void
nsComputedDOMStyle::SetValueToCoord(nsROCSSPrimitiveValue* aValue,
nsStyleCoord aCoord,
const nsStyleCoord& aCoord,
PercentageBaseGetter aPercentageBaseGetter,
const PRInt32 aTable[],
nscoord aMinAppUnits)
nscoord aMinAppUnits,
nscoord aMaxAppUnits)
{
NS_PRECONDITION(aValue, "Must have a value to work with");
@ -2721,7 +2726,7 @@ nsComputedDOMStyle::SetValueToCoord(nsROCSSPrimitiveValue* aValue,
if (aPercentageBaseGetter &&
(this->*aPercentageBaseGetter)(percentageBase)) {
nscoord val = nscoord(aCoord.GetPercentValue() * percentageBase);
aValue->SetAppUnits(PR_MAX(aMinAppUnits, val));
aValue->SetAppUnits(PR_MAX(aMinAppUnits, PR_MIN(val, aMaxAppUnits)));
} else {
aValue->SetPercent(aCoord.GetPercentValue());
}
@ -2735,7 +2740,7 @@ nsComputedDOMStyle::SetValueToCoord(nsROCSSPrimitiveValue* aValue,
case eStyleUnit_Coord:
{
nscoord val = aCoord.GetCoordValue();
aValue->SetAppUnits(PR_MAX(aMinAppUnits, val));
aValue->SetAppUnits(PR_MAX(aMinAppUnits, PR_MIN(val, aMaxAppUnits)));
}
break;
@ -2766,8 +2771,9 @@ nsComputedDOMStyle::SetValueToCoord(nsROCSSPrimitiveValue* aValue,
}
nscoord
nsComputedDOMStyle::StyleCoordToNSCoord(nsStyleCoord aCoord,
PercentageBaseGetter aPercentageBaseGetter)
nsComputedDOMStyle::StyleCoordToNSCoord(const nsStyleCoord& aCoord,
PercentageBaseGetter aPercentageBaseGetter,
nscoord aDefaultValue)
{
NS_PRECONDITION(aPercentageBaseGetter, "Must have a percentage base getter");
switch (aCoord.GetUnit()) {
@ -2780,12 +2786,12 @@ nsComputedDOMStyle::StyleCoordToNSCoord(nsStyleCoord aCoord,
return nscoord(aCoord.GetPercentValue() * percentageBase);
}
}
// Fall through to returning 0 if we have no percentage base
// Fall through to returning aDefaultValue if we have no percentage base.
default:
break;
}
return 0;
return aDefaultValue;
}
PRBool

View File

@ -287,25 +287,28 @@ private:
* the percent value of aCoord is set as a percent value on aValue. aTable,
* if not null, is the keyword table to handle eStyleUnit_Enumerated. When
* calling SetAppUnits on aValue (for coord or percent values), the value
* passed in will be PR_MAX of the actual value in aCoord and the value in
* aMinAppUnits.
* passed in will be PR_MAX of the value in aMinAppUnits and the PR_MIN of
* the actual value in aCoord and the value in aMaxAppUnits.
*
* XXXbz should caller pass in some sort of bitfield indicating which units
* can be expected or something?
*/
void SetValueToCoord(nsROCSSPrimitiveValue* aValue, nsStyleCoord aCoord,
void SetValueToCoord(nsROCSSPrimitiveValue* aValue,
const nsStyleCoord& aCoord,
PercentageBaseGetter aPercentageBaseGetter = nsnull,
const PRInt32 aTable[] = nsnull,
nscoord aMinAppUnits = nscoord_MIN);
nscoord aMinAppUnits = nscoord_MIN,
nscoord aMaxAppUnits = nscoord_MAX);
/**
* If aCoord is a eStyleUnit_Coord returns the nscoord. If it's
* eStyleUnit_Percent, attempts to resolve the percentage base and returns the
* resulting nscoord. If it's some other unit or a percentge base can't be
* determined, returns 0.
* eStyleUnit_Percent, attempts to resolve the percentage base and returns
* the resulting nscoord. If it's some other unit or a percentge base can't
* be determined, returns aDefaultValue.
*/
nscoord StyleCoordToNSCoord(nsStyleCoord aCoord,
PercentageBaseGetter aPercentageBaseGetter);
nscoord StyleCoordToNSCoord(const nsStyleCoord& aCoord,
PercentageBaseGetter aPercentageBaseGetter,
nscoord aDefaultValue);
PRBool GetFrameContentWidth(nscoord& aWidth);
PRBool GetCBContentWidth(nscoord& aWidth);

View File

@ -11,6 +11,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=365932
<style>
#content {
width: 800px;
height: 800px;
padding: 0 200px;
border-width: 0 200px;
border-style: solid;
@ -21,11 +22,17 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=365932
}
#content > div, #content2 > div {
width: 400px;
height: 400px;
padding: 0 100px;
border-width: 0 100px;
border-style: solid;
border-color: transparent
}
#content > div.auto, #content2 > div.auto {
width: auto; height: auto;
padding: 0 100px;
border-width: 0 80px;
}
</style>
</head>
<body>
@ -37,10 +44,110 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=365932
<div id="indent1" style="text-indent: 400px"></div>
<div id="indent2" style="text-indent: 50%"></div>
<div id="widthheight-1" class="auto"></div>
<div id="minwidth1-1" style="min-width: 200px"></div>
<div id="minwidth1-2" style="min-width: 25%"></div>
<div id="minwidth2-1" style="min-width: 600px"></div>
<div id="minwidth2-2" style="min-width: 75%"></div>
<div id="minwidth3-1" class="auto" style="min-width: 200px"></div>
<div id="minwidth3-2" class="auto" style="min-width: 25%"></div>
<div id="minwidth4-1" class="auto" style="min-width: 600px"></div>
<div id="minwidth4-2" class="auto" style="min-width: 75%"></div>
<div id="maxwidth1-1" style="max-width: 320px"></div>
<div id="maxwidth1-2" style="max-width: 40%"></div>
<div id="maxwidth2-1" style="max-width: 480px"></div>
<div id="maxwidth2-2" style="max-width: 60%"></div>
<div id="maxwidth3-1" class="auto" style="max-width: 320px"></div>
<div id="maxwidth3-2" class="auto" style="max-width: 40%"></div>
<div id="maxwidth4-1" class="auto" style="max-width: 480px"></div>
<div id="maxwidth4-2" class="auto" style="max-width: 60%"></div>
<div id="minmaxwidth1-1" style="min-width: 200px; max-width: 320px"></div>
<div id="minmaxwidth1-2" style="min-width: 200px; max-width: 40%"></div>
<div id="minmaxwidth2-1" style="min-width: 25%; max-width: 320px"></div>
<div id="minmaxwidth2-2" style="min-width: 25%; max-width: 40%"></div>
<div id="minmaxwidth3-1" style="min-width: 600px; max-width: 320px"></div>
<div id="minmaxwidth3-2" style="min-width: 600px; max-width: 40%"></div>
<div id="minmaxwidth4-1" style="min-width: 75%; max-width: 320px"></div>
<div id="minmaxwidth4-2" style="min-width: 75%; max-width: 40%"></div>
<div id="minmaxwidth5-1"
style="display:none; min-width: 200px; max-width: 320px"></div>
<div id="minmaxwidth6-1"
style="display: none; min-width: 25%; max-width: 320px"></div>
<div id="minmaxwidth7-1"
style="display: none; min-width: 600px; max-width: 320px"></div>
<div id="minmaxwidth7-2"
style="display: none; min-width: 600px; max-width: 40%"></div>
<div id="minmaxwidth8-1" class="auto"
style="min-width: 200px; max-width: 320px"></div>
<div id="minmaxwidth8-2" class="auto"
style="min-width: 200px; max-width: 40%"></div>
<div id="minmaxwidth9-1" class="auto"
style="min-width: 25%; max-width: 320px"></div>
<div id="minmaxwidth9-2" class="auto"
style="min-width: 25%; max-width: 40%"></div>
<div id="minmaxwidth10-1" class="auto"
style="min-width: 600px; max-width: 320px"></div>
<div id="minmaxwidth10-2" class="auto"
style="min-width: 600px; max-width: 40%"></div>
<div id="minmaxwidth11-1" class="auto"
style="min-width: 75%; max-width: 320px"></div>
<div id="minmaxwidth11-2" class="auto"
style="min-width: 75%; max-width: 40%"></div>
<div id="minheight1-1" style="min-height: 200px"></div>
<div id="minheight1-2" style="min-height: 25%"></div>
<div id="minheight2-1" style="min-height: 600px"></div>
<div id="minheight2-2" style="min-height: 75%"></div>
<div id="minheight3-1" class="auto" style="min-height: 200px"></div>
<div id="minheight3-2" class="auto" style="min-height: 25%"></div>
<div id="minheight4-1" class="auto" style="min-height: 600px"></div>
<div id="minheight4-2" class="auto" style="min-height: 75%"></div>
<div id="maxheight1-1" style="max-height: 320px"></div>
<div id="maxheight1-2" style="max-height: 40%"></div>
<div id="maxheight2-1" style="max-height: 480px"></div>
<div id="maxheight2-2" style="max-height: 60%"></div>
<div id="maxheight3-1" class="auto" style="max-height: 320px"></div>
<div id="maxheight3-2" class="auto" style="max-height: 40%"></div>
<div id="maxheight4-1" class="auto" style="max-height: 480px"></div>
<div id="maxheight4-2" class="auto" style="max-height: 60%"></div>
<div id="minmaxheight1-1" style="min-height: 200px; max-height: 320px"></div>
<div id="minmaxheight1-2" style="min-height: 200px; max-height: 40%"></div>
<div id="minmaxheight2-1" style="min-height: 25%; max-height: 320px"></div>
<div id="minmaxheight2-2" style="min-height: 25%; max-height: 40%"></div>
<div id="minmaxheight3-1" style="min-height: 600px; max-height: 320px"></div>
<div id="minmaxheight3-2" style="min-height: 600px; max-height: 40%"></div>
<div id="minmaxheight4-1" style="min-height: 75%; max-height: 320px"></div>
<div id="minmaxheight4-2" style="min-height: 75%; max-height: 40%"></div>
<div id="minmaxheight5-1"
style="display:none; min-height: 200px; max-height: 320px"></div>
<div id="minmaxheight6-1"
style="display: none; min-height: 25%; max-height: 320px"></div>
<div id="minmaxheight7-1"
style="display: none; min-height: 600px; max-height: 320px"></div>
<div id="minmaxheight7-2"
style="display: none; min-height: 600px; max-height: 40%"></div>
<div id="minmaxheight8-1" class="auto"
style="min-height: 200px; max-height: 320px"></div>
<div id="minmaxheight8-2" class="auto"
style="min-height: 200px; max-height: 40%"></div>
<div id="minmaxheight9-1" class="auto"
style="min-height: 25%; max-height: 320px"></div>
<div id="minmaxheight9-2" class="auto"
style="min-height: 25%; max-height: 40%"></div>
<div id="minmaxheight10-1" class="auto"
style="min-height: 600px; max-height: 320px"></div>
<div id="minmaxheight10-2" class="auto"
style="min-height: 600px; max-height: 40%"></div>
<div id="minmaxheight11-1" class="auto"
style="min-height: 75%; max-height: 320px"></div>
<div id="minmaxheight11-2" class="auto"
style="min-height: 75%; max-height: 40%"></div>
<div id="radius1" style="-moz-border-radius: 80px"></div>
<div id="radius2" style="-moz-border-radius: 10%"></div>
<div id="outlineradius1" style="-moz-outline-radius: 160px"></div>
@ -56,6 +163,40 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=365932
<div id="minwidth1-4" style="min-width: 25%"></div>
<div id="minwidth2-3" style="min-width: 600px"></div>
<div id="minwidth2-4" style="min-width: 75%"></div>
<div id="maxwidth1-3" style="max-width: 320px"></div>
<div id="maxwidth1-4" style="max-width: 40%"></div>
<div id="maxwidth2-3" style="max-width: 480px"></div>
<div id="maxwidth2-4" style="max-width: 60%"></div>
<div id="minmaxwidth1-3" style="min-width: 200px; max-width: 320px"></div>
<div id="minmaxwidth1-4" style="min-width: 200px; max-width: 40%"></div>
<div id="minmaxwidth2-3" style="min-width: 25%; max-width: 320px"></div>
<div id="minmaxwidth2-4" style="min-width: 25%; max-width: 40%"></div>
<div id="minmaxwidth3-3" style="min-width: 600px; max-width: 320px"></div>
<div id="minmaxwidth3-4" style="min-width: 600px; max-width: 40%"></div>
<div id="minmaxwidth4-3" style="min-width: 75%; max-width: 320px"></div>
<div id="minmaxwidth4-4" style="min-width: 75%; max-width: 40%"></div>
<div id="minheight1-3" style="min-height: 200px"></div>
<div id="minheight1-4" style="min-height: 25%"></div>
<div id="minheight2-3" style="min-height: 600px"></div>
<div id="minheight2-4" style="min-height: 75%"></div>
<div id="maxheight1-3" style="max-height: 320px"></div>
<div id="maxheight1-4" style="max-height: 40%"></div>
<div id="maxheight2-3" style="max-height: 480px"></div>
<div id="maxheight2-4" style="max-height: 60%"></div>
<div id="minmaxheight1-3" style="min-height: 200px; max-height: 320px"></div>
<div id="minmaxheight1-4" style="min-height: 200px; max-height: 40%"></div>
<div id="minmaxheight2-3" style="min-height: 25%; max-height: 320px"></div>
<div id="minmaxheight2-4" style="min-height: 25%; max-height: 40%"></div>
<div id="minmaxheight3-3" style="min-height: 600px; max-height: 320px"></div>
<div id="minmaxheight3-4" style="min-height: 600px; max-height: 40%"></div>
<div id="minmaxheight4-3" style="min-height: 75%; max-height: 320px"></div>
<div id="minmaxheight4-4" style="min-height: 75%; max-height: 40%"></div>
<div id="radius3" style="-moz-border-radius: 80px"></div>
<div id="radius4" style="-moz-border-radius: 10%"></div>
<div id="outlineradius3" style="-moz-outline-radius: 160px"></div>
@ -70,12 +211,76 @@ document.body.offsetWidth;
doATest("-moz-column-gap", "column", 200, 50);
doATest("text-indent", "indent", 400, 50);
//doATest("min-width", "minwidth1-", 200, 25);
//doATest("min-width", "minwidth2-", 600, 75);
// doATest("width", "minwidth2-", 600, 0);
doATest("-moz-border-radius-topleft", "radius", 80, 10);
doATest("-moz-outline-radius-topleft", "outlineradius", 160, 20);
doATest("width", "widthheight-", 440, 0);
doATest("height", "widthheight-", 0, 0);
doATest("min-width", "minwidth1-", 200, 25);
doATest("min-width", "minwidth2-", 600, 75);
doATest("max-width", "maxwidth1-", 320, 40);
doATest("max-width", "maxwidth2-", 480, 60);
// Test that min-width doesn't affect computed max-width
doATest("max-width", "minmaxwidth1-", 320, 40);
doATest("max-width", "minmaxwidth2-", 320, 40);
doATest("max-width", "minmaxwidth3-", 320, 40);
doATest("max-width", "minmaxwidth4-", 320, 40);
// Test that max and min-width affect computed width correctly
doATest("width", "minwidth1-", 400, 0);
doATest("width", "minwidth2-", 600, 0);
doATest("width", "minwidth3-", 440, 0);
doATest("width", "minwidth4-", 600, 0);
doATest("width", "maxwidth1-", 320, 0);
doATest("width", "maxwidth2-", 400, 0);
doATest("width", "maxwidth3-", 320, 0);
doATest("width", "maxwidth4-", 440, 0);
doATest("width", "minmaxwidth1-", 320, 0);
doATest("width", "minmaxwidth2-", 320, 0);
doATest("width", "minmaxwidth3-", 600, 0);
doATest("width", "minmaxwidth4-", 600, 0);
doATest("width", "minmaxwidth5-", 320, 0);
doATest("width", "minmaxwidth6-", 320, 0);
doATest("width", "minmaxwidth7-", 600, 0);
doATest("width", "minmaxwidth8-", 320, 0);
doATest("width", "minmaxwidth9-", 320, 0);
doATest("width", "minmaxwidth10-", 600, 0);
doATest("width", "minmaxwidth11-", 600, 0);
doATest("min-height", "minheight1-", 200, 25);
doATest("min-height", "minheight2-", 600, 75);
doATest("max-height", "maxheight1-", 320, 40);
doATest("max-height", "maxheight2-", 480, 60);
// Test that min-height doesn't affect computed max-height
doATest("max-height", "minmaxheight1-", 320, 40);
doATest("max-height", "minmaxheight2-", 320, 40);
doATest("max-height", "minmaxheight3-", 320, 40);
doATest("max-height", "minmaxheight4-", 320, 40);
// Test that max and min-height affect computed height correctly
doATest("height", "minheight1-", 400, 0);
doATest("height", "minheight2-", 600, 0);
doATest("height", "minheight3-", 200, 0);
doATest("height", "minheight4-", 600, 0);
doATest("height", "maxheight1-", 320, 0);
doATest("height", "maxheight2-", 400, 0);
doATest("height", "maxheight3-", 0, 0);
doATest("height", "maxheight4-", 0, 0);
doATest("height", "minmaxheight1-", 320, 0);
doATest("height", "minmaxheight2-", 320, 0);
doATest("height", "minmaxheight3-", 600, 0);
doATest("height", "minmaxheight4-", 600, 0);
doATest("height", "minmaxheight5-", 320, 0);
doATest("height", "minmaxheight6-", 320, 0);
doATest("height", "minmaxheight7-", 600, 0);
doATest("height", "minmaxheight8-", 200, 0);
doATest("height", "minmaxheight9-", 200, 0);
doATest("height", "minmaxheight10-", 600, 0);
doATest("height", "minmaxheight11-", 600, 0);
function style(id) {
return document.defaultView.getComputedStyle($(id), "");
}
@ -110,78 +315,74 @@ function doATest(propName, idBase, coordVal, percentVal)
}
var decl = style(idBase+"1");
var prettyName = propName + " of " + idBase+"1";
is(decl[cssPropertiesPropName], coordVal+"px",
"Coord " + propName + " displayed");
is(decl[cssPropertiesPropName], coordVal+"px", prettyName);
is(decl.getPropertyCSSValue(propName).cssValueType,
CSSValue.CSS_PRIMITIVE_VALUE,
"displayed coord " + propName + " is primitive value");
CSSValue.CSS_PRIMITIVE_VALUE, prettyName + " is primitive value");
is(decl.getPropertyCSSValue(propName).primitiveType,
CSSPrimitiveValue.CSS_PX, "displayed coord " + propName + " is px");
CSSPrimitiveValue.CSS_PX, prettyName + " is px");
is(decl.getPropertyCSSValue(propName).cssText, coordVal + "px",
"displayed coord " + propName + " length");
prettyName + " cssText");
/* Since floats are only accurate to like 6 decimal places, round to 3 decimal
places here. */
is(round(decl.getPropertyCSSValue(propName)
.getFloatValue(CSSPrimitiveValue.CSS_PX),
3),
coordVal, "displayed coord " + propName + " length as float value");
3), coordVal, prettyName + " as float value");
if (!$(idBase+"2")) {
// Nothing else to do here
return
}
decl = style(idBase+"2");
prettyName = propName + " of " + idBase+"2";
is(decl[cssPropertiesPropName], coordVal+"px",
"Percent " + propName + " displayed");
is(decl[cssPropertiesPropName], coordVal+"px", prettyName);
is(decl.getPropertyCSSValue(propName).cssValueType,
CSSValue.CSS_PRIMITIVE_VALUE,
"displayed percent " + propName + " is primitive value");
CSSValue.CSS_PRIMITIVE_VALUE, prettyName + " is primitive value");
is(decl.getPropertyCSSValue(propName).primitiveType,
CSSPrimitiveValue.CSS_PX, "displayed percent " + propName + " is px");
is(decl.getPropertyCSSValue(propName).cssText, coordVal+"px",
"displayed percent " + propName + " length");
CSSPrimitiveValue.CSS_PX, prettyName + " is px");
is(decl.getPropertyCSSValue(propName).cssText, coordVal + "px",
prettyName + " cssText");
/* Since floats are only accurate to like 6 decimal places, round to 3 decimal
places here. */
is(round(decl.getPropertyCSSValue(propName)
.getFloatValue(CSSPrimitiveValue.CSS_PX),
3),
coordVal, "displayed percent " + propName + " length as float value");
3), coordVal, prettyName + " as float value");
if (percentVal) {
decl = style(idBase+"3");
prettyName = propName + " of " + idBase+"3";
is(decl[cssPropertiesPropName], coordVal+"px",
"Coord " + propName +" undisplayed");
is(decl[cssPropertiesPropName], coordVal+"px", prettyName);
is(decl.getPropertyCSSValue(propName).cssValueType,
CSSValue.CSS_PRIMITIVE_VALUE,
"undisplayed coord " + propName + " is primitive value");
CSSValue.CSS_PRIMITIVE_VALUE, prettyName + " is primitive value");
is(decl.getPropertyCSSValue(propName).primitiveType,
CSSPrimitiveValue.CSS_PX, "undisplayed coord " + propName + " is px");
is(decl.getPropertyCSSValue(propName).cssText, coordVal+"px",
"undisplayed coord " + propName + " length");
CSSPrimitiveValue.CSS_PX, prettyName + " is px");
is(decl.getPropertyCSSValue(propName).cssText, coordVal + "px",
prettyName + " cssText");
/* Since floats are only accurate to like 6 decimal places, round to 3 decimal
places here. */
is(round(decl.getPropertyCSSValue(propName)
.getFloatValue(CSSPrimitiveValue.CSS_PX),
3),
coordVal, "undisplayed coord " + propName + " length as float value");
3), coordVal, prettyName + " as float value");
decl = style(idBase+"4");
prettyName = propName + " of " + idBase+"4";
is(decl[cssPropertiesPropName], percentVal+"%",
"Percent " + propName + " undisplayed");
is(decl[cssPropertiesPropName], percentVal+"%", prettyName);
is(decl.getPropertyCSSValue(propName).cssValueType,
CSSValue.CSS_PRIMITIVE_VALUE,
"undisplayed percent " + propName + " is primitive value");
CSSValue.CSS_PRIMITIVE_VALUE, prettyName + " is primitive value");
is(decl.getPropertyCSSValue(propName).primitiveType,
CSSPrimitiveValue.CSS_PERCENTAGE,
"undisplayed percent " + propName + " is percent");
CSSPrimitiveValue.CSS_PERCENTAGE, prettyName + " is percent");
is(decl.getPropertyCSSValue(propName).cssText, percentVal+"%",
"undisplayed percent " + propName + " length");
prettyName + " cssText");
/* Since floats are only accurate to like 6 decimal places, round to 3 decimal
places here. */
is(round(decl.getPropertyCSSValue(propName)
.getFloatValue(CSSPrimitiveValue.CSS_PERCENTAGE),
3),
percentVal, "undisplayed percent " + propName + " percentage as float value");
3), percentVal, prettyName + " as float value");
}
}