mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 988702 patch 2 - Test invalid CSS property values for their balanced-ness of () [] or {}. r=heycam
(This provides an easy mechanism for testing for missing UngetToken() calls as in the following patch.)
This commit is contained in:
parent
1d5f54dbab
commit
0c81f40b4b
@ -31,9 +31,13 @@ const CSS_TYPE_SHORTHAND_AND_LONGHAND = 2;
|
||||
// XXX Should have a third field for values whose computed value may or
|
||||
// may not be the same as for the property's initial value.
|
||||
// invalid_values: Things that are not values for the property and
|
||||
// should be rejected.
|
||||
// should be rejected, but which are balanced and should not absorb
|
||||
// what follows
|
||||
// quirks_values: Values that should be accepted in quirks mode only,
|
||||
// mapped to the values they are equivalent to.
|
||||
// unbalanced_values: Things that are not values for the property and
|
||||
// should be rejected, and which also contain unbalanced constructs
|
||||
// that should absorb what follows
|
||||
|
||||
// Helper functions used to construct gCSSProperties.
|
||||
|
||||
@ -318,13 +322,13 @@ var validGradientAndElementValues = [
|
||||
"-moz-radial-gradient(left calc(100px + -25%), red, blue)",
|
||||
"-moz-radial-gradient(calc(100px + -25px) top, red, blue)",
|
||||
"-moz-radial-gradient(left calc(100px + -25px), red, blue)"
|
||||
]
|
||||
];
|
||||
var invalidGradientAndElementValues = [
|
||||
"-moz-element(#a:1)",
|
||||
"-moz-element(a#a)",
|
||||
"-moz-element(#a a)",
|
||||
"-moz-element(#a+a)",
|
||||
"-moz-element(#a()",
|
||||
"-moz-element(#a())",
|
||||
/* no quirks mode colors */
|
||||
"linear-gradient(red, ff00ff)",
|
||||
/* no quirks mode colors */
|
||||
@ -555,7 +559,10 @@ var invalidGradientAndElementValues = [
|
||||
"-moz-radial-gradient(30% 40% at top left, red, blue)",
|
||||
"-moz-radial-gradient(50px 60px at 15% 20%, red, blue)",
|
||||
"-moz-radial-gradient(7em 8em at 45px, red, blue)"
|
||||
]
|
||||
];
|
||||
var unbalancedGradientAndElementValues = [
|
||||
"-moz-element(#a()",
|
||||
];
|
||||
|
||||
var gCSSProperties = {
|
||||
"animation": {
|
||||
@ -758,7 +765,9 @@ var gCSSProperties = {
|
||||
].concat(validGradientAndElementValues),
|
||||
invalid_values: [
|
||||
"url('border.png') url('border.png')",
|
||||
].concat(invalidGradientAndElementValues)
|
||||
].concat(invalidGradientAndElementValues),
|
||||
unbalanced_values: [
|
||||
].concat(unbalancedGradientAndElementValues)
|
||||
},
|
||||
"border-image-slice": {
|
||||
domProp: "borderImageSlice",
|
||||
@ -1925,7 +1934,9 @@ var gCSSProperties = {
|
||||
"url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAIAAAD8GO2jAAAAKElEQVR42u3NQQ0AAAgEoNP+nTWFDzcoQE1udQQCgUAgEAgEAsGTYAGjxAE/G/Q2tQAAAABJRU5ErkJggg==), url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAIAAAD8GO2jAAAAKElEQVR42u3NQQ0AAAgEoNP+nTWFDzcoQE1udQQCgUAgEAgEAsGTYAGjxAE/G/Q2tQAAAABJRU5ErkJggg==)",
|
||||
].concat(validGradientAndElementValues),
|
||||
invalid_values: [
|
||||
].concat(invalidGradientAndElementValues)
|
||||
].concat(invalidGradientAndElementValues),
|
||||
unbalanced_values: [
|
||||
].concat(unbalancedGradientAndElementValues)
|
||||
},
|
||||
"background-origin": {
|
||||
domProp: "backgroundOrigin",
|
||||
@ -4905,7 +4916,6 @@ if (SpecialPowers.getBoolPref("layout.css.grid.enabled")) {
|
||||
"(5th) 40px",
|
||||
"(foo() bar) 40px",
|
||||
"(foo)) 40px",
|
||||
"(foo] 40px",
|
||||
"[foo] 40px",
|
||||
"(foo) (bar) 40px",
|
||||
"40px (foo) (bar)",
|
||||
@ -4939,6 +4949,9 @@ if (SpecialPowers.getBoolPref("layout.css.grid.enabled")) {
|
||||
"subgrid repeat(1, )",
|
||||
"subgrid repeat(2, (40px))",
|
||||
"subgrid repeat(2, foo)",
|
||||
],
|
||||
unbalanced_values: [
|
||||
"(foo] 40px",
|
||||
]
|
||||
};
|
||||
gCSSProperties["grid-template-rows"] = {
|
||||
|
@ -41,6 +41,30 @@ function check_not_accepted(decl, property, info, badval)
|
||||
decl.removeProperty(property);
|
||||
}
|
||||
|
||||
function check_value_balanced(decl, property, badval)
|
||||
{
|
||||
var goodProp =
|
||||
(property == "background-color") ? "color" : "background-color";
|
||||
decl.cssText = goodProp + ": red; " + property + ": " + badval + "; " +
|
||||
goodProp + ": green";
|
||||
is(decl.getPropertyValue(goodProp), "green",
|
||||
"invalid value '" + property + ": " + badval +
|
||||
"' is balanced and does not lead to parsing errors afterwards");
|
||||
decl.cssText = "";
|
||||
}
|
||||
|
||||
function check_value_unbalanced(decl, property, badval)
|
||||
{
|
||||
var goodProp =
|
||||
(property == "background-color") ? "color" : "background-color";
|
||||
decl.cssText = goodProp + ": green; " + property + ": " + badval + "; " +
|
||||
goodProp + ": red";
|
||||
is(decl.getPropertyValue(goodProp), "green",
|
||||
"invalid value '" + property + ": " + badval +
|
||||
"' is unbalanced and absorbs what follows it");
|
||||
decl.cssText = "";
|
||||
}
|
||||
|
||||
function run()
|
||||
{
|
||||
var gDeclaration = document.getElementById("testnode").style;
|
||||
@ -54,12 +78,15 @@ function run()
|
||||
info.invalid_values[idx]);
|
||||
check_not_accepted(gQuirksDeclaration, property, info,
|
||||
info.invalid_values[idx]);
|
||||
check_value_balanced(gDeclaration, property,
|
||||
info.invalid_values[idx]);
|
||||
}
|
||||
|
||||
if ("quirks_values" in info) {
|
||||
for (var quirkval in info.quirks_values) {
|
||||
var standardval = info.quirks_values[quirkval];
|
||||
check_not_accepted(gDeclaration, property, info, quirkval);
|
||||
check_value_balanced(gDeclaration, property, quirkval);
|
||||
|
||||
gQuirksDeclaration.setProperty(property, quirkval, "");
|
||||
gDeclaration.setProperty(property, standardval, "");
|
||||
@ -86,6 +113,15 @@ function run()
|
||||
gDeclaration.removeProperty(property);
|
||||
}
|
||||
}
|
||||
|
||||
for (var idx in info.unbalanced_values) {
|
||||
check_not_accepted(gDeclaration, property, info,
|
||||
info.invalid_values[idx]);
|
||||
check_not_accepted(gQuirksDeclaration, property, info,
|
||||
info.invalid_values[idx]);
|
||||
check_value_unbalanced(gDeclaration, property,
|
||||
info.unbalanced_values[idx]);
|
||||
}
|
||||
}
|
||||
|
||||
SimpleTest.finish();
|
||||
|
Loading…
Reference in New Issue
Block a user