Bug 393910 - Serialize "0" as "0px" for lengths instead of "0pt"; r=dbaron

This commit is contained in:
Aryeh Gregor 2012-02-14 10:54:08 -05:00
parent 6ae9126bcf
commit 7dd4ea9e29
4 changed files with 10 additions and 5 deletions

View File

@ -49,7 +49,7 @@ function attr_modified(ev) {
e_prev = e_new;
if (!recursive) {
recursive = true;
e_new = "width: 0pt;";
e_new = "width: 0px;";
testDiv.style.width = "0";
} else {
recursive = false;

View File

@ -4331,7 +4331,7 @@ CSSParserImpl::TranslateDimension(nsCSSValue& aValue,
// Must be a zero number...
NS_ASSERTION(0 == aNumber, "numbers without units must be 0");
if ((VARIANT_LENGTH & aVariantMask) != 0) {
units = eCSSUnit_Point;
units = eCSSUnit_Pixel;
type = VARIANT_LENGTH;
}
else if ((VARIANT_ANGLE & aVariantMask) != 0) {

View File

@ -71,12 +71,12 @@ is(bounce.cssRules[0].keyText, "0%", "keyframe rule keyText");
is(bounce.cssRules[1].keyText, "25%", "keyframe rule keyText");
is(bounce.cssRules[2].keyText, "75%, 85%", "keyframe rule keyText");
is(bounce.cssRules[3].keyText, "100%", "keyframe rule keyText");
is(bounce.cssRules[0].style.marginLeft, "0pt", "keyframe rule style");
is(bounce.cssRules[0].style.marginLeft, "0px", "keyframe rule style");
is(bounce.cssRules[1].style.marginLeft, "25px", "keyframe rule style");
is(bounce.cssRules[0].cssText, "0% { margin-left: 0pt; }");
is(bounce.cssRules[0].cssText, "0% { margin-left: 0px; }");
is(bounce.cssText, "@-moz-keyframes bouncier {\n" +
"0% { margin-left: 0pt; }\n" +
"0% { margin-left: 0px; }\n" +
"25% { margin-left: 25px; }\n" +
"75%, 85% { margin-left: 90px; }\n" +
"100% { margin-left: 100px; }\n" +

View File

@ -48,6 +48,11 @@ for (var test in tests) {
}
}
// Bug 393910
p.setAttribute("style", "margin-left: 0");
is(p.style.getPropertyValue("margin-left"), "0px",
"0 serializes to 0px");
</script>
</pre>
</body>