W3C home > Mailing lists > Public > www-validator-cvs@w3.org > January 2013

CVS 2002/css-validator/org/w3c/css/properties/css1

From: CVS User ylafon <cvsmail@w3.org>
Date: Wed, 09 Jan 2013 10:50:39 +0000
Message-Id: <E1TstF1-0007Of-6e@roscoe.w3.org>
To: www-validator-cvs@w3.org
Update of /sources/public/2002/css-validator/org/w3c/css/properties/css1
In directory roscoe:/tmp/cvs-serv28421/css1

Modified Files:
	CssListStyle.java 
Log Message:
fixed the 'none' case

--- /sources/public/2002/css-validator/org/w3c/css/properties/css1/CssListStyle.java	2012/11/14 13:58:27	1.8
+++ /sources/public/2002/css-validator/org/w3c/css/properties/css1/CssListStyle.java	2013/01/09 10:50:39	1.9
@@ -1,4 +1,4 @@
-// $Id: CssListStyle.java,v 1.8 2012/11/14 13:58:27 ylafon Exp $
+// $Id: CssListStyle.java,v 1.9 2013/01/09 10:50:39 ylafon Exp $
 // Author: Yves Lafon <ylafon@w3.org>
 //
 // (c) COPYRIGHT MIT, ERCIM and Keio University, 2012.
@@ -62,6 +62,7 @@
 		CssValue imageVal = null;
 		CssValue positionVal = null;
 		CssValue typeVal = null;
+		int nbnone = 0;
 
 		while (!expression.end()) {
 			val = expression.getValue();
@@ -77,13 +78,7 @@
 					break;
 				case CssTypes.CSS_IDENT:
 					if (none.equals(val)) {
-						if (imageVal != null || typeVal != null) {
-							// TODO duplicate value error
-							throw new InvalidParamException("value", val,
-									getPropertyName(), ac);
-						}
-						typeVal = none;
-						imageVal = none;
+						nbnone++;
 						break;
 					}
 					// now we go to other values...
@@ -111,6 +106,38 @@
 			}
 			expression.next();
 		}
+		// some postprocessing...
+		if (nbnone > 0) {
+			switch (nbnone) {
+				case 1:
+					// we set the value ot the non-specified by the shorthand
+					// values...
+					if (imageVal != null && typeVal != null) {
+						// TODO duplicate value error
+						throw new InvalidParamException("value", none,
+								getPropertyName(), ac);
+					}
+					if (typeVal == null) {
+						typeVal = none;
+					}
+					if (imageVal == null) {
+						imageVal = none;
+					}
+					break;
+				case 2:
+					if (imageVal != null || typeVal != null) {
+						// TODO duplicate value error
+						throw new InvalidParamException("value", none,
+								getPropertyName(), ac);
+					}
+					typeVal = none;
+					imageVal = none;
+					break;
+				default:
+					throw new InvalidParamException("value", none,
+							getPropertyName(), ac);
+			}
+		}
 		// set the value
 		if (value != inherit) {
 			ArrayList<CssValue> v = new ArrayList<CssValue>();
Received on Wednesday, 9 January 2013 10:50:39 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 9 January 2013 10:50:40 GMT