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

2002/css-validator/org/w3c/css/properties/css1 CssBackgroundColor.java,1.4,1.5

From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
Date: Wed, 26 Mar 2008 10:23:05 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1JeSmf-0007n5-Gp@lionel-hutz.w3.org>

Update of /sources/public/2002/css-validator/org/w3c/css/properties/css1
In directory hutz:/tmp/cvs-serv29921

Modified Files:
	CssBackgroundColor.java 
Log Message:
small update


Index: CssBackgroundColor.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css1/CssBackgroundColor.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- CssBackgroundColor.java	14 Sep 2005 15:14:31 -0000	1.4
+++ CssBackgroundColor.java	26 Mar 2008 10:23:03 -0000	1.5
@@ -12,6 +12,7 @@
 import org.w3c.css.util.InvalidParamException;
 import org.w3c.css.values.CssExpression;
 import org.w3c.css.values.CssIdent;
+import org.w3c.css.values.CssTypes;
 import org.w3c.css.values.CssValue;
 
 /**
@@ -35,7 +36,12 @@
 
     CssValue color;
 
-    static CssIdent transparent = new CssIdent("transparent"); //not in CSS3 anymore, has become color value
+    static CssIdent transparent;
+    private static final String propertyName = "background-color";
+
+    static {
+	transparent = new CssIdent("transparent"); 
+    }
 
     /**
      * Create a new CssBackgroundColor
@@ -60,26 +66,22 @@
 	setByUser();
 	CssValue val = expression.getValue();
 
-	if (val instanceof org.w3c.css.values.CssColor) {
+	switch (val.getType()) {
+	case CssTypes.CSS_COLOR:
 	    color = val;
-	    expression.next();
-	} else if (val instanceof CssIdent) {
-	    //if (val.equals(transparent)) { // obsolete, transparent is a color value now
-		//color = transparent;
-		//expression.next();
-	    //} else
-	    if (val.equals(inherit)) {
+	    break;
+	case CssTypes.CSS_IDENT:
+	    if (inherit.equals(val)) {
 		color = inherit;
-		expression.next();
-	    }
-	    else {
-		color = new org.w3c.css.values.CssColor(ac, (String) val.get());
-		expression.next();
+		break;
 	    }
-	} else {
+	    color = new org.w3c.css.values.CssColor(ac, (String) val.get());
+	    break;
+	default:
 	    throw new InvalidParamException("value", val.toString(),
 					    getPropertyName(), ac);
 	}
+	expression.next();
     }
 
     public CssBackgroundColor(ApplContext ac, CssExpression expression)
@@ -157,7 +159,7 @@
      * Returns the name of this property
      */
     public String getPropertyName() {
-	return "background-color";
+	return propertyName;
     }
 
     /**
Received on Wednesday, 26 March 2008 10:23:39 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 26 April 2012 12:55:00 GMT