W3C home > Mailing lists > Public > www-validator-cvs@w3.org > September 2011

2002/css-validator/org/w3c/css/properties/css1 CssColor.java,1.10,1.11

From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
Date: Wed, 14 Sep 2011 16:31:52 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1R3sNM-0006Ww-6l@lionel-hutz.w3.org>
Update of /sources/public/2002/css-validator/org/w3c/css/properties/css1
In directory hutz:/tmp/cvs-serv24952/properties/css1

Modified Files:
	CssColor.java 
Log Message:
reworking profile/version check ot avoid doing too many string comparisons, and user defaulting

Index: CssColor.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css1/CssColor.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- CssColor.java	5 Jan 2010 19:49:50 -0000	1.10
+++ CssColor.java	14 Sep 2011 16:31:50 -0000	1.11
@@ -70,18 +70,25 @@
 		color = inherit;
 		break;
 	    }
-	    if ("css1".equals(ac.getCssVersion())) {
-		color = new org.w3c.css.values.CssColorCSS1(ac,
+        switch (ac.getCssVersion()) {
+            case CSS1:
+               color = new org.w3c.css.values.CssColorCSS1(ac,
 							    (String) val.get());
-	    } else if ("css2".equals(ac.getCssVersion())) {
-		color = new org.w3c.css.values.CssColorCSS2(ac, 
+                break;
+            case CSS2:
+            case CSS21:
+                color = new org.w3c.css.values.CssColorCSS2(ac,
 							    (String) val.get());
-	    } else if ("css3".equals(ac.getCssVersion())){
-		color = new org.w3c.css.values.CssColor(ac, (String) val.get());
-	    } else {
-		color = new org.w3c.css.values.CssColorCSS2(ac, 
-							    (String) val.get()); // SVG profiles
-	    }
+                break;
+            case CSS3:
+                color = new org.w3c.css.values.CssColor(ac, (String) val.get());
+                break;
+            default:
+                // TODO FIXME this looks like a bad default.
+                color = new org.w3c.css.values.CssColorCSS2(ac,
+							    (String) val.get());
+
+        }
 	    //	    color = new org.w3c.css.values.CssColor();
 	    break;
 	case CssTypes.CSS_COLOR:
Received on Wednesday, 14 September 2011 16:32:07 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:17:46 UTC