Author: felix8a
Date: Wed Jul 8 13:01:32 2009
New Revision: 3560
Modified:
trunk/src/com/google/caja/lang/css/css21-defs.json
trunk/tests/com/google/caja/plugin/CssValidatorTest.java
Log:
Remove spurious warning for negative word-spacing
http://codereview.appspot.com/91076
CSS allows you to say word-spacing:-1px and letter-spacing:-1px,
but caja's css21-defs.json thinks the range is constrained to [0,inf).
This change removes the constraint.
[email protected]
Modified: trunk/src/com/google/caja/lang/css/css21-defs.json
==============================================================================
--- trunk/src/com/google/caja/lang/css/css21-defs.json (original)
+++ trunk/src/com/google/caja/lang/css/css21-defs.json Wed Jul 8 13:01:32
2009
@@ -386,7 +386,7 @@
"dom2property": "left" },
{ "key": "letter-spacing",
- "signature": "normal | <length:0,> | inherit",
+ "signature": "normal | <length> | inherit",
"default": "normal",
"appliesTo": "*",
"inherited": true,
@@ -847,7 +847,7 @@
"dom2property": "width" },
{ "key": "word-spacing",
- "signature": "normal | <length:0,> | inherit",
+ "signature": "normal | <length> | inherit",
"default": "normal",
"appliesTo": "*",
"inherited": true,
Modified: trunk/tests/com/google/caja/plugin/CssValidatorTest.java
==============================================================================
--- trunk/tests/com/google/caja/plugin/CssValidatorTest.java (original)
+++ trunk/tests/com/google/caja/plugin/CssValidatorTest.java Wed Jul 8
13:01:32 2009
@@ -1230,6 +1230,28 @@
);
}
+ public void testNegativeSpacing() throws Exception {
+ runTest("p { letter-spacing: -4px; word-spacing: -2px }",
+ "StyleSheet\n"
+ + " RuleSet\n"
+ + " Selector\n"
+ + " SimpleSelector\n"
+ + " IdentLiteral : p\n"
+ + " PropertyDeclaration\n"
+ + " Property : letter-spacing\n"
+ + " Expr\n"
+ + " Term : NEGATION ; cssPropertyPartType=LENGTH"
+ + " ; cssPropertyPart=letter-spacing\n"
+ + " QuantityLiteral : 4px\n"
+ + " PropertyDeclaration\n"
+ + " Property : word-spacing\n"
+ + " Expr\n"
+ + " Term : NEGATION ; cssPropertyPartType=LENGTH"
+ + " ; cssPropertyPart=word-spacing\n"
+ + " QuantityLiteral : 2px\n"
+ );
+ }
+
public void testOpacity() throws Exception {
runTest("img {\n"
+ " opacity: 0.5;\n"
@@ -1406,7 +1428,7 @@
public void testSimpleAttrSelectorEqual() throws Exception {
// various forms of attribute selector with an 'equals' comparator
runTest("input[type='radio'] { font-weight: bold }", null);
- runTest("input[type=radio] { font-weight: bold }", null);
+ runTest("input[type=radio] { font-weight: bold }", null);
fails("input[zork='radio'] { font-weight: bold }");
fails("input[type='atyourservice'] { font-weight: bold }");
fails("input[type=atyourservice] { font-weight: bold }");
@@ -1422,10 +1444,10 @@
fails("input[zork~='radio'] { font-weight: bold }");
fails("input[zork~='radio atyourservice'] { font-weight: bold }");
fails("input[type~='atyourservice'] { font-weight: bold }");
- fails("input[type~=atyourservice] { font-weight: bold }");
+ fails("input[type~=atyourservice] { font-weight: bold }");
fails("input[type~='radio atyourservice'] { font-weight: bold }");
}
-
+
public void testSimpleAttrSelectorDashMatch() throws Exception {
// we don't know how to whitelist the "|=" form so rejected
fails("input[type|='button'] { font-weight: bold }");