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

2002/css-validator/org/w3c/css/properties/css3 CssBorderBottomLeftRadius.java,1.2,1.3 CssBorderBottomRightRadius.java,1.2,1.3 CssBorderRadius.java,1.3,1.4 CssBorderTopLeftRadius.java,1.2,1.3 CssBorderTopRightRadius.java,1.2,1.3

From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
Date: Wed, 26 Mar 2008 09:04:07 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1JeRYF-0006PG-RO@lionel-hutz.w3.org>

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

Modified Files:
	CssBorderBottomLeftRadius.java CssBorderBottomRightRadius.java 
	CssBorderRadius.java CssBorderTopLeftRadius.java 
	CssBorderTopRightRadius.java 
Log Message:
border-radius... and all specific border properties (top-left, bottom-left etc...)

Index: CssBorderBottomLeftRadius.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css3/CssBorderBottomLeftRadius.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- CssBorderBottomLeftRadius.java	14 Sep 2005 15:15:04 -0000	1.2
+++ CssBorderBottomLeftRadius.java	26 Mar 2008 09:04:05 -0000	1.3
@@ -15,6 +15,8 @@
 import org.w3c.css.values.CssExpression;
 import org.w3c.css.values.CssLength;
 import org.w3c.css.values.CssNumber;
+import org.w3c.css.values.CssOperator;
+import org.w3c.css.values.CssTypes;
 import org.w3c.css.values.CssValue;
 
 public class CssBorderBottomLeftRadius extends CssProperty {
@@ -22,12 +24,18 @@
     String value;
     ApplContext ac;
 
+    private static final String defaultValue;
+    private final static String propertyName = "border-bottom-left-radius";
+    
+    static {
+	defaultValue = (new CssNumber((float) 1.0)).toString();
+    }
+    
     /**
      * Create new CssBorderBottomLeftRadius
      */
     public CssBorderBottomLeftRadius() {
-	CssNumber cssnum =  new CssNumber((float) 1.0);
-	value = cssnum.toString();
+	value = defaultValue;
     }
 
     /**
@@ -40,26 +48,47 @@
 	    boolean check) throws InvalidParamException {
 	setByUser();
 	CssValue val = expression.getValue();
+	char op = expression.getOperator();
+	StringBuilder sb = new StringBuilder();
 
-	if (val instanceof CssLength) {
-	    value = val.toString();
+	if (op != CssOperator.SPACE) {
+	    throw new InvalidParamException("operator", Character.toString(op),
+					    ac);
+	}
+	switch (val.getType()) {
+	case CssTypes.CSS_NUMBER:
+	    val = ((CssNumber)val).getLength();
+	case CssTypes.CSS_LENGTH:
+	    sb.append(val.toString());
+	    
 	    expression.next();
-
 	    val = expression.getValue();
+	    op = expression.getOperator();
 	    if (val != null) {
-
-		if (val instanceof CssLength) {
-		    value += " " + val.toString();
+		if (op != CssOperator.SPACE) {
+		    throw new InvalidParamException("operator", 
+						    Character.toString(op),
+						    ac);
+		}
+		switch (val.getType()) {
+		case CssTypes.CSS_NUMBER:
+		    val = ((CssNumber)val).getLength();
+		case CssTypes.CSS_LENGTH:
+		    sb.append(' ').append(val.toString());
 		    expression.next();
-		} else {
-		    throw new InvalidParamException("value", expression.getValue(),
-			    getPropertyName(), ac);
+		    break;
+		default:
+		    throw new InvalidParamException("value", 
+						    val,
+						    getPropertyName(), ac);
 		}
 	    }
-	}
-	else {
-	    throw new InvalidParamException("value", expression.getValue(),
-		    getPropertyName(), ac);
+	    value = sb.toString();
+	    break;
+	default:
+	    throw new InvalidParamException("value", 
+					    val,
+					    getPropertyName(), ac);
 	}
     }
 
@@ -106,8 +135,8 @@
     /**
      * Returns the name of this property
      */
-    public String getPropertyName() {
-	return "border-bottom-left-radius";
+    public final String getPropertyName() {
+	return propertyName;
     }
 
     /**
@@ -128,7 +157,7 @@
      * Returns a string representation of the object
      */
     public String toString() {
-	return value.toString();
+	return value;
     }
 
     /**
@@ -136,8 +165,8 @@
      * It is used by all macro for the function <code>print</code>
      */
     public boolean isDefault() {
-	CssNumber cssnum = new CssNumber(ac, (float) 1.0);
-	return value == cssnum.toString();
+	return (defaultValue == value);
+
     }
 
 }

Index: CssBorderTopRightRadius.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css3/CssBorderTopRightRadius.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- CssBorderTopRightRadius.java	14 Sep 2005 15:15:04 -0000	1.2
+++ CssBorderTopRightRadius.java	26 Mar 2008 09:04:05 -0000	1.3
@@ -15,6 +15,8 @@
 import org.w3c.css.values.CssExpression;
 import org.w3c.css.values.CssLength;
 import org.w3c.css.values.CssNumber;
+import org.w3c.css.values.CssOperator;
+import org.w3c.css.values.CssTypes;
 import org.w3c.css.values.CssValue;
 
 public class CssBorderTopRightRadius extends CssProperty {
@@ -22,12 +24,18 @@
     String value;
     ApplContext ac;
 
+    private static final String defaultValue;
+    private final static String propertyName = "border-top-right-radius";
+   
+    static {
+	defaultValue = (new CssNumber((float) 1.0)).toString();
+    }
+    
     /**
      * Create new CssBorderTopRightRadius
      */
     public CssBorderTopRightRadius() {
-	CssNumber cssnum =  new CssNumber((float) 1.0);
-	value = cssnum.toString();
+	value = defaultValue;
     }
 
     /**
@@ -37,34 +45,55 @@
      * @exception InvalidParamException Values are incorrect
      */
     public CssBorderTopRightRadius(ApplContext ac, CssExpression expression,
-	    boolean check) throws InvalidParamException {
+				   boolean check) throws InvalidParamException {
 	setByUser();
 	CssValue val = expression.getValue();
+	char op = expression.getOperator();
+	StringBuilder sb = new StringBuilder();
 
-	if (val instanceof CssLength) {
-	    value = val.toString();
+	if (op != CssOperator.SPACE) {
+	    throw new InvalidParamException("operator", Character.toString(op),
+					    ac);
+	}
+	switch (val.getType()) {
+	case CssTypes.CSS_NUMBER:
+	    val = ((CssNumber)val).getLength();
+	case CssTypes.CSS_LENGTH:
+	    sb.append(val.toString());
+	    
 	    expression.next();
-
 	    val = expression.getValue();
+	    op = expression.getOperator();
 	    if (val != null) {
-
-		if (val instanceof CssLength) {
-		    value += " " + val.toString();
+		if (op != CssOperator.SPACE) {
+		    throw new InvalidParamException("operator", 
+						    Character.toString(op),
+						    ac);
+		}
+		switch (val.getType()) {
+		case CssTypes.CSS_NUMBER:
+		    val = ((CssNumber)val).getLength();
+		case CssTypes.CSS_LENGTH:
+		    sb.append(' ').append(val.toString());
 		    expression.next();
-		} else {
-		    throw new InvalidParamException("value", expression.getValue(),
-			    getPropertyName(), ac);
+		    break;
+		default:
+		    throw new InvalidParamException("value", 
+						    val,
+						    getPropertyName(), ac);
 		}
 	    }
-	}
-	else {
-	    throw new InvalidParamException("value", expression.getValue(),
-		    getPropertyName(), ac);
+	    value = sb.toString();
+	    break;
+	default:
+	    throw new InvalidParamException("value", 
+					    val,
+					    getPropertyName(), ac);
 	}
     }
 
     public CssBorderTopRightRadius(ApplContext ac, CssExpression expression)
-	    throws InvalidParamException {
+	throws InvalidParamException {
 	this(ac, expression, false);
     }
 
@@ -106,8 +135,8 @@
     /**
      * Returns the name of this property
      */
-    public String getPropertyName() {
-	return "border-top-right-radius";
+    public final String getPropertyName() {
+	return propertyName;
     }
 
     /**
@@ -136,8 +165,7 @@
      * It is used by all macro for the function <code>print</code>
      */
     public boolean isDefault() {
-	CssNumber cssnum = new CssNumber(ac, (float) 1.0);
-	return value == cssnum.toString();
+	return (defaultValue == value);
     }
 
 }

Index: CssBorderBottomRightRadius.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css3/CssBorderBottomRightRadius.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- CssBorderBottomRightRadius.java	14 Sep 2005 15:15:04 -0000	1.2
+++ CssBorderBottomRightRadius.java	26 Mar 2008 09:04:05 -0000	1.3
@@ -15,6 +15,8 @@
 import org.w3c.css.values.CssExpression;
 import org.w3c.css.values.CssLength;
 import org.w3c.css.values.CssNumber;
+import org.w3c.css.values.CssOperator;
+import org.w3c.css.values.CssTypes;
 import org.w3c.css.values.CssValue;
 
 public class CssBorderBottomRightRadius extends CssProperty {
@@ -22,12 +24,18 @@
     String value;
     ApplContext ac;
 
+    private static final String defaultValue;
+    private final static String propertyName = "border-bottom-right-radius";
+    
+    static {
+	defaultValue = (new CssNumber((float) 1.0)).toString();
+    }
+
     /**
      * Create new CssBorderBottomRightRadius
      */
     public CssBorderBottomRightRadius() {
-	CssNumber cssnum =  new CssNumber((float) 1.0);
-	value = cssnum.toString();
+	value = defaultValue;
     }
 
     /**
@@ -40,26 +48,47 @@
 	    boolean check) throws InvalidParamException {
 	setByUser();
 	CssValue val = expression.getValue();
+	char op = expression.getOperator();
+	StringBuilder sb = new StringBuilder();
 
-	if (val instanceof CssLength) {
-	    value = val.toString();
+	if (op != CssOperator.SPACE) {
+	    throw new InvalidParamException("operator", Character.toString(op),
+					    ac);
+	}
+	switch (val.getType()) {
+	case CssTypes.CSS_NUMBER:
+	    val = ((CssNumber)val).getLength();
+	case CssTypes.CSS_LENGTH:
+	    sb.append(val.toString());
+	    
 	    expression.next();
-
 	    val = expression.getValue();
+	    op = expression.getOperator();
 	    if (val != null) {
-
-		if (val instanceof CssLength) {
-		    value += " " + val.toString();
+		if (op != CssOperator.SPACE) {
+		    throw new InvalidParamException("operator", 
+						    Character.toString(op),
+						    ac);
+		}
+		switch (val.getType()) {
+		case CssTypes.CSS_NUMBER:
+		    val = ((CssNumber)val).getLength();
+		case CssTypes.CSS_LENGTH:
+		    sb.append(' ').append(val.toString());
 		    expression.next();
-		} else {
-		    throw new InvalidParamException("value",
-			    expression.getValue(), getPropertyName(), ac);
+		    break;
+		default:
+		    throw new InvalidParamException("value", 
+						    val,
+						    getPropertyName(), ac);
 		}
 	    }
-	}
-	else {
-	    throw new InvalidParamException("value", expression.getValue(),
-		    getPropertyName(), ac);
+	    value = sb.toString();
+	    break;
+	default:
+	    throw new InvalidParamException("value", 
+					    val,
+					    getPropertyName(), ac);
 	}
     }
 
@@ -106,8 +135,8 @@
     /**
      * Returns the name of this property
      */
-    public String getPropertyName() {
-	return "border-bottom-right-radius";
+    public final String getPropertyName() {
+	return propertyName;
     }
 
     /**
@@ -136,8 +165,7 @@
      * It is used by all macro for the function <code>print</code>
      */
     public boolean isDefault() {
-	CssNumber cssnum = new CssNumber(ac, (float) 1.0);
-	return value == cssnum.toString();
+	return (defaultValue == value);
     }
 
 }

Index: CssBorderTopLeftRadius.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css3/CssBorderTopLeftRadius.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- CssBorderTopLeftRadius.java	14 Sep 2005 15:15:04 -0000	1.2
+++ CssBorderTopLeftRadius.java	26 Mar 2008 09:04:05 -0000	1.3
@@ -15,6 +15,8 @@
 import org.w3c.css.values.CssExpression;
 import org.w3c.css.values.CssLength;
 import org.w3c.css.values.CssNumber;
+import org.w3c.css.values.CssOperator;
+import org.w3c.css.values.CssTypes;
 import org.w3c.css.values.CssValue;
 
 public class CssBorderTopLeftRadius extends CssProperty {
@@ -22,12 +24,18 @@
     String value;
     ApplContext ac;
 
+    private static String defaultValue;
+    private final static String propertyName = "border-top-left-radius";
+
+    static {
+	defaultValue = (new CssNumber((float) 1.0)).toString();
+    }
+
     /**
      * Create new CssBorderTopLeftRadius
      */
     public CssBorderTopLeftRadius() {
-	CssNumber cssnum =  new CssNumber((float) 1.0);
-	value = cssnum.toString();
+	value = defaultValue;
     }
 
     /**
@@ -40,29 +48,50 @@
 	    boolean check) throws InvalidParamException {
 	setByUser();
 	CssValue val = expression.getValue();
+	char op = expression.getOperator();
+	StringBuilder sb = new StringBuilder();
 
-	if (val instanceof CssLength) {
-	    value = val.toString();
+	if (op != CssOperator.SPACE) {
+	    throw new InvalidParamException("operator", Character.toString(op),
+					    ac);
+	}
+	switch (val.getType()) {
+	case CssTypes.CSS_NUMBER:
+	    val = ((CssNumber)val).getLength();
+	case CssTypes.CSS_LENGTH:
+	    sb.append(val.toString());
+	    
 	    expression.next();
-
 	    val = expression.getValue();
+	    op = expression.getOperator();
 	    if (val != null) {
-
-		if (val instanceof CssLength) {
-		    value += " " + val.toString();
+		if (op != CssOperator.SPACE) {
+		    throw new InvalidParamException("operator", 
+						    Character.toString(op),
+						    ac);
+		}
+		switch (val.getType()) {
+		case CssTypes.CSS_NUMBER:
+		    val = ((CssNumber)val).getLength();
+		case CssTypes.CSS_LENGTH:
+		    sb.append(' ').append(val.toString());
 		    expression.next();
-		} else {
-		    throw new InvalidParamException("value", expression.getValue(),
-			    getPropertyName(), ac);
+		    break;
+		default:
+		    throw new InvalidParamException("value", 
+						    val,
+						    getPropertyName(), ac);
 		}
 	    }
-	}
-	else {
-	    throw new InvalidParamException("value", expression.getValue(),
-		    getPropertyName(), ac);
+	    value = sb.toString();
+	    break;
+	default:
+	    throw new InvalidParamException("value", 
+					    val,
+					    getPropertyName(), ac);
 	}
     }
-
+    
     public CssBorderTopLeftRadius(ApplContext ac, CssExpression expression)
 	    throws InvalidParamException {
 	this(ac, expression, false);
@@ -106,8 +135,8 @@
     /**
      * Returns the name of this property
      */
-    public String getPropertyName() {
-	return "border-top-left-radius";
+    public final String getPropertyName() {
+	return propertyName;
     }
 
     /**
@@ -121,14 +150,14 @@
      * Returns true if this property is "softly" inherited
      */
     public boolean isSoftlyInherited() {
-	return value.equals(inherit);
+	return inherit.equals(value);
     }
-
+    
     /**
      * Returns a string representation of the object
      */
     public String toString() {
-	return value.toString();
+	return value;
     }
 
     /**
@@ -136,8 +165,7 @@
      * It is used by all macro for the function <code>print</code>
      */
     public boolean isDefault() {
-	CssNumber cssnum = new CssNumber(ac, (float) 1.0);
-	return value == cssnum.toString();
+	return  (defaultValue == value);
     }
 
 }

Index: CssBorderRadius.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css3/CssBorderRadius.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- CssBorderRadius.java	25 Mar 2008 18:26:40 -0000	1.3
+++ CssBorderRadius.java	26 Mar 2008 09:04:05 -0000	1.4
@@ -26,7 +26,7 @@
     String value;
     ApplContext ac;
 
-    private static final String defaultValue;
+    private static String defaultValue;
     
     static {
 	defaultValue = (new CssNumber((float) 1.0)).toString();
@@ -36,6 +36,7 @@
      * Create new CssBorderRadius
      */
     public CssBorderRadius() {
+	value = defaultValue;
     }
 
     /**
@@ -166,6 +167,6 @@
      * It is used by all macro for the function <code>print</code>
      */
     public boolean isDefault() {
-	return defaultValue.equals(value);
+	return (defaultValue == value);
     }
 }
Received on Wednesday, 26 March 2008 09:04:38 GMT

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