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

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

From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
Date: Thu, 17 Dec 2009 17:12:45 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1NLJu9-0007Fh-ON@lionel-hutz.w3.org>
Update of /sources/public/2002/css-validator/org/w3c/css/properties/css1
In directory hutz:/tmp/cvs-serv27831/org/w3c/css/properties/css1

Modified Files:
	CssBorderFaceWidthCSS2.java 
Log Message:
column-rule-width uses CSS21 definition

Index: CssBorderFaceWidthCSS2.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css1/CssBorderFaceWidthCSS2.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- CssBorderFaceWidthCSS2.java	25 Mar 2008 18:43:30 -0000	1.4
+++ CssBorderFaceWidthCSS2.java	17 Dec 2009 17:12:43 -0000	1.5
@@ -6,6 +6,8 @@
 // Please first read the full copyright statement in file COPYRIGHT.html
 package org.w3c.css.properties.css1;
 
+import java.util.HashSet;
+
 import org.w3c.css.util.ApplContext;
 import org.w3c.css.util.InvalidParamException;
 import org.w3c.css.values.CssExpression;
@@ -20,22 +22,21 @@
  */
 public class CssBorderFaceWidthCSS2 {
 
-    CssValue value;
-    private static CssIdent thin;
-    private static CssIdent medium;
-    private static CssIdent thick;
-    
+    public static HashSet<CssIdent> acceptable_values;
     static {
-	thin = new CssIdent("thin");
-	medium = new CssIdent("medium");
-	thick = new CssIdent("thick");
+	acceptable_values = new HashSet<CssIdent>();
+	acceptable_values.add(CssIdent.getIdent("thin"));
+	acceptable_values.add(CssIdent.getIdent("medium"));
+	acceptable_values.add(CssIdent.getIdent("thick"));
     }
+
+    CssValue value;
     
     /**
      * Create a new CssBorderFaceWidthCSS2
      */
     public CssBorderFaceWidthCSS2() {
-	value = medium;
+	value = CssIdent.getIdent("medium");
     }
 
     /**
@@ -63,6 +64,8 @@
 	CssValue val = expression.getValue();
 
 	switch (val.getType()) {
+	case CssTypes.CSS_NUMBER:
+	    val = ((CssNumber) val).getLength();
 	case CssTypes.CSS_LENGTH:
 	    float f = ((Float) val.get()).floatValue();
 	    if (f >= 0) {
@@ -71,31 +74,20 @@
 		throw new InvalidParamException("negative-value", val.toString(), ac);
 	    }
 	    break;
-	case CssTypes.CSS_NUMBER:
-	    value = ((CssNumber) val).getLength();
-	    break;
 	case CssTypes.CSS_IDENT:
 	    CssIdent ci = (CssIdent) val;
 	    if (CssProperty.inherit.equals(ci)) {
 		value = CssProperty.inherit;
 		break;
 	    } 
-	    if (thin.equals(ci)) {
-		value = thin;
-		break;
-	    }
-	    if (medium.equals(ci)) {
-		value = medium;
-		break;
-	    }
-	    if (thick.equals(ci)) {
-		value = thick;
+	    if (acceptable_values.contains(ci)) {
+		// use the cached version
+		value = CssIdent.getIdent(ci.toString());
 		break;
 	    }
 	default:
 	    throw new InvalidParamException("value", val.toString(), "width", ac);
 	}
-	
 	expression.next();
     }
 
Received on Thursday, 17 December 2009 17:15:56 GMT

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