2002/css-validator/org/w3c/css/properties/css1 Css1Style.java,1.25,1.26 CssBackground.java,1.8,1.9 CssBorder.java,1.7,1.8 CssBorderBottom.java,1.6,1.7 CssBorderBottomWidth.java,1.4,1.5 CssBorderColor.java,1.8,1.9 CssBorderLeft.java,1.5,1.6 CssBorderLeftWidth.java,1.4,1.5 CssBorderRight.java,1.5,1.6 CssBorderRightWidth.java,1.4,1.5 CssBorderStyle.java,1.8,1.9 CssBorderTop.java,1.5,1.6 CssBorderTopWidth.java,1.4,1.5 CssBorderWidth.java,1.5,1.6 CssBorderBottomCSS1.java,1.5,NONE CssBorderBottomCSS2.java,1.6,NONE CssBorderBottomColor.java,1.6,NONE CssBorderBottomColorCSS1.java,1.6,NONE CssBorderBottomColorCSS2.java,1.7,NONE CssBorderBottomStyle.java,1.4,NONE CssBorderBottomStyleCSS1.java,1.4,NONE CssBorderBottomStyleCSS2.java,1.4,NONE CssBorderBottomWidthCSS1.java,1.4,NONE CssBorderBottomWidthCSS2.java,1.4,NONE CssBorderCSS1.java,1.5,NONE CssBorderCSS2.java,1.6,NONE CssBorderColorCSS1.java,1.6,NONE CssBorderColorCSS2.java,1.8,NONE CssBorderFaceColor.java,1.4,NONE CssBorderFaceColorCSS1.java,1.5,NONE Css

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

Modified Files:
	Css1Style.java CssBackground.java CssBorder.java 
	CssBorderBottom.java CssBorderBottomWidth.java 
	CssBorderColor.java CssBorderLeft.java CssBorderLeftWidth.java 
	CssBorderRight.java CssBorderRightWidth.java 
	CssBorderStyle.java CssBorderTop.java CssBorderTopWidth.java 
	CssBorderWidth.java 
Removed Files:
	CssBorderBottomCSS1.java CssBorderBottomCSS2.java 
	CssBorderBottomColor.java CssBorderBottomColorCSS1.java 
	CssBorderBottomColorCSS2.java CssBorderBottomStyle.java 
	CssBorderBottomStyleCSS1.java CssBorderBottomStyleCSS2.java 
	CssBorderBottomWidthCSS1.java CssBorderBottomWidthCSS2.java 
	CssBorderCSS1.java CssBorderCSS2.java CssBorderColorCSS1.java 
	CssBorderColorCSS2.java CssBorderFaceColor.java 
	CssBorderFaceColorCSS1.java CssBorderFaceColorCSS2.java 
	CssBorderFaceStyle.java CssBorderFaceStyleCSS1.java 
	CssBorderFaceStyleCSS2.java CssBorderFaceWidth.java 
	CssBorderFaceWidthCSS1.java CssBorderFaceWidthCSS2.java 
	CssBorderLeftCSS1.java CssBorderLeftCSS2.java 
	CssBorderLeftColor.java CssBorderLeftColorCSS1.java 
	CssBorderLeftColorCSS2.java CssBorderLeftStyle.java 
	CssBorderLeftStyleCSS1.java CssBorderLeftStyleCSS2.java 
	CssBorderLeftWidthCSS1.java CssBorderLeftWidthCSS2.java 
	CssBorderRightCSS1.java CssBorderRightCSS2.java 
	CssBorderRightColor.java CssBorderRightColorCSS1.java 
	CssBorderRightColorCSS2.java CssBorderRightStyle.java 
	CssBorderRightStyleCSS1.java CssBorderRightStyleCSS2.java 
	CssBorderRightWidthCSS1.java CssBorderRightWidthCSS2.java 
	CssBorderStyleCSS1.java CssBorderStyleCSS2.java 
	CssBorderTopCSS1.java CssBorderTopCSS2.java 
	CssBorderTopColor.java CssBorderTopColorCSS1.java 
	CssBorderTopColorCSS2.java CssBorderTopStyle.java 
	CssBorderTopStyleCSS1.java CssBorderTopStyleCSS2.java 
	CssBorderTopWidthCSS1.java CssBorderTopWidthCSS2.java 
	CssBorderWidthCSS1.java CssBorderWidthCSS2.java 
Log Message:
Finished implementation of css3-background (background and borders)
* border is now a single item, instead of one per level
* able to parse all the positive tests, some negative ones will need some tuning
* Grammar modification to use the '/' between two numbers without matching a ratio 



--- CssBorderTopStyleCSS2.java DELETED ---

--- CssBorderBottomStyleCSS1.java DELETED ---

Index: CssBorderBottomWidth.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css1/CssBorderBottomWidth.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- CssBorderBottomWidth.java	5 Jan 2010 13:49:40 -0000	1.4
+++ CssBorderBottomWidth.java	25 Apr 2012 20:21:56 -0000	1.5
@@ -1,158 +1,44 @@
-//
 // $Id$
-// From Philippe Le Hegaret (Philippe.Le_Hegaret@sophia.inria.fr)
+// Author: Yves Lafon <ylafon@w3.org>
 //
-// (c) COPYRIGHT MIT and INRIA, 1997.
+// (c) COPYRIGHT MIT, ERCIM and Keio University, 2012.
 // 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.CssValue;
 
 /**
- *   <H4>
- *      &nbsp;&nbsp; 'border-bottom-width'
- *   </H4>
- *   <P>
- *   <EM>Value:</EM> thin | medium | thick | &lt;length&gt;<BR>
- *   <EM>Initial:</EM> 'medium'<BR>
- *   <EM>Applies to:</EM> all elements<BR>
- *   <EM>Inherited:</EM> no<BR>
- *   <EM>Percentage values:</EM> N/A<BR>
- *   <P> This property sets the width of an element's bottom border. The width
- *   of the keyword values are UA dependent, but the following holds: 'thin'
- *   &lt;= 'medium' &lt;= 'thick'.
- *   <P>
- *   The keyword widths are constant throughout a document:
- *   <PRE>
- *   H1 { border: solid thick red }
- *   P  { border: solid thick blue }
- * </PRE>
- *   <P>
- *   In the example above, 'H1' and 'P' elements will have the same border width
- *   regardless of font size. To achieve relative widths, the 'em' unit can be
- *   used:
- *   <PRE>
- *   H1 { border: solid 0.5em }
- * </PRE>
- *   <P>
- *   Border widths cannot be negative.
- * @version $Revision$ */
-public class CssBorderBottomWidth extends CssProperty {
-
-  CssBorderFaceWidth face;
-
-  /**
-   * Create a new CssBorderBottomWidth
-   */
-  public CssBorderBottomWidth() {
-    face = new CssBorderFaceWidth();
-  }
-
-  /**
-   * Create a new CssBorderBottomWidth with an another CssBorderFaceWidth
-   *
-   * @param another An another face.
-   */
-  public CssBorderBottomWidth(CssBorderFaceWidth another) {
-	setByUser();
-
-    face = another;
-  }
-
-  /**
-   * Create a new CssBorderBottomWidth
-   *
-   * @param expression The expression for this property.
-   * @exception InvalidParamException Values are incorrect
-   */
-  public CssBorderBottomWidth(ApplContext ac, CssExpression expression,
-	  boolean check) throws InvalidParamException {
-
-      if(check && expression.getCount() > 1) {
-	  throw new InvalidParamException("unrecognize", ac);
-      }
-
-      setByUser();
-      face = new CssBorderFaceWidth(ac, expression);
-  }
-
-  public CssBorderBottomWidth(ApplContext ac, CssExpression expression)
-	throws InvalidParamException {
-	this(ac, expression, false);
-  }
-
-  /**
-   * Returns the value of this property
-   */
-  public Object get() {
-    return face;
-  }
-
-  /**
-   * Return the value of this property
-   */
-  public CssValue getValue() {
-      if(face != null) {
-	  return face.getValue();
-      }
-      return null;
-  }
-
-  /**
-   * Returns a string representation of the object.
-   */
-  public String toString() {
-      if(face != null) {
-	  return face.toString();
-      }
-      return "";
-  }
-
-  /**
-   * Returns the name of this property
-   */
-  public String getPropertyName() {
-    return "border-bottom-width";
-  }
+ * @spec http://www.w3.org/TR/2011/REC-CSS2-20110607/box.html#value-def-border-width
+ * @version $Revision$
+ */
+public class CssBorderBottomWidth extends org.w3c.css.properties.css.CssBorderBottomWidth {
 
-  /**
-   * Add this property to the CssStyle.
-   *
-   * @param style The CssStyle
-   */
-  public void addToStyle(ApplContext ac, CssStyle style) {
-    CssBorderBottom bottom = ((Css1Style) style).cssBorder.bottom;
-    if (bottom.width != null)
-      style.addRedefinitionWarning(ac, this);
-    bottom.width = this;
-  }
+    /**
+     * Create a new CssBorderBottomWidth
+     */
+    public CssBorderBottomWidth() {
+    }
 
-  /**
-   * 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).getBorderBottomWidth();
-    } else {
-      return ((Css1Style) style).cssBorder.getBottom().width;
+    /**
+     * Creates a new CssBorderBottomWidth
+     *
+     * @param expression The expression for this property
+     * @throws org.w3c.css.util.InvalidParamException
+     *          Expressions are incorrect
+     */
+    public CssBorderBottomWidth(ApplContext ac, CssExpression expression, boolean check)
+            throws InvalidParamException {
+        setByUser();
+        // here we delegate to BorderWidth implementation
+        value = CssBorderWidth.checkBorderSideWidth(ac, this, expression, check);
     }
-  }
 
-  /**
-   * Compares two properties for equality.
-   *
-   * @param value The other property.
-   */
-  public boolean equals(CssProperty property) {
-    return (property instanceof CssBorderBottomWidth && face.equals(((CssBorderBottomWidth) property).face));
-  }
+    public CssBorderBottomWidth(ApplContext ac, CssExpression expression)
+            throws InvalidParamException {
+        this(ac, expression, false);
+    }
 
 }
+

Index: CssBorderStyle.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css1/CssBorderStyle.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- CssBorderStyle.java	9 Sep 2011 12:16:44 -0000	1.8
+++ CssBorderStyle.java	25 Apr 2012 20:21:59 -0000	1.9
@@ -1,386 +1,183 @@
-//
 // $Id$
-// From Philippe Le Hegaret (Philippe.Le_Hegaret@sophia.inria.fr)
-//
-// (c) COPYRIGHT MIT and INRIA, 1997.
-// Please first read the full copyright statement in file COPYRIGHT.html
+// @author Yves Lafon <ylafon@w3.org>
 
+// (c) COPYRIGHT MIT, ERCIM and Keio University, 2012.
+// Please first read the full copyright statement in file COPYRIGHT.html
 package org.w3c.css.properties.css1;
 
-import java.util.HashSet;
-
-import org.w3c.css.parser.CssSelectors;
-import org.w3c.css.parser.CssStyle;
 import org.w3c.css.properties.css.CssProperty;
+import org.w3c.css.properties.css2.CssBorderBottomStyle;
+import org.w3c.css.properties.css2.CssBorderLeftStyle;
+import org.w3c.css.properties.css2.CssBorderRightStyle;
+import org.w3c.css.properties.css2.CssBorderTopStyle;
 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.CssOperator;
+import org.w3c.css.values.CssTypes;
+import org.w3c.css.values.CssValue;
+import org.w3c.css.values.CssValueList;
+
+import java.util.ArrayList;
+
+import static org.w3c.css.values.CssOperator.SPACE;
 
 /**
- *   <H4>
- *      &nbsp;&nbsp; 'border-style'
- *   </H4>
- *   <P>
- *   <EM>Value:</EM> none | dotted | dashed | solid | double | groove | ridge
- *   | inset | outset<BR>
- *   <EM>Initial:</EM> none<BR>
- *   <EM>Applies to:</EM> all elements<BR>
- *   <EM>Inherited:</EM> no<BR>
- *   <EM>Percentage values:</EM> N/A<BR>
- *   <P>
- *   The 'border-style' property sets the style of the four borders. It can have
- *   from one to four values, and the values are set on the different sides as
- *   for 'border-width' above.
- *   <PRE>
- *   #xy34 { border-style: solid dotted }
- * </PRE>
- *   <P>
- *   In the above example, the horizontal borders will be 'solid' and the vertical
- *   borders will be 'dotted'.
- *   <P>
- *   Since the initial value of the border styles is 'none', no borders will be
- *   visible unless the border style is set.
- *   <P>
- *   The border styles mean:
- *   <DL>
- *     <DT>
- *       none
- *     <DD>
- *       no border is drawn (regardless of the 'border-width' value)
- *     <DT>
- *       dotted
- *     <DD>
- *       the border is a dotted line drawn on top of the background of the element
- *     <DT>
- *       dashed
- *     <DD>
- *       the border is a dashed line drawn on top of the background of the element
- *     <DT>
- *       solid
- *     <DD>
- *       the border is a solid line
- *     <DT>
- *       double
- *     <DD> the border is a double line drawn on top of the background of the
- *     element.  The sum of the two single lines and the space between equals
- *     the &lt;border-width&gt; value.
- *     <DT>
- *       groove
- *     <DD>
- *       a 3D groove is drawn in colors based on the &lt;color&gt; value.
- *     <DT>
- *       ridge
- *     <DD>
- *       a 3D ridge is drawn in colors based on the &lt;color&gt; value.
- *     <DT>
- *       inset
- *     <DD>
- *       a 3D inset is drawn in colors based on the &lt;color&gt; value.
- *     <DT>
- *       outset
- *     <DD>
- *       a 3D outset is drawn in colors based on the &lt;color&gt; value.
- *   </DL>
- *   <P>
- *   <EM>CSS1 core:</EM> UAs may interpret all of 'dotted', 'dashed', 'double',
- *   'groove', 'ridge', 'inset' and 'outset' as 'solid'.
- *
- * @version $Revision$
+ * @spec http://www.w3.org/TR/2011/REC-CSS2-20110607/box.html#value-def-border-style
  */
-public class CssBorderStyle extends CssProperty implements CssOperator {
+public class CssBorderStyle extends org.w3c.css.properties.css.CssBorderStyle {
+
+    public static CssIdent allowed_values[];
 
-    public static HashSet<CssIdent> acceptable_values;
     static {
-	acceptable_values = new HashSet<CssIdent>();
-	acceptable_values.add(CssIdent.getIdent("none"));
-	acceptable_values.add(CssIdent.getIdent("hidden"));
-	acceptable_values.add(CssIdent.getIdent("dotted"));
-	acceptable_values.add(CssIdent.getIdent("dashed"));
-	acceptable_values.add(CssIdent.getIdent("solid"));
-	acceptable_values.add(CssIdent.getIdent("double"));
-	acceptable_values.add(CssIdent.getIdent("dot-dash"));
-	acceptable_values.add(CssIdent.getIdent("dot-dot-dash"));
-	acceptable_values.add(CssIdent.getIdent("wave"));
-	acceptable_values.add(CssIdent.getIdent("groove"));
-	acceptable_values.add(CssIdent.getIdent("ridge"));
-	acceptable_values.add(CssIdent.getIdent("inset"));
-	acceptable_values.add(CssIdent.getIdent("outset"));
+        String _val[] = {"none", "hidden", "dotted", "dashed", "solid",
+                "double", "groove", "ridge", "inset", "outset"};
+        int i = 0;
+        allowed_values = new CssIdent[_val.length];
+        for (String s : _val) {
+            allowed_values[i++] = CssIdent.getIdent(s);
+
+        }
+    }
+
+    static CssIdent getMatchingIdent(CssIdent ident) {
+        for (CssIdent id : allowed_values) {
+            if (id.equals(ident)) {
+                return id;
+            }
+        }
+        return null;
     }
-    CssBorderTopStyle top;
-    CssBorderBottomStyle bottom;
-    CssBorderRightStyle right;
-    CssBorderLeftStyle left;
 
     /**
      * Create a new CssBorderStyle
      */
-    public CssBorderStyle(CssBorderTopStyle top,
-	    CssBorderBottomStyle bottom,
-	    CssBorderRightStyle right,
-	    CssBorderLeftStyle left) {
-	this.top = top;
-	this.bottom = bottom;
-	this.left = left;
-	this.right = right;
+    public CssBorderStyle() {
     }
 
     /**
-     * Create a new CssBorder
+     * Set the value of the property<br/>
+     * Does not check the number of values
      *
      * @param expression The expression for this property
-     * @exception InvalidParamException Values are incorrect
+     * @throws org.w3c.css.util.InvalidParamException
+     *          The expression is incorrect
      */
-    public CssBorderStyle(ApplContext ac, CssExpression expression,
-	    boolean check) throws InvalidParamException {
-
-	setByUser();
-
-	switch (expression.getCount()) {
-	case 1:
-	    top = new CssBorderTopStyle(ac, expression);
-	    /*bottom = new CssBorderBottomStyle((CssBorderFaceStyle) top.get());
-	    right = new CssBorderRightStyle((CssBorderFaceStyle) top.get());
-	    left = new CssBorderLeftStyle((CssBorderFaceStyle) top.get());*/
-	    break;
-	case 2:
-	    if (expression.getOperator() != SPACE)
-		throw new InvalidParamException("operator",
-			((new Character(expression.getOperator())).toString()),
-			ac);
-	    if(expression.getValue().equals(inherit)) {
-		throw new InvalidParamException("unrecognize", ac);
-	    }
-	    top = new CssBorderTopStyle(ac, expression);
-	    if(expression.getValue().equals(inherit)) {
-		throw new InvalidParamException("unrecognize", ac);
-	    }
-	    right = new CssBorderRightStyle(ac, expression);
-	    /*bottom = new CssBorderBottomStyle((CssBorderFaceStyle) top.get());
-	    left = new CssBorderLeftStyle((CssBorderFaceStyle) right.get());*/
-	    break;
-	case 3:
-	    if (expression.getOperator() != SPACE)
-		throw new InvalidParamException("operator",
-			((new Character(expression.getOperator())).toString()),
-			ac);
-	    if(expression.getValue().equals(inherit)) {
-		throw new InvalidParamException("unrecognize", ac);
-	    }
-	    top = new CssBorderTopStyle(ac, expression);
-	    if (expression.getOperator() != SPACE)
-		throw new InvalidParamException("operator",
-			((new Character(expression.getOperator())).toString()),
-			ac);
-	    if(expression.getValue().equals(inherit)) {
-		throw new InvalidParamException("unrecognize", ac);
-	    }
-	    right = new CssBorderRightStyle(ac, expression);
-	    if(expression.getValue().equals(inherit)) {
-		throw new InvalidParamException("unrecognize", ac);
-	    }
-	    bottom = new CssBorderBottomStyle(ac, expression);
-	    //left = new CssBorderLeftStyle((CssBorderFaceStyle) right.get());
-	    break;
-	case 4:
-	    if (expression.getOperator() != SPACE) {
-		throw new InvalidParamException("operator",
-			((new Character(expression.getOperator())).toString()),
-			ac);
-	    }
-	    if(expression.getValue().equals(inherit)) {
-		throw new InvalidParamException("unrecognize", ac);
-	    }
-	    top = new CssBorderTopStyle(ac, expression);
-	    if (expression.getOperator() != SPACE)
-		throw new InvalidParamException("operator",
-		    ((new Character(expression.getOperator())).toString()),
-		    ac);
-	    if(expression.getValue().equals(inherit)) {
-		throw new InvalidParamException("unrecognize", ac);
-	    }
-	    right = new CssBorderRightStyle(ac, expression);
-	    if (expression.getOperator() != SPACE)
-		throw new InvalidParamException("operator",
-		    ((new Character(expression.getOperator())).toString()),
-		    ac);
-	    if(expression.getValue().equals(inherit)) {
-		throw new InvalidParamException("unrecognize", ac);
-	    }
-	    bottom = new CssBorderBottomStyle(ac, expression);
-	    if(expression.getValue().equals(inherit)) {
-		throw new InvalidParamException("unrecognize", ac);
-	    }
-	    left = new CssBorderLeftStyle(ac, expression);
-	    break;
-	    default:
-		if(check) {
-		    throw new InvalidParamException("unrecognize", ac);
-		}
-	    break;
-	}
-    }
-
     public CssBorderStyle(ApplContext ac, CssExpression expression)
-	throws InvalidParamException {
-	this(ac, expression,false);
-    }
-
-    /**
-     * Returns the value of this property
-     */
-    public Object get() {
-	return top;
-    }
-
-    /**
-     * Returns the name of this property
-     */
-    public String getPropertyName() {
-	return "border-style";
-    }
-
-    /**
-     * Returns a string representation of the object.
-     */
-    public String toString() {
-        String result = "";
-        // top should never be null
-        if(top != null) result += top;
-        if(right != null) result += " " + right;
-        if(bottom != null) result += " " + bottom;
-        if(left != null) result += " " + left;
-        return result;
-	/*if (right.face.equals(left.face)) {
-	    if (top.face.equals(bottom.face)) {
-		if (top.face.equals(right.face)) {
-		    return top.toString();
-		} else {
-		    return top + " " + right;
-		}
-	    } else {
-		return top + " " + right + " " + bottom;
-	    }
-	} else {
-	    return top + " " + right + " " + bottom + " " + left;
-	}*/
-    }
-
-    /**
-     * Set this property to be important.
-     * Overrides this method for a macro
-     */
-    public void setImportant() {
-	if(top != null) {
-	    top.important = true;
-	}
-	if(right != null) {
-	    right.important = true;
-	}
-	if(left != null) {
-	    left.important = true;
-	}
-	if(bottom != null) {
-	    bottom.important = true;
-	}
-    }
-
-    /**
-     * Returns true if this property is important.
-     * Overrides this method for a macro
-     */
-    public boolean getImportant() {
-	return ((top == null || top.important) &&
-		(right == null || right.important) &&
-		(left == null || left.important) &&
-		(bottom == null || bottom.important));
+            throws InvalidParamException {
+        this(ac, expression, false);
     }
 
     /**
-     * Set the context.
-     * Overrides this method for a macro
+     * Set the value of the property
      *
-     * @see org.w3c.css.css.CssCascadingOrder#order
-     * @see org.w3c.css.css.StyleSheetParser#handleRule
+     * @param expression The expression for this property
+     * @param check      set it to true to check the number of values
+     * @throws org.w3c.css.util.InvalidParamException
+     *          The expression is incorrect
      */
-    public void setSelectors(CssSelectors selector) {
-	super.setSelectors(selector);
-	if (top != null) {
-	    top.setSelectors(selector);
-	}
-	if (right != null) {
-	    right.setSelectors(selector);
-	}
-	if (bottom != null) {
-	    bottom.setSelectors(selector);
-	}
-	if (left != null) {
-	    left.setSelectors(selector);
-	}
-    }
+    public CssBorderStyle(ApplContext ac, CssExpression expression,
+                          boolean check) throws InvalidParamException {
+        if (check && expression.getCount() > 4) {
+            throw new InvalidParamException("unrecognize", ac);
+        }
+        setByUser();
+        CssValue val;
+        char op;
 
-    /**
-     * Add this property to the CssStyle
-     *
-     * @param style The CssStyle
-     */
-    public void addToStyle(ApplContext ac, CssStyle style) {
-	if(top != null) {
-	    top.addToStyle(ac , style);
-	}
-	if(right != null) {
-	    right.addToStyle(ac, style);
-	}
-	if(left != null) {
-	    left.addToStyle(ac, style);
-	}
-	if(bottom != null) {
-	    bottom.addToStyle(ac, style);
-	}
-    }
+        ArrayList<CssValue> res = new ArrayList<CssValue>();
+        while (res.size() < 4 && !expression.end()) {
+            val = expression.getValue();
+            op = expression.getOperator();
 
-    /**
-     * 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) {
-	throw new IllegalStateException("Can't invoke this method on the property " +
-		getPropertyName());
-    }
+            switch (val.getType()) {
+                case CssTypes.CSS_IDENT:
+                    if (inherit.equals(val)) {
+                        res.add(inherit);
+                        break;
+                    }
+                    CssIdent match = getMatchingIdent((CssIdent) val);
+                    if (match == null) {
+                        throw new InvalidParamException("value", expression.getValue(),
+                                getPropertyName(), ac);
+                    }
+                    res.add(match);
+                    break;
+                default:
+                    throw new InvalidParamException("unrecognize", ac);
+            }
+            expression.next();
+            if (op != SPACE) {
+                throw new InvalidParamException("operator",
+                        Character.toString(op),
+                        ac);
+            }
+        }
+        // check that inherit is alone
+        if (res.size() > 1 && res.contains(inherit)) {
+            throw new InvalidParamException("unrecognize", ac);
+        }
+        value = (res.size() == 1) ? res.get(0) : new CssValueList(res);
 
-    /**
-     * Update the source file and the line.
-     * Overrides this method for a macro
-     *
-     * @param line The line number where this property is defined
-     * @param source The source file where this property is defined
-     */
-    public void setInfo(int line, String source) {
-	super.setInfo(line, source);
-	if(top != null) {
-	    top.setInfo(line, source);
-	}
-	if(right != null) {
-	    right.setInfo(line, source);
-	}
-	if(left != null) {
-	    left.setInfo(line, source);
-	}
-	if(bottom != null) {
-	    bottom.setInfo(line, source);
-	}
+        // now assign the computed values...
+        top = new CssBorderTopStyle();
+        right = new CssBorderRightStyle();
+        bottom = new CssBorderBottomStyle();
+        left = new CssBorderLeftStyle();
+
+        switch (res.size()) {
+            case 1:
+                top.value = left.value = right.value = bottom.value = res.get(0);
+                break;
+            case 2:
+                top.value = bottom.value = res.get(0);
+                right.value = left.value = res.get(1);
+                break;
+            case 3:
+                top.value = res.get(0);
+                right.value = left.value = res.get(1);
+                bottom.value = res.get(2);
+                break;
+            case 4:
+                top.value = res.get(0);
+                right.value = res.get(1);
+                bottom.value = res.get(2);
+                left.value = res.get(3);
+                break;
+            default:
+                // can't happen
+                throw new InvalidParamException("unrecognize", ac);
+        }
     }
 
     /**
-     * Compares two properties for equality.
-     *
-     * @param value The other property.
+     * Check the border-*-style and returns a value.
+     * It makes sense to do it only once for all the sides, so by having the code here.
      */
-    public boolean equals(CssProperty property) {
-	return false; // FIXME
+    protected static CssValue checkBorderSideStyle(ApplContext ac, CssProperty caller, CssExpression expression,
+                                                   boolean check) throws InvalidParamException {
+        if (check && expression.getCount() > 1) {
+            throw new InvalidParamException("unrecognize", ac);
+        }
+        CssValue retval = null;
+        CssValue val = expression.getValue();
+        switch (val.getType()) {
+            case CssTypes.CSS_IDENT:
+                if (inherit.equals(val)) {
+                    retval = inherit;
+                } else {
+                    retval = getMatchingIdent((CssIdent) val);
+                }
+                if (retval == null) {
+                    throw new InvalidParamException("value", expression.getValue(),
+                            caller.getPropertyName(), ac);
+                }
+                break;
+            default:
+                throw new InvalidParamException("unrecognize", ac);
+        }
+        expression.next();
+        return retval;
     }
 
 }

--- CssBorderStyleCSS2.java DELETED ---

--- CssBorderBottomStyle.java DELETED ---

--- CssBorderTopWidthCSS1.java DELETED ---

--- CssBorderFaceStyle.java DELETED ---

--- CssBorderFaceColorCSS2.java DELETED ---

Index: CssBorderLeftWidth.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css1/CssBorderLeftWidth.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- CssBorderLeftWidth.java	5 Jan 2010 13:49:41 -0000	1.4
+++ CssBorderLeftWidth.java	25 Apr 2012 20:21:58 -0000	1.5
@@ -1,161 +1,44 @@
-//
 // $Id$
-// From Philippe Le Hegaret (Philippe.Le_Hegaret@sophia.inria.fr)
+// Author: Yves Lafon <ylafon@w3.org>
 //
-// (c) COPYRIGHT MIT and INRIA, 1997.
+// (c) COPYRIGHT MIT, ERCIM and Keio University, 2012.
 // 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.CssValue;
 
 /**
- *   <H4>
- *      &nbsp;&nbsp; 'border-left-width'
- *   </H4>
- *   <P>
- *   <EM>Value:</EM> thin | medium | thick | &lt;length&gt;<BR>
- *   <EM>Initial:</EM> 'medium'<BR>
- *   <EM>Applies to:</EM> all elements<BR>
- *   <EM>Inherited:</EM> no<BR>
- *   <EM>Percentage values:</EM> N/A<BR>
- *   <P>
- *   This property sets the width of an element's left border. The width of the
- *   keyword values are UA dependent, but the following holds: 'thin' &lt;= 'medium'
- *   &lt;= 'thick'.
- *   <P>
- *   The keyword widths are constant throughout a document:
- *   <PRE>
- *   H1 { border: solid thick red }
- *   P  { border: solid thick blue }
- * </PRE>
- *   <P>
- *   In the example above, 'H1' and 'P' elements will have the same border width
- *   regardless of font size. To achieve relative widths, the 'em' unit can be
- *   used:
- *   <PRE>
- *   H1 { border: solid 0.5em }
- * </PRE>
- *   <P>
- *   Border widths cannot be negative.
+ * @spec http://www.w3.org/TR/2011/REC-CSS2-20110607/box.html#value-def-border-width
  * @version $Revision$
  */
-public class CssBorderLeftWidth extends CssProperty {
-
-    CssBorderFaceWidth face;
+public class CssBorderLeftWidth extends org.w3c.css.properties.css.CssBorderLeftWidth {
 
     /**
      * Create a new CssBorderLeftWidth
      */
     public CssBorderLeftWidth() {
-	face = new CssBorderFaceWidth();
     }
 
     /**
-     * Create a new CssBorderLeftWidth with an another CssBorderFaceWidth
-     *
-     * @param another The another side.
-     */
-    public CssBorderLeftWidth(CssBorderFaceWidth another) {
-	setByUser();
-
-	face = another;
-    }
-
-    /**
-     * Create a new CssBorderLeftWidth
+     * Creates a new CssBorderLeftWidth
      *
-     * @param expression The expression for this property.
-     * @exception InvalidParamException Values are incorrect
+     * @param expression The expression for this property
+     * @throws org.w3c.css.util.InvalidParamException
+     *          Expressions are incorrect
      */
-    public CssBorderLeftWidth(ApplContext ac, CssExpression expression,
-	    boolean check) throws InvalidParamException {
-
-	if(check && expression.getCount() > 1) {
-	    throw new InvalidParamException("unrecognize", ac);
-	}
-
-	setByUser();
-	face = new CssBorderFaceWidth(ac, expression);
+    public CssBorderLeftWidth(ApplContext ac, CssExpression expression, boolean check)
+            throws InvalidParamException {
+        setByUser();
+        // here we delegate to BorderWidth implementation
+        value = CssBorderWidth.checkBorderSideWidth(ac, this, expression, check);
     }
 
     public CssBorderLeftWidth(ApplContext ac, CssExpression expression)
-	throws InvalidParamException {
-	this(ac, expression,false);
-    }
-
-    /**
-     * Returns the value of this property
-     */
-    public Object get() {
-	return face;
-    }
-
-    /**
-     * Return the value of this property
-     */
-    public CssValue getValue() {
-	if(face != null) {
-	    return face.getValue();
-	}
-	return null;
-    }
-
-    /**
-     * Returns a string representation of the object.
-     */
-    public String toString() {
-	if(face != null) {
-	    return face.toString();
-	}
-	return "";
-    }
-
-    /**
-     * Returns the name of this property
-     */
-    public String getPropertyName() {
-	return "border-left-width";
-    }
-
-    /**
-     * Add this property to the CssStyle.
-     *
-     * @param style The CssStyle
-     */
-    public void addToStyle(ApplContext ac, CssStyle style) {
-	CssBorderLeft left = ((Css1Style) style).cssBorder.left;
-	if (left.width != null)
-	    style.addRedefinitionWarning(ac, this);
-	left.width = 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).getBorderLeftWidth();
-	} else {
-	    return ((Css1Style) style).cssBorder.getLeft().width;
-	}
-    }
-
-    /**
-     * Compares two properties for equality.
-     *
-     * @param value The other property.
-     */
-    public boolean equals(CssProperty property) {
-	return (property instanceof CssBorderLeftWidth &&
-		face.equals(((CssBorderLeftWidth) property).face));
+            throws InvalidParamException {
+        this(ac, expression, false);
     }
 
 }
+

--- CssBorderLeftCSS2.java DELETED ---

--- CssBorderRightColorCSS1.java DELETED ---

--- CssBorderRightCSS1.java DELETED ---

--- CssBorderTopStyleCSS1.java DELETED ---

Index: CssBorderLeft.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css1/CssBorderLeft.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- CssBorderLeft.java	9 Sep 2011 12:16:44 -0000	1.5
+++ CssBorderLeft.java	25 Apr 2012 20:21:57 -0000	1.6
@@ -1,355 +1,95 @@
-//
 // $Id$
-// From Philippe Le Hegaret (Philippe.Le_Hegaret@sophia.inria.fr)
-//
-// (c) COPYRIGHT MIT and INRIA, 1997.
+// @author Yves Lafon <ylafon@w3.org>
+
+// (c) COPYRIGHT MIT, ERCIM and Keio University, 2012.
 // Please first read the full copyright statement in file COPYRIGHT.html
 package org.w3c.css.properties.css1;
 
-import org.w3c.css.parser.CssSelectors;
-import org.w3c.css.parser.CssStyle;
-import org.w3c.css.properties.css.CssProperty;
+import org.w3c.css.properties.css2.CssBorderLeftColor;
+import org.w3c.css.properties.css2.CssBorderLeftStyle;
 import org.w3c.css.util.ApplContext;
 import org.w3c.css.util.InvalidParamException;
 import org.w3c.css.values.CssExpression;
-import org.w3c.css.values.CssLength;
-import org.w3c.css.values.CssOperator;
-import org.w3c.css.values.CssURL;
-import org.w3c.css.values.CssValue;
 
 /**
- *   <H4>
- *     &nbsp;&nbsp; 'border-left'
- *   </H4>
- *   <P>
- *   <EM>Value:</EM> &lt;border-left-width&gt; || &lt;border-style&gt; ||
- *   &lt;color&gt;<BR>
- *   <EM>Initial:</EM> not defined for shorthand properties<BR>
- *   <EM>Applies to:</EM> all elements<BR>
- *   <EM>Inherited:</EM> no<BR>
- *   <EM>Percentage values:</EM> N/A<BR>
- *   <P>
- *   This is a shorthand property for setting the width, style and color of an
- *   element's left border.
- *   <PRE>
- *   H1 { border-bottom: thick solid red }
- * </PRE>
- *   <P>
- *   The above rule will set the width, style and color of the border below the
- *   H1 element. Omitted values will be set to their initial values:
- *   <PRE>
- *   H1 { border-bottom: thick solid }
- * </PRE>
- *   <P>
- *   Since the color value is omitted in the example above, the border color will
- *   be the same as the 'color' value of the element itself.
- *   <P>
- *   Note that while the 'border-style' property accepts up to four values, this
- *   property only accepts one style value.
- *
- * @version $Revision$
+ * @since CSS1
  */
-public class CssBorderLeft extends CssProperty implements CssOperator {
+public class CssBorderLeft extends org.w3c.css.properties.css.CssBorderLeft {
 
-    CssBorderLeftWidth width;
-    CssBorderLeftStyle style;
-    CssBorderLeftColor color;
-    CssValue uri = null;
 
     /**
-     * Create a new CssBorderFace
+     * Create a new CssBorderLeft
      */
     public CssBorderLeft() {
     }
 
     /**
-     * Create a new CssBorderFace
+     * Set the value of the property<br/>
+     * Does not check the number of values
      *
      * @param expression The expression for this property
-     * @exception InvalidParamException The expression is incorrect
+     * @throws org.w3c.css.util.InvalidParamException The expression is incorrect
      */
-    public CssBorderLeft(ApplContext ac, CssExpression expression,
-	    boolean check) throws InvalidParamException {
-	CssValue val = null;
-	char op = SPACE;
-	boolean find = true;
-
-	if(check &&expression.getCount() > 4) {
-	    throw new InvalidParamException("unrecognize", ac);
-	}
-
-	setByUser();
-
-	boolean manyValues = (expression.getCount() > 1);
-
-	while (find) {
-	    find = false;
-	    val = expression.getValue();
-	    op = expression.getOperator();
-
-	    if (val == null)
-		break;
-
-	    // if there are many values, we can't have inherit as one of them
-	    if(manyValues && val.equals(inherit)) {
-		throw new InvalidParamException("unrecognize", null, null, ac);
-	    }
-
-	    if (op != SPACE)
-		throw new InvalidParamException("operator",
-						((new Character(op)).toString()),
-						ac);
-
-	    if (width == null) {
-		try {
-		    width = new CssBorderLeftWidth(ac, expression);
-		    find = true;
-		} catch (InvalidParamException e) {
-		    // nothing to do, style will test this value
-		}
-	    }
-
-	    if (!find && style == null) {
-		try {
-		    style = new CssBorderLeftStyle(ac, expression);
-		    find = true;
-		}
-		catch (InvalidParamException e) {
-		    // nothing to do, style will test this value
-		}
-	    }
-
-	    if (!find && color == null) {
-		try {
-		    color = new CssBorderLeftColor(ac, expression);
-		    find = true;
-		}
-		catch(InvalidParamException e) {
-		    // nothing to do, uri will test this value
-		}
-	    }
-
-	    if (!find && uri == null) {
-		if (val instanceof CssURL) {
-		    uri = val;
-		    find = true;
-		}
-		else {
-		    throw new InvalidParamException("unrecognize", ac);
-		}
-	    }
-	}
-	/*
-	if (width == null)
-	    width = new CssBorderLeftWidth();
-	if (style == null)
-	    style = new CssBorderLeftStyle();
-	if (color == null)
-	    color = new CssBorderLeftColor();
-	*/
-    }
-
     public CssBorderLeft(ApplContext ac, CssExpression expression)
-	throws InvalidParamException {
-	this(ac, expression, false);
-    }
-
-    /**
-     * Returns the value of this property
-     */
-    public Object get() {
-	return width;
-    }
-
-    /**
-     * Returns the color property
-     */
-    public CssValue getColor() {
-	if (color != null) {
-	    return color.getColor();
-	} else {
-	    return null;
-	}
-    }
-
-    /**
-     * Returns the width property
-     */
-    public CssValue getWidth() {
-	if (width != null) {
-	    return width.getValue();
-	} else {
-	    return null;
-	}
+            throws InvalidParamException {
+        this(ac, expression, false);
     }
 
     /**
-     * Returns the style property
+     * Set the value of the property
+     *
+     * @param expression The expression for this property
+     * @param check      set it to true to check the number of values
+     * @throws org.w3c.css.util.InvalidParamException The expression is incorrect
      */
-    public String getStyle() {
-	if (style != null) {
-	    return style.getStyle();
-	} else {
-	    return null;
-	}
+    public CssBorderLeft(ApplContext ac, CssExpression expression,
+                         boolean check) throws InvalidParamException {
+        CssBorder.SideValues values = CssBorder.checkBorderSide(ac, this, expression, check);
+        if (values.width != null) {
+            _width = new CssBorderLeftWidth();
+            _width.setByUser();
+            _width.value = values.width;
+        }
+        if (values.style != null) {
+            _style = new CssBorderLeftStyle();
+            _style.setByUser();
+            _style.value = values.style;
+        }
+        if (values.color != null) {
+            _color = new CssBorderLeftColor();
+            _color.setByUser();
+            _color.value = values.color;
+        }
     }
 
     /**
      * Returns a string representation of the object.
      */
     public String toString() {
-	String ret = "";
-	if(width != null) {
-	    ret += width;
-	}
-	if(style != null) {
-	    if(!ret.equals("")) {
-		ret += " ";
-	    }
-	    ret += style;
-	}
-	if(color != null) {
-	    if(!ret.equals("")) {
-		ret += " ";
-	    }
-	    ret += color;
-	}
-	if (uri != null) {
-	    if(!ret.equals("")) {
-		ret += " ";
-	    }
-	    ret += " " + uri.toString();
-	}
-	return ret;
-    }
-
-    /**
-     * Returns the name of this property
-     */
-    public String getPropertyName() {
-	return "border-left";
-    }
-
-    /**
-     * Set this property to be important.
-     * Overrides this method for a macro
-     */
-    public void setImportant() {
-	if(width != null) {
-	    width.important = true;
-	}
-	if(style != null) {
-	    style.important = true;
-	}
-	if(color != null) {
-	    color.important = true;
-	}
-    }
-
-    /**
-     * Returns true if this property is important.
-     * Overrides this method for a macro
-     */
-    public boolean getImportant() {
-	return ((width == null || width.important) &&
-		(style == null || style.important) &&
-		(color == null || color.important));
-    }
-
-
-    /**
-     * Add this property to the CssStyle
-     *
-     * @param style The CssStyle
-     */
-    public void addToStyle(ApplContext ac, CssStyle style) {
-	if(width != null) {
-	    width.addToStyle(ac, style);
-	}
-	if(this.style != null) {
-	    this.style.addToStyle(ac, style);
-	}
-	if(color != null) {
-	    color.addToStyle(ac, style);
-	}
-    }
-
-    /**
-     * 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).getBorderLeft();
-	} else {
-	    return ((Css1Style) style).cssBorder.getLeft();
-	}
-    }
-
-    /**
-     * Update the source file and the line.
-     * Overrides this method for a macro
-     *
-     * @param line The line number where this property is defined
-     * @param source The source file where this property is defined
-     */
-    public void setInfo(int line, String source) {
-	super.setInfo(line, source);
-	if(width != null) {
-	    width.setInfo(line, source);
-	}
-	if(style != null) {
-	    style.setInfo(line, source);
-	}
-	if(color != null) {
-	    color.setInfo(line, source);
-	}
-    }
-
-    /**
-     * Set the context.
-     * Overrides this method for a macro
-     *
-     * @see org.w3c.css.css.CssCascadingOrder#order
-     * @see org.w3c.css.css.StyleSheetParser#handleRule
-     */
-    public void setSelectors(CssSelectors selector) {
-	super.setSelectors(selector);
-	if (width != null) {
-	    width.setSelectors(selector);
-	}
-	if (style != null) {
-	    style.setSelectors(selector);
-	}
-	if (color != null) {
-	    color.setSelectors(selector);
-	}
-    }
-
-    /**
-     * Compares two properties for equality.
-     *
-     * @param value The other property.
-     */
-    public boolean equals(CssProperty property) {
-	if (property instanceof CssBorderLeft) {
-	    CssBorderLeft left = (CssBorderLeft) property;
-	    return (width != null && width.equals(left.width) &&
-		    style != null && style.equals(left.style) &&
-		    color != null && color.equals(left.color));
-	} else {
-	    return false;
-	}
-    }
-
-    void check() {
-	if ((style != null)
-	    && (style.face.value == 0)) {
-	    if (width != null) {
-		width.face.value = new CssLength();
-	    }
-	}
+        if (_width != null && inherit == _width.value) {
+            return inherit.toString();
+        }
+        StringBuilder sb = new StringBuilder();
+        boolean first = true;
+        if (_width != null) {
+            sb.append(_width);
+            first = false;
+        }
+        if (_style != null) {
+            if (first) {
+                sb.append(_style);
+            } else {
+                sb.append(' ').append(_style);
+            }
+            first = false;
+        }
+        if (_color != null) {
+            if (first) {
+                sb.append(_color);
+            } else {
+                sb.append(' ').append(_color);
+            }
+        }
+        return sb.toString();
     }
 }

--- CssBorderColorCSS1.java DELETED ---

--- CssBorderFaceStyleCSS1.java DELETED ---

--- CssBorderBottomStyleCSS2.java DELETED ---

Index: CssBorderColor.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css1/CssBorderColor.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- CssBorderColor.java	9 Feb 2012 17:36:29 -0000	1.8
+++ CssBorderColor.java	25 Apr 2012 20:21:57 -0000	1.9
@@ -1,336 +1,171 @@
-//
 // $Id$
-// From Philippe Le Hegaret (Philippe.Le_Hegaret@sophia.inria.fr)
-//
-// (c) COPYRIGHT MIT and INRIA, 1997.
-// Please first read the full copyright statement in file COPYRIGHT.html
+// @author Yves Lafon <ylafon@w3.org>
 
+// (c) COPYRIGHT MIT, ERCIM and Keio University, 2012.
+// Please first read the full copyright statement in file COPYRIGHT.html
 package org.w3c.css.properties.css1;
 
-import org.w3c.css.parser.CssSelectors;
-import org.w3c.css.parser.CssStyle;
 import org.w3c.css.properties.css.CssProperty;
+import org.w3c.css.properties.css2.CssBorderBottomColor;
+import org.w3c.css.properties.css2.CssBorderLeftColor;
+import org.w3c.css.properties.css2.CssBorderRightColor;
+import org.w3c.css.properties.css2.CssBorderTopColor;
 import org.w3c.css.util.ApplContext;
 import org.w3c.css.util.InvalidParamException;
 import org.w3c.css.values.CssExpression;
-import org.w3c.css.values.CssOperator;
+import org.w3c.css.values.CssTypes;
+import org.w3c.css.values.CssValue;
+import org.w3c.css.values.CssValueList;
 
-/**
- *   <H4>
- *      &nbsp;&nbsp; 'border-color'
- *   </H4>
- *   <P>
- *   <EM>Value:</EM> &lt;color&gt;{1,4}<BR>
- *   <EM>Initial:</EM> the value of the 'color' property<BR>
- *   <EM>Applies to:</EM> all elements<BR>
- *   <EM>Inherited:</EM> no<BR>
- *   <EM>Percentage values:</EM> N/A<BR>
- *   <P>
- *   The 'border-color' property sets the color of the four borders. 'border-color'
- *   can have from one to four values, and the values are set on the different
- *   sides as for 'border-width' above.
- *   <P>
- *   If no color value is specified, the value of the 'color' property of the
- *   element itself will take its place:
- *   <PRE>
- *   P {
- *     color: black;
- *     background: white;
- *     border: solid;
- *   }
- * </PRE>
- *   <P>
- *   In the above example, the border will be a solid black line.
- *
- * @version $Revision$
- */
-public class CssBorderColor extends CssProperty implements CssOperator {
+import java.util.ArrayList;
 
-    CssBorderTopColor top;
-    CssBorderBottomColor bottom;
-    CssBorderRightColor right;
-    CssBorderLeftColor left;
+import static org.w3c.css.values.CssOperator.SPACE;
 
-    //private static CssIdent transparent = new CssIdent("transparent"); // obsolete, not in CSS3 anymore
+/**
+ * @spec http://www.w3.org/TR/2011/REC-CSS2-20110607/box.html#border-color-properties
+ */
+public class CssBorderColor extends org.w3c.css.properties.css.CssBorderColor {
 
     /**
-     * Create a new CssBorderColor with all four sides
+     * Create a new CssBorderColor
      */
-    public CssBorderColor(CssBorderTopColor top,
-			  CssBorderBottomColor bottom,
-			  CssBorderRightColor right,
-			  CssBorderLeftColor left) {
-	this.top = top;
-	this.bottom = bottom;
-	this.left = left;
-	this.right = right;
+    public CssBorderColor() {
     }
 
     /**
-     * Create a new CssBorder
+     * Set the value of the property<br/>
+     * Does not check the number of values
      *
      * @param expression The expression for this property
-     * @exception InvalidParamException Values are incorrect
+     * @throws org.w3c.css.util.InvalidParamException
+     *          The expression is incorrect
      */
-    public CssBorderColor(ApplContext ac, CssExpression expression,
-	    boolean check) throws InvalidParamException {
-
-	setByUser();
-
-	switch (expression.getCount()) {
-	case 1:
-	    //CssValue val = expression.floatValue();
-	    //if (val.equals(transparent)) { // obsolete, transparent is a color value now
-		//top = new CssBorderTopColor();
-		//top.face.face = transparent;
-		//expression.next();
-	    //} else
-	    /*if (val.equals(inherit)) {
-		top = new CssBorderTopColor();
-		top.face.face = inherit;
-		expression.next();
-	    } else*/
-	    top = new CssBorderTopColor(ac, expression);
-	    /*bottom = new CssBorderBottomColorCSS21((CssBorderFaceColor) top.get());
-	    right = new CssBorderRightColor((CssBorderFaceColor) top.get());
-	    left = new CssBorderLeftColor((CssBorderFaceColor) top.get());*/
-	    break;
-	case 2:
-	    if (expression.getOperator() != SPACE)
-		throw new InvalidParamException("operator",
-						((new Character(expression.getOperator())).toString()),
-						ac);
-	    if(expression.getValue().equals(inherit)) {
-		throw new InvalidParamException("unrecognize", ac);
-	    }
-	    top = new CssBorderTopColor(ac, expression);
-	    if(expression.getValue().equals(inherit)) {
-		throw new InvalidParamException("unrecognize", ac);
-	    }
-	    right = new CssBorderRightColor(ac, expression);
-	    /*bottom = new CssBorderBottomColorCSS21((CssBorderFaceColor) top.get());
-	    left = new CssBorderLeftColor((CssBorderFaceColor) right.get());*/
-	    break;
-	case 3:
-	    if (expression.getOperator() != SPACE)
-		throw new InvalidParamException("operator",
-						((new Character(expression.getOperator())).toString()),
-						ac);
-	    if(expression.getValue().equals(inherit)) {
-		throw new InvalidParamException("unrecognize", ac);
-	    }
-	    top = new CssBorderTopColor(ac, expression);
-	    if (expression.getOperator() != SPACE)
-		throw new InvalidParamException("operator",
-						((new Character(expression.getOperator())).toString()), ac);
-	    if(expression.getValue().equals(inherit)) {
-		throw new InvalidParamException("unrecognize", ac);
-	    }
-	    right = new CssBorderRightColor(ac, expression);
-	    if(expression.getValue().equals(inherit)) {
-		throw new InvalidParamException("unrecognize", ac);
-	    }
-	    bottom = new CssBorderBottomColor(ac, expression);
-	    //left = new CssBorderLeftColor((CssBorderFaceColor) right.get());
-	    break;
-	case 4:
-	    if (expression.getOperator() != SPACE)
-		throw new InvalidParamException("operator",
-						((new Character(expression.getOperator())).toString()),
-						ac);
-	    if(expression.getValue().equals(inherit)) {
-		throw new InvalidParamException("unrecognize", ac);
-	    }
-	    top = new CssBorderTopColor(ac, expression);
-	    if (expression.getOperator() != SPACE)
-		throw new InvalidParamException("operator",
-						((new Character(expression.getOperator())).toString()),
-						ac);
-	    if(expression.getValue().equals(inherit)) {
-		throw new InvalidParamException("unrecognize", ac);
-	    }
-	    right = new CssBorderRightColor(ac, expression);
-	    if (expression.getOperator() != SPACE)
-		throw new InvalidParamException("operator",
-						((new Character(expression.getOperator())).toString()),
-						ac);
-	    if(expression.getValue().equals(inherit)) {
-		throw new InvalidParamException("unrecognize", ac);
-	    }
-	    bottom = new CssBorderBottomColor(ac, expression);
-	    if(expression.getValue().equals(inherit)) {
-		throw new InvalidParamException("unrecognize", ac);
-	    }
-	    left = new CssBorderLeftColor(ac, expression);
-	    break;
-	default:
-	    if(check) {
-		throw new InvalidParamException("unrecognize", ac);
-	    }
-	    break;
-	}
-    }
-
     public CssBorderColor(ApplContext ac, CssExpression expression)
-	throws InvalidParamException {
-	this(ac, expression, false);
-    }
-
-    /**
-     * Returns the value of this property
-     */
-    public Object get() {
-	return top;
+            throws InvalidParamException {
+        this(ac, expression, false);
     }
 
     /**
-     * Returns the name of this property
+     * Set the value of the property
+     *
+     * @param expression The expression for this property
+     * @param check      set it to true to check the number of values
+     * @throws org.w3c.css.util.InvalidParamException
+     *          The expression is incorrect
      */
-    public String getPropertyName() {
-	return "border-color";
-    }
+    public CssBorderColor(ApplContext ac, CssExpression expression,
+                          boolean check) throws InvalidParamException {
+        if (check && expression.getCount() > 4) {
+            throw new InvalidParamException("unrecognize", ac);
+        }
+        setByUser();
+        CssValue val;
+        char op;
 
-    /**
-     * Returns a string representation of the object.
-     */
-    public String toString() {
-        String result = "";
-        // top should never be null
-        if(top != null) result += top;
-        if(right != null) result += " " + right;
-        if(bottom != null) result += " " + bottom;
-        if(left != null) result += " " + left;
-        return result;
-	/*if (right.face.equals(left.face)) {
-	    if (top.face.equals(bottom.face)) {
-		if (top.face.equals(right.face)) {
-		    return top.toString();
-		} else {
-		    return top + " " + right;
-		}
-	    } else {
-		return top + " " + right + " " + bottom;
-	    }
-	} else {
-	    return top + " " + right + " " + bottom + " " + left;
-	}*/
+        ArrayList<CssValue> res = new ArrayList<CssValue>();
+        while (res.size() < 4 && !expression.end()) {
+            val = expression.getValue();
+            op = expression.getOperator();
 
-    }
+            switch (val.getType()) {
+                case CssTypes.CSS_COLOR:
+                    res.add(val);
+                    break;
+                case CssTypes.CSS_IDENT:
+                    if (inherit.equals(val)) {
+                        res.add(inherit);
+                        break;
+                    }
+                    if (transparent.equals(val)) {
+                        res.add(transparent);
+                        break;
+                    }
+                    res.add(new org.w3c.css.values.CssColor(ac, (String)val.get()));
+                    break;
+                default:
+                    throw new InvalidParamException("unrecognize", ac);
+            }
+            expression.next();
+            if (op != SPACE) {
+                throw new InvalidParamException("operator",
+                        Character.toString(op),
+                        ac);
+            }
+        }
+        // check that inherit is alone
+        if (res.size() > 1 && res.contains(inherit)) {
+            throw new InvalidParamException("unrecognize", ac);
+        }
+        value = (res.size() == 1) ? res.get(0) : new CssValueList(res);
 
-    /**
-     * Set this property to be important.
-     * Overrides this method for a macro
-     */
-    public void setImportant() {
-	if(top != null) {
-	    top.important = true;
-	}
-	if(right != null) {
-	    right.important = true;
-	}
-	if(left != null) {
-	    left.important = true;
-	}
-	if(bottom != null) {
-	    bottom.important = true;
-	}
-    }
+        // now assign the computed values...
+        top = new CssBorderTopColor();
+        right = new CssBorderRightColor();
+        bottom = new CssBorderBottomColor();
+        left = new CssBorderLeftColor();
 
-    /**
-     * Returns true if this property is important.
-     * Overrides this method for a macro
-     */
-    public boolean getImportant() {
-	return ((top == null || top.important) &&
-		(right == null || right.important) &&
-		(left == null || left.important) &&
-		(bottom == null || bottom.important));
-    }
+        switch (res.size()) {
+            case 1:
+                top.value = left.value = right.value = bottom.value = res.get(0);
+                break;
+            case 2:
+                top.value = bottom.value = res.get(0);
+                right.value = left.value = res.get(1);
+                break;
+            case 3:
+                top.value = res.get(0);
+                right.value = left.value = res.get(1);
+                bottom.value = res.get(2);
+                break;
+            case 4:
+                top.value = res.get(0);
+                right.value = res.get(1);
+                bottom.value = res.get(2);
+                left.value = res.get(3);
+                break;
+            default:
+                // can't happen
+                throw new InvalidParamException("unrecognize", ac);
+        }
+        throw new InvalidParamException("unrecognize", ac);
 
-    /**
-     * Set the context.
-     * Overrides this method for a macro
-     *
-     * @see org.w3c.css.css.CssCascadingOrder#order
-     * @see org.w3c.css.css.StyleSheetParser#handleRule
-     */
-    public void setSelectors(CssSelectors selector) {
-	super.setSelectors(selector);
-	if (top != null) {
-	    top.setSelectors(selector);
-	}
-	if (right != null) {
-	    right.setSelectors(selector);
-	}
-	if (bottom != null) {
-	    bottom.setSelectors(selector);
-	}
-	if (left != null) {
-	    left.setSelectors(selector);
-	}
     }
 
     /**
-     * Add this property to the CssStyle
-     *
-     * @param style The CssStyle
+     * Check the border-*-color and returns a value.
+     * It makes sense to do it only once for all the sides, so by having the code here.
      */
-    public void addToStyle(ApplContext ac, CssStyle style) {
-	if(top != null) {
-	    top.addToStyle(ac, style);
-	}
-	if(right != null) {
-	    right.addToStyle(ac, style);
-	}
-	if(left != null) {
-	    left.addToStyle(ac, style);
-	}
-	if(bottom != null) {
-	    bottom.addToStyle(ac, style);
-	}
-    }
+    protected static CssValue checkBorderSideColor(ApplContext ac, CssProperty caller, CssExpression expression,
+                                                   boolean check) throws InvalidParamException {
 
-    /**
-     * 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) {
-	throw new IllegalStateException("Can't invoke this method on the property " +
-					getPropertyName());
-    }
+        if (check && expression.getCount() > 1) {
+            throw new InvalidParamException("unrecognize", ac);
+        }
 
-    /**
-     * Update the source file and the line.
-     * Overrides this method for a macro
-     *
-     * @param line The line number where this property is defined
-     * @param source The source file where this property is defined
-     */
-    public void setInfo(int line, String source) {
-	super.setInfo(line, source);
-	if(top != null) {
-	    top.setInfo(line, source);
-	}
-	if(right != null) {
-	    right.setInfo(line, source);
-	}
-	if(left != null) {
-	    left.setInfo(line, source);
-	}
-	if(bottom != null) {
-	    bottom.setInfo(line, source);
-	}
-    }
+        CssValue retval = null;
+        CssValue val = expression.getValue();
 
-    /**
-     * Compares two properties for equality.
-     *
-     * @param value The other property.
-     */
-    public boolean equals(CssProperty property) {
-	return false; // FIXME
+        switch (val.getType()) {
+            case CssTypes.CSS_COLOR:
+                retval = val;
+                break;
+            case CssTypes.CSS_IDENT:
+                if (transparent.equals(val)) {
+                    retval = transparent;
+                    break;
+                }
+                if (inherit.equals(val)) {
+                    retval = inherit;
+                    break;
+                }
+                retval = new org.w3c.css.values.CssColor(ac,
+                        (String) val.get());
+                break;
+            default:
+                throw new InvalidParamException("value", val.toString(),
+                        caller.getPropertyName(), ac);
+        }
+        expression.next();
+        return retval;
     }
-
 }

--- CssBorderCSS1.java DELETED ---

--- CssBorderRightStyle.java DELETED ---

--- CssBorderCSS2.java DELETED ---

--- CssBorderLeftCSS1.java DELETED ---

--- CssBorderBottomColorCSS2.java DELETED ---

--- CssBorderFaceStyleCSS2.java DELETED ---

--- CssBorderLeftStyleCSS1.java DELETED ---

--- CssBorderFaceColor.java DELETED ---

--- CssBorderTopCSS1.java DELETED ---

--- CssBorderFaceWidthCSS1.java DELETED ---

--- CssBorderBottomColorCSS1.java DELETED ---

--- CssBorderLeftStyle.java DELETED ---

--- CssBorderRightColorCSS2.java DELETED ---

Index: CssBorderTopWidth.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css1/CssBorderTopWidth.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- CssBorderTopWidth.java	5 Jan 2010 13:49:42 -0000	1.4
+++ CssBorderTopWidth.java	25 Apr 2012 20:22:00 -0000	1.5
@@ -1,163 +1,44 @@
-//
 // $Id$
-// From Philippe Le Hegaret (Philippe.Le_Hegaret@sophia.inria.fr)
+// Author: Yves Lafon <ylafon@w3.org>
 //
-// (c) COPYRIGHT MIT and INRIA, 1997.
+// (c) COPYRIGHT MIT, ERCIM and Keio University, 2012.
 // 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.CssValue;
 
 /**
- *   <H4>
- *     &nbsp;&nbsp; 'border-top-width'
- *   </H4>
- *   <P>
- *   <EM>Value:</EM> thin | medium | thick | &lt;length&gt;<BR>
- *   <EM>Initial:</EM> 'medium'<BR>
- *   <EM>Applies to:</EM> all elements<BR>
- *   <EM>Inherited:</EM> no<BR>
- *   <EM>Percentage values:</EM> N/A<BR>
- *   <P>
- *   This property sets the width of an element's top border. The width of the
- *   keyword values are UA dependent, but the following holds: 'thin' &lt;= 'medium'
- *   &lt;= 'thick'.
- *   <P>
- *   The keyword widths are constant throughout a document:
- *   <PRE>
- *   H1 { border: solid thick red }
- *   P  { border: solid thick blue }
- * </PRE>
- *   <P>
- *   In the example above, 'H1' and 'P' elements will have the same border width
- *   regardless of font size. To achieve relative widths, the 'em' unit can be
- *   used:
- *   <PRE>
- *   H1 { border: solid 0.5em }
- * </PRE>
- *   <P>
- *   Border widths cannot be negative.
+ * @see CssBorderWidth
  * @version $Revision$
  */
-public class CssBorderTopWidth extends CssProperty {
-
-    CssBorderFaceWidth face;
+public class CssBorderTopWidth extends org.w3c.css.properties.css.CssBorderTopWidth {
 
     /**
      * Create a new CssBorderTopWidth
      */
     public CssBorderTopWidth() {
-	face = new CssBorderFaceWidth();
     }
 
     /**
-     * Create a new CssBorderTopWidth with an another CssBorderFaceWidth
-     *
-     * @param another The another side.
-     */
-    public CssBorderTopWidth(CssBorderFaceWidth another) {
-	setByUser();
-
-	face = another;
-    }
-
-    /**
-     * Create a new CssBorderTopWidth
+     * Creates a new CssBorderTopWidth
      *
-     * @param expression The expression for this property.
-     * @exception InvalidParamException Values are incorrect
+     * @param expression The expression for this property
+     * @throws org.w3c.css.util.InvalidParamException
+     *          Expressions are incorrect
      */
-    public CssBorderTopWidth(ApplContext ac, CssExpression expression,
-	    boolean check) throws InvalidParamException {
-
-	if(check && expression.getCount() > 1) {
-	    throw new InvalidParamException("unrecognize", ac);
-	}
-
-	setByUser();
-	face = new CssBorderFaceWidth(ac, expression);
+    public CssBorderTopWidth(ApplContext ac, CssExpression expression, boolean check)
+            throws InvalidParamException {
+        setByUser();
+        // here we delegate to BorderWidth implementation
+        value = CssBorderWidth.checkBorderSideWidth(ac, this, expression, check);
     }
 
     public CssBorderTopWidth(ApplContext ac, CssExpression expression)
-	throws InvalidParamException {
-	this(ac, expression,false);
-    }
-
-    /**
-     * Returns the value of this property
-     */
-    public Object get() {
-	return face;
-    }
-
-    /**
-     * Return the value of this property
-     */
-    public CssValue getValue() {
-	if(face != null) {
-	    return face.getValue();
-	}
-	return null;
-    }
-
-    /**
-     * Returns a string representation of the object.
-     */
-    public String toString() {
-	if(face != null) {
-	    return face.toString();
-	}
-	return "";
-    }
-
-    /**
-     * Returns the name of this property
-     */
-    public String getPropertyName() {
-	return "border-top-width";
-    }
-
-    /**
-     * Add this property to the CssStyle.
-     *
-     * @param style The CssStyle
-     */
-    public void addToStyle(ApplContext ac, CssStyle style) {
-	CssBorderTop top = ((Css1Style) style).cssBorder.top;
-
-	if (top.width != null) {
-	    style.addRedefinitionWarning(ac, this);
-	}
-	top.width = 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).getBorderTopWidth();
-	} else {
-	    return ((Css1Style) style).cssBorder.getTop().width;
-	}
-    }
-
-    /**
-     * Compares two properties for equality.
-     *
-     * @param value The other property.
-     */
-    public boolean equals(CssProperty property) {
-	return (property instanceof CssBorderTopWidth &&
-		face.equals(((CssBorderTopWidth) property).face));
+            throws InvalidParamException {
+        this(ac, expression, false);
     }
 
 }
+

--- CssBorderBottomWidthCSS2.java DELETED ---

--- CssBorderFaceWidth.java DELETED ---

Index: CssBorder.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css1/CssBorder.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- CssBorder.java	9 Feb 2012 17:36:29 -0000	1.7
+++ CssBorder.java	25 Apr 2012 20:21:55 -0000	1.8
@@ -1,371 +1,196 @@
-//
 // $Id$
-// From Philippe Le Hegaret (Philippe.Le_Hegaret@sophia.inria.fr)
-//
-// (c) COPYRIGHT MIT and INRIA, 1997.
+// @author Yves Lafon <ylafon@w3.org>
+
+// (c) COPYRIGHT MIT, ERCIM and Keio University, 2012.
 // Please first read the full copyright statement in file COPYRIGHT.html
 package org.w3c.css.properties.css1;
 
-import org.w3c.css.parser.CssSelectors;
-import org.w3c.css.parser.CssStyle;
+import org.w3c.css.properties.css.CssBorderBottomColor;
+import org.w3c.css.properties.css.CssBorderBottomStyle;
+import org.w3c.css.properties.css.CssBorderLeftColor;
+import org.w3c.css.properties.css.CssBorderLeftStyle;
+import org.w3c.css.properties.css.CssBorderRightColor;
+import org.w3c.css.properties.css.CssBorderRightStyle;
+import org.w3c.css.properties.css.CssBorderTopColor;
+import org.w3c.css.properties.css.CssBorderTopStyle;
 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.CssOperator;
+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;
+import org.w3c.css.values.CssValueList;
+
+import static org.w3c.css.values.CssOperator.SPACE;
 
 /**
- * @version $Revision$
+ * @spec http://www.w3.org/TR/2011/REC-CSS2-20110607/box.html#border-shorthand-properties
  */
-public class CssBorder extends CssProperty implements CssOperator {
-
-//    CssBorderTopWidth width;
-//    CssBorderTopStyle style;
-//    CssBorderTopColor color;
-//    CssValue uri = null;
-//    CssBorderImageTransform imagetransform = null;
-
-    CssBorderTop top = new CssBorderTop();
-    CssBorderRight right = new CssBorderRight();
-    CssBorderBottom bottom = new CssBorderBottom();
-    CssBorderLeft left = new CssBorderLeft();
+public class CssBorder extends org.w3c.css.properties.css.CssBorder {
 
     /**
-     * Create a new CssBorder
+     * Create a new CssBackground
      */
     public CssBorder() {
-	top = new CssBorderTop();
-	right = new CssBorderRight();
-	bottom = new CssBorderBottom();
-	left = new CssBorderLeft();
     }
 
     /**
-     * Create a new CssBorder
+     * Set the value of the property<br/>
+     * Does not check the number of values
      *
-     * @param value The value for this property
-     * @exception InvalidParamException The value is incorrect
+     * @param expression The expression for this property
+     * @throws org.w3c.css.util.InvalidParamException
+     *          The expression is incorrect
      */
-    public CssBorder(ApplContext ac, CssExpression expression,
-	    boolean check) throws InvalidParamException {
-	CssValue val = expression.getValue();
-
-	if(check && expression.getCount() > 4) {
-	    throw new InvalidParamException("unrecognize", ac);
-	}
-
-	setByUser();
-
-
-	top = new CssBorderTop(ac, expression);
-
-	if (val == expression.getValue()) {
-	    throw new InvalidParamException("value",
-					    expression.getValue(),
-					    getPropertyName(), ac);
-	}
-	right = new CssBorderRight();
-	bottom = new CssBorderBottom();
-	left = new CssBorderLeft();
-
-	CssBorderTopWidth w = top.width;
-	CssBorderTopStyle s = top.style;
-	CssBorderTopColor c = top.color;
-
-	if(w != null) {
-	    right.width  =
-		new CssBorderRightWidth((CssBorderFaceWidth) w.get());
-	    left.width =
-		new CssBorderLeftWidth((CssBorderFaceWidth) w.get());
-	    bottom.width =
-		new CssBorderBottomWidth((CssBorderFaceWidth) w.get());
-	}
-	if(s != null) {
-	    right.style =
-		new CssBorderRightStyle((CssBorderFaceStyle) s.get());
-	    left.style =
-		new CssBorderLeftStyle((CssBorderFaceStyle) s.get());
-	    bottom.style =
-		new CssBorderBottomStyle((CssBorderFaceStyle) s.get());
-	}
-	if(c != null) {
-	    right.color =
-		new CssBorderRightColor((CssBorderFaceColor) c.get());
-	    left.color =
-		new CssBorderLeftColor((CssBorderFaceColor) c.get());
-	    bottom.color =
-		new CssBorderBottomColor((CssBorderFaceColor) c.get());
-	}
-	/*
-	CssValue val = expression.floatValue();
-	char op = SPACE;
-	boolean find = true;
-
-	setByUser();
-
-	boolean manyValues = (expression.getCount() > 1);
-
-	while (find) {
-	    find = false;
-	    val = expression.floatValue();
-	    op = expression.getOperator();
-
-	    if (val == null)
-		break;
-
-	    // if there are many values, we can't have inherit as one of them
-	    if(manyValues && val.equals(inherit)) {
-		throw new InvalidParamException("unrecognize", null, null, ac);
-	    }
-
-	    if (op != SPACE)
-		throw new InvalidParamException("operator",
-			((new Character(op)).toString()), ac);
-
-	    if (width == null) {
-		try {
-		    width = new CssBorderTopWidth(ac, expression);
-		    find = true;
-		} catch (InvalidParamException e) {
-		    // nothing to do, style will test the value
-		}
-	    }
-
-	    if (!find && style == null) {
-		try {
-		    style = new CssBorderTopStyle(ac, expression);
-		    find = true;
-		}
-		catch (InvalidParamException e) {
-		    // nothing to do, color will test the value
-		}
-	    }
-
-	    if (!find && color == null) {
-		try {
-		    color = new CssBorderTopColor(ac, expression);
-		    find = true;
-		}
-		catch (InvalidParamException e) {
-		    // nothing to do, uri will test the value
-		}
-	    }
-
-	    if (!find && uri == null) {
-		if (val instanceof CssURL) {
-		    uri = val;
-		    find = true;
-		}
-	    }
-
-	    if (!find && imagetransform == null) {
-		imagetransform = new CssBorderImageTransform(ac, expression);
-		find = true;
-	    }
-	}*/
-	/*
-	if (width == null) {
-	    width = new CssBorderTopWidth();
-	}
-	if (style == null) {
-	    style = new CssBorderTopStyle();
-	}
-
-	if (color == null) {
-	    color = new CssBorderTopColor();
-	}
-	*/
-	//
-
-
-//	top = new CssBorderTop(ac, expression);
-/*
-	right = new CssBorderRight();
-	bottom = new CssBorderBottomCSS21();
-	left = new CssBorderLeft();*/
-/*
-	right.width  =  new CssBorderRightWidth((CssBorderFaceWidth) top.width.get());
-	left.width   =  new CssBorderLeftWidth((CssBorderFaceWidth) top.width.get());
-	bottom.width =  new CssBorderBottomWidth((CssBorderFaceWidth) top.width.get());
-
-	right.style  =  new CssBorderRightStyle((CssBorderFaceStyle) top.style.get());
-	left.style   =  new CssBorderLeftStyle((CssBorderFaceStyle) top.style.get());
-	bottom.style =  new CssBorderBottomStyle((CssBorderFaceStyle) top.style.get());
-
-	right.color  = 	new CssBorderRightColor((CssBorderFaceColor) top.color.get());
-	left.color   =  new CssBorderLeftColor((CssBorderFaceColor) top.color.get());
-	bottom.color =  new CssBorderBottomColorCSS21((CssBorderFaceColor) top.color.get());
-*/
-    }
-
     public CssBorder(ApplContext ac, CssExpression expression)
-	throws InvalidParamException {
-	this(ac, expression, false);
-    }
-
-    /**
-     * Returns the value of this property
-     */
-    public Object get() {
-	return top.get();
-    }
-
-    /**
-     * Returns the top property
-     */
-    public CssBorderTop getTop() {
-	return top;
-    }
-
-    /**
-     * Returns the right property
-     */
-    public CssBorderRight getRight() {
-	return right;
-    }
-
-    /**
-     * Returns the bottom property
-     */
-    public CssBorderBottom getBottom() {
-	return bottom;
-    }
-
-    /**
-     * Returns the left property
-     */
-    public CssBorderLeft getLeft() {
-	return left;
+            throws InvalidParamException {
+        this(ac, expression, false);
     }
 
     /**
-     * Returns a string representation of the object.
+     * Set the value of the property
+     *
+     * @param expression The expression for this property
+     * @param check      set it to true to check the number of values
+     * @throws org.w3c.css.util.InvalidParamException
+     *          The expression is incorrect
      */
-    public String toString() {
-	if(top != null) {
-	    return top.toString();
-	}
-	return "";
-    }
+    public CssBorder(ApplContext ac, CssExpression expression,
+                     boolean check) throws InvalidParamException {
+        // great, it's the same thing as one side!
+        SideValues values = checkBorderSide(ac, this, expression, check);
+        CssValueList valueList = new CssValueList();
 
-    public boolean equals(CssProperty property) {
-	return false; // FIXME
+        if (values.color != null) {
+            valueList.add(values.color);
+            borderColor = new CssBorderColor();
+            borderColor.bottom = new CssBorderBottomColor();
+            borderColor.bottom.value = values.color;
+            borderColor.top = new CssBorderTopColor();
+            borderColor.top.value = values.color;
+            borderColor.left = new CssBorderLeftColor();
+            borderColor.left.value = values.color;
+            borderColor.right = new CssBorderRightColor();
+            borderColor.right.value = values.color;
+        }
+        if (values.style != null) {
+            valueList.add(values.style);
+            borderStyle = new CssBorderStyle();
+            borderStyle.bottom = new CssBorderBottomStyle();
+            borderStyle.bottom.value = values.style;
+            borderStyle.top = new CssBorderTopStyle();
+            borderStyle.top.value = values.style;
+            borderStyle.left = new CssBorderLeftStyle();
+            borderStyle.left.value = values.style;
+            borderStyle.right = new CssBorderRightStyle();
+            borderStyle.right.value = values.style;
+        }
+        if (values.width != null) {
+            valueList.add(values.width);
+            borderWidth = new CssBorderWidth();
+            borderWidth.bottom = new CssBorderBottomWidth();
+            borderWidth.bottom.value = values.width;
+            borderWidth.top = new CssBorderTopWidth();
+            borderWidth.top.value = values.width;
+            borderWidth.left = new CssBorderLeftWidth();
+            borderWidth.left.value = values.width;
+            borderWidth.right = new CssBorderRightWidth();
+            borderWidth.right.value = values.width;
+        }
+        value = valueList;
     }
 
     /**
-     * Returns the name of this property
+     * Check the border-* and returns a value.
+     * It makes sense to do it only once for all the sides, so by having the code here.
      */
-    public String getPropertyName() {
-	return "border";
-    }
+    protected static SideValues checkBorderSide(ApplContext ac, CssProperty caller, CssExpression expression,
+                                                boolean check) throws InvalidParamException {
+        if (check && expression.getCount() > 3) {
+            throw new InvalidParamException("unrecognize", ac);
+        }
+        CssValue _width = null;
+        CssValue _style = null;
+        CssValue _color = null;
 
-    /**
-     * Set this property to be important.
-     * Overrides this method for a macro
-     */
-    public void setImportant() {
-	if(top != null) {
-	    top.setImportant();
-	}
-	if(right != null) {
-	    right.setImportant();
-	}
-	if(left != null) {
-	    left.setImportant();
-	}
-	if(bottom != null) {
-	    bottom.setImportant();
-	}
-    }
+        CssValue val;
+        char op;
 
-    /**
-     * Returns true if this property is important.
-     * Overrides this method for a macro
-     */
-    public boolean getImportant() {
-	return (top.getImportant() &&
-		right.getImportant() &&
-		left.getImportant() &&
-		bottom.getImportant());
-    }
+        while (!expression.end()) {
+            val = expression.getValue();
+            op = expression.getOperator();
 
-    /**
-     * Set the context.
-     * Overrides this method for a macro
-     *
-     * @see org.w3c.css.css.CssCascadingOrder#order
-     * @see org.w3c.css.css.StyleSheetParser#handleRule
-     */
-    public void setSelectors(CssSelectors selector) {
-	super.setSelectors(selector);
-	if (top != null) {
-	    top.setSelectors(selector);
-	}
-	if (right != null) {
-	    right.setSelectors(selector);
-	}
-	if (bottom != null) {
-	    bottom.setSelectors(selector);
-	}
-	if (left != null) {
-	    left.setSelectors(selector);
-	}
+            switch (val.getType()) {
+                case CssTypes.CSS_NUMBER:
+                    val = ((CssNumber) val).getLength();
+                case CssTypes.CSS_LENGTH:
+                    CssLength length = (CssLength) val;
+                    if (!length.isPositive()) {
+                        throw new InvalidParamException("negative-value", expression.getValue(),
+                                caller.getPropertyName(), ac);
+                    }
+                    _width = val;
+                    break;
+                case CssTypes.CSS_COLOR:
+                    _color = val;
+                    break;
+                case CssTypes.CSS_IDENT:
+                    CssIdent id = (CssIdent) val;
+                    if (transparent.equals(id)) {
+                        _color = transparent;
+                        break;
+                    }
+                    if (inherit.equals(id)) {
+                        if (expression.getCount() > 1) {
+                            throw new InvalidParamException("unrecognize", ac);
+                        }
+                        _width = inherit;
+                        _style = inherit;
+                        _color = inherit;
+                        break;
+                    }
+                    CssIdent match = CssBorderWidth.getMatchingIdent(id);
+                    if (match != null) {
+                        _width = match;
+                    } else {
+                        match = CssBorderStyle.getMatchingIdent(id);
+                        if (match != null) {
+                            _style = match;
+                        } else {
+                            // if not a width or a style, fail if it's not a proper color
+                            _color = new org.w3c.css.values.CssColor(ac, id.toString());
+                        }
+                    }
+                    break;
+                default:
+                    throw new InvalidParamException("value", val.toString(),
+                            caller.getPropertyName(), ac);
+            }
+            expression.next();
+            if (op != SPACE) {
+                throw new InvalidParamException("operator",
+                        Character.toString(op),
+                        ac);
+            }
+        }
+        return new SideValues(_width, _style, _color);
     }
 
-    /**
-     * Add this property to the CssStyle
-     *
-     * @param style The CssStyle
-     */
-    public void addToStyle(ApplContext ac, CssStyle style) {
-	if(top != null) {
-	    top.addToStyle(ac, style);
-	}
-	if(right != null) {
-	    right.addToStyle(ac, style);
-	}
-	if(left != null) {
-	    left.addToStyle(ac, style);
-	}
-	if(bottom != null) {
-	    bottom.addToStyle(ac, style);
-	}
-    }
+// small wrapper to return values...
+protected static class SideValues {
+    CssValue width;
+    CssValue style;
+    CssValue color;
 
-    /**
-     * 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).getBorder();
-	} else {
-	    return ((Css1Style) style).cssBorder;
-	}
-    }
+    SideValues(CssValue width, CssValue style, CssValue color) {
+        this.width = width;
+        this.style = style;
+        this.color = color;
 
-    /**
-     * Update the source file and the line.
-     * Overrides this method for a macro
-     *
-     * @param line The line number where this property is defined
-     * @param source The source file where this property is defined
-     */
-    public void setInfo(int line, String source) {
-	//super.setInfo(line, source);
-	//top.setInfo(line, source);
-	//right.setInfo(line, source);
-	//left.setInfo(line, source);
-	//bottom.setInfo(line, source);
     }
 
-    void check() {
-	//top.check();
-	//bottom.check();
-	//right.check();
-	//left.check();
-    }
+}
 }

--- CssBorderBottomColor.java DELETED ---

--- CssBorderFaceWidthCSS2.java DELETED ---

--- CssBorderTopColor.java DELETED ---

--- CssBorderTopColorCSS2.java DELETED ---

Index: Css1Style.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css1/Css1Style.java,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- Css1Style.java	9 Feb 2012 17:36:28 -0000	1.25
+++ Css1Style.java	25 Apr 2012 20:21:55 -0000	1.26
@@ -105,9 +105,8 @@
     /**
      * border properties
      */
-    public CssBorder cssBorder = new CssBorder();
-    public CssBorderCSS2 cssBorderCSS2 = new CssBorderCSS2();
-    public CssBorderCSS1 cssBorderCSS1 = new CssBorderCSS1();
+    public org.w3c.css.properties.css.CssBorder cssBorder = new org.w3c.css.properties.css.CssBorder(true);
+
     /**
      * width property
      */
@@ -609,6 +608,7 @@
         return cssBackground.image;
     }
 
+    // TODO this one has to go as well
     public final CssBackgroundImageMob getBackgroundImageMob() {
         if (cssBackgroundMob.image == null) {
             cssBackgroundMob.image =
@@ -653,6 +653,7 @@
         return cssBackground.attachment;
     }
 
+    // TODO this one has to go as well
     public final CssBackgroundAttachmentMob getBackgroundAttachmentMob() {
         if (cssBackgroundMob.attachment == null) {
             cssBackgroundMob.attachment =
@@ -674,6 +675,7 @@
         return cssBackground.position;
     }
 
+    // TODO this one has to go as well
     public final CssBackgroundPositionMob getBackgroundPositionMob() {
         if (cssBackgroundMob.position == null) {
             cssBackgroundMob.position =
@@ -1041,638 +1043,59 @@
     /**
      * Get the border-top-width property
      */
-    public final CssBorderTopWidth getBorderTopWidth() {
-        if (cssBorder.getTop().getWidth() == null) {
-            cssBorder.getTop().width =
-                    (CssBorderTopWidth) style.CascadingOrder(new CssBorderTopWidth(),
-                            style, selector);
-        }
-        return cssBorder.getTop().width;
-    }
-
-    public final CssBorderTopWidthCSS2 getBorderTopWidthCSS2() {
-        if (cssBorderCSS2.getTop().getWidth() == null) {
-            cssBorderCSS2.getTop().width =
-                    (CssBorderTopWidthCSS2) style.CascadingOrder(new CssBorderTopWidthCSS2(),
-                            style, selector);
-        }
-        return cssBorderCSS2.getTop().width;
-    }
-
-    public final CssBorderTopWidthCSS1 getBorderTopWidthCSS1() {
-        if (cssBorderCSS1.getTop().getWidth() == null) {
-            cssBorderCSS1.getTop().width =
-                    (CssBorderTopWidthCSS1) style.CascadingOrder(new CssBorderTopWidthCSS1(),
-                            style, selector);
-        }
-        return cssBorderCSS1.getTop().width;
-    }
-
-    /**
-     * Get the border-top-style property
-     */
-    public final CssBorderTopStyle getBorderTopStyle() {
-        if (cssBorder.getTop().getStyle() == null) {
-            cssBorder.getTop().style =
-                    (CssBorderTopStyle) style.CascadingOrder(new CssBorderTopStyle(),
-                            style, selector);
-        }
-        return cssBorder.getTop().style;
-    }
-
-    public final CssBorderTopStyleCSS2 getBorderTopStyleCSS2() {
-        if (cssBorderCSS2.getTop().getStyle() == null) {
-            cssBorderCSS2.getTop().style =
-                    (CssBorderTopStyleCSS2) style.CascadingOrder(new CssBorderTopStyleCSS2(),
-                            style, selector);
-        }
-        return cssBorderCSS2.getTop().style;
-    }
-
-    public final CssBorderTopStyleCSS1 getBorderTopStyleCSS1() {
-        if (cssBorderCSS1.getTop().getStyle() == null) {
-            cssBorderCSS1.getTop().style =
-                    (CssBorderTopStyleCSS1) style.CascadingOrder(new CssBorderTopStyleCSS1(),
-                            style, selector);
-        }
-        return cssBorderCSS1.getTop().style;
-    }
-
-    /**
-     * Get the border-top-color property
-     */
-    public final CssBorderTopColorCSS2 getBorderTopColorCSS2() {
-        if (cssBorderCSS2.getTop().getColor() == null) {
-            cssBorderCSS2.getTop().color =
-                    (CssBorderTopColorCSS2) style.CascadingOrder(new CssBorderTopColorCSS2(),
-                            style, selector);
-        }
-        return cssBorderCSS2.getTop().color;
-    }
-
-    public final CssBorderTopColor getBorderTopColor() {
-        if (cssBorder.getTop().getColor() == null) {
-            cssBorder.getTop().color =
-                    (CssBorderTopColor) style.CascadingOrder(new CssBorderTopColor(),
-                            style, selector);
-        }
-        return cssBorder.getTop().color;
-    }
-
-    public final CssBorderTopColorCSS1 getBorderTopColorCSS1() {
-        if (cssBorderCSS1.getTop().getColor() == null) {
-            cssBorderCSS1.getTop().color =
-                    (CssBorderTopColorCSS1) style.CascadingOrder(new CssBorderTopColorCSS1(),
+    public final org.w3c.css.properties.css.CssBorderTopWidth getBorderTopWidth() {
+        if (cssBorder.borderWidth.top == null) {
+            cssBorder.borderWidth.top =
+                    (org.w3c.css.properties.css.CssBorderTopWidth) style.CascadingOrder(new org.w3c.css.properties.css.CssBorderTopWidth(),
                             style, selector);
         }
-        return cssBorderCSS1.getTop().color;
+        return cssBorder.borderWidth.top;
     }
 
     /**
      * Get the border-right-width property
      */
-    public final CssBorderRightWidth getBorderRightWidth() {
-        if (cssBorder.getRight().getWidth() == null) {
-            cssBorder.getRight().width =
-                    (CssBorderRightWidth) style.CascadingOrder(new CssBorderRightWidth(),
-                            style, selector);
-        }
-        return cssBorder.getRight().width;
-    }
-
-    public final CssBorderRightWidthCSS2 getBorderRightWidthCSS2() {
-        if (cssBorderCSS2.getRight().getWidth() == null) {
-            cssBorderCSS2.getRight().width =
-                    (CssBorderRightWidthCSS2) style.CascadingOrder(new CssBorderRightWidthCSS2(),
-                            style, selector);
-        }
-        return cssBorderCSS2.getRight().width;
-    }
-
-    public final CssBorderRightWidthCSS1 getBorderRightWidthCSS1() {
-        if (cssBorderCSS1.getRight().getWidth() == null) {
-            cssBorderCSS1.getRight().width =
-                    (CssBorderRightWidthCSS1) style.CascadingOrder(new CssBorderRightWidthCSS1(),
-                            style, selector);
-        }
-        return cssBorderCSS1.getRight().width;
-    }
-
-    /**
-     * Get the border-right-style property
-     */
-    public final CssBorderRightStyle getBorderRightStyle() {
-        if (cssBorder.getRight().getStyle() == null) {
-            cssBorder.getRight().style =
-                    (CssBorderRightStyle) style.CascadingOrder(new CssBorderRightStyle(),
-                            style, selector);
-        }
-        return cssBorder.getRight().style;
-    }
-
-    public final CssBorderRightStyleCSS2 getBorderRightStyleCSS2() {
-        if (cssBorderCSS2.getRight().getStyle() == null) {
-            cssBorderCSS2.getRight().style =
-                    (CssBorderRightStyleCSS2) style.CascadingOrder(new CssBorderRightStyleCSS2(),
-                            style, selector);
-        }
-        return cssBorderCSS2.getRight().style;
-    }
-
-    public final CssBorderRightStyleCSS1 getBorderRightStyleCSS1() {
-        if (cssBorderCSS1.getRight().getStyle() == null) {
-            cssBorderCSS1.getRight().style =
-                    (CssBorderRightStyleCSS1) style.CascadingOrder(new CssBorderRightStyleCSS1(),
-                            style, selector);
-        }
-        return cssBorderCSS1.getRight().style;
-    }
-
-    /**
-     * Get the border-right-color property
-     */
-    public final CssBorderRightColor getBorderRightColor() {
-        if (cssBorder.getRight().getColor() == null) {
-            cssBorder.getRight().color =
-                    (CssBorderRightColor) style.CascadingOrder(new CssBorderRightColor(),
-                            style, selector);
-        }
-        return cssBorder.getRight().color;
-    }
-
-    public final CssBorderRightColorCSS2 getBorderRightColorCSS2() {
-        if (cssBorderCSS2.getRight().getColor() == null) {
-            cssBorderCSS2.getRight().color =
-                    (CssBorderRightColorCSS2) style.CascadingOrder(new CssBorderRightColorCSS2(),
-                            style, selector);
-        }
-        return cssBorderCSS2.getRight().color;
-    }
-
-    public final CssBorderRightColorCSS1 getBorderRightColorCSS1() {
-        if (cssBorderCSS1.getRight().getColor() == null) {
-            cssBorderCSS1.getRight().color =
-                    (CssBorderRightColorCSS1) style.CascadingOrder(new CssBorderRightColorCSS1(),
+    public final org.w3c.css.properties.css.CssBorderRightWidth getBorderRightWidth() {
+        if (cssBorder.borderWidth.right == null) {
+            cssBorder.borderWidth.right =
+                    (org.w3c.css.properties.css.CssBorderRightWidth) style.CascadingOrder(new org.w3c.css.properties.css.CssBorderRightWidth(),
                             style, selector);
         }
-        return cssBorderCSS1.getRight().color;
+        return cssBorder.borderWidth.right;
     }
 
     /**
      * Get the border-bottom-width property
      */
-    public final CssBorderBottomWidth getBorderBottomWidth() {
-        if (cssBorder.getBottom().getWidth() == null) {
-            cssBorder.getBottom().width =
-                    (CssBorderBottomWidth) style.CascadingOrder(new CssBorderBottomWidth(),
-                            style, selector);
-        }
-        return cssBorder.getBottom().width;
-    }
-
-    public final CssBorderBottomWidthCSS2 getBorderBottomWidthCSS2() {
-        if (cssBorderCSS2.getBottom().getWidth() == null) {
-            cssBorderCSS2.getBottom().width =
-                    (CssBorderBottomWidthCSS2) style.CascadingOrder(new CssBorderBottomWidthCSS2(),
-                            style, selector);
-        }
-        return cssBorderCSS2.getBottom().width;
-    }
-
-    public final CssBorderBottomWidthCSS1 getBorderBottomWidthCSS1() {
-        if (cssBorderCSS1.getBottom().getWidth() == null) {
-            cssBorderCSS1.getBottom().width =
-                    (CssBorderBottomWidthCSS1) style.CascadingOrder(new CssBorderBottomWidthCSS1(),
-                            style, selector);
-        }
-        return cssBorderCSS1.getBottom().width;
-    }
-
-    /**
-     * Get the border-bottom-style property
-     */
-    public final CssBorderBottomStyle getBorderBottomStyle() {
-        if (cssBorder.getBottom().getStyle() == null) {
-            cssBorder.getBottom().style =
-                    (CssBorderBottomStyle) style.CascadingOrder(new CssBorderBottomStyle(),
-                            style, selector);
-        }
-        return cssBorder.getBottom().style;
-    }
-
-    public final CssBorderBottomStyleCSS2 getBorderBottomStyleCSS2() {
-        if (cssBorderCSS2.getBottom().getStyle() == null) {
-            cssBorderCSS2.getBottom().style =
-                    (CssBorderBottomStyleCSS2) style.CascadingOrder(new CssBorderBottomStyleCSS2(),
-                            style, selector);
-        }
-        return cssBorderCSS2.getBottom().style;
-    }
-
-    public final CssBorderBottomStyleCSS1 getBorderBottomStyleCSS1() {
-        if (cssBorderCSS1.getBottom().getStyle() == null) {
-            cssBorderCSS1.getBottom().style =
-                    (CssBorderBottomStyleCSS1) style.CascadingOrder(new CssBorderBottomStyleCSS1(),
-                            style, selector);
-        }
-        return cssBorderCSS1.getBottom().style;
-    }
-
-    /**
-     * Get the border-bottom-color property
-     */
-    public final CssBorderBottomColor getBorderBottomColor() {
-        if (cssBorder.getBottom().getColor() == null) {
-            cssBorder.getBottom().color =
-                    (CssBorderBottomColor) style.CascadingOrder(new CssBorderBottomColor(),
-                            style, selector);
-        }
-        return cssBorder.getBottom().color;
-    }
-
-    public final CssBorderBottomColorCSS2 getBorderBottomColorCSS2() {
-        if (cssBorderCSS2.getBottom().getColor() == null) {
-            cssBorderCSS2.getBottom().color =
-                    (CssBorderBottomColorCSS2) style.CascadingOrder(new CssBorderBottomColorCSS2(),
-                            style, selector);
-        }
-        return cssBorderCSS2.getBottom().color;
-    }
-
-    public final CssBorderBottomColorCSS1 getBorderBottomColorCSS1() {
-        if (cssBorderCSS1.getBottom().getColor() == null) {
-            cssBorderCSS1.getBottom().color =
-                    (CssBorderBottomColorCSS1) style.CascadingOrder(new CssBorderBottomColorCSS1(),
+    public final org.w3c.css.properties.css.CssBorderBottomWidth getBorderBottomWidth() {
+        if (cssBorder.borderWidth.bottom == null) {
+            cssBorder.borderWidth.bottom =
+                    (org.w3c.css.properties.css.CssBorderBottomWidth) style.CascadingOrder(new org.w3c.css.properties.css.CssBorderBottomWidth(),
                             style, selector);
         }
-        return cssBorderCSS1.getBottom().color;
+        return cssBorder.borderWidth.bottom;
     }
 
     /**
      * Get the border-left-width property
      */
-    public final CssBorderLeftWidth getBorderLeftWidth() {
-        if (cssBorder.getLeft().getWidth() == null) {
-            cssBorder.getLeft().width =
-                    (CssBorderLeftWidth) style.CascadingOrder(new CssBorderLeftWidth(),
-                            style, selector);
-        }
-        return cssBorder.getLeft().width;
-    }
-
-    public final CssBorderLeftWidthCSS2 getBorderLeftWidthCSS2() {
-        if (cssBorderCSS2.getLeft().getWidth() == null) {
-            cssBorderCSS2.getLeft().width =
-                    (CssBorderLeftWidthCSS2) style.CascadingOrder(new CssBorderLeftWidthCSS2(),
-                            style, selector);
-        }
-        return cssBorderCSS2.getLeft().width;
-    }
-
-    public final CssBorderLeftWidthCSS1 getBorderLeftWidthCSS1() {
-        if (cssBorderCSS1.getLeft().getWidth() == null) {
-            cssBorderCSS1.getLeft().width =
-                    (CssBorderLeftWidthCSS1) style.CascadingOrder(new CssBorderLeftWidthCSS1(),
-                            style, selector);
-        }
-        return cssBorderCSS1.getLeft().width;
-    }
-
-    /**
-     * Get the border-left-style property
-     */
-    public final CssBorderLeftStyle getBorderLeftStyle() {
-        if (cssBorder.getLeft().getStyle() == null) {
-            cssBorder.getLeft().style =
-                    (CssBorderLeftStyle) style.CascadingOrder(new CssBorderLeftStyle(),
-                            style, selector);
-        }
-        return cssBorder.getLeft().style;
-    }
-
-    public final CssBorderLeftStyleCSS2 getBorderLeftStyleCSS2() {
-        if (cssBorderCSS2.getLeft().getStyle() == null) {
-            cssBorderCSS2.getLeft().style =
-                    (CssBorderLeftStyleCSS2) style.CascadingOrder(new CssBorderLeftStyleCSS2(),
-                            style, selector);
-        }
-        return cssBorderCSS2.getLeft().style;
-    }
-
-    public final CssBorderLeftStyleCSS1 getBorderLeftStyleCSS1() {
-        if (cssBorderCSS1.getLeft().getStyle() == null) {
-            cssBorderCSS1.getLeft().style =
-                    (CssBorderLeftStyleCSS1) style.CascadingOrder(new CssBorderLeftStyleCSS1(),
-                            style, selector);
-        }
-        return cssBorderCSS1.getLeft().style;
-    }
-
-    /**
-     * Get the border-left-color property
-     */
-    public final CssBorderLeftColor getBorderLeftColor() {
-        if (cssBorder.getLeft().getColor() == null) {
-            cssBorder.getLeft().color =
-                    (CssBorderLeftColor) style.CascadingOrder(new CssBorderLeftColor(),
-                            style, selector);
-        }
-        return cssBorder.getLeft().color;
-    }
-
-    public final CssBorderLeftColorCSS2 getBorderLeftColorCSS2() {
-        if (cssBorderCSS2.getLeft().getColor() == null) {
-            cssBorderCSS2.getLeft().color =
-                    (CssBorderLeftColorCSS2) style.CascadingOrder(new CssBorderLeftColorCSS2(),
-                            style, selector);
-        }
-        return cssBorderCSS2.getLeft().color;
-    }
-
-    public final CssBorderLeftColorCSS1 getBorderLeftColorCSS1() {
-        if (cssBorderCSS1.getLeft().getColor() == null) {
-            cssBorderCSS1.getLeft().color =
-                    (CssBorderLeftColorCSS1) style.CascadingOrder(new CssBorderLeftColorCSS1(),
+    public final org.w3c.css.properties.css.CssBorderLeftWidth getBorderLeftWidth() {
+        if (cssBorder.borderWidth.left == null) {
+            cssBorder.borderWidth.left =
+                    (org.w3c.css.properties.css.CssBorderLeftWidth) style.CascadingOrder(new org.w3c.css.properties.css.CssBorderLeftWidth(),
                             style, selector);
         }
-        return cssBorderCSS1.getLeft().color;
-    }
-
-    /**
-     * Get the border-top property
-     */
-    public final CssBorderTop getBorderTop() {
-        if (cssBorder.getTop().getWidth() == null) {
-            cssBorder.getTop().width = getBorderTopWidth();
-        }
-        if (cssBorder.getTop().getStyle() == null) {
-            cssBorder.getTop().style = getBorderTopStyle();
-        }
-        if (cssBorder.getTop().getColor() == null) {
-            cssBorder.getTop().color = getBorderTopColor();
-        }
-        return cssBorder.getTop();
-    }
-
-    public final CssBorderTopCSS2 getBorderTopCSS2() {
-        if (cssBorderCSS2.getTop().getWidth() == null) {
-            cssBorderCSS2.getTop().width = getBorderTopWidthCSS2();
-        }
-        if (cssBorderCSS2.getTop().getStyle() == null) {
-            cssBorderCSS2.getTop().style = getBorderTopStyleCSS2();
-        }
-        if (cssBorderCSS2.getTop().getColor() == null) {
-            cssBorderCSS2.getTop().color = getBorderTopColorCSS2();
-        }
-        return cssBorderCSS2.getTop();
-    }
-
-    public final CssBorderTopCSS1 getBorderTopCSS1() {
-        if (cssBorderCSS1.getTop().getWidth() == null) {
-            cssBorderCSS1.getTop().width = getBorderTopWidthCSS1();
-        }
-        if (cssBorderCSS1.getTop().getStyle() == null) {
-            cssBorderCSS1.getTop().style = getBorderTopStyleCSS1();
-        }
-        if (cssBorderCSS1.getTop().getColor() == null) {
-            cssBorderCSS1.getTop().color = getBorderTopColorCSS1();
-        }
-        return cssBorderCSS1.getTop();
-    }
-
-    /**
-     * Get the border-right property
-     */
-    public final CssBorderRight getBorderRight() {
-        if (cssBorder.getRight().getWidth() == null) {
-            cssBorder.getRight().width = getBorderRightWidth();
-        }
-        if (cssBorder.getRight().getStyle() == null) {
-            cssBorder.getRight().style = getBorderRightStyle();
-        }
-        if (cssBorder.getRight().getColor() == null) {
-            cssBorder.getRight().color = getBorderRightColor();
-        }
-        return cssBorder.getRight();
-    }
-
-    public final CssBorderRightCSS2 getBorderRightCSS2() {
-        if (cssBorderCSS2.getRight().getWidth() == null) {
-            cssBorderCSS2.getRight().width = getBorderRightWidthCSS2();
-        }
-        if (cssBorderCSS2.getRight().getStyle() == null) {
-            cssBorderCSS2.getRight().style = getBorderRightStyleCSS2();
-        }
-        if (cssBorderCSS2.getRight().getColor() == null) {
-            cssBorderCSS2.getRight().color = getBorderRightColorCSS2();
-        }
-        return cssBorderCSS2.getRight();
-    }
-
-    public final CssBorderRightCSS1 getBorderRightCSS1() {
-        if (cssBorderCSS1.getRight().getWidth() == null) {
-            cssBorderCSS1.getRight().width = getBorderRightWidthCSS1();
-        }
-        if (cssBorderCSS1.getRight().getStyle() == null) {
-            cssBorderCSS1.getRight().style = getBorderRightStyleCSS1();
-        }
-        if (cssBorderCSS1.getRight().getColor() == null) {
-            cssBorderCSS1.getRight().color = getBorderRightColorCSS1();
-        }
-        return cssBorderCSS1.getRight();
-    }
-
-    /**
-     * Get the border-bottom property
-     */
-    public final CssBorderBottom getBorderBottom() {
-        if (cssBorder.getBottom().getWidth() == null) {
-            cssBorder.getBottom().width = getBorderBottomWidth();
-        }
-        if (cssBorder.getBottom().getStyle() == null) {
-            cssBorder.getBottom().style = getBorderBottomStyle();
-        }
-        if (cssBorder.getBottom().getColor() == null) {
-            cssBorder.getBottom().color = getBorderBottomColor();
-        }
-        return cssBorder.getBottom();
-    }
-
-    public final CssBorderBottomCSS2 getBorderBottomCSS2() {
-        if (cssBorderCSS2.getBottom().getWidth() == null) {
-            cssBorderCSS2.getBottom().width = getBorderBottomWidthCSS2();
-        }
-        if (cssBorderCSS2.getBottom().getStyle() == null) {
-            cssBorderCSS2.getBottom().style = getBorderBottomStyleCSS2();
-        }
-        if (cssBorderCSS2.getBottom().getColor() == null) {
-            cssBorderCSS2.getBottom().color = getBorderBottomColorCSS2();
-        }
-        return cssBorderCSS2.getBottom();
-    }
-
-    public final CssBorderBottomCSS1 getBorderBottomCSS1() {
-        if (cssBorderCSS1.getBottom().getWidth() == null) {
-            cssBorderCSS1.getBottom().width = getBorderBottomWidthCSS1();
-        }
-        if (cssBorderCSS1.getBottom().getStyle() == null) {
-            cssBorderCSS1.getBottom().style = getBorderBottomStyleCSS1();
-        }
-        if (cssBorderCSS1.getBottom().getColor() == null) {
-            cssBorderCSS1.getBottom().color = getBorderBottomColorCSS1();
-        }
-        return cssBorderCSS1.getBottom();
-    }
-
-    /**
-     * Get the border-left property
-     */
-    public final CssBorderLeft getBorderLeft() {
-        if (cssBorder.getLeft().getWidth() == null) {
-            cssBorder.getLeft().width = getBorderLeftWidth();
-        }
-        if (cssBorder.getLeft().getStyle() == null) {
-            cssBorder.getLeft().style = getBorderLeftStyle();
-        }
-        if (cssBorder.getLeft().getColor() == null) {
-            cssBorder.getLeft().color = getBorderLeftColor();
-        }
-        return cssBorder.getLeft();
-    }
-
-    public final CssBorderLeftCSS2 getBorderLeftCSS2() {
-        if (cssBorderCSS2.getLeft().getWidth() == null) {
-            cssBorderCSS2.getLeft().width = getBorderLeftWidthCSS2();
-        }
-        if (cssBorderCSS2.getLeft().getStyle() == null) {
-            cssBorderCSS2.getLeft().style = getBorderLeftStyleCSS2();
-        }
-        if (cssBorderCSS2.getLeft().getColor() == null) {
-            cssBorderCSS2.getLeft().color = getBorderLeftColorCSS2();
-        }
-        return cssBorderCSS2.getLeft();
+        return cssBorder.borderWidth.left;
     }
 
-    public final CssBorderLeftCSS1 getBorderLeftCSS1() {
-        if (cssBorderCSS1.getLeft().getWidth() == null) {
-            cssBorderCSS1.getLeft().width = getBorderLeftWidthCSS1();
-        }
-        if (cssBorderCSS1.getLeft().getStyle() == null) {
-            cssBorderCSS1.getLeft().style = getBorderLeftStyleCSS1();
-        }
-        if (cssBorderCSS1.getLeft().getColor() == null) {
-            cssBorderCSS1.getLeft().color = getBorderLeftColorCSS1();
-        }
-        return cssBorderCSS1.getLeft();
-    }
 
     /**
      * Get the border property
      */
-    public final CssBorder getBorder() {
-        getBorderTop();
-        getBorderRight();
-        getBorderBottom();
-        getBorderLeft();
+    public final org.w3c.css.properties.css.CssBorder getBorder() {
         return cssBorder;
     }
 
-    public final CssBorderCSS2 getBorderCSS2() {
-        getBorderTopCSS2();
-        getBorderRightCSS2();
-        getBorderBottomCSS2();
-        getBorderLeftCSS2();
-        return cssBorderCSS2;
-    }
-
-    public final CssBorderCSS1 getBorderCSS1() {
-        getBorderTopCSS1();
-        getBorderRightCSS1();
-        getBorderBottomCSS1();
-        getBorderLeftCSS1();
-        return cssBorderCSS1;
-    }
-
-    /**
-     * Get the border-width property
-     */
-    public final CssBorderWidth getBorderWidth() {
-        // WARNING invalid fields in this property ....
-        return new CssBorderWidth(getBorderTopWidth(),
-                getBorderBottomWidth(),
-                getBorderRightWidth(),
-                getBorderLeftWidth());
-    }
-
-    public final CssBorderWidthCSS2 getBorderWidthCSS2() {
-        // WARNING invalid fields in this property ....
-        return new CssBorderWidthCSS2(getBorderTopWidthCSS2(),
-                getBorderBottomWidthCSS2(),
-                getBorderRightWidthCSS2(),
-                getBorderLeftWidthCSS2());
-    }
-
-    public final CssBorderWidthCSS1 getBorderWidthCSS1() {
-        // WARNING invalid fields in this property ....
-        return new CssBorderWidthCSS1(getBorderTopWidthCSS1(),
-                getBorderBottomWidthCSS1(),
-                getBorderRightWidthCSS1(),
-                getBorderLeftWidthCSS1());
-    }
-
-    /**
-     * Get the border-style property
-     */
-    public final CssBorderStyle getBorderStyle() {
-        // WARNING invalid fields in this property ....
-        return new CssBorderStyle(getBorderTopStyle(),
-                getBorderBottomStyle(),
-                getBorderRightStyle(),
-                getBorderLeftStyle());
-    }
-
-    public final CssBorderStyleCSS2 getBorderStyleCSS2() {
-        // WARNING invalid fields in this property ....
-        return new CssBorderStyleCSS2(getBorderTopStyleCSS2(),
-                getBorderBottomStyleCSS2(),
-                getBorderRightStyleCSS2(),
-                getBorderLeftStyleCSS2());
-    }
-
-    public final CssBorderStyleCSS1 getBorderStyleCSS1() {
-        // WARNING invalid fields in this property ....
-        return new CssBorderStyleCSS1(getBorderTopStyleCSS1(),
-                getBorderBottomStyleCSS1(),
-                getBorderRightStyleCSS1(),
-                getBorderLeftStyleCSS1());
-    }
-
-    /**
-     * Get the border-color property
-     */
-    public final CssBorderColor getBorderColor() {
-        // WARNING invalid fields in this porperty ....
-        return new CssBorderColor(getBorderTopColor(),
-                getBorderBottomColor(),
-                getBorderRightColor(),
-                getBorderLeftColor());
-    }
-
-    public final CssBorderColorCSS2 getBorderColorCSS2() {
-        // WARNING invalid fields in this porperty ....
-        return new CssBorderColorCSS2(getBorderTopColorCSS2(),
-                getBorderBottomColorCSS2(),
-                getBorderRightColorCSS2(),
-                getBorderLeftColorCSS2());
-    }
-
-    public final CssBorderColorCSS1 getBorderColorCSS1() {
-        // WARNING invalid fields in this porperty ....
-        return new CssBorderColorCSS1(getBorderTopColorCSS1(),
-                getBorderBottomColorCSS1(),
-                getBorderRightColorCSS1(),
-                getBorderLeftColorCSS1());
-    }
 
     /**
      * Get the width property
@@ -2340,9 +1763,6 @@
      */
     public void findConflicts(ApplContext ac, Warnings warnings,
                               CssSelectors selector, CssSelectors[] allSelectors) {
-        // if border-style == none, border-width should be 0
-        // @@ this is a horrible place to do this ...
-        cssBorder.check();
 
         // check conflicts for 'font-family'
         findConflictsFontFamily(ac, warnings, selector, allSelectors);
@@ -2355,26 +1775,26 @@
         }
 
         if (cssBackground.getColor() != null) {
-            org.w3c.css.properties.css.CssColor colorCSS3 = cssColor;
+            org.w3c.css.properties.css.CssColor fgColor = cssColor;
             // we need to look if there is the same selector elsewhere
             // containing a color definition
             for (int i = 0; i < allSelectors.length; i++) {
                 CssSelectors sel = allSelectors[i];
                 if (sel.toString().equals(selector.toString())) {
-                    colorCSS3 = ((Css1Style) sel.getStyle()).cssColor;
+                    fgColor = ((Css1Style) sel.getStyle()).cssColor;
                     break;
                 }
             }
-            if (colorCSS3 != null) {
-                if (cssBackground.getColor().equals(colorCSS3.getColor())) {
+            if (fgColor != null) {
+                if (cssBackground.getColor().equals(fgColor.getColor())) {
                     // background and color can't have the same color
                     warnings.addWarning(new Warning(cssBackground.color,
-                            "same-colors", 1, colorCSS3, ac));
+                            "same-colors", 1, fgColor, ac));
                 } else if (cssBackground.getColor().equals(
                         CssProperty.transparent)) {
 //		  It's better to have a background color with a color
                     warnings.addWarning(new Warning(
-                            colorCSS3, "no-background-color", 2, emptyArray, ac));
+                            fgColor, "no-background-color", 2, emptyArray, ac));
                 }
             } else {
                 CssValue color = cssBackground.getColor();
@@ -2388,45 +1808,55 @@
 
             // Note : For borders, I don't look for inherited value.
             //        So I can't find same colors in two differents contexts.
-
-            if (cssBorder.getTop().getColor() != null) {
-                CssValue color = cssBorder.getTop().getColor();
+            if (cssBorder.borderColor.shorthand) {
+                CssValue color = (CssValue) cssBorder.borderColor.top.get();
                 if (color != CssProperty.inherit
                         && cssBackground.getColor().equals(color)) {
                     // background and border-color can't have the same color
                     warnings.addWarning(new Warning(cssBackground.color,
                             "same-colors", 1,
-                            cssBorder.getTop().color, ac));
+                            cssBorder.borderColor, ac));
                 }
-            }
-            if (cssBorder.getRight().getColor() != null) {
-                CssValue color = cssBorder.getRight().getColor();
-                if (color != CssProperty.inherit
-                        && cssBackground.getColor().equals(color)) {
-                    // background and border-color can't have the same color
-                    warnings.addWarning(new Warning(cssBackground.color,
-                            "same-colors", 1,
-                            cssBorder.getRight().color, ac));
+            } else {
+                if (cssBorder.borderColor.top != null) {
+                    CssValue color = (CssValue) cssBorder.borderColor.top.get();
+                    if (color != CssProperty.inherit
+                            && cssBackground.getColor().equals(color)) {
+                        // background and border-color can't have the same color
+                        warnings.addWarning(new Warning(cssBackground.color,
+                                "same-colors", 1,
+                                cssBorder.borderColor.top, ac));
+                    }
                 }
-            }
-            if (cssBorder.getBottom().getColor() != null) {
-                CssValue color = cssBorder.getBottom().getColor();
-                if (color != CssProperty.inherit
-                        && cssBackground.getColor().equals(color)) {
-                    // background and border-color can't have the same color
-                    warnings.addWarning(new Warning(cssBackground.color,
-                            "same-colors", 1,
-                            cssBorder.getBottom().color, ac));
+                if (cssBorder.borderColor.right != null) {
+                    CssValue color = (CssValue) cssBorder.borderColor.right.get();
+                    if (color != CssProperty.inherit
+                            && cssBackground.getColor().equals(color)) {
+                        // background and border-color can't have the same color
+                        warnings.addWarning(new Warning(cssBackground.color,
+                                "same-colors", 1,
+                                cssBorder.borderColor.right, ac));
+                    }
                 }
-            }
-            if (cssBorder.getLeft().getColor() != null) {
-                CssValue color = cssBorder.getLeft().getColor();
-                if (color != CssProperty.inherit
-                        && cssBackground.getColor().equals(color)) {
-                    // background and border-color can't have the same color
-                    warnings.addWarning(new Warning(cssBackground.color,
-                            "same-colors", 1,
-                            cssBorder.getLeft().color, ac));
+                if (cssBorder.borderColor.bottom != null) {
+                    CssValue color = (CssValue) cssBorder.borderColor.bottom.get();
+                    if (color != CssProperty.inherit
+                            && cssBackground.getColor().equals(color)) {
+                        // background and border-color can't have the same color
+                        warnings.addWarning(new Warning(cssBackground.color,
+                                "same-colors", 1,
+                                cssBorder.borderColor.bottom, ac));
+                    }
+                }
+                if (cssBorder.borderColor.left != null) {
+                    CssValue color = (CssValue) cssBorder.borderColor.left.get();
+                    if (color != CssProperty.inherit
+                            && cssBackground.getColor().equals(color)) {
+                        // background and border-color can't have the same color
+                        warnings.addWarning(new Warning(cssBackground.color,
+                                "same-colors", 1,
+                                cssBorder.borderColor.left, ac));
+                    }
                 }
             }
             /* suppressed 03-09-98

--- CssBorderTopCSS2.java DELETED ---

--- CssBorderWidthCSS2.java DELETED ---

--- CssBorderBottomCSS2.java DELETED ---

Index: CssBorderRight.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css1/CssBorderRight.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- CssBorderRight.java	9 Sep 2011 12:16:44 -0000	1.5
+++ CssBorderRight.java	25 Apr 2012 20:21:58 -0000	1.6
@@ -1,354 +1,96 @@
-//
 // $Id$
 // From Philippe Le Hegaret (Philippe.Le_Hegaret@sophia.inria.fr)
-//
-// (c) COPYRIGHT MIT and INRIA, 1997.
+// Rewritten 2010 Yves Lafon <ylafon@w3.org>
+
+// (c) COPYRIGHT MIT, ERCIM and Keio, 1997-2010.
 // Please first read the full copyright statement in file COPYRIGHT.html
 package org.w3c.css.properties.css1;
 
-import org.w3c.css.parser.CssSelectors;
-import org.w3c.css.parser.CssStyle;
-import org.w3c.css.properties.css.CssProperty;
+import org.w3c.css.properties.css2.CssBorderRightColor;
+import org.w3c.css.properties.css2.CssBorderRightStyle;
 import org.w3c.css.util.ApplContext;
 import org.w3c.css.util.InvalidParamException;
 import org.w3c.css.values.CssExpression;
-import org.w3c.css.values.CssLength;
-import org.w3c.css.values.CssOperator;
-import org.w3c.css.values.CssURL;
-import org.w3c.css.values.CssValue;
 
 /**
- *   <H4>
- *     &nbsp;&nbsp; 'border-right'
- *   </H4>
- *   <P>
- *   <EM>Value:</EM> &lt;border-right-width&gt; || &lt;border-style&gt; ||
- *   &lt;color&gt;<BR>
- *   <EM>Initial:</EM> not defined for shorthand properties<BR>
- *   <EM>Applies to:</EM> all elements<BR>
- *   <EM>Inherited:</EM> no<BR>
- *   <EM>Percentage values:</EM> N/A<BR>
- *   <P>
- *   This is a shorthand property for setting the width, style and color of an
- *   element's right border.
- *   <PRE>
- *   H1 { border-bottom: thick solid red }
- * </PRE>
- *   <P>
- *   The above rule will set the width, style and color of the border below the
- *   H1 element. Omitted values will be set to their initial values:
- *   <PRE>
- *   H1 { border-bottom: thick solid }
- * </PRE>
- *   <P>
- *   Since the color value is omitted in the example above, the border color will
- *   be the same as the 'color' value of the element itself.
- *   <P>
- *   Note that while the 'border-style' property accepts up to four values, this
- *   property only accepts one style value.
- *
- * @version $Revision$
+ * @since CSS1
  */
-public class CssBorderRight extends CssProperty implements CssOperator {
-
-    CssBorderRightWidth width;
-    CssBorderRightStyle style;
-    CssBorderRightColor color;
-    CssValue uri = null;
+public class CssBorderRight extends org.w3c.css.properties.css.CssBorderRight {
 
     /**
-     * Create a new CssBorderFace
+     * Create a new CssBorderRight
      */
     public CssBorderRight() {
     }
 
     /**
-     * Create a new CssBorderFace
+     * Set the value of the property<br/>
+     * Does not check the number of values
      *
      * @param expression The expression for this property
-     * @exception InvalidParamException The expression is incorrect
+     * @throws org.w3c.css.util.InvalidParamException The expression is incorrect
      */
-    public CssBorderRight(ApplContext ac, CssExpression expression,
-	    boolean check) throws InvalidParamException {
-	CssValue val = null;
-	char op = SPACE;
-	boolean find = true;
-
-	if(check && expression.getCount() > 4) {
-	    throw new InvalidParamException("unrecognize", ac);
-	}
-
-	setByUser();
-
-	boolean manyValues = (expression.getCount() > 1);
-
-	while (find) {
-	    find = false;
-	    val = expression.getValue();
-	    op = expression.getOperator();
-
-	    if (val == null)
-		break;
-
-	    // if there are many values, we can't have inherit as one of them
-	    if(manyValues && val.equals(inherit)) {
-		throw new InvalidParamException("unrecognize", null, null, ac);
-	    }
-
-	    if (op != SPACE)
-		throw new InvalidParamException("operator",
-						((new Character(op)).toString()),
-						ac);
-
-	    if (width == null) {
-		try {
-		    width = new CssBorderRightWidth(ac, expression);
-		    find = true;
-		} catch (InvalidParamException e) {
-		    // nothing to do, style will test this value
-		}
-	    }
-
-	    if (!find && style == null) {
-		try {
-		    style = new CssBorderRightStyle(ac, expression);
-		    find = true;
-		}
-		catch (InvalidParamException e) {
-		    // nothing to do, color will test this value
-		}
-	    }
-
-	    if (!find && color == null) {
-		try {
-		    color = new CssBorderRightColor(ac, expression);
-		    find = true;
-		}
-		catch(InvalidParamException e) {
-		    // nothing to do, uri will test this value
-		}
-	    }
-
-	    if (!find && uri == null) {
-		if (val instanceof CssURL) {
-		    uri = val;
-		    find = true;
-		}
-		else {
-		    throw new InvalidParamException("unrecognize", ac);
-		}
-	    }
-	}
-	/*
-	if (width == null)
-	    width = new CssBorderRightWidth();
-	if (style == null)
-	    style = new CssBorderRightStyle();
-	if (color == null)
-	    color = new CssBorderRightColor();
-	*/
-    }
-
     public CssBorderRight(ApplContext ac, CssExpression expression)
-	throws InvalidParamException {
-	this(ac, expression,false);
-    }
-
-    /**
-     * Returns the value of this property
-     */
-    public Object get() {
-	return width;
-    }
-
-    /**
-     * Returns the color property
-     */
-    public CssValue getColor() {
-	if (color != null) {
-	    return color.getColor();
-	} else {
-	    return null;
-	}
-    }
-
-    /**
-     * Returns the width property
-     */
-    public CssValue getWidth() {
-	if (width != null) {
-	    return width.getValue();
-	} else {
-	    return null;
-	}
+            throws InvalidParamException {
+        this(ac, expression, false);
     }
 
     /**
-     * Returns the style property
+     * Set the value of the property
+     *
+     * @param expression The expression for this property
+     * @param check      set it to true to check the number of values
+     * @throws org.w3c.css.util.InvalidParamException The expression is incorrect
      */
-    public String getStyle() {
-	if (style != null) {
-	    return style.getStyle();
-	} else {
-	    return null;
-	}
+    public CssBorderRight(ApplContext ac, CssExpression expression,
+                          boolean check) throws InvalidParamException {
+        CssBorder.SideValues values = CssBorder.checkBorderSide(ac, this, expression, check);
+        if (values.width != null) {
+            _width = new CssBorderRightWidth();
+            _width.setByUser();
+            _width.value = values.width;
+        }
+        if (values.style != null) {
+            _style = new CssBorderRightStyle();
+            _style.setByUser();
+            _style.value = values.style;
+        }
+        if (values.color != null) {
+            _color = new CssBorderRightColor();
+            _color.setByUser();
+            _color.value = values.color;
+        }
     }
 
     /**
      * Returns a string representation of the object.
      */
     public String toString() {
-	String ret = "";
-	if(width != null) {
-	    ret += width;
-	}
-	if(style != null) {
-	    if(!ret.equals("")) {
-		ret += " ";
-	    }
-	    ret += style;
-	}
-	if(color != null) {
-	    if(!ret.equals("")) {
-		ret += " ";
-	    }
-	    ret += color;
-	}
-	if (uri != null) {
-	    if(!ret.equals("")) {
-		ret += " ";
-	    }
-	    ret += " " + uri.toString();
-	}
-	return ret;
-    }
-
-    /**
-     * Returns the name of this property
-     */
-    public String getPropertyName() {
-	return "border-right";
-    }
-
-    /**
-     * Set this property to be important.
-     * Overrides this method for a macro
-     */
-    public void setImportant() {
-	if(width != null) {
-	    width.important = true;
-	}
-	if(style != null) {
-	    style.important = true;
-	}
-	if(color != null) {
-	    color.important = true;
-	}
-    }
-
-    /**
-     * Returns true if this property is important.
-     * Overrides this method for a macro
-     */
-    public boolean getImportant() {
-	return ((width == null || width.important) &&
-		(style == null || style.important) &&
-		(color == null || color.important));
-    }
-
-    /**
-     * Add this property to the CssStyle
-     *
-     * @param style The CssStyle
-     */
-    public void addToStyle(ApplContext ac, CssStyle style) {
-	if(width != null) {
-	    width.addToStyle(ac, style);
-	}
-	if(this.style != null) {
-	    this.style.addToStyle(ac, style);
-	}
-	if(color != null) {
-	    color.addToStyle(ac, style);
-	}
-    }
-
-    /**
-     * 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).getBorderRight();
-	} else {
-	    return ((Css1Style) style).cssBorder.getRight();
-	}
-    }
-
-    /**
-     * Update the source file and the line.
-     * Overrides this method for a macro
-     *
-     * @param line The line number where this property is defined
-     * @param source The source file where this property is defined
-     */
-    public void setInfo(int line, String source) {
-	super.setInfo(line, source);
-	if(width != null) {
-	    width.setInfo(line, source);
-	}
-	if(style != null) {
-	    style.setInfo(line, source);
-	}
-	if(color != null) {
-	    color.setInfo(line, source);
-	}
-    }
-
-    /**
-     * Set the context.
-     * Overrides this method for a macro
-     *
-     * @see org.w3c.css.css.CssCascadingOrder#order
-     * @see org.w3c.css.css.StyleSheetParser#handleRule
-     */
-    public void setSelectors(CssSelectors selector) {
-	super.setSelectors(selector);
-	if (width != null) {
-	    width.setSelectors(selector);
-	}
-	if (style != null) {
-	    style.setSelectors(selector);
-	}
-	if (color != null) {
-	    color.setSelectors(selector);
-	}
-    }
-
-    /**
-     * Compares two properties for equality.
-     *
-     * @param value The other property.
-     */
-    public boolean equals(CssProperty property) {
-	if (property instanceof CssBorderRight) {
-	    CssBorderRight right = (CssBorderRight) property;
-	    return (width != null && width.equals(right.width) &&
-		    style != null && style.equals(right.style) &&
-		    color != null && color.equals(right.color));
-	} else {
-	    return false;
-	}
+        if (_width != null && inherit == _width.value) {
+            return inherit.toString();
+        }
+        StringBuilder sb = new StringBuilder();
+        boolean first = true;
+        if (_width != null) {
+            sb.append(_width);
+            first = false;
+        }
+        if (_style != null) {
+            if (first) {
+                sb.append(_style);
+            } else {
+                sb.append(' ').append(_style);
+            }
+            first = false;
+        }
+        if (_color != null) {
+            if (first) {
+                sb.append(_color);
+            } else {
+                sb.append(' ').append(_color);
+            }
+        }
+        return sb.toString();
     }
 
-    void check() {
-	if ((style != null)
-	    && (style.face.value == 0)) {
-	    if (width != null) {
-		width.face.value = new CssLength();
-	    }
-	}
-    }
 }

--- CssBorderTopStyle.java DELETED ---

Index: CssBorderBottom.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css1/CssBorderBottom.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- CssBorderBottom.java	9 Feb 2012 17:36:29 -0000	1.6
+++ CssBorderBottom.java	25 Apr 2012 20:21:56 -0000	1.7
@@ -1,354 +1,97 @@
-//
 // $Id$
 // From Philippe Le Hegaret (Philippe.Le_Hegaret@sophia.inria.fr)
-//
-// (c) COPYRIGHT MIT and INRIA, 1997.
+// Rewritten 2010 Yves Lafon <ylafon@w3.org>
+
+// (c) COPYRIGHT MIT, ERCIM and Keio, 1997-2010.
 // Please first read the full copyright statement in file COPYRIGHT.html
 package org.w3c.css.properties.css1;
 
-import org.w3c.css.parser.CssSelectors;
-import org.w3c.css.parser.CssStyle;
-import org.w3c.css.properties.css.CssProperty;
+import org.w3c.css.properties.css2.CssBorderBottomColor;
+import org.w3c.css.properties.css2.CssBorderBottomStyle;
 import org.w3c.css.util.ApplContext;
 import org.w3c.css.util.InvalidParamException;
 import org.w3c.css.values.CssExpression;
-import org.w3c.css.values.CssLength;
-import org.w3c.css.values.CssOperator;
-import org.w3c.css.values.CssURL;
-import org.w3c.css.values.CssValue;
 
 /**
- *   <H4>
- *     &nbsp;&nbsp; 'border-bottom'
- *   </H4>
- *   <P>
- *   <EM>Value:</EM> &lt;border-bottom-width&gt; || &lt;border-style&gt; ||
- *   &lt;color&gt;<BR>
- *   <EM>Initial:</EM> not defined for shorthand properties<BR>
- *   <EM>Applies to:</EM> all elements<BR>
- *   <EM>Inherited:</EM> no<BR>
- *   <EM>Percentage values:</EM> N/A<BR>
- *   <P>
- *   This is a shorthand property for setting the width, style and color of an
- *   element's bottom border.
- *   <PRE>
- *   H1 { border-bottom: thick solid red }
- * </PRE>
- *   <P>
- *   The above rule will set the width, style and color of the border below the
- *   H1 element. Omitted values will be set to their initial values:
- *   <PRE>
- *   H1 { border-bottom: thick solid }
- * </PRE>
- *   <P>
- *   Since the color value is omitted in the example above, the border color will
- *   be the same as the 'color' value of the element itself.
- *   <P>
- *   Note that while the 'border-style' property accepts up to four values, this
- *   property only accepts one style value.
- *
- * @version $Revision$
+ * @since CSS1
  */
-public class CssBorderBottom extends CssProperty implements CssOperator {
-
-    CssBorderBottomWidth width;
-    CssBorderBottomStyle style;
-    CssBorderBottomColor color;
-    CssValue uri = null;
+public class CssBorderBottom extends org.w3c.css.properties.css.CssBorderBottom {
 
     /**
-     * Create a new CssBorderFace
+     * Create a new CssBorderBottom
      */
     public CssBorderBottom() {
     }
 
     /**
-     * Create a new CssBorderFace
+     * Set the value of the property<br/>
+     * Does not check the number of values
+     *
      * @param expression The expression for this property
-     * @exception InvalidParamException The expression is incorrect
+     * @throws org.w3c.css.util.InvalidParamException
+     *          The expression is incorrect
      */
-    public CssBorderBottom(ApplContext ac, CssExpression expression,
-	    boolean check) throws InvalidParamException {
-	CssValue val = null;
-	char op = SPACE;
-	boolean find = true;
-
-	if(check && expression.getCount() > 4) {
-	    throw new InvalidParamException("unrecognize", ac);
-	}
-
-	setByUser();
-
-	boolean manyValues = (expression.getCount() > 1);
-
-	while (find) {
-	    find = false;
-	    val = expression.getValue();
-	    op = expression.getOperator();
-
-	    if (val == null)
-		break;
-
-	    // if there are many values, we can't have inherit as one of them
-	    if(manyValues && val.equals(inherit)) {
-		throw new InvalidParamException("unrecognize", null, null, ac);
-	    }
-
-	    if (op != SPACE)
-		throw new InvalidParamException("operator",
-						((new Character(op)).toString()),
-						ac);
-
-	    if (width == null) {
-		try {
-		    width = new CssBorderBottomWidth(ac, expression);
-		    find = true;
-		} catch (InvalidParamException e) {
-		    // nothing to do, style will test this value
-		}
-	    }
-
-	    if (!find && style == null) {
-		try {
-		    style = new CssBorderBottomStyle(ac, expression);
-		    find = true;
-		}
-		catch (InvalidParamException e) {
-		    // nothing to do, color will test this value
-		}
-	    }
-
-	    if (!find && color == null) {
-		try {
-		    color = new CssBorderBottomColor(ac, expression);
-		    find = true;
-		}
-		catch (InvalidParamException e) {
-		    // nothing to do, uri will test this value
-		}
-	    }
-
-	    if (!find && uri == null) {
-		if (val instanceof CssURL) {
-		    uri = val;
-		    find = true;
-		}
-		else {
-		    // the value is invalid
-		    throw new InvalidParamException("unrecognize", ac);
-		}
-	    }
-	}
-	/*
-	if (width == null)
-	    width = new CssBorderBottomWidth();
-	if (style == null)
-	    style = new CssBorderBottomStyle();
-	if (color == null)
-	    color = new CssBorderBottomColorCSS21();
-	*/
-    }
-
     public CssBorderBottom(ApplContext ac, CssExpression expression)
-	throws InvalidParamException {
-	this(ac, expression, false);
-    }
-
-    /**
-     * Returns the value of this property
-     */
-    public Object get() {
-	return width;
-    }
-
-    /**
-     * Returns the color property
-     */
-    public CssValue getColor() {
-	if (color != null) {
-	    return color.getColor();
-	} else {
-	    return null;
-	}
-    }
-
-    /**
-     * Returns the width property
-     */
-    public CssValue getWidth() {
-	if (width != null) {
-	    return width.getValue();
-	} else {
-	    return null;
-	}
+            throws InvalidParamException {
+        this(ac, expression, false);
     }
 
     /**
-     * Returns the style property
+     * Set the value of the property
+     *
+     * @param expression The expression for this property
+     * @param check      set it to true to check the number of values
+     * @throws org.w3c.css.util.InvalidParamException
+     *          The expression is incorrect
      */
-    public String getStyle() {
-	if (style != null) {
-	    return style.getStyle();
-	} else {
-	    return null;
-	}
+    public CssBorderBottom(ApplContext ac, CssExpression expression,
+                           boolean check) throws InvalidParamException {
+        CssBorder.SideValues values = CssBorder.checkBorderSide(ac, this, expression, check);
+        if (values.width != null) {
+            _width = new CssBorderBottomWidth();
+            _width.setByUser();
+            _width.value = values.width;
+        }
+        if (values.style != null) {
+            _style = new CssBorderBottomStyle();
+            _style.setByUser();
+            _style.value = values.style;
+        }
+        if (values.color != null) {
+            _color = new CssBorderBottomColor();
+            _color.setByUser();
+            _color.value = values.color;
+        }
     }
 
     /**
      * Returns a string representation of the object.
      */
     public String toString() {
-	String ret = "";
-	if(width != null) {
-	    ret += width;
-	}
-	if(style != null) {
-	    if(!ret.equals("")) {
-		ret += " ";
-	    }
-	    ret += style;
-	}
-	if(color != null) {
-	    if(!ret.equals("")) {
-		ret += " ";
-	    }
-	    ret += color;
-	}
-	if (uri != null) {
-	    if(!ret.equals("")) {
-		ret += " ";
-	    }
-	    ret += " " + uri.toString();
-	}
-	return ret;
-    }
-
-    /**
-     * Returns the name of this property
-     */
-    public String getPropertyName() {
-	return "border-bottom";
-    }
-
-    /**
-     * Set this property to be important.
-     * Overrides this method for a macro
-     */
-    public void setImportant() {
-	if(width != null) {
-	    width.important = true;
-	}
-	if(style != null) {
-	    style.important = true;
-	}
-	if(color != null) {
-	    color.important = true;
-	}
-    }
-
-    /**
-     * Returns true if this property is important.
-     * Overrides this method for a macro
-     */
-    public boolean getImportant() {
-	return ((width == null || width.important) &&
-		(style == null || style.important) &&
-		(color == null || color.important));
-    }
-
-    /**
-     * Add this property to the CssStyle
-     *
-     * @param style The CssStyle
-     */
-    public void addToStyle(ApplContext ac, CssStyle style) {
-	if(width != null) {
-	    width.addToStyle(ac, style);
-	}
-	if(this.style != null) {
-	    this.style.addToStyle(ac, style);
-	}
-	if(color != null) {
-	    color.addToStyle(ac, style);
-	}
-    }
-
-    /**
-     * 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).getBorderBottom();
-	} else {
-	    return ((Css1Style) style).cssBorder.getBottom();
-	}
-    }
-
-    /**
-     * Update the source file and the line.
-     * Overrides this method for a macro
-     *
-     * @param line The line number where this property is defined
-     * @param source The source file where this property is defined
-     */
-    public void setInfo(int line, String source) {
-	super.setInfo(line, source);
-	if(width != null) {
-	    width.setInfo(line, source);
-	}
-	if(style != null) {
-	    style.setInfo(line, source);
-	}
-	if(color != null) {
-	    color.setInfo(line, source);
-	}
-    }
-
-    /**
-     * Set the context.
-     * Overrides this method for a macro
-     *
-     * @see org.w3c.css.css.CssCascadingOrder#order
-     * @see org.w3c.css.css.StyleSheetParser#handleRule
-     */
-    public void setSelectors(CssSelectors selector) {
-	super.setSelectors(selector);
-	if (width != null) {
-	    width.setSelectors(selector);
-	}
-	if (style != null) {
-	    style.setSelectors(selector);
-	}
-	if (color != null) {
-	    color.setSelectors(selector);
-	}
-    }
-
-    /**
-     * Compares two properties for equality.
-     *
-     * @param value The other property.
-     */
-    public boolean equals(CssProperty property) {
-	if (property instanceof CssBorderBottom) {
-	    CssBorderBottom bottom = (CssBorderBottom) property;
-	    return (width != null && width.equals(bottom.width) &&
-		    style != null && style.equals(bottom.style) &&
-		    color != null && color.equals(bottom.color));
-	} else {
-	    return false;
-	}
-    }
-
-    void check() {
-	if ((style != null)
-	    && (style.face.value == 0)) {
-	    if (width != null) {
-		width.face.value = new CssLength();
-	    }
-	}
+        if (_width != null && inherit == _width.value) {
+            return inherit.toString();
+        }
+        StringBuilder sb = new StringBuilder();
+        boolean first = true;
+        if (_width != null) {
+            sb.append(_width);
+            first = false;
+        }
+        if (_style != null) {
+            if (first) {
+                sb.append(_style);
+            } else {
+                sb.append(' ').append(_style);
+            }
+            first = false;
+        }
+        if (_color != null) {
+            if (first) {
+                sb.append(_color);
+            } else {
+                sb.append(' ').append(_color);
+            }
+        }
+        return sb.toString();
     }
 }

--- CssBorderBottomCSS1.java DELETED ---

--- CssBorderRightCSS2.java DELETED ---

Index: CssBackground.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css1/CssBackground.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- CssBackground.java	9 Feb 2012 17:36:28 -0000	1.8
+++ CssBackground.java	25 Apr 2012 20:21:55 -0000	1.9
@@ -8,14 +8,14 @@
 
 import org.w3c.css.parser.CssSelectors;
 import org.w3c.css.parser.CssStyle;
-import org.w3c.css.properties.css.CssBackgroundConstants;
 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.CssOperator;
 import org.w3c.css.values.CssValue;
 
+import static org.w3c.css.values.CssOperator.SPACE;
+
 /**
  * <H4>
  * <A NAME="background">5.3.7 &nbsp;&nbsp; 'background'</A>
@@ -53,8 +53,7 @@
  * @see org.w3c.css.properties.css.CssBackgroundAttachment
  * @see org.w3c.css.properties.css.CssBackgroundPosition
  */
-public class CssBackground extends org.w3c.css.properties.css.CssBackground
-        implements CssOperator, CssBackgroundConstants {
+public class CssBackground extends org.w3c.css.properties.css.CssBackground {
 
     CssBackgroundColor color;
     CssBackgroundImage image;
@@ -147,18 +146,6 @@
                 throw new InvalidParamException("unrecognize", ac);
             }
         }
-        /*
-      if (color == null)
-          color = new CssBackgroundColor();
-      if (image == null)
-          image = new CssBackgroundImage();
-      if (repeat == null)
-          repeat = new CssBackgroundRepeat();
-      if (attachment == null)
-          attachment = new CssBackgroundAttachment();
-      if (position == null)
-          position = new CssBackgroundPosition();
-      */
     }
 
     public CssBackground(ApplContext ac, CssExpression expression)
@@ -219,7 +206,6 @@
             if (!first) {
                 sb.append(' ');
             }
-            first = false;
             sb.append(position);
         }
         return sb.toString();

--- CssBorderColorCSS2.java DELETED ---

--- CssBorderTopWidthCSS2.java DELETED ---

--- CssBorderStyleCSS1.java DELETED ---

--- CssBorderRightStyleCSS1.java DELETED ---

--- CssBorderTopColorCSS1.java DELETED ---

--- CssBorderLeftWidthCSS1.java DELETED ---

--- CssBorderLeftWidthCSS2.java DELETED ---

--- CssBorderLeftStyleCSS2.java DELETED ---

--- CssBorderLeftColorCSS1.java DELETED ---

--- CssBorderRightColor.java DELETED ---

--- CssBorderBottomWidthCSS1.java DELETED ---

--- CssBorderWidthCSS1.java DELETED ---

Index: CssBorderRightWidth.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css1/CssBorderRightWidth.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- CssBorderRightWidth.java	5 Jan 2010 13:49:41 -0000	1.4
+++ CssBorderRightWidth.java	25 Apr 2012 20:21:59 -0000	1.5
@@ -1,162 +1,44 @@
-//
 // $Id$
-// From Philippe Le Hegaret (Philippe.Le_Hegaret@sophia.inria.fr)
+// Author: Yves Lafon <ylafon@w3.org>
 //
-// (c) COPYRIGHT MIT and INRIA, 1997.
+// (c) COPYRIGHT MIT, ERCIM and Keio University, 2012.
 // 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.CssValue;
 
 /**
- *   <H4>
- *      &nbsp;&nbsp; 'border-right-width'
- *   </H4>
- *   <P>
- *   <EM>Value:</EM> thin | medium | thick | &lt;length&gt;<BR>
- *   <EM>Initial:</EM> 'medium'<BR>
- *   <EM>Applies to:</EM> all elements<BR>
- *   <EM>Inherited:</EM> no<BR>
- *   <EM>Percentage values:</EM> N/A<BR>
- *   <P> This property sets the width of an element's right border. The width of
- *   the keyword values are UA dependent, but the following holds: 'thin' &lt;=
- *   'medium' &lt;= 'thick'.
- *   <P>
- *   The keyword widths are constant throughout a document:
- *   <PRE>
- *   H1 { border: solid thick red }
- *   P  { border: solid thick blue }
- * </PRE>
- *   <P>
- *   In the example above, 'H1' and 'P' elements will have the same border width
- *   regardless of font size. To achieve relative widths, the 'em' unit can be
- *   used:
- *   <PRE>
- *   H1 { border: solid 0.5em }
- * </PRE>
- *   <P>
- *   Border widths cannot be negative.
- *
+ * @spec http://www.w3.org/TR/2011/REC-CSS2-20110607/box.html#value-def-border-width
  * @version $Revision$
  */
-public class CssBorderRightWidth extends CssProperty {
-
-    CssBorderFaceWidth face;
+public class CssBorderRightWidth extends org.w3c.css.properties.css.CssBorderRightWidth {
 
     /**
      * Create a new CssBorderRightWidth
      */
     public CssBorderRightWidth() {
-	face = new CssBorderFaceWidth();
     }
 
     /**
-     * Create a new CssBorderRightWidth with an another CssBorderFaceWidth
-     *
-     * @param another The another side.
-     */
-    public CssBorderRightWidth(CssBorderFaceWidth another) {
-	setByUser();
-
-	face = another;
-    }
-
-    /**
-     * Create a new CssBorderRightWidth
+     * Creates a new CssBorderRightWidth
      *
-     * @param expression The expression for this property.
-     * @exception InvalidParamException Values are incorrect
+     * @param expression The expression for this property
+     * @throws org.w3c.css.util.InvalidParamException
+     *          Expressions are incorrect
      */
-    public CssBorderRightWidth(ApplContext ac, CssExpression expression,
-	    boolean check) throws InvalidParamException {
-
-	if(check && expression.getCount() > 1) {
-	    throw new InvalidParamException("unrecognize", ac);
-	}
-
-	setByUser();
-
-	face = new CssBorderFaceWidth(ac, expression);
+    public CssBorderRightWidth(ApplContext ac, CssExpression expression, boolean check)
+            throws InvalidParamException {
+        setByUser();
+        // here we delegate to BorderWidth implementation
+        value = CssBorderWidth.checkBorderSideWidth(ac, this, expression, check);
     }
 
     public CssBorderRightWidth(ApplContext ac, CssExpression expression)
-	throws InvalidParamException {
-	this(ac, expression,false);
-    }
-
-    /**
-     * Returns the value of this property
-     */
-    public Object get() {
-	return face;
-    }
-
-    /**
-     * Return the value of this property
-     */
-    public CssValue getValue() {
-	if(face != null) {
-	    return face.getValue();
-	}
-	return null;
-    }
-
-    /**
-     * Returns a string representation of the object.
-     */
-    public String toString() {
-	if(face != null) {
-	    return face.toString();
-	}
-	return "";
-    }
-
-    /**
-     * Returns the name of this property
-     */
-    public String getPropertyName() {
-	return "border-right-width";
-    }
-
-    /**
-     * Add this property to the CssStyle.
-     *
-     * @param style The CssStyle
-     */
-    public void addToStyle(ApplContext ac, CssStyle style) {
-	CssBorderRight right = ((Css1Style) style).cssBorder.right;
-	if (right.width != null)
-	    style.addRedefinitionWarning(ac, this);
-	right.width = 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).getBorderRightWidth();
-	} else {
-	    return ((Css1Style) style).cssBorder.getRight().width;
-	}
-    }
-
-    /**
-     * Compares two properties for equality.
-     *
-     * @param value The other property.
-     */
-    public boolean equals(CssProperty property) {
-	return (property instanceof CssBorderRightWidth &&
-		face.equals(((CssBorderRightWidth) property).face));
+            throws InvalidParamException {
+        this(ac, expression, false);
     }
 
 }
+

Index: CssBorderWidth.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css1/CssBorderWidth.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- CssBorderWidth.java	9 Sep 2011 12:16:44 -0000	1.5
+++ CssBorderWidth.java	25 Apr 2012 20:22:00 -0000	1.6
@@ -1,318 +1,200 @@
-//
 // $Id$
-// From Philippe Le Hegaret (Philippe.Le_Hegaret@sophia.inria.fr)
-//
-// (c) COPYRIGHT MIT and INRIA, 1997.
+// @author Yves Lafon <ylafon@w3.org>
+
+// (c) COPYRIGHT MIT, ERCIM and Keio University, 2012.
 // Please first read the full copyright statement in file COPYRIGHT.html
 package org.w3c.css.properties.css1;
 
-import org.w3c.css.parser.CssSelectors;
-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.CssOperator;
-
-/**
- *   <H4>
- *     &nbsp;&nbsp; 'border-width'
- *   </H4>
- *   <P>
- *   <EM>Value:</EM> [thin | medium | thick | &lt;length&gt;]{1,4}<BR>
- *   <EM>Initial:</EM> not defined for shorthand properties<BR>
- *   <EM>Applies to:</EM> all elements<BR>
- *   <EM>Inherited:</EM> no<BR>
- *   <EM>Percentage values:</EM> N/A<BR>
- *   <P>
- *   This property is a shorthand property for setting 'border-width-top',
- *   'border-width-right', 'border-width-bottom' and 'border-width-left' at the
- *   same place in the style sheet.
- *   <P>
- *   There can be from one to four values, with the following interpretation:
- *   <UL>
- *     <LI>
- *       one value: all four border widths are set to that value
- *     <LI>
- *       two values: top and bottom border widths are set to the first value, right
- *       and left are set to the second
- *     <LI>
- *       three values: top is set to the first, right and left are set to the second,
- *       bottom is set to the third
- *     <LI>
- *       four values: top, right, bottom and left, respectively
- *   </UL>
- *   <P>
- *   In the examples below, the comments indicate the resulting widths of the
- *   top, right, bottom and left borders:
- *   <PRE>
- *   H1 { border-width: thin }                   / * thin thin thin thin * /
- *   H1 { border-width: thin thick }             / * thin thick thin thick * /
- *   H1 { border-width: thin thick medium }      / * thin thick medium thin * /
- *   H1 { border-width: thin thick medium 12cm } / * thin thick medium 12cm * /
- * </PRE>
- *   <P>
- *   Border widths cannot be negative.
- * @version $Revision$
- */
-public class CssBorderWidth extends CssProperty implements CssOperator {
+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;
+import org.w3c.css.values.CssValueList;
 
-    CssBorderTopWidth top;
-    CssBorderBottomWidth bottom;
-    CssBorderRightWidth right;
-    CssBorderLeftWidth left;
+import java.util.ArrayList;
 
-    /**
-     * Create a new CssBorderWidth
-     */
-    public CssBorderWidth(CssBorderTopWidth top,
-			  CssBorderBottomWidth bottom,
-			  CssBorderRightWidth right,
-			  CssBorderLeftWidth left) {
-	this.top = top;
-	this.bottom = bottom;
-	this.left = left;
-	this.right = right;
-    }
+import static org.w3c.css.values.CssOperator.SPACE;
 
-    /**
-     * Create a new CssBorder
-     *
-     * @param expression The expression for this property
-     * @param check true will test the number of values
-     * @exception InvalidParamException Values are incorrect
-     */
-    public CssBorderWidth(ApplContext ac, CssExpression expression, boolean check)
-    	throws InvalidParamException {
+/**
+ * @spec http://www.w3.org/TR/2011/REC-CSS2-20110607/box.html#value-def-border-width
+ */
+public class CssBorderWidth extends org.w3c.css.properties.css.CssBorderWidth {
 
-	setByUser();
-	switch (expression.getCount()) {
-	case 1:
-	    top = new CssBorderTopWidth(ac, expression);
-	    bottom = new CssBorderBottomWidth((CssBorderFaceWidth) top.get());
-	    right = new CssBorderRightWidth((CssBorderFaceWidth) top.get());
-	    left = new CssBorderLeftWidth((CssBorderFaceWidth) top.get());
-	    break;
-	case 2:
-	    if (expression.getOperator() != SPACE)
-		throw new InvalidParamException("operator",
-			((new Character(expression.getOperator())).toString()),
-			ac);
-	    if(expression.getValue().equals(inherit)) {
-		throw new InvalidParamException("unrecognize", ac);
-	    }
-	    top = new CssBorderTopWidth(ac, expression);
-	    if(expression.getValue().equals(inherit)) {
-		throw new InvalidParamException("unrecognize", ac);
-	    }
-	    right = new CssBorderRightWidth(ac, expression);
-	    bottom = new CssBorderBottomWidth((CssBorderFaceWidth) top.get());
-	    left = new CssBorderLeftWidth((CssBorderFaceWidth) right.get());
-	    break;
-	case 3:
-	    if (expression.getOperator() != SPACE)
-		throw new InvalidParamException("operator",
-			((new Character(expression.getOperator())).toString()),
-			ac);
-	    if(expression.getValue().equals(inherit)) {
-		throw new InvalidParamException("unrecognize", ac);
-	    }
-	    top = new CssBorderTopWidth(ac, expression);
-	    if (expression.getOperator() != SPACE)
-		throw new InvalidParamException("operator",
-			((new Character(expression.getOperator())).toString()),
-			ac);
-	    if(expression.getValue().equals(inherit)) {
-		throw new InvalidParamException("unrecognize", ac);
-	    }
-	    right = new CssBorderRightWidth(ac, expression);
-	    if(expression.getValue().equals(inherit)) {
-		throw new InvalidParamException("unrecognize", ac);
-	    }
-	    bottom = new CssBorderBottomWidth(ac, expression);
-	    left = new CssBorderLeftWidth((CssBorderFaceWidth) right.get());
-	    break;
-	default:
-	    // checks the number of parameters
-	    if(check && expression.getCount() > 4) {
-		throw new InvalidParamException("unrecognize", ac);
-	    }
-	    if (expression.getOperator() != SPACE)
-		throw new InvalidParamException("operator",
-			((new Character(expression.getOperator())).toString()),
-			ac);
-	    if(expression.getValue().equals(inherit)) {
-		throw new InvalidParamException("unrecognize", ac);
-	    }
-	    top = new CssBorderTopWidth(ac, expression);
-	    if (expression.getOperator() != SPACE)
-		throw new InvalidParamException("operator",
-			((new Character(expression.getOperator())).toString()),
-			ac);
-	    if(expression.getValue().equals(inherit)) {
-		throw new InvalidParamException("unrecognize", ac);
-	    }
-	    right = new CssBorderRightWidth(ac, expression);
-	    if (expression.getOperator() != SPACE)
-		throw new InvalidParamException("operator",
-			((new Character(expression.getOperator())).toString()),
-			ac);
-	    if(expression.getValue().equals(inherit)) {
-		throw new InvalidParamException("unrecognize", ac);
-	    }
-	    bottom = new CssBorderBottomWidth(ac, expression);
-	    if(expression.getValue().equals(inherit)) {
-		throw new InvalidParamException("unrecognize", ac);
-	    }
-	    left = new CssBorderLeftWidth(ac, expression);
-	    break;
-	}
-    }
+    public static CssIdent allowed_values[];
 
-    public CssBorderWidth(ApplContext ac, CssExpression expression)
-	throws InvalidParamException {
-	this(ac, expression, false);
+    static {
+        allowed_values = new CssIdent[3];
+        allowed_values[0] = CssIdent.getIdent("thin");
+        allowed_values[1] = CssIdent.getIdent("medium");
+        allowed_values[2] = CssIdent.getIdent("thick");
     }
 
-    /**
-     * Returns the value of this property
+    /*
+     * Get the cached ident if it matches null otherwise
      */
-    public Object get() {
-	return top;
+    static CssIdent getMatchingIdent(CssIdent ident) {
+        for (CssIdent id : allowed_values) {
+            if (id.equals(ident)) {
+                return id;
+            }
+        }
+        return null;
     }
 
     /**
-     * Returns the name of this property
+     * Create a new CssBorderWidth
      */
-    public String getPropertyName() {
-	return "border-width";
+    public CssBorderWidth() {
     }
 
     /**
-     * Returns a string representation of the object.
+     * Set the value of the property<br/>
+     * Does not check the number of values
+     *
+     * @param expression The expression for this property
+     * @throws org.w3c.css.util.InvalidParamException
+     *          The expression is incorrect
      */
-    public String toString() {
-	if (right.face.equals(left.face)) {
-	    if (top.face.equals(bottom.face)) {
-		if (top.face.equals(right.face)) {
-		    return top.toString();
-		} else {
-		    return top + " " + right;
-		}
-	    } else {
-		return top + " " + right + " " + bottom;
-	    }
-	} else {
-	    return top + " " + right + " " + bottom + " " + left;
-	}
+    public CssBorderWidth(ApplContext ac, CssExpression expression)
+            throws InvalidParamException {
+        this(ac, expression, false);
     }
 
     /**
-     * Set this property to be important.
-     * Overrides this method for a macro
+     * Set the value of the property
+     *
+     * @param expression The expression for this property
+     * @param check      set it to true to check the number of values
+     * @throws org.w3c.css.util.InvalidParamException
+     *          The expression is incorrect
      */
-    public void setImportant() {
-	top.important = true;
-	right.important = true;
-	left.important = true;
-	bottom.important = true;
-    }
+    public CssBorderWidth(ApplContext ac, CssExpression expression,
+                          boolean check) throws InvalidParamException {
+        if (check && expression.getCount() > 4) {
+            throw new InvalidParamException("unrecognize", ac);
+        }
+        setByUser();
+        CssValue val;
+        char op;
 
-    /**
-     * Returns true if this property is important.
-     * Overrides this method for a macro
-     */
-    public boolean getImportant() {
-	return ((top == null || top.important) &&
-		(right == null || right.important) &&
-		(left == null || left.important) &&
-		(bottom == null || bottom.important));
-    }
+        ArrayList<CssValue> res = new ArrayList<CssValue>();
+        while (res.size() < 4 && !expression.end()) {
+            val = expression.getValue();
+            op = expression.getOperator();
 
-    /**
-     * Set the context.
-     * Overrides this method for a macro
-     *
-     * @see org.w3c.css.css.CssCascadingOrder#order
-     * @see org.w3c.css.css.StyleSheetParser#handleRule
-     */
-    public void setSelectors(CssSelectors selector) {
-	super.setSelectors(selector);
-	if (top != null) {
-	    top.setSelectors(selector);
-	}
-	if (right != null) {
-	    right.setSelectors(selector);
-	}
-	if (bottom != null) {
-	    bottom.setSelectors(selector);
-	}
-	if (left != null) {
-	    left.setSelectors(selector);
-	}
-    }
+            switch (val.getType()) {
+                case CssTypes.CSS_NUMBER:
+                    val = ((CssNumber) val).getLength();
+                case CssTypes.CSS_LENGTH:
+                    CssLength length = (CssLength) val;
+                    if (!length.isPositive()) {
+                        throw new InvalidParamException("negative-value", expression.getValue(),
+                                getPropertyName(), ac);
+                    }
+                    res.add(length);
+                    break;
+                case CssTypes.CSS_IDENT:
+                    if (inherit.equals(val)) {
+                        res.add(inherit);
+                        break;
+                    }
+                    CssIdent match = getMatchingIdent((CssIdent) val);
+                    if (match == null) {
+                        throw new InvalidParamException("value", expression.getValue(),
+                                getPropertyName(), ac);
+                    }
+                    res.add(match);
+                    break;
+                default:
+                    throw new InvalidParamException("unrecognize", ac);
+            }
+            expression.next();
+            if (op != SPACE) {
+                throw new InvalidParamException("operator",
+                        Character.toString(op),
+                        ac);
+            }
+        }
+        // check that inherit is alone
+        if (res.size() > 1 && res.contains(inherit)) {
+            throw new InvalidParamException("unrecognize", ac);
+        }
+        value = (res.size() == 1) ? res.get(0) : new CssValueList(res);
 
-    /**
-     * Add this property to the CssStyle
-     *
-     * @param style The CssStyle
-     */
-    public void addToStyle(ApplContext ac, CssStyle style) {
-	if(top != null) {
-	    top.addToStyle(ac, style);
-	}
-	if(right != null) {
-	    right.addToStyle(ac, style);
-	}
-	if(left != null) {
-	    left.addToStyle(ac, style);
-	}
-	if(bottom != null) {
-	    bottom.addToStyle(ac, style);
-	}
-    }
+        // now assign the computed values...
+        top = new CssBorderTopWidth();
+        right = new CssBorderRightWidth();
+        bottom = new CssBorderBottomWidth();
+        left = new CssBorderLeftWidth();
 
-    /**
-     * 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) {
-	throw new IllegalStateException("Can't invoke this method on the property " +
-					getPropertyName());
+        switch (res.size()) {
+            case 1:
+                top.value = left.value = right.value = bottom.value = res.get(0);
+                break;
+            case 2:
+                top.value = bottom.value = res.get(0);
+                right.value = left.value = res.get(1);
+                break;
+            case 3:
+                top.value = res.get(0);
+                right.value = left.value = res.get(1);
+                bottom.value = res.get(2);
+                break;
+            case 4:
+                top.value = res.get(0);
+                right.value = res.get(1);
+                bottom.value = res.get(2);
+                left.value = res.get(3);
+                break;
+            default:
+                // can't happen
+                throw new InvalidParamException("unrecognize", ac);
+        }
     }
 
-    /**
-     * Update the source file and the line.
-     * Overrides this method for a macro
-     *
-     * @param line The line number where this property is defined
-     * @param source The source file where this property is defined
-     */
-    public void setInfo(int line, String source) {
-	super.setInfo(line, source);
-	if(top != null) {
-	    top.setInfo(line, source);
-	}
-	if(right != null) {
-	    right.setInfo(line, source);
-	}
-	if(left != null) {
-	    left.setInfo(line, source);
-	}
-	if(bottom != null) {
-	    bottom.setInfo(line, source);
-	}
-    }
 
     /**
-     * Compares two properties for equality.
-     *
-     * @param value The other property.
+     * Check the border-*-width and returns a value.
+     * It makes sense to do it only once for all the sides, so by having the code here.
      */
-    public boolean equals(CssProperty property) {
-	return false; //FIXME
+    protected static CssValue checkBorderSideWidth(ApplContext ac, CssProperty caller, CssExpression expression,
+                                                   boolean check) throws InvalidParamException {
+        if (check && expression.getCount() > 1) {
+            throw new InvalidParamException("unrecognize", ac);
+        }
+        CssValue retval = null;
+        CssValue val = expression.getValue();
+        switch (val.getType()) {
+            case CssTypes.CSS_NUMBER:
+                val = ((CssNumber) val).getLength();
+            case CssTypes.CSS_LENGTH:
+                CssLength length = (CssLength) val;
+                if (!length.isPositive()) {
+                    throw new InvalidParamException("negative-value", expression.getValue(),
+                            caller.getPropertyName(), ac);
+                }
+                retval = length;
+                break;
+            case CssTypes.CSS_IDENT:
+                if (inherit.equals(val)) {
+                    retval = inherit;
+                } else {
+                    retval = getMatchingIdent((CssIdent) val);
+                }
+                if (retval == null) {
+                    throw new InvalidParamException("value", expression.getValue(),
+                            caller.getPropertyName(), ac);
+                }
+                break;
+            default:
+                throw new InvalidParamException("unrecognize", ac);
+        }
+        expression.next();
+        return retval;
     }
-
 }

--- CssBorderRightWidthCSS1.java DELETED ---

--- CssBorderLeftColorCSS2.java DELETED ---

--- CssBorderLeftColor.java DELETED ---

--- CssBorderRightStyleCSS2.java DELETED ---

--- CssBorderFaceColorCSS1.java DELETED ---

--- CssBorderRightWidthCSS2.java DELETED ---

Index: CssBorderTop.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css1/CssBorderTop.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- CssBorderTop.java	9 Sep 2011 12:16:44 -0000	1.5
+++ CssBorderTop.java	25 Apr 2012 20:21:59 -0000	1.6
@@ -1,357 +1,96 @@
-//
 // $Id$
 // From Philippe Le Hegaret (Philippe.Le_Hegaret@sophia.inria.fr)
-//
-// (c) COPYRIGHT MIT and INRIA, 1997.
+// Rewritten 2010 Yves Lafon <ylafon@w3.org>
+
+// (c) COPYRIGHT MIT, ERCIM and Keio, 1997-2010.
 // Please first read the full copyright statement in file COPYRIGHT.html
 package org.w3c.css.properties.css1;
 
-import org.w3c.css.parser.CssSelectors;
-import org.w3c.css.parser.CssStyle;
-import org.w3c.css.properties.css.CssProperty;
+import org.w3c.css.properties.css2.CssBorderTopColor;
+import org.w3c.css.properties.css2.CssBorderTopStyle;
 import org.w3c.css.util.ApplContext;
 import org.w3c.css.util.InvalidParamException;
 import org.w3c.css.values.CssExpression;
-import org.w3c.css.values.CssLength;
-import org.w3c.css.values.CssOperator;
-import org.w3c.css.values.CssURL;
-import org.w3c.css.values.CssValue;
 
 /**
- *   <H4>
- *     &nbsp;&nbsp; 'border-top'
- *   </H4>
- *   <P>
- *   <EM>Value:</EM> &lt;border-top-width&gt; || &lt;border-style&gt; ||
- *   &lt;color&gt;<BR>
- *   <EM>Initial:</EM> not defined for shorthand properties<BR>
- *   <EM>Applies to:</EM> all elements<BR>
- *   <EM>Inherited:</EM> no<BR>
- *   <EM>Percentage values:</EM> N/A<BR>
- *   <P>
- *   This is a shorthand property for setting the width, style and color of an
- *   element's top border.
- *   <PRE>
- *   H1 { border-bottom: thick solid red }
- * </PRE>
- *   <P>
- *   The above rule will set the width, style and color of the border below the
- *   H1 element. Omitted values will be set to their initial values:
- *   <PRE>
- *   H1 { border-bottom: thick solid }
- * </PRE>
- *   <P>
- *   Since the color value is omitted in the example above, the border color will
- *   be the same as the 'color' value of the element itself.
- *   <P>
- *   Note that while the 'border-style' property accepts up to four values, this
- *   property only accepts one style value.
- *
- * @version $Revision$
+ * @since CSS1
  */
-public class CssBorderTop extends CssProperty implements CssOperator {
-
-    CssBorderTopWidth width;
-    CssBorderTopStyle style;
-    CssBorderTopColor color;
-    CssValue uri = null;
+public class CssBorderTop extends org.w3c.css.properties.css.CssBorderTop {
 
     /**
-     * Create a new CssBorderFace
+     * Create a new CssBorderTop
      */
     public CssBorderTop() {
     }
 
     /**
-     * Create a new CssBorderFace
+     * Set the value of the property<br/>
+     * Does not check the number of values
      *
      * @param expression The expression for this property
-     * @exception InvalidParamException The expression is incorrect
+     * @throws org.w3c.css.util.InvalidParamException The expression is incorrect
      */
-    public CssBorderTop(ApplContext ac, CssExpression expression,
-	    boolean check) throws InvalidParamException {
-	CssValue val = null;
-	char op = SPACE;
-	boolean find = true;
-
-	if(check && expression.getCount() > 4) {
-	    throw new InvalidParamException("unrecognize", ac);
-	}
-
-	setByUser();
-
-	boolean manyValues = (expression.getCount() > 1);
-
-	while (find) {
-	    find = false;
-	    val = expression.getValue();
-	    op = expression.getOperator();
-
-	    if (val == null)
-		break;
-
-	    // if there are many values, we can't have inherit as one of them
-	    if(manyValues && val.equals(inherit)) {
-		throw new InvalidParamException("unrecognize", null, null, ac);
-	    }
-
-	    if (op != SPACE)
-			throw new InvalidParamException("operator",
-						((new Character(op)).toString()), ac);
-
-	    if (width == null) {
-		try {
-		    width = new CssBorderTopWidth(ac, expression);
-		    find = true;
-		} catch (InvalidParamException e) {
-		    // nothing to do, style will test this value
-		}
-	    }
-
-	    if (!find && style == null) {
-		try {
-		    style = new CssBorderTopStyle(ac, expression);
-		    find = true;
-		}
-		catch (InvalidParamException e) {
-		    // nothing to do, color will test this value
-		}
-	    }
-
-	    if (!find && color == null) {
-		try {
-		    color = new CssBorderTopColor(ac, expression);
-		    find = true;
-		}
-		catch (InvalidParamException e) {
-		    // nothing to do, color will test this value
-		}
-	    }
-
-	    if (!find && uri == null) {
-		if (val instanceof CssURL) {
-		    uri = val;
-		    find = true;
-		}
-		else {
-		    throw new InvalidParamException("unrecognize", ac);
-		}
-	    }
-	}
-	/*
-	if (width == null) {
-	    width = new CssBorderTopWidth();
-	}
-	if (style == null) {
-	    style = new CssBorderTopStyle();
-	}
-
-	if (color == null) {
-	    color = new CssBorderTopColor();
-	}
-	*/
-    }
-
     public CssBorderTop(ApplContext ac, CssExpression expression)
-	throws InvalidParamException {
-	this(ac, expression,false);
-    }
-
-    /**
-     * Returns the value of this property
-     */
-    public Object get() {
-	return width;
-    }
-
-    /**
-     * Returns the color property
-     */
-    public CssValue getColor() {
-	if (color != null) {
-	    return color.getColor();
-	} else {
-	    return null;
-	}
-    }
-
-    /**
-     * Returns the width property
-     */
-    public CssValue getWidth() {
-	if (width != null) {
-	    return width.getValue();
-	} else {
-	    return null;
-	}
+            throws InvalidParamException {
+        this(ac, expression, false);
     }
 
     /**
-     * Returns the style property
+     * Set the value of the property
+     *
+     * @param expression The expression for this property
+     * @param check      set it to true to check the number of values
+     * @throws org.w3c.css.util.InvalidParamException The expression is incorrect
      */
-    public String getStyle() {
-	if (style != null) {
-	    return style.getStyle();
-	} else {
-	    return null;
-	}
+    public CssBorderTop(ApplContext ac, CssExpression expression,
+                        boolean check) throws InvalidParamException {
+        CssBorder.SideValues values = CssBorder.checkBorderSide(ac, this, expression, check);
+        if (values.width != null) {
+            _width = new CssBorderTopWidth();
+            _width.setByUser();
+            _width.value = values.width;
+        }
+        if (values.style != null) {
+            _style = new CssBorderTopStyle();
+            _style.setByUser();
+            _style.value = values.style;
+        }
+        if (values.color != null) {
+            _color = new CssBorderTopColor();
+            _color.setByUser();
+            _color.value = values.color;
+        }
     }
 
     /**
      * Returns a string representation of the object.
      */
     public String toString() {
-	String ret = "";
-	if(width != null) {
-	    ret += width;
-	}
-	if(style != null) {
-	    if(!ret.equals("")) {
-		ret += " ";
-	    }
-	    ret += style;
-	}
-	if(color != null) {
-	    if(!ret.equals("")) {
-		ret += " ";
-	    }
-	    ret += color;
-	}
-	if (uri != null) {
-	    if(!ret.equals("")) {
-		ret += " ";
-	    }
-	    ret += " " + uri;
-	}
-	return ret;
-    }
-
-    /**
-     * Returns the name of this property
-     */
-    public String getPropertyName() {
-	return "border-top";
-    }
-
-    /**
-     * Set this property to be important.
-     * Overrides this method for a macro
-     */
-    public void setImportant() {
-	if(width != null) {
-	    width.important = true;
-	}
-	if(style != null) {
-	    style.important = true;
-	}
-	if(color != null) {
-	    color.important = true;
-	}
-    }
-
-    /**
-     * Returns true if this property is important.
-     * Overrides this method for a macro
-     */
-    public boolean getImportant() {
-	return ((width == null || width.important) &&
-		(style == null || style.important) &&
-		(color == null || color.important));
-    }
-
-    /**
-     * Add this property to the CssStyle
-     *
-     * @param style The CssStyle
-     */
-    public void addToStyle(ApplContext ac, CssStyle style) {
-	if(width != null) {
-	    width.addToStyle(ac, style);
-	}
-	if(this.style != null) {
-	    this.style.addToStyle(ac, style);
-	}
-	if(color != null) {
-	    color.addToStyle(ac, style);
-	}
-    }
-
-    /**
-     * 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).getBorderTop();
-	} else {
-	    return ((Css1Style) style).cssBorder.getTop();
-	}
-    }
-
-    /**
-     * Update the source file and the line.
-     * Overrides this method for a macro
-     *
-     * @param line The line number where this property is defined
-     * @param source The source file where this property is defined
-     */
-    public void setInfo(int line, String source) {
-	super.setInfo(line, source);
-	if(width != null) {
-	    width.setInfo(line, source);
-	}
-	if(style != null) {
-	    style.setInfo(line, source);
-	}
-	if(color != null) {
-	    color.setInfo(line, source);
-	}
-    }
-
-    /**
-     * Set the context.
-     * Overrides this method for a macro
-     *
-     * @see org.w3c.css.css.CssCascadingOrder#order
-     * @see org.w3c.css.css.StyleSheetParser#handleRule
-     */
-    public void setSelectors(CssSelectors selector) {
-	super.setSelectors(selector);
-	if (width != null) {
-	    width.setSelectors(selector);
-	}
-	if (style != null) {
-	    style.setSelectors(selector);
-	}
-	if (color != null) {
-	    color.setSelectors(selector);
-	}
-    }
-
-    /**
-     * Compares two properties for equality.
-     *
-     * @param value The other property.
-     */
-    public boolean equals(CssProperty property) {
-	if (property instanceof CssBorderTop) {
-	    CssBorderTop top = (CssBorderTop) property;
-	    return (width != null && width.equals(top.width) &&
-		    style != null && style.equals(top.style) &&
-		    color != null && color.equals(top.color));
-	} else {
-	    return false;
-	}
+        if (_width != null && inherit == _width.value) {
+            return inherit.toString();
+        }
+        StringBuilder sb = new StringBuilder();
+        boolean first = true;
+        if (_width != null) {
+            sb.append(_width);
+            first = false;
+        }
+        if (_style != null) {
+            if (first) {
+                sb.append(_style);
+            } else {
+                sb.append(' ').append(_style);
+            }
+            first = false;
+        }
+        if (_color != null) {
+            if (first) {
+                sb.append(_color);
+            } else {
+                sb.append(' ').append(_color);
+            }
+        }
+        return sb.toString();
     }
 
-    void check() {
-	if ((style != null)
-	    && (style.face.value == 0)) {
-	    if (width != null) {
-		width.face.value = new CssLength();
-	    }
-	}
-    }
 }

Received on Wednesday, 25 April 2012 20:22:41 UTC