зеркало из https://github.com/mozilla/gecko-dev.git
In contexts where the CSS parser accepts numbers and lengths, treat unitless zero as a number rather than a length. (Bug 595648) r=bzbarsky,dholbert a=blocking2.0:betaN+
This patch has the side-effect of changing the representation of '0' values in properties added by SVG to use the number representation rather than the length representation. This requires marking the stroke-dashoffset:0 test in test_value_computation.html as known to fail, since computed style code now returns 0 rather than 0px, and also requires changing some inputs and results in some SMIL tests (which seems like it's showing a bug that we can't interpolate between equivalent values when we ought to be able to do so).
This commit is contained in:
Родитель
ec8cc2fa4b
Коммит
c64142dd70
|
@ -61,7 +61,7 @@ var _fromByTestLists =
|
|||
toComp: "40px"}),
|
||||
],
|
||||
lengthNoUnitsSVG: [
|
||||
new AnimTestcaseFromBy("0", "50", { fromComp: "0px", // 0 acts like 0px
|
||||
new AnimTestcaseFromBy("0", "50", { fromComp: "0",
|
||||
midComp: "25",
|
||||
toComp: "50"}),
|
||||
new AnimTestcaseFromBy("30", "10", { fromComp: "30",
|
||||
|
@ -69,9 +69,9 @@ var _fromByTestLists =
|
|||
toComp: "40"}),
|
||||
],
|
||||
lengthPx: [
|
||||
new AnimTestcaseFromBy("0", "8px", { fromComp: "0px", // 0 acts like 0px
|
||||
midComp: "4px",
|
||||
toComp: "8px"}),
|
||||
new AnimTestcaseFromBy("0px", "8px", { fromComp: "0px",
|
||||
midComp: "4px",
|
||||
toComp: "8px"}),
|
||||
new AnimTestcaseFromBy("1px", "10px", { midComp: "6px", toComp: "11px"}),
|
||||
],
|
||||
opacity: [
|
||||
|
|
|
@ -117,21 +117,21 @@ var _fromToTestLists = {
|
|||
toComp: "80px"}),
|
||||
],
|
||||
lengthNoUnitsSVG: [
|
||||
new AnimTestcaseFromTo("0", "20", { fromComp: "0px", // 0 acts like 0px
|
||||
new AnimTestcaseFromTo("0", "20", { fromComp: "0",
|
||||
midComp: "10",
|
||||
toComp: "20"}),
|
||||
new AnimTestcaseFromTo("50", "0", { fromComp: "50",
|
||||
midComp: "25",
|
||||
toComp: "0px"}), // 0 acts like 0px
|
||||
toComp: "0"}),
|
||||
new AnimTestcaseFromTo("30", "80", { fromComp: "30",
|
||||
midComp: "55",
|
||||
toComp: "80"}),
|
||||
],
|
||||
lengthPx: [
|
||||
new AnimTestcaseFromTo("0", "12px", { fromComp: "0px", // 0 acts like 0px
|
||||
midComp: "6px"}),
|
||||
new AnimTestcaseFromTo("16px", "0", { midComp: "8px",
|
||||
toComp: "0px"}), // 0 acts like 0px
|
||||
new AnimTestcaseFromTo("0px", "12px", { fromComp: "0px",
|
||||
midComp: "6px"}),
|
||||
new AnimTestcaseFromTo("16px", "0px", { midComp: "8px",
|
||||
toComp: "0px"}),
|
||||
new AnimTestcaseFromTo("10px", "20px", { midComp: "15px"}),
|
||||
new AnimTestcaseFromTo("41px", "1px", { midComp: "21px"}),
|
||||
],
|
||||
|
|
|
@ -112,7 +112,7 @@ var _pacedTestLists =
|
|||
new AnimTestcasePaced("2; 0; 4",
|
||||
{ comp0: "2",
|
||||
comp1_6: "1",
|
||||
comp1_3: "0px", // 0 acts like 0px
|
||||
comp1_3: "0",
|
||||
comp2_3: "2",
|
||||
comp1: "4"
|
||||
}),
|
||||
|
@ -125,8 +125,8 @@ var _pacedTestLists =
|
|||
}),
|
||||
],
|
||||
lengthPx : [
|
||||
new AnimTestcasePaced("0; 2px; 6px",
|
||||
{ comp0: "0px", // 0 acts like 0px
|
||||
new AnimTestcasePaced("0px; 2px; 6px",
|
||||
{ comp0: "0px",
|
||||
comp1_6: "1px",
|
||||
comp1_3: "2px",
|
||||
comp2_3: "4px",
|
||||
|
|
|
@ -4359,6 +4359,18 @@ CSSParserImpl::ParseVariant(nsCSSValue& aValue,
|
|||
}
|
||||
}
|
||||
}
|
||||
// Check VARIANT_NUMBER and VARIANT_INTEGER before VARIANT_LENGTH or
|
||||
// VARIANT_ZERO_ANGLE.
|
||||
if (((aVariantMask & VARIANT_NUMBER) != 0) &&
|
||||
(eCSSToken_Number == tk->mType)) {
|
||||
aValue.SetFloatValue(tk->mNumber, eCSSUnit_Number);
|
||||
return PR_TRUE;
|
||||
}
|
||||
if (((aVariantMask & VARIANT_INTEGER) != 0) &&
|
||||
(eCSSToken_Number == tk->mType) && tk->mIntegerValid) {
|
||||
aValue.SetIntValue(tk->mInteger, eCSSUnit_Integer);
|
||||
return PR_TRUE;
|
||||
}
|
||||
if (((aVariantMask & (VARIANT_LENGTH | VARIANT_ANGLE |
|
||||
VARIANT_FREQUENCY | VARIANT_TIME)) != 0 &&
|
||||
eCSSToken_Dimension == tk->mType) ||
|
||||
|
@ -4377,16 +4389,6 @@ CSSParserImpl::ParseVariant(nsCSSValue& aValue,
|
|||
aValue.SetPercentValue(tk->mNumber);
|
||||
return PR_TRUE;
|
||||
}
|
||||
if (((aVariantMask & VARIANT_NUMBER) != 0) &&
|
||||
(eCSSToken_Number == tk->mType)) {
|
||||
aValue.SetFloatValue(tk->mNumber, eCSSUnit_Number);
|
||||
return PR_TRUE;
|
||||
}
|
||||
if (((aVariantMask & VARIANT_INTEGER) != 0) &&
|
||||
(eCSSToken_Number == tk->mType) && tk->mIntegerValid) {
|
||||
aValue.SetIntValue(tk->mInteger, eCSSUnit_Integer);
|
||||
return PR_TRUE;
|
||||
}
|
||||
if (mNavQuirkMode && !IsParsingCompoundProperty()) { // NONSTANDARD: Nav interprets unitless numbers as px
|
||||
if (((aVariantMask & VARIANT_LENGTH) != 0) &&
|
||||
(eCSSToken_Number == tk->mType)) {
|
||||
|
|
|
@ -146,7 +146,7 @@ var gCSSProperties = {
|
|||
"-moz-calc(2px)",
|
||||
"-moz-calc(-2px)",
|
||||
"-moz-calc(0em)",
|
||||
"-moz-calc(0)",
|
||||
"-moz-calc(0px)",
|
||||
"-moz-calc(5em)",
|
||||
"-moz-calc(3*25px)",
|
||||
"-moz-calc(25px*3)",
|
||||
|
@ -324,7 +324,7 @@ var gCSSProperties = {
|
|||
"-moz-calc(2px)",
|
||||
"-moz-calc(-2px)",
|
||||
"-moz-calc(0em)",
|
||||
"-moz-calc(0)",
|
||||
"-moz-calc(0px)",
|
||||
"-moz-calc(5em)",
|
||||
"-moz-calc(3*25px)",
|
||||
"-moz-calc(25px*3)",
|
||||
|
@ -413,7 +413,7 @@ var gCSSProperties = {
|
|||
other_values: [ "2px", "4em",
|
||||
"-moz-calc(2px)",
|
||||
"-moz-calc(-2px)",
|
||||
"-moz-calc(0)",
|
||||
"-moz-calc(0px)",
|
||||
"-moz-calc(0pt)",
|
||||
"-moz-calc(5em)",
|
||||
"-moz-calc(3*25px)",
|
||||
|
@ -1354,7 +1354,7 @@ var gCSSProperties = {
|
|||
"-moz-calc(2px)",
|
||||
"-moz-calc(-2px)",
|
||||
"-moz-calc(0em)",
|
||||
"-moz-calc(0)",
|
||||
"-moz-calc(0px)",
|
||||
"-moz-calc(5em)",
|
||||
"-moz-calc(3*25px)",
|
||||
"-moz-calc(25px*3)",
|
||||
|
@ -1416,7 +1416,7 @@ var gCSSProperties = {
|
|||
"-moz-calc(2px)",
|
||||
"-moz-calc(-2px)",
|
||||
"-moz-calc(0em)",
|
||||
"-moz-calc(0)",
|
||||
"-moz-calc(0px)",
|
||||
"-moz-calc(5em)",
|
||||
"-moz-calc(3*25px)",
|
||||
"-moz-calc(25px*3)",
|
||||
|
@ -1461,7 +1461,7 @@ var gCSSProperties = {
|
|||
"-moz-calc(2px)",
|
||||
"-moz-calc(-2px)",
|
||||
"-moz-calc(0em)",
|
||||
"-moz-calc(0)",
|
||||
"-moz-calc(0px)",
|
||||
"-moz-calc(5em)",
|
||||
"-moz-calc(3*25px)",
|
||||
"-moz-calc(25px*3)",
|
||||
|
@ -1524,7 +1524,7 @@ var gCSSProperties = {
|
|||
"-moz-calc(2px)",
|
||||
"-moz-calc(-2px)",
|
||||
"-moz-calc(0em)",
|
||||
"-moz-calc(0)",
|
||||
"-moz-calc(0px)",
|
||||
"-moz-calc(5em)",
|
||||
"-moz-calc(3*25px)",
|
||||
"-moz-calc(25px*3)",
|
||||
|
@ -2039,7 +2039,7 @@ var gCSSProperties = {
|
|||
other_values: [ "30px", "50%", "0",
|
||||
"-moz-calc(2px)",
|
||||
"-moz-calc(-2px)",
|
||||
"-moz-calc(0)",
|
||||
"-moz-calc(0px)",
|
||||
"-moz-calc(50%)",
|
||||
"-moz-calc(3*25px)",
|
||||
"-moz-calc(25px*3)",
|
||||
|
@ -2056,7 +2056,7 @@ var gCSSProperties = {
|
|||
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(0px)",
|
||||
"-moz-calc(50%)",
|
||||
"-moz-calc(3*25px)",
|
||||
"-moz-calc(25px*3)",
|
||||
|
@ -2161,7 +2161,7 @@ var gCSSProperties = {
|
|||
other_values: [ "thin", "thick", "1px", "2em",
|
||||
"-moz-calc(2px)",
|
||||
"-moz-calc(-2px)",
|
||||
"-moz-calc(0)",
|
||||
"-moz-calc(0px)",
|
||||
"-moz-calc(0px)",
|
||||
"-moz-calc(5em)",
|
||||
"-moz-calc(3*25px)",
|
||||
|
@ -2203,7 +2203,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", "-moz-calc(0) -moz-calc(0em) -moz-calc(-2px) -moz-calc(-1%)" ],
|
||||
initial_values: [ "0", "0px 0 0em", "0% 0px 0em 0pt", "-moz-calc(0px) -moz-calc(0em) -moz-calc(-2px) -moz-calc(-1%)" ],
|
||||
other_values: [ "3px 0", "2em 4px 2pt", "1em 2em 3px 4px" ],
|
||||
invalid_values: []
|
||||
},
|
||||
|
|
|
@ -43,6 +43,10 @@ var gBadComputed = {
|
|||
// These values are treated as auto.
|
||||
"page-break-after": [ "avoid" ],
|
||||
"page-break-before": [ "avoid" ],
|
||||
|
||||
// This is the only SVG-length property (i.e., length allowing
|
||||
// unitless lengths) whose initial value is zero.
|
||||
"stroke-dashoffset": [ "0" ],
|
||||
};
|
||||
|
||||
var gBadComputedNoFrame = {
|
||||
|
@ -68,7 +72,7 @@ var gBadComputedNoFrame = {
|
|||
"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": [ "0% 0px 0em 0pt", "-moz-calc(0px) -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%)" ],
|
||||
|
|
Загрузка…
Ссылка в новой задаче