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

2002/css-validator/org/w3c/css/properties/css1 CssBackground.java,1.7,1.8 CssBackgroundAttachment.java,1.5,1.6 CssBackgroundColor.java,1.7,1.8 CssBackgroundImage.java,1.5,1.6 CssBackgroundPosition.java,1.6,1.7 CssBackgroundRepeat.java,1.4,1.5 CSS1Default.properties,1.1,1.2 Css1Style.java,1.24,1.25 CssBackgroundColorMob.java,1.5,1.6 CssBackgroundTV.java,1.5,1.6 CssBorder.java,1.6,1.7 CssBorderBottom.java,1.5,1.6 CssBorderBottomColor.java,1.5,1.6 CssBorderBottomColorCSS1.java,1.5,1.6 CssBorderBottomColorCSS2.java,1.6,1.7 CssBorderColor.java,1.7,1.8 CssBorderFaceWidth.java,1.4,1.5 CssBorderFaceWidthCSS1.java,1.4,1.5 CssBorderFaceWidthCSS2.java,1.6,1.7 CssBoxOffsetFace.java,1.3,1.4 CssFontCSS2.java,1.6,1.7 CssHeight.java,1.5,1.6 CssLetterSpacing.java,1.4,1.5 CssWhiteSpace.java,1.5,1.6 CssWidth.java,1.5,1.6 CssWordSpacing.java,1.4,1.5 CssBackgroundAttachmentCSS1.java,1.6,NONE CssBackgroundCSS1.java,1.9,NONE CssBackgroundColorCSS1.java,1.6,NONE CssBackgroundImageCSS1.java,1.5,NONE CssBackgroundPositionCS

From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
Date: Thu, 09 Feb 2012 17:36:31 +0000
To: Message-Id: <E1RvXva-0006lS-2d@lionel-hutz.w3.org>
Update of /sources/public/2002/css-validator/org/w3c/css/properties/css1
In directory hutz:/tmp/cvs-serv25830/w3c/css/properties/css1

Modified Files:
	CSS1Default.properties Css1Style.java 
	CssBackgroundColorMob.java CssBackgroundTV.java CssBorder.java 
	CssBorderBottom.java CssBorderBottomColor.java 
	CssBorderBottomColorCSS1.java CssBorderBottomColorCSS2.java 
	CssBorderColor.java CssBorderFaceWidth.java 
	CssBorderFaceWidthCSS1.java CssBorderFaceWidthCSS2.java 
	CssBoxOffsetFace.java CssFontCSS2.java CssHeight.java 
	CssLetterSpacing.java CssWhiteSpace.java CssWidth.java 
	CssWordSpacing.java 
Added Files:
	CssBackground.java CssBackgroundAttachment.java 
	CssBackgroundColor.java CssBackgroundImage.java 
	CssBackgroundPosition.java CssBackgroundRepeat.java 
Removed Files:
	CssBackgroundAttachmentCSS1.java CssBackgroundCSS1.java 
	CssBackgroundColorCSS1.java CssBackgroundImageCSS1.java 
	CssBackgroundPositionCSS1.java CssBackgroundRepeatCSS1.java 
Log Message:
various things: Use of BigIntegers to avoid limits, background-* are now avoiding multiplication of checks and properties in CssXStyles impls, various updates for other properties, use of a string reader for string input, added the possibility of not following links, prepared for aggregation of all uris parsed

Index: CssBorder.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css1/CssBorder.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- CssBorder.java	27 Sep 2011 08:15:45 -0000	1.6
+++ CssBorder.java	9 Feb 2012 17:36:29 -0000	1.7
@@ -182,7 +182,7 @@
 //	top = new CssBorderTop(ac, expression);
 /*
 	right = new CssBorderRight();
-	bottom = new CssBorderBottom();
+	bottom = new CssBorderBottomCSS21();
 	left = new CssBorderLeft();*/
 /*
 	right.width  =  new CssBorderRightWidth((CssBorderFaceWidth) top.width.get());
@@ -195,7 +195,7 @@
 
 	right.color  = 	new CssBorderRightColor((CssBorderFaceColor) top.color.get());
 	left.color   =  new CssBorderLeftColor((CssBorderFaceColor) top.color.get());
-	bottom.color =  new CssBorderBottomColor((CssBorderFaceColor) top.color.get());
+	bottom.color =  new CssBorderBottomColorCSS21((CssBorderFaceColor) top.color.get());
 */
     }
 

--- CssBackgroundAttachmentCSS1.java DELETED ---

--- NEW FILE: CssBackgroundPosition.java ---
//
// $Id: CssBackgroundPosition.java,v 1.7 2012/02/09 17:36:28 ylafon Exp $
// From Philippe Le Hegaret (http://www.w3.org/TR/2008/REC-CSS1-20080411/#letter-spacing
  * @version $Revision$
  */
-public class CssLetterSpacing extends CssProperty {
+public class CssLetterSpacing extends org.w3c.css.properties.css.CssLetterSpacing {
 
-    CssValue length;
-    static CssIdent normal = new CssIdent("normal");
+    private CssValue value;
+    private static CssIdent normal = CssIdent.getIdent("normal");
 
     /**
-     * Create a new CssLetterSpacing
+     * Create a new CssLetterSpacing.
      */
     public CssLetterSpacing() {
-	length = normal;
+        value = normal;
     }
 
     /**
-     * Create a new CssLetterSpacing
+     * Create a new CssLetterSpacing with an expression
      *
-     * @param expression The expression for this property
-     * @exception InvalidParamException Values are incorrect
+     * @param expression The expression
+     * @throws InvalidParamException The expression is incorrect
      */
     public CssLetterSpacing(ApplContext ac, CssExpression expression,
-	    boolean check) throws InvalidParamException {
+                          boolean check) throws InvalidParamException {
 
-	if(check && expression.getCount() > 1) {
-	    throw new InvalidParamException("unrecognize", ac);
-	}
+        if (check && expression.getCount() > 1) {
+            throw new InvalidParamException("unrecognize", ac);
+        }
 
-	setByUser();
+        CssValue val = expression.getValue();
 
-	CssValue val = expression.getValue();
-	if (val instanceof CssLength) {
-	    length = (CssLength) val;
-	    expression.next();
-	} else if (val instanceof CssNumber) {
-	    length = ((CssNumber) val).getLength();
-	    expression.next();
-	} else if (val.equals(inherit)) {
-	    length = inherit;
-	    expression.next();
-	} else if (val.equals(normal)) {
-	    length = normal;
-	    expression.next();
-	} else {
-	    throw new InvalidParamException("value",
-					    expression.getValue(),
-					    getPropertyName(), ac);
-	}
+        setByUser();
+
+        switch (val.getType()) {
+            case CssTypes.CSS_NUMBER:
+                val = ((CssNumber) val).getLength();
+            case CssTypes.CSS_LENGTH:
+                value = val;
+                break;
+            case CssTypes.CSS_IDENT:
+                if (inherit.equals(val) || normal.equals(val)) {
+                    value = val;
+                    break;
+                }
+            default:
+                throw new InvalidParamException("value", expression.getValue(),
+                        getPropertyName(), ac);
+        }
+        expression.next();
     }
 
     public CssLetterSpacing(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 length;
-    }
-
-    /**
-     * Returns the name of this property
-     */
-    public String getPropertyName() {
-	return "letter-spacing";
+        return value;
     }
 
     /**
@@ -122,50 +82,23 @@
      * e.g. his value equals inherit
      */
     public boolean isSoftlyInherited() {
-	return length == inherit;
+        return value == inherit;
     }
 
     /**
      * Returns a string representation of the object.
      */
     public String toString() {
-	return length.toString();
-    }
-
-    /**
-     * Add this property to the CssStyle.
-     *
-     * @param style The CssStyle
-     */
-    public void addToStyle(ApplContext ac, CssStyle style) {
-	Css1Style style0 = (Css1Style) style;
-	if (style0.cssLetterSpacing != null)
-	    style0.addRedefinitionWarning(ac, this);
-	style0.cssLetterSpacing = 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).getLetterSpacing();
-	} else {
-	    return ((Css1Style) style).cssLetterSpacing;
-	}
+        return value.toString();
     }
 
     /**
      * Compares two properties for equality.
      *
-     * @param value The other property.
+     * @param property The other property.
      */
     public boolean equals(CssProperty property) {
-	return (property instanceof CssLetterSpacing &&
-		length.equals(((CssLetterSpacing) property).length));
+        return (property instanceof CssLetterSpacing &&
+                value.equals(((CssLetterSpacing) property).value));
     }
-
 }

Index: CssBorderFaceWidthCSS2.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css1/CssBorderFaceWidthCSS2.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- CssBorderFaceWidthCSS2.java	5 Jan 2010 13:49:41 -0000	1.6
+++ CssBorderFaceWidthCSS2.java	9 Feb 2012 17:36:29 -0000	1.7
@@ -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.CssLength;
 import org.w3c.css.values.CssNumber;
 import org.w3c.css.values.CssTypes;
 import org.w3c.css.values.CssValue;
@@ -23,20 +24,21 @@
 public class CssBorderFaceWidthCSS2 {
 
     public static HashSet<CssIdent> acceptable_values;
+
     static {
-	acceptable_values = new HashSet<CssIdent>();
-	acceptable_values.add(CssIdent.getIdent("thin"));
-	acceptable_values.add(CssIdent.getIdent("medium"));
-	acceptable_values.add(CssIdent.getIdent("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 = CssIdent.getIdent("medium");
+        value = CssIdent.getIdent("medium");
     }
 
     /**
@@ -45,72 +47,72 @@
      * @param another The another side.
      */
     public CssBorderFaceWidthCSS2(CssBorderFaceWidthCSS2 another) {
-	value = another.value;
+        value = another.value;
     }
 
     /**
      * Create a new CssBorderFaceWidth
      *
      * @param expression The expression for this property
-     * @exception InvalidParamException Values are incorrect
+     * @throws InvalidParamException Values are incorrect
      */
     public CssBorderFaceWidthCSS2(ApplContext ac, CssExpression expression,
-	    boolean check) throws InvalidParamException {
+                                  boolean check) 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();
+        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) {
-		this.value = val;
-	    } else {
-		throw new InvalidParamException("negative-value", val.toString(), ac);
-	    }
-	    break;
-	case CssTypes.CSS_IDENT:
-	    CssIdent ci = (CssIdent) val;
-	    if (CssProperty.inherit.equals(ci)) {
-		value = CssProperty.inherit;
-		break;
-	    } 
-	    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();
+        switch (val.getType()) {
+            case CssTypes.CSS_NUMBER:
+                val = ((CssNumber) val).getLength();
+            case CssTypes.CSS_LENGTH:
+                CssLength l = (CssLength) val;
+                if (l.isPositive()) {
+                    this.value = val;
+                } else {
+                    throw new InvalidParamException("negative-value", val.toString(), ac);
+                }
+                break;
+            case CssTypes.CSS_IDENT:
+                CssIdent ci = (CssIdent) val;
+                if (CssProperty.inherit.equals(ci)) {
+                    value = CssProperty.inherit;
+                    break;
+                }
+                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();
     }
 
     public CssBorderFaceWidthCSS2(ApplContext ac, CssExpression expression)
-	throws InvalidParamException {
-	this(ac, expression, false);
+            throws InvalidParamException {
+        this(ac, expression, false);
     }
 
     /**
      * Returns the internal value
      */
     public CssValue getValue() {
-	return value;
+        return value;
     }
 
     /**
      * Returns a string representation of the object.
      */
     public String toString() {
-	if(value != null) {
-	    return value.toString();
-	}
-	return "";
+        if (value != null) {
+            return value.toString();
+        }
+        return "";
     }
 
     /**
@@ -119,11 +121,10 @@
      * @param value The another side.
      */
     public boolean equals(CssBorderFaceWidthCSS2 another) {
-	return value.equals(another.value); // FIXME
+        return value.equals(another.value); // FIXME
     }
 
 
-
 }
 
 

Index: CssBackgroundTV.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css1/CssBackgroundTV.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- CssBackgroundTV.java	9 Sep 2011 12:16:43 -0000	1.5
+++ CssBackgroundTV.java	9 Feb 2012 17:36:29 -0000	1.6
@@ -10,10 +10,10 @@
 import org.w3c.css.parser.CssStyle;
 import org.w3c.css.properties.css.CssBackgroundConstants;
 import org.w3c.css.properties.css.CssProperty;
-import org.w3c.css.properties.css2.CssBackgroundColorCSS2;
-import org.w3c.css.properties.css2.CssBackgroundImageCSS2;
-import org.w3c.css.properties.css2.CssBackgroundPositionCSS2;
-import org.w3c.css.properties.css2.CssBackgroundRepeatCSS2;
+import org.w3c.css.properties.css2.CssBackgroundColor;
+import org.w3c.css.properties.css2.CssBackgroundImage;
+import org.w3c.css.properties.css2.CssBackgroundPosition;
+import org.w3c.css.properties.css2.CssBackgroundRepeat;
 import org.w3c.css.util.ApplContext;
 import org.w3c.css.util.InvalidParamException;
 import org.w3c.css.values.CssExpression;
@@ -59,15 +59,15 @@
 public class CssBackgroundTV extends CssProperty
         implements CssOperator, CssBackgroundConstants {
 
-    CssBackgroundColorCSS2 color;
-    CssBackgroundImageCSS2 image;
-    CssBackgroundRepeatCSS2 repeat;
-    CssBackgroundPositionCSS2 position;
+    CssBackgroundColor color;
+    CssBackgroundImage image;
+    CssBackgroundRepeat repeat;
+    CssBackgroundPosition position;
 
     boolean same;
 
     /**
-     * Create a new CssBackgroundCSS2
+     * Create a new CssBackground
      */
     public CssBackgroundTV() {
     }
@@ -95,13 +95,13 @@
 	    if(expression.getCount() > 1) {
 		throw new InvalidParamException("unrecognize", ac);
 	    }
-	    color = new CssBackgroundColorCSS2();
+	    color = new CssBackgroundColor();
 	    color.color = inherit;
-	    image = new CssBackgroundImageCSS2();
+	    image = new CssBackgroundImage();
 	    image.url = inherit;
-	    repeat = new CssBackgroundRepeatCSS2();
+	    repeat = new CssBackgroundRepeat();
 //	    repeat.repeat = REPEAT.length - 1;
-	    position = new CssBackgroundPositionCSS2();
+	    position = new CssBackgroundPosition();
 	    position.value = inherit;
 	    same = true;
 	    expression.next();
@@ -119,27 +119,27 @@
 
 	    if (color == null) {
 		try {
-		    color = new CssBackgroundColorCSS2(ac, expression);
+		    color = new CssBackgroundColor(ac, expression);
 		    find = true;
 		} catch (InvalidParamException e) {
 		}
 	    }
 	    if (!find && image == null) {
 		try {
-		    image = new CssBackgroundImageCSS2(ac, expression);
+		    image = new CssBackgroundImage(ac, expression);
 		    find = true;
 		} catch (InvalidParamException e) {
 		}
 	    }
 	    if (!find && repeat == null) {
 		try {
-		    repeat = new CssBackgroundRepeatCSS2(ac, expression);
+		    repeat = new CssBackgroundRepeat(ac, expression);
 		    find = true;
 		} catch (InvalidParamException e) {
 		}
 	    }
 	    if (!find && position == null) {
-		position = new CssBackgroundPositionCSS2(ac, expression);
+		position = new CssBackgroundPosition(ac, expression);
 		find = true;
 	    }
 	    if (op != SPACE) {
@@ -150,13 +150,13 @@
 	}
 	/*
 	if (color == null)
-	    color = new CssBackgroundColorCSS2();
+	    color = new CssBackgroundColor();
 	if (image == null)
-	    image = new CssBackgroundImageCSS2();
+	    image = new CssBackgroundImage();
 	if (repeat == null)
-	    repeat = new CssBackgroundRepeatCSS2();
+	    repeat = new CssBackgroundRepeat();
 	if (position == null)
-	    position = new CssBackgroundPositionCSS2();
+	    position = new CssBackgroundPosition();
 	*/
     }
 
@@ -278,8 +278,8 @@
      * @param style The CssStyle
      */
     public void addToStyle(ApplContext ac, CssStyle style) {
-	((Css1Style) style).cssBackgroundCSS2.same = same;
-	((Css1Style) style).cssBackgroundCSS2.byUser = byUser;
+	((Css1Style) style).cssBackground.same = same;
+	((Css1Style) style).cssBackground.byUser = byUser;
 
 	if(color != null) {
 	    color.addToStyle(ac, style);
@@ -303,9 +303,9 @@
      */
     public CssProperty getPropertyInStyle(CssStyle style, boolean resolve) {
 	if (resolve) {
-	    return ((Css1Style) style).getBackgroundCSS2();
+	    return ((Css1Style) style).getBackground();
 	} else {
-	    return ((Css1Style) style).cssBackgroundCSS2;
+	    return ((Css1Style) style).cssBackground;
 	}
     }
 

Index: CssWordSpacing.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css1/CssWordSpacing.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- CssWordSpacing.java	5 Jan 2010 13:49:46 -0000	1.4
+++ CssWordSpacing.java	9 Feb 2012 17:36:29 -0000	1.5
@@ -6,104 +6,76 @@
 // Please first read the full copyright statement in file COPYRIGHT.html
 package org.w3c.css.properties.css1;
 
-import org.w3c.css.parser.CssStyle;
 import org.w3c.css.properties.css.CssProperty;
 import org.w3c.css.util.ApplContext;
 import org.w3c.css.util.InvalidParamException;
 import org.w3c.css.values.CssExpression;
 import org.w3c.css.values.CssIdent;
-import org.w3c.css.values.CssLength;
 import org.w3c.css.values.CssNumber;
+import org.w3c.css.values.CssTypes;
 import org.w3c.css.values.CssValue;
 
 /**
- *   <H4>
- *     &nbsp;&nbsp; 'word-spacing'
- *   </H4>
- *   <P>
- *   <EM>Value:</EM> normal | &lt;length&gt; <BR>
- *   <EM>Initial:</EM> normal<BR>
- *   <EM>Applies to:</EM> all elements<BR>
- *   <EM>Inherited:</EM> yes<BR>
- *   <EM>Percentage values:</EM> N/A<BR>
- *   <P> The length unit indicates an addition to the default space between
- *   words.  Values can be negative, but there may be implementation-specific
- *   limits.  The UA is free to select the exact spacing algorithm. The word
- *   spacing may also be influenced by justification (which is a value of the
- *   'align' property).
- *   <PRE>
- *   H1 { word-spacing: 0.4em }
- * </PRE>
- *   <P>
- *   Here, the word-spacing between each word in 'H1' elements would be increased
- *   by '1em'.
- *
+ * @spec  http://www.w3.org/TR/2008/REC-CSS1-20080411/#word-spacing
  * @version $Revision$
  */
-public class CssWordSpacing extends CssProperty {
+public class CssWordSpacing extends org.w3c.css.properties.css.CssWordSpacing {
 
-    private CssValue length;
-    private static CssIdent normal = new CssIdent("normal");
+    private CssValue value;
+    private static CssIdent normal = CssIdent.getIdent("normal");
 
     /**
      * Create a new CssWordSpacing.
      */
     public CssWordSpacing() {
-	length = normal;
+        value = normal;
     }
 
     /**
      * Create a new CssWordSpacing with an expression
      *
      * @param expression The expression
-     * @exception InvalidParamException The expression is incorrect
+     * @throws InvalidParamException The expression is incorrect
      */
     public CssWordSpacing(ApplContext ac, CssExpression expression,
-	boolean check) throws InvalidParamException {
+                          boolean check) 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();
+        CssValue val = expression.getValue();
 
-	setByUser();
+        setByUser();
 
-	if (val instanceof CssLength) {
-	    length = (CssLength) val;
-	    expression.next();
-	} else if (val instanceof CssNumber) {
-	    length = ((CssNumber) val).getLength();
-	    expression.next();
-	} else if (val.equals(inherit)) {
-	    length = inherit;
-	    expression.next();
-	} else if (val.equals(normal)) {
-	    length = normal;
-	    expression.next();
-	} else {
-	    throw new InvalidParamException("value", expression.getValue(),
-					    getPropertyName(), ac);
-	}
+        switch (val.getType()) {
+            case CssTypes.CSS_NUMBER:
+                val = ((CssNumber) val).getLength();
+            case CssTypes.CSS_LENGTH:
+                value = val;
+                break;
+            case CssTypes.CSS_IDENT:
+                if (inherit.equals(val) || normal.equals(val)) {
+                    value = val;
+                    break;
+                }
+            default:
+                throw new InvalidParamException("value", expression.getValue(),
+                        getPropertyName(), ac);
+        }
+        expression.next();
     }
 
     public CssWordSpacing(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 length;
-    }
-
-    /**
-     * Returns the name of this property
-     */
-    public String getPropertyName() {
-	return "word-spacing";
+        return value;
     }
 
     /**
@@ -111,49 +83,23 @@
      * e.g. his value equals inherit
      */
     public boolean isSoftlyInherited() {
-	return length == inherit;
+        return value == inherit;
     }
 
     /**
      * Returns a string representation of the object.
      */
     public String toString() {
-	return length.toString();
-    }
-
-    /**
-     * Adds this property to a style.
-     *
-     * @param style The style.
-     */
-    public void addToStyle(ApplContext ac, CssStyle style) {
-	Css1Style style0 = (Css1Style) style;
-	if (style0.cssWordSpacing != null)
-	    style0.addRedefinitionWarning(ac, this);
-	style0.cssWordSpacing = 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).getWordSpacing();
-	} else {
-	    return ((Css1Style) style).cssWordSpacing;
-	}
+        return value.toString();
     }
 
     /**
      * Compares two properties for equality.
      *
-     * @param value The other property.
+     * @param property The other property.
      */
     public boolean equals(CssProperty property) {
-	return (property instanceof CssWordSpacing &&
-		length.equals(((CssWordSpacing) property).length));
+        return (property instanceof CssWordSpacing &&
+                value.equals(((CssWordSpacing) property).value));
     }
 }

Index: CssBorderFaceWidth.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css1/CssBorderFaceWidth.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- CssBorderFaceWidth.java	5 Jan 2010 13:49:40 -0000	1.4
+++ CssBorderFaceWidth.java	9 Feb 2012 17:36:29 -0000	1.5
@@ -27,7 +27,7 @@
      * Create a new CssBorderFaceWidth
      */
     public CssBorderFaceWidth() {
-	//value = medium;
+        //value = medium;
     }
 
     /**
@@ -36,62 +36,62 @@
      * @param another The another side.
      */
     public CssBorderFaceWidth(CssBorderFaceWidth another) {
-	value = another.value;
+        value = another.value;
     }
 
     /**
      * Create a new CssBorderFaceWidth
      *
      * @param expression The expression for this property
-     * @exception InvalidParamException Values are incorrect
+     * @throws InvalidParamException Values are incorrect
      */
     public CssBorderFaceWidth(ApplContext ac, CssExpression expression,
-	    boolean check) throws InvalidParamException {
+                              boolean check) 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();
-	CssIdent initial = new CssIdent("initial");
+        CssValue val = expression.getValue();
+        CssIdent initial = new CssIdent("initial");
 
-	if (val instanceof CssLength) {
-	    float f = ((Float) val.get()).floatValue();
-	    if (f >= 0)
-		this.value = val;
-	    else
-		throw new InvalidParamException("negative-value", val.toString(), ac);
-	} else if (val instanceof CssNumber) {
-	    value = ((CssNumber) val).getLength();
-	} else if (val instanceof CssPercentage) {
-	    value = val;
-	} else if (val.equals(thin)) {
-	    value = thin;
-	} else if (val.equals(medium)) {
-	    value = medium;
-	} else if (val.equals(thick)) {
-	    value = thick;
-	} else if (val.equals(initial)) {
-	    value = initial;
-	} else if (val.equals(CssProperty.inherit)) {
-	    value = CssProperty.inherit;
-	} else {
-	    throw new InvalidParamException("value", val.toString(), "width", ac);
-	}
+        if (val instanceof CssLength) {
+            CssLength l = (CssLength) val;
+            if (l.isPositive()) {
+                this.value = val;
+            } else
+                throw new InvalidParamException("negative-value", val.toString(), ac);
+        } else if (val instanceof CssNumber) {
+            value = ((CssNumber) val).getLength();
+        } else if (val instanceof CssPercentage) {
+            value = val;
+        } else if (val.equals(thin)) {
+            value = thin;
+        } else if (val.equals(medium)) {
+            value = medium;
+        } else if (val.equals(thick)) {
+            value = thick;
+        } else if (val.equals(initial)) {
+            value = initial;
+        } else if (val.equals(CssProperty.inherit)) {
+            value = CssProperty.inherit;
+        } else {
+            throw new InvalidParamException("value", val.toString(), "width", ac);
+        }
 
-	expression.next();
+        expression.next();
     }
 
     public CssBorderFaceWidth(ApplContext ac, CssExpression expression)
-	throws InvalidParamException {
-	this(ac, expression, false);
+            throws InvalidParamException {
+        this(ac, expression, false);
     }
 
     /**
      * Returns the internal value
      */
     public CssValue getValue() {
-	return value;
+        return value;
     }
 
     /**
@@ -99,11 +99,11 @@
      */
     public String toString() {
 
-	if (value != null) {
-	    return value.toString();
-	} else {
-	    return "";
-	}
+        if (value != null) {
+            return value.toString();
+        } else {
+            return "";
+        }
     }
 
     /**
@@ -112,7 +112,7 @@
      * @param value The another side.
      */
     public boolean equals(CssBorderFaceWidth another) {
-	return value.equals(another.value); // FIXME
+        return value.equals(another.value); // FIXME
     }
 
     private static CssIdent thin = new CssIdent("thin");

Index: CssWhiteSpace.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css1/CssWhiteSpace.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- CssWhiteSpace.java	5 Jan 2010 13:49:46 -0000	1.5
+++ CssWhiteSpace.java	9 Feb 2012 17:36:29 -0000	1.6
@@ -1,123 +1,70 @@
-//
 // $Id$
 // From Philippe Le Hegaret (http://www.w3.org/TR/2008/REC-CSS1-20080411/#white-space
  */
-public class CssWhiteSpace extends CssProperty {
+public class CssWhiteSpace extends org.w3c.css.properties.css.CssWhiteSpace {
 
-    int value;
+    CssValue value;
 
-    private static String[] WHITESPACE = {
-	"normal", "pre", "nowrap", "inherit" };
-    private static int[] hash_values;
+    public static HashMap<String, CssIdent> allowed_values;
 
-    /**
-     * Create a new CssWhiteSpace
-     */
-    public CssWhiteSpace() {
-	// nothing to do
+    static {
+        allowed_values = new HashMap<String, CssIdent>();
+        String[] WHITESPACE = {
+                "normal", "pre", "nowrap"
+        };
+
+        for (String aWS : WHITESPACE) {
+            allowed_values.put(aWS, CssIdent.getIdent(aWS));
+        }
     }
 
     /**
      * Create a new CssWhiteSpace
      *
      * @param expression The expression for this property
-     * @exception InvalidParamException values are incorrect
+     * @throws InvalidParamException values are incorrect
      */
     public CssWhiteSpace(ApplContext ac, CssExpression expression, boolean check)
-    	throws InvalidParamException {
-
-	if(check && expression.getCount() > 1) {
-	    throw new InvalidParamException("unrecognize", ac);
-	}
-
-	CssValue val = expression.getValue();
+            throws InvalidParamException {
 
-	setByUser();
+        if (check && expression.getCount() > 1) {
+            throw new InvalidParamException("unrecognize", ac);
+        }
 
-	if ( val instanceof CssIdent) {
-	    int hash = val.hashCode();
-	    for (int i = 0; i < WHITESPACE.length; i++)
-		if (hash_values[i] == hash) {
-		    value = i;
-		    expression.next();
-		    return;
-		}
-	}
+        CssValue val = expression.getValue();
+        setByUser();
 
-	throw new InvalidParamException("value", expression.getValue(),
-					getPropertyName(), ac);
+        if (val.getType() == CssTypes.CSS_IDENT) {
+            value = allowed_values.get(val.toString());
+            if (value != null) {
+                expression.next();
+                return;
+            }
+        }
+        throw new InvalidParamException("value", expression.getValue(),
+                getPropertyName(), ac);
     }
 
     public CssWhiteSpace(ApplContext ac, CssExpression expression)
-	throws InvalidParamException {
-	this(ac, expression, false);
-    }
-
-    /**
-     * @return Returns the value.
-     */
-    public int getValue() {
-        return value;
-    }
-
-    /**
-     * @param value The value to set.
-     */
-    public void setValue(int value) {
-        this.value = value;
-    }
-
-    /**
-     * Returns the value of this property
-     */
-    public Object get() {
-	return WHITESPACE[value];
-    }
-
-    /**
-     * Returns the name of this property
-     */
-    public String getPropertyName() {
-	return "white-space";
+            throws InvalidParamException {
+        this(ac, expression, false);
     }
 
     /**
@@ -125,55 +72,14 @@
      * e.g. his value equals inherit
      */
     public boolean isSoftlyInherited() {
-	return value == (WHITESPACE.length - 1);
+        return (inherit == value);
     }
 
     /**
      * Returns a string representation of the object.
      */
     public String toString() {
-	return WHITESPACE[value];
-    }
-
-    /**
-     * Add this property to the CssStyle.
-     *
-     * @param style The CssStyle
-     */
-    public void addToStyle(ApplContext ac, CssStyle style) {
-	Css1Style style0 = (Css1Style) style;
-	if (style0.cssWhiteSpace != null)
-	    style0.addRedefinitionWarning(ac, this);
-	style0.cssWhiteSpace = 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).getWhiteSpace();
-	} else {
-	    return ((Css1Style) style).cssWhiteSpace;
-	}
-    }
-
-    /**
-     * Compares two properties for equality.
-     *
-     * @param value The other property.
-     */
-    public boolean equals(CssProperty property) {
-	return (property instanceof CssWhiteSpace &&
-		value == ((CssWhiteSpace) property).value);
+        return value.toString();
     }
 
-    static {
-	hash_values = new int[WHITESPACE.length];
-	for (int i = 0; i < WHITESPACE.length; i++)
-	    hash_values[i] = WHITESPACE[i].hashCode();
-    }
 }

--- NEW FILE: CssBackgroundAttachment.java ---
//
// $Id: CssBackgroundAttachment.java,v 1.6 2012/02/09 17:36:28 ylafon Exp $
// From Philippe Le Hegaret (Received on Thursday,  9 February 2012 17:37:13 GMT

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