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

2002/css-validator/org/w3c/css/properties/css CssColumnCount.java,1.2,1.3 CssColumnWidth.java,1.2,1.3 CssHeight.java,1.1,1.2 CssOpacity.java,1.1,1.2 CssWidth.java,1.1,1.2

From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
Date: Thu, 06 Sep 2012 12:37:58 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1T9bLo-00072o-C8@lionel-hutz.w3.org>
Update of /sources/public/2002/css-validator/org/w3c/css/properties/css
In directory hutz:/tmp/cvs-serv26889/properties/css

Modified Files:
	CssColumnCount.java CssColumnWidth.java CssHeight.java 
	CssOpacity.java CssWidth.java 
Log Message:
preparation of new css3 types support, parser already modified to accept them, some alignment of coding std for old properties

Index: CssHeight.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css/CssHeight.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- CssHeight.java	27 Sep 2011 08:15:45 -0000	1.1
+++ CssHeight.java	6 Sep 2012 12:37:56 -0000	1.2
@@ -13,6 +13,7 @@
 import org.w3c.css.util.InvalidParamException;
 import org.w3c.css.values.CssExpression;
 import org.w3c.css.values.CssIdent;
+import org.w3c.css.values.CssValue;
 
 /**
  * @version $Revision$
@@ -21,7 +22,7 @@
 
     public static CssIdent auto = CssIdent.getIdent("auto");
 
-    CssIdent identVal;
+    public CssValue value;
 
     /**
      * Create a new CssWidth
@@ -45,7 +46,7 @@
      * Returns the value of this property.
      */
     public Object get() {
-        return null;
+        return value;
     }
 
     /**
@@ -60,14 +61,14 @@
      * e.g. his value equals inherit
      */
     public boolean isSoftlyInherited() {
-        return false;
+        return value == inherit;
     }
 
     /**
      * Returns a string representation of the object.
      */
     public String toString() {
-        return auto.toString();
+        return value.toString();
     }
 
 
@@ -78,8 +79,9 @@
      */
     public void addToStyle(ApplContext ac, CssStyle style) {
         Css1Style style0 = (Css1Style) style;
-        if (style0.cssHeight != null)
+        if (style0.cssHeight != null) {
             style0.addRedefinitionWarning(ac, this);
+		}
         style0.cssHeight = this;
     }
 
@@ -103,7 +105,7 @@
      * @param property The other property.
      */
     public boolean equals(CssProperty property) {
-        return (property instanceof CssHeight);
+        return (property instanceof CssHeight) && ((CssHeight)property).value.equals(value);
     }
 
     /**

Index: CssColumnCount.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css/CssColumnCount.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- CssColumnCount.java	5 Oct 2011 07:12:16 -0000	1.2
+++ CssColumnCount.java	6 Sep 2012 12:37:55 -0000	1.3
@@ -23,7 +23,7 @@
 
     private static final String propertyName = "column-count";
 
-    CssValue count;
+    public CssValue value;
 
     /**
      * Create a new CssColumnCount
@@ -53,8 +53,9 @@
      * @param style The CssStyle
      */
     public void addToStyle(ApplContext ac, CssStyle style) {
-        if (((Css3Style) style).cssColumnCount != null)
+        if (((Css3Style) style).cssColumnCount != null) {
             style.addRedefinitionWarning(ac, this);
+		}
         ((Css3Style) style).cssColumnCount = this;
     }
 
@@ -79,7 +80,7 @@
      */
     public boolean equals(CssProperty property) {
         return (property instanceof CssColumnCount &&
-                count.equals(((CssColumnCount) property).count));
+                value.equals(((CssColumnCount) property).value));
     }
 
     /**
@@ -93,21 +94,21 @@
      * Returns the value of this property
      */
     public Object get() {
-        return count;
+        return value;
     }
 
     /**
      * Returns true if this property is "softly" inherited
      */
     public boolean isSoftlyInherited() {
-        return (count == inherit);
+        return (value == inherit);
     }
 
     /**
      * Returns a string representation of the object
      */
     public String toString() {
-        return count.toString();
+        return value.toString();
     }
 
     /**

Index: CssWidth.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css/CssWidth.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- CssWidth.java	27 Sep 2011 08:15:45 -0000	1.1
+++ CssWidth.java	6 Sep 2012 12:37:56 -0000	1.2
@@ -13,105 +13,106 @@
 import org.w3c.css.util.InvalidParamException;
 import org.w3c.css.values.CssExpression;
 import org.w3c.css.values.CssIdent;
+import org.w3c.css.values.CssValue;
 
 /**
- * @version $Revision$
+ * @since CSS1
  */
 public class CssWidth extends CssProperty {
 
-    public static CssIdent auto = CssIdent.getIdent("auto");
-
-    CssIdent identVal;
+	public static CssIdent auto = CssIdent.getIdent("auto");
 
-    /**
-     * Create a new CssWidth
-     */
-    public CssWidth() {
-    }
+	public CssValue value;
 
-    /**
-     * Create a new CssWidth.
-     *
-     * @param expression The expression for this property
-     * @throws org.w3c.css.util.InvalidParamException
-     *          Values are incorrect
-     */
-    public CssWidth(ApplContext ac, CssExpression expression, boolean check)
-            throws InvalidParamException {
-        throw new InvalidParamException("unrecognize", ac);
-    }
+	/**
+	 * Create a new CssWidth
+	 */
+	public CssWidth() {
+	}
 
-    /**
-     * Returns the value of this property.
-     */
-    public Object get() {
-        return null;
-    }
+	/**
+	 * Create a new CssWidth.
+	 *
+	 * @param expression The expression for this property
+	 * @throws org.w3c.css.util.InvalidParamException
+	 *          Values are incorrect
+	 */
+	public CssWidth(ApplContext ac, CssExpression expression, boolean check)
+			throws InvalidParamException {
+		throw new InvalidParamException("unrecognize", ac);
+	}
 
-    /**
-     * Returns the name of this property.
-     */
-    public final String getPropertyName() {
-        return "width";
-    }
+	/**
+	 * Returns the value of this property.
+	 */
+	public Object get() {
+		return null;
+	}
 
-    /**
-     * Returns true if this property is "softly" inherited
-     * e.g. his value equals inherit
-     */
-    public boolean isSoftlyInherited() {
-        return false;
-    }
+	/**
+	 * Returns the name of this property.
+	 */
+	public final String getPropertyName() {
+		return "width";
+	}
 
-    /**
-     * Returns a string representation of the object.
-     */
-    public String toString() {
-        return auto.toString();
-    }
+	/**
+	 * Returns true if this property is "softly" inherited
+	 * e.g. his value equals inherit
+	 */
+	public boolean isSoftlyInherited() {
+		return inherit == value;
+	}
 
+	/**
+	 * Returns a string representation of the object.
+	 */
+	public String toString() {
+		return value.toString();
+	}
 
-    /**
-     * Add this property to the CssStyle.
-     *
-     * @param style The CssStyle
-     */
-    public void addToStyle(ApplContext ac, CssStyle style) {
-        Css1Style style0 = (Css1Style) style;
-        if (style0.cssWidth != null)
-            style0.addRedefinitionWarning(ac, this);
-        style0.cssWidth = this;
-    }
 
-    /**
-     * Get this property in the style.
-     *
-     * @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).getWidth();
-        } else {
-            return ((Css1Style) style).cssWidth;
-        }
-    }
+	/**
+	 * Add this property to the CssStyle.
+	 *
+	 * @param style The CssStyle
+	 */
+	public void addToStyle(ApplContext ac, CssStyle style) {
+		Css1Style style0 = (Css1Style) style;
+		if (style0.cssWidth != null) {
+			style0.addRedefinitionWarning(ac, this);
+		}
+		style0.cssWidth = this;
+	}
 
-    /**
-     * Compares two properties for equality.
-     *
-     * @param property The other property.
-     */
-    public boolean equals(CssProperty property) {
-        return (property instanceof CssWidth);
-    }
+	/**
+	 * Get this property in the style.
+	 *
+	 * @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).getWidth();
+		} else {
+			return ((Css1Style) style).cssWidth;
+		}
+	}
 
-    /**
-     * Is the value of this property is a default value.
-     * It is used by all macro for the function <code>print</code>
-     */
-    public boolean isDefault() {
-        return true;
-    }
+	/**
+	 * Compares two properties for equality.
+	 *
+	 * @param property The other property.
+	 */
+	public boolean equals(CssProperty property) {
+		return (property instanceof CssWidth) && ((CssWidth) property).value.equals(value);
+	}
 
+	/**
+	 * Is the value of this property is a default value.
+	 * It is used by all macro for the function <code>print</code>
+	 */
+	public boolean isDefault() {
+		return false;
+	}
 }

Index: CssColumnWidth.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css/CssColumnWidth.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- CssColumnWidth.java	5 Oct 2011 07:12:17 -0000	1.2
+++ CssColumnWidth.java	6 Sep 2012 12:37:56 -0000	1.3
@@ -13,6 +13,7 @@
 import org.w3c.css.util.ApplContext;
 import org.w3c.css.util.InvalidParamException;
 import org.w3c.css.values.CssExpression;
+import org.w3c.css.values.CssValue;
 
 /**
  * @since CSS3
@@ -22,6 +23,8 @@
 
     private static final String propertyName = "column-width";
 
+	public CssValue value;
+
     /**
      * Create a new CssColumnWidth
      */
@@ -77,7 +80,7 @@
      * @param property The other property.
      */
     public boolean equals(CssProperty property) {
-        return false;
+        return value.equals(((CssColumnWidth) property).value);
     }
 
     /**
@@ -91,21 +94,21 @@
      * Returns the value of this property
      */
     public Object get() {
-        return null;
+        return value;
     }
 
     /**
      * Returns true if this property is "softly" inherited
      */
     public boolean isSoftlyInherited() {
-        return false;
+        return inherit == value;
     }
 
     /**
      * Returns a string representation of the object
      */
     public String toString() {
-        return null;
+        return value.toString();
     }
 
     /**

Index: CssOpacity.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css/CssOpacity.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- CssOpacity.java	7 Oct 2011 09:33:19 -0000	1.1
+++ CssOpacity.java	6 Sep 2012 12:37:56 -0000	1.2
@@ -11,7 +11,6 @@
 import org.w3c.css.properties.css3.Css3Style;
 import org.w3c.css.util.ApplContext;
 import org.w3c.css.util.InvalidParamException;
-import org.w3c.css.util.Util;
 import org.w3c.css.values.CssExpression;
 import org.w3c.css.values.CssValue;
 
@@ -21,7 +20,7 @@
 
 public class CssOpacity extends CssProperty {
 
-    CssValue value;
+    public CssValue value;
 
     /**
      * Create a new CssOpacity
@@ -47,26 +46,14 @@
     }
 
     /**
-     * Brings all values back between 0 and 1
-     *
-     * @param opac The value to be modified if necessary
-     */
-    private float clampedValue(ApplContext ac, float opac) {
-        if (opac < 0 || opac > 1) {
-            ac.getFrame().addWarning("out-of-range", Util.displayFloat(opac));
-            return ((opac < 0) ? 0 : 1);
-        } else
-            return (opac);
-    }
-
-    /**
      * Add this property to the CssStyle.
      *
      * @param style The CssStyle
      */
     public void addToStyle(ApplContext ac, CssStyle style) {
-        if (((Css3Style) style).cssOpacity != null)
+        if (((Css3Style) style).cssOpacity != null) {
             style.addRedefinitionWarning(ac, this);
+		}
         ((Css3Style) style).cssOpacity = this;
     }
 
@@ -90,7 +77,7 @@
      * @param property The other property.
      */
     public boolean equals(CssProperty property) {
-        return false;
+        return (property instanceof CssOpacity) && ((CssOpacity)property).value.equals(value);
     }
 
     /**
Received on Thursday, 6 September 2012 12:38:29 UTC

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