W3C home > Mailing lists > Public > www-validator-cvs@w3.org > March 2009

2002/css-validator/org/w3c/css/properties/css21 CssColorCSS21.java,1.2,1.3

From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
Date: Thu, 05 Mar 2009 18:01:20 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1LfHsm-0002KV-A4@lionel-hutz.w3.org>
Update of /sources/public/2002/css-validator/org/w3c/css/properties/css21
In directory hutz:/tmp/cvs-serv8941

Modified Files:
	CssColorCSS21.java 
Log Message:
using getType()


Index: CssColorCSS21.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css21/CssColorCSS21.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- CssColorCSS21.java	14 Sep 2005 15:14:58 -0000	1.2
+++ CssColorCSS21.java	5 Mar 2009 18:01:18 -0000	1.3
@@ -10,6 +10,7 @@
 import org.w3c.css.values.CssExpression;
 import org.w3c.css.values.CssIdent;
 import org.w3c.css.values.CssValue;
+import org.w3c.css.values.CssTypes;
 
 /**
  * CssColorCSS21<br />
@@ -22,29 +23,35 @@
      * @param expression The expression for this property
      * @exception InvalidParamException Values are incorrect
      */
-    public CssColorCSS21(ApplContext ac, CssExpression expression, boolean check)
-	throws InvalidParamException {
-
+    public CssColorCSS21(ApplContext ac, CssExpression expression, 
+			 boolean check)
+	throws InvalidParamException 
+    {
 	if(check && expression.getCount() > 1) {
 	    throw new InvalidParamException("unrecognize", ac);
 	}
 
 	CssValue val = expression.getValue();
 	setByUser();
-	if (val.equals(inherit)) {
-	    setColor(inherit);
-	    expression.next();
-	} else if (val instanceof org.w3c.css.values.CssColor) {
+
+	switch (val.getType()) {
+	case CssTypes.CSS_COLOR:
 	    setColor(val);
-	    expression.next();
-	} else if (val instanceof CssIdent) {
+	    break;
+	case CssTypes.CSS_IDENT:
+	    if (inherit.equals(val)) {
+		setColor(inherit);
+		break;
+	    }
 	    setColor(new org.w3c.css.values.CssColorCSS21(ac,
-							(String) val.get()));
-	    expression.next();
-	} else {
+							  (String) val.get()));
+	    break;
+	default:
+	    org.w3c.util.Trace.showTrace("foo: "+val.getType()+" - "+val);
 	    throw new InvalidParamException("value", expression.getValue(),
 					    getPropertyName(), ac);
 	}
+	expression.next();
     }
 
     public CssColorCSS21(ApplContext ac, CssExpression expression)
Received on Thursday, 5 March 2009 18:01:32 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:02:34 UTC