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

2002/css-validator/org/w3c/css/properties/css1 CssBackgroundColorCSS1.java,1.5,1.6 CssBackgroundColorMob.java,1.4,1.5 CssBorderFaceColorCSS1.java,1.3,1.4 CssBorderFaceColorCSS2.java,1.6,1.7 CssColor.java,1.11,1.12 CssColorCSS1.java,1.6,1.7 CssColorCSS2.java,1.6,1.7

From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
Date: Thu, 29 Sep 2011 09:09:01 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1R9Cc1-0006f6-Ey@lionel-hutz.w3.org>
Update of /sources/public/2002/css-validator/org/w3c/css/properties/css1
In directory hutz:/tmp/cvs-serv25474/org/w3c/css/properties/css1

Modified Files:
	CssBackgroundColorCSS1.java CssBackgroundColorMob.java 
	CssBorderFaceColorCSS1.java CssBorderFaceColorCSS2.java 
	CssColor.java CssColorCSS1.java CssColorCSS2.java 
Log Message:
getting rid of multiple classes for Color value

Index: CssColorCSS2.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css1/CssColorCSS2.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- CssColorCSS2.java	5 Jan 2010 13:49:42 -0000	1.6
+++ CssColorCSS2.java	29 Sep 2011 09:08:59 -0000	1.7
@@ -72,7 +72,7 @@
 	    color = val;
 	    expression.next();
 	} else if (val instanceof CssIdent) {
-	    color = new org.w3c.css.values.CssColorCSS2(ac,
+	    color = new org.w3c.css.values.CssColor(ac,
 							(String) val.get());
 	    expression.next();
 	} else {

Index: CssBorderFaceColorCSS2.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css1/CssBorderFaceColorCSS2.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- CssBorderFaceColorCSS2.java	5 Jan 2010 13:49:40 -0000	1.6
+++ CssBorderFaceColorCSS2.java	29 Sep 2011 09:08:59 -0000	1.7
@@ -24,7 +24,7 @@
      * Create a new CssBorderFaceColor
      */
     public CssBorderFaceColorCSS2() {
-	face = new org.w3c.css.values.CssColorCSS2();
+	face = new org.w3c.css.values.CssColor();
     }
 
     /**
@@ -67,7 +67,7 @@
 	} else if(val.equals(CssProperty.transparent)) {
 	    setFace(CssProperty.transparent);
 	} else if (val instanceof CssIdent) {
-	    face = new org.w3c.css.values.CssColorCSS2(ac, (String) val.get());
+	    face = new org.w3c.css.values.CssColor(ac, (String) val.get());
 	} else {
 	    throw new InvalidParamException("value", val.toString(),
 					    "border-color", ac);

Index: CssColor.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css1/CssColor.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- CssColor.java	14 Sep 2011 16:31:50 -0000	1.11
+++ CssColor.java	29 Sep 2011 09:08:59 -0000	1.12
@@ -18,22 +18,23 @@
 import org.w3c.css.values.CssValue;
 
 /**
- *   <H4>
- *     &nbsp;&nbsp; 'color'
- *   </H4>
- *   <P>
- *   <EM>Value:</EM> &lt;color&gt;<BR>
- *   <EM>Initial:</EM> UA specific<BR>
- *   <EM>Applies to:</EM> all elements<BR>
- *   <EM>Inherited:</EM> yes<BR>
- *   <EM>Percentage values:</EM> N/A<BR>
- *   <P>
- *   This property describes the text color of an element (often referred to as
- *   the <EM>foreground</EM> color). There are different ways to specify red:
- *   <PRE>
- *   EM { color: red }              /* natural language * /
- *   EM { color: rgb(255,0,0) }     /* RGB range 0-255   * /
+ * <H4>
+ * &nbsp;&nbsp; 'color'
+ * </H4>
+ * <p/>
+ * <EM>Value:</EM> &lt;color&gt;<BR>
+ * <EM>Initial:</EM> UA specific<BR>
+ * <EM>Applies to:</EM> all elements<BR>
+ * <EM>Inherited:</EM> yes<BR>
+ * <EM>Percentage values:</EM> N/A<BR>
+ * <p/>
+ * This property describes the text color of an element (often referred to as
+ * the <EM>foreground</EM> color). There are different ways to specify red:
+ * <PRE>
+ * EM { color: red }              /* natural language * /
+ * EM { color: rgb(255,0,0) }     /* RGB range 0-255   * /
  * </PRE>
+ *
  * @version $Revision$
  */
 public class CssColor extends CssProperty implements CssOperator {
@@ -46,125 +47,112 @@
      * Create a new CssColor
      */
     public CssColor() {
-	color = inherit;
+        color = inherit;
     }
 
     /**
      * Set the value of the property
+     *
      * @param expression The expression for this property
-     * @exception InvalidParamException Values are incorrect
+     * @throws InvalidParamException Values are incorrect
      */
     public CssColor(ApplContext ac, CssExpression expression, boolean check)
-	throws InvalidParamException {
+            throws InvalidParamException {
 
-	if(check && expression.getCount() > 1) {
-	    throw new InvalidParamException("unrecognize", ac);
-	}
+        if (check && expression.getCount() > 1) {
+            throw new InvalidParamException("unrecognize", ac);
+        }
 
-	CssValue val = expression.getValue();
-	setByUser();
+        CssValue val = expression.getValue();
+        setByUser();
 
-	switch(val.getType()) {
-	case CssTypes.CSS_IDENT:
-	    if (inherit.equals(val)) {
-		color = inherit;
-		break;
-	    }
-        switch (ac.getCssVersion()) {
-            case CSS1:
-               color = new org.w3c.css.values.CssColorCSS1(ac,
-							    (String) val.get());
+        switch (val.getType()) {
+            case CssTypes.CSS_IDENT:
+                if (inherit.equals(val)) {
+                    color = inherit;
+                    break;
+                }
+                color = new org.w3c.css.values.CssColor(ac, (String) val.get());
+                //	    color = new org.w3c.css.values.CssColor();
                 break;
-            case CSS2:
-            case CSS21:
-                color = new org.w3c.css.values.CssColorCSS2(ac,
-							    (String) val.get());
+            case CssTypes.CSS_COLOR:
+                color = val;
                 break;
-            case CSS3:
-                color = new org.w3c.css.values.CssColor(ac, (String) val.get());
+            case CssTypes.CSS_FUNCTION:
+                CssFunction attr = (CssFunction) val;
+                CssExpression params = attr.getParameters();
+                String fname = attr.getName();
+
+                if (fname.equals("attr")) {
+                    CssValue v1 = params.getValue();
+                    params.next();
+                    CssValue v2 = params.getValue();
+                    if ((params.getCount() != 2)) {
+                        throw new InvalidParamException("value",
+                                params.getValue(),
+                                getPropertyName(), ac);
+                    } else if (v1.getType() != CssTypes.CSS_IDENT) {
+                        throw new InvalidParamException("value",
+                                params.getValue(),
+                                getPropertyName(), ac);
+
+                    } else if (!(v2.toString().equals("color"))) {
+                        throw new InvalidParamException("value",
+                                params.getValue(),
+                                getPropertyName(), ac);
+                    } else {
+                        attrvalue = "attr(" + v1 + ", " + v2 + ")";
+                    }
+                } else if (fname.equals("rgba")) {
+                    tempcolor.setRGBAColor(params, ac);
+                    color = tempcolor;
+                } else if (fname.equals("hsl")) {
+                    tempcolor.setHSLColor(params, ac);
+                    color = tempcolor;
+                } else if (fname.equals("hsla")) {
+                    tempcolor.setHSLAColor(params, ac);
+                    color = tempcolor;
+                } else if (fname.equals("atsc-rgba")) {
+                    tempcolor.setATSCRGBAColor(params, ac);
+                    color = tempcolor;
+                } else {
+                    throw new InvalidParamException("value",
+                            params.getValue(),
+                            getPropertyName(), ac);
+                }
                 break;
             default:
-                // TODO FIXME this looks like a bad default.
-                color = new org.w3c.css.values.CssColorCSS2(ac,
-							    (String) val.get());
-
+                throw new InvalidParamException("value", expression.getValue(),
+                        getPropertyName(), ac);
         }
-	    //	    color = new org.w3c.css.values.CssColor();
-	    break;
-	case CssTypes.CSS_COLOR:
-	    color = val;
-	    break;
-	case CssTypes.CSS_FUNCTION:
-	    CssFunction attr = (CssFunction) val;
-	    CssExpression params = attr.getParameters();
-
-	    if (attr.getName().equals("attr")) {
-		CssValue v1 = params.getValue();
-		params.next();
-		CssValue v2 = params.getValue();
-		if ((params.getCount() != 2)) {
-		    throw new InvalidParamException("value",
-						    params.getValue(),
-						    getPropertyName(), ac);
-		} else if (v1.getType() != CssTypes.CSS_IDENT) {
-		    throw new InvalidParamException("value",
-						    params.getValue(),
-						    getPropertyName(), ac);
-
-		} else if (!(v2.toString().equals("color"))) {
-		    throw new InvalidParamException("value",
-						    params.getValue(),
-						    getPropertyName(), ac);
-		} else {
-		    attrvalue = "attr(" + v1 + ", " + v2 + ")";
-		}
-	    } else if (attr.getName().equals("rgba")) {
-		tempcolor.setRGBAColor(params, ac);
-		color = tempcolor;
-	    } else if (attr.getName().equals("hsl")) {
-		tempcolor.setHSLColor(params, ac);
-		color = tempcolor;
-	    } else if (attr.getName().equals("hsla")) {
-		tempcolor.setHSLAColor(params, ac);
-		color = tempcolor;
-	    } else {
-		throw new InvalidParamException("value",
-						params.getValue(),
-						getPropertyName(), ac);
-	    }
-	    break;
-	default:
-	    throw new InvalidParamException("value", expression.getValue(),
-					    getPropertyName(), ac);
-	}
-	expression.next();
+        expression.next();
     }
 
     public CssColor(ApplContext ac, CssExpression expression)
-	throws InvalidParamException {
-	this(ac, expression, false);
+            throws InvalidParamException {
+        this(ac, expression, false);
     }
 
     /**
      * Returns the value of this property
      */
     public Object get() {
-	return color;
+        return color;
     }
 
     /**
      * Returns the color
      */
     public org.w3c.css.values.CssColor getColor() {
-	if (color.equals(inherit)) {
-	    /*
-	      System.err.println("[ERROR] org.w3c.css.properties.CssColor");
-	      System.err.println("[ERROR] value is inherited");
-	    */
-	    return null;
-	} else {
-	    return (org.w3c.css.values.CssColor) color;
-	}
+        if (color.equals(inherit)) {
+            /*
+             System.err.println("[ERROR] org.w3c.css.properties.CssColor");
+             System.err.println("[ERROR] value is inherited");
+           */
+            return null;
+        } else {
+            return (org.w3c.css.values.CssColor) color;
+        }
     }
 
     /**
@@ -172,18 +160,18 @@
      * e.g. his value equals inherit
      */
     public boolean isSoftlyInherited() {
-	return color.equals(inherit);
+        return color.equals(inherit);
     }
 
     /**
      * Returns a string representation of the object.
      */
     public String toString() {
-	if (attrvalue != null) {
-	    return attrvalue;
-	} else {
-	    return color.toString();
-	}
+        if (attrvalue != null) {
+            return attrvalue;
+        } else {
+            return color.toString();
+        }
     }
 
     /**
@@ -192,25 +180,25 @@
      * @param style The CssStyle
      */
     public void addToStyle(ApplContext ac, CssStyle style) {
-	Css1Style style0 = (Css1Style) style;
-	if (style0.cssColor != null) {
-	    style0.addRedefinitionWarning(ac, this);
-	}
-	style0.cssColor = this;
+        Css1Style style0 = (Css1Style) style;
+        if (style0.cssColor != null) {
+            style0.addRedefinitionWarning(ac, this);
+        }
+        style0.cssColor = this;
     }
 
     /**
      * Get this property in the style.
      *
-     * @param style The style where the property is
+     * @param style   The style where the property is
      * @param resolve if true, resolve the style to find this property
      */
     public CssProperty getPropertyInStyle(CssStyle style, boolean resolve) {
-	if (resolve) {
-	    return ((Css1Style) style).getColor();
-	} else {
-	    return ((Css1Style) style).cssColor;
-	}
+        if (resolve) {
+            return ((Css1Style) style).getColor();
+        } else {
+            return ((Css1Style) style).cssColor;
+        }
     }
 
     /**
@@ -219,15 +207,15 @@
      * @param property The other property.
      */
     public boolean equals(CssProperty property) {
-	return (property instanceof CssColor &&
-		color.equals(((CssColor) property).color));
+        return (property instanceof CssColor &&
+                color.equals(((CssColor) property).color));
     }
-    
+
     /**
      * Returns the name of this property
      */
     public String getPropertyName() {
-	return "color";
+        return "color";
     }
 
 }

Index: CssBackgroundColorMob.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css1/CssBackgroundColorMob.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- CssBackgroundColorMob.java	5 Jan 2010 13:49:39 -0000	1.4
+++ CssBackgroundColorMob.java	29 Sep 2011 09:08:59 -0000	1.5
@@ -62,7 +62,7 @@
 	setByUser();
 	CssValue val = expression.getValue();
 
-	if (val instanceof org.w3c.css.values.CssColorCSS2) {
+	if (val instanceof org.w3c.css.values.CssColor) {
 	    color = val;
 	    expression.next();
 	} else if (val instanceof CssIdent) {
@@ -73,7 +73,7 @@
 		color = inherit;
 		expression.next();
 	    } else {
-		color = new org.w3c.css.values.CssColorCSS2(ac, (String) val.get());
+		color = new org.w3c.css.values.CssColor(ac, (String) val.get());
 		expression.next();
 	    }
 	} else {

Index: CssColorCSS1.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css1/CssColorCSS1.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- CssColorCSS1.java	5 Jan 2010 13:49:42 -0000	1.6
+++ CssColorCSS1.java	29 Sep 2011 09:08:59 -0000	1.7
@@ -62,7 +62,7 @@
 	    color = val;
 	    break;
 	case CssTypes.CSS_IDENT:
-	    color = new org.w3c.css.values.CssColorCSS1(ac, (String) val.get());
+	    color = new org.w3c.css.values.CssColor(ac, (String) val.get());
 	    break;
 	default:
 	    throw new InvalidParamException("value", expression.getValue(),

Index: CssBorderFaceColorCSS1.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css1/CssBorderFaceColorCSS1.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- CssBorderFaceColorCSS1.java	14 Sep 2005 15:14:31 -0000	1.3
+++ CssBorderFaceColorCSS1.java	29 Sep 2011 09:08:59 -0000	1.4
@@ -23,7 +23,7 @@
      * Create a new CssBorderFaceColor
      */
     public CssBorderFaceColorCSS1() {
-	face = new org.w3c.css.values.CssColorCSS1();
+	face = new org.w3c.css.values.CssColor();
     }
 
     /**
@@ -62,7 +62,7 @@
 	if (val instanceof org.w3c.css.values.CssColor) {
 	    face = val;
 	} else if (val instanceof CssIdent) {
-	    face = new org.w3c.css.values.CssColorCSS1(ac, (String) val.get());
+	    face = new org.w3c.css.values.CssColor(ac, (String) val.get());
 	} else {
 	    throw new InvalidParamException("value", val.toString(),
 					    "border-color", ac);

Index: CssBackgroundColorCSS1.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css1/CssBackgroundColorCSS1.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- CssBackgroundColorCSS1.java	5 Jan 2010 13:49:39 -0000	1.5
+++ CssBackgroundColorCSS1.java	29 Sep 2011 09:08:59 -0000	1.6
@@ -74,7 +74,7 @@
                     setColor(inherit);
                     break;
                 }
-                setColor(new org.w3c.css.values.CssColorCSS1(ac,
+                setColor(new org.w3c.css.values.CssColor(ac,
                         (String) val.get()));
                 break;
             default:
Received on Thursday, 29 September 2011 09:09:03 UTC

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