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

2002/css-validator/org/w3c/css/properties/css3 CssColumnWidth.java,1.2,1.3

From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
Date: Thu, 27 Mar 2008 15:50:33 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1JeuN7-0001Ra-9a@lionel-hutz.w3.org>

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

Modified Files:
	CssColumnWidth.java 
Log Message:
fixed bug http://www.w3.org/Bugs/Public/show_bug.cgi?id=5589
It was checking for numbers instead of dimensions
(see http://www.w3.org/TR/css3-multicol/#lsquo )


Index: CssColumnWidth.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css3/CssColumnWidth.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- CssColumnWidth.java	14 Sep 2005 15:15:04 -0000	1.2
+++ CssColumnWidth.java	27 Mar 2008 15:50:31 -0000	1.3
@@ -15,6 +15,7 @@
 import org.w3c.css.values.CssExpression;
 import org.w3c.css.values.CssIdent;
 import org.w3c.css.values.CssNumber;
+import org.w3c.css.values.CssTypes;
 import org.w3c.css.values.CssValue;
 
 /**
@@ -35,7 +36,10 @@
 
     CssValue width;
 
-    static CssIdent auto = new CssIdent("auto");
+    static CssIdent auto;
+    static {
+	auto = new CssIdent("auto");
+    }
 
     /**
      * Create a new CssColumnWidth
@@ -56,19 +60,22 @@
 	setByUser();
 	CssValue val = expression.getValue();
 
-	if (val.equals(inherit)) {
-	    width = val;
-	    expression.next();
-	} else if (val.equals(auto)) {
-	    width = val;
-	    expression.next();
-	} else if (val instanceof CssNumber) {
+	switch (val.getType()) {
+	case CssTypes.CSS_NUMBER:
+	    val = ((CssNumber)val).getLength();
+	case CssTypes.CSS_LENGTH:
 	    width = val;
-	    expression.next();
-	} else {
+	    break;
+	case CssTypes.CSS_IDENT:
+	    if (inherit.equals(val) || auto.equals(val)) {
+		width = val;
+		break;
+	    } 
+	default:
 	    throw new InvalidParamException("value", expression.getValue(),
 					    getPropertyName(), ac);
 	}
+	expression.next();
     }
 
     public CssColumnWidth(ApplContext ac, CssExpression expression)
Received on Thursday, 27 March 2008 15:51:06 GMT

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