2002/css-validator/org/w3c/css/properties/css1 Css1Style.java,1.26,1.27 CssFont.java,1.7,1.8 CssFontFamily.java,1.5,1.6 CssFontSize.java,1.4,1.5 CssFontStyle.java,1.4,1.5 CssFontVariant.java,1.4,1.5 CssFontWeight.java,1.6,1.7 CssLineHeight.java,1.5,1.6

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

Modified Files:
	Css1Style.java CssFont.java CssFontFamily.java 
	CssFontSize.java CssFontStyle.java CssFontVariant.java 
	CssFontWeight.java CssLineHeight.java 
Log Message:
font revamp, still some missing properties for CSS3 and @font-face for CSS2 and CSS3

Index: CssFont.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css1/CssFont.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- CssFont.java	3 Apr 2012 14:20:54 -0000	1.7
+++ CssFont.java	4 Aug 2012 21:17:05 -0000	1.8
@@ -1,441 +1,238 @@
-//
 // $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.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.*;
-
-/**
- *   <H4>
- *      &nbsp;&nbsp; 'font'
- *   </H4>
- *   <P>
- *   <EM>Value:</EM> [ &lt;font-style&gt; || &lt;font-variant&gt; ||
- *   &lt;font-weight&gt; ]? &lt;font-size&gt; [ / &lt;line-height&gt; ]?
- *   &lt;font-family&gt;<BR>
- *   <EM>Initial:</EM> not defined for shorthand properties<BR>
- *   <EM>Applies to:</EM> all elements<BR>
- *   <EM>Inherited:</EM> yes<BR>
- *   <EM>Percentage values:</EM> allowed on &lt;font-size&gt; and
- *   &lt;line-height&gt;<BR>
- *   <P>
- *   The 'font' property is a shorthand property for setting
- *   'font-style',
- *   'font-variant',
- *   'font-weight',
- *   'font-size',
- *   'line-height' and
- *   'font-family' at the same place in the style sheet.
- *   The syntax of this property is based on a traditional typographical
- *   shorthand notation to set multiple properties related to fonts.
- *   <P> For a definition of allowed and initial values, see the previously
- *   defined properties. Properties for which no values are given are set to
- *   their initial value.
- *   <PRE>
- *   P { font: 12pt/14pt sans-serif }
- *   P { font: 80% sans-serif }
- *   P { font: x-large/110% "new century schoolbook", serif }
- *   P { font: bold italic large Palatino, serif }
- *   P { font: normal small-caps 120%/120% fantasy }
- *   </PRE>
- *   <P> In the second rule, the font size percentage value ('80%') refers to
- *   the font size of the parent element. In the third rule, the line height
- *   percentage refers to the font size of the element itself.
- *   <P> In the first three rules above, the 'font-style', 'font-variant' and
- *   'font-weight' are not explicitly mentioned, which means they are all three
- *   set to their initial value ('normal'). The fourth rule sets the
- *   'font-weight' to 'bold', the 'font-style' to 'italic' and implicitly sets
- *   'font-variant' to 'normal'.
- *   <P> The fifth rule sets the 'font-variant' ('small-caps'), the 'font-size'
- *   (120% of the parent's font), the 'line-height' (120% times the font size)
- *   and the 'font-family' ('fantasy'). It follows that the keyword 'normal'
- *   applies to the two remaining properties: 'font-style' and 'font-weight'.
- *
- * @see CssFontStyle
- * @see CssFontVariant
- * @see CssFontWeight
- * @see CssFontSize
- * @see CssLineHeight
- * @see CssFontFamily
- * @see CssPercentage
- * @see CssLength
- * @version $Revision$
- */
-public class CssFont extends CssProperty
-    implements CssOperator, CssFontConstant {
-
-    CssValue value;
-
-    CssFontStyle   fontStyle;
-    CssFontVariant fontVariant;
-    CssFontWeight  fontWeight;
-
-    CssFontSize    fontSize;
-    CssLineHeight  lineHeight;
-    CssFontFamily  fontFamily;
-
-    // internal hack for strings comparaison
-    private static int[] hash_values;
-
-    static CssIdent normal = new CssIdent("normal");
-
-    /**
-     * Create a new CssFont
-     */
-    public CssFont() {
-    }
-
-    /**
-     * Creates a new CssFont
-     *
-     * @param expression The expression for this property
-     * @exception InvalidParamException The expression is incorrect
-     */
-    public CssFont(ApplContext ac, CssExpression expression,boolean check)
-    	throws InvalidParamException {
-
-	CssValue val = expression.getValue();
-	char op = SPACE;
-	boolean find = true;
-	int max_values = 3;
-
-	int normalNb = 0;
-
-	if (val instanceof CssIdent) {
-	    CssIdent ident = checkIdent((CssIdent) val);
-	    if (ident != null) {
-		if(expression.getCount() > 1) {
-		    throw new InvalidParamException("unrecognize", ac);
-		}
-		value = ident;
-		expression.next();
-		return;
-	    } // else continue;
-	}
-
-	while (find && max_values-- > 0) {
-	    find = false;
-	    val = expression.getValue();
-	    op = expression.getOperator();
-
-	    if (val == null) {
-		throw new InvalidParamException("few-value", getPropertyName(), ac);
-	    }
+import org.w3c.css.values.CssExpression;
+import org.w3c.css.values.CssIdent;
+import org.w3c.css.values.CssTypes;
+import org.w3c.css.values.CssValue;
 
-	    if(val.equals(inherit)) {
-		throw new InvalidParamException("unrecognize", ac);
-	    }
+import java.util.HashMap;
 
-	    if(val.equals(normal)) {
-		normalNb++;
-		expression.next();
-		find = true;
-	    }
+import static org.w3c.css.values.CssOperator.SPACE;
 
-	    if (!find && fontStyle == null) {
-		try {
-		    fontStyle = new CssFontStyle(ac, expression);
-		    find = true;
-		} catch (InvalidParamException e) {
-		}
-	    }
+/**
+ * @spec http://www.w3.org/TR/2008/REC-CSS1-20080411/#font
+ */
+public class CssFont extends org.w3c.css.properties.css.CssFont {
 
-	    if (!find && fontVariant == null) {
-		try {
-		    fontVariant = new CssFontVariant(ac, expression);
-		    find = true;
-		} catch (InvalidParamException e) {
-		}
-	    }
+	public static final CssIdent normal;
+	public static final HashMap<String, CssIdent> systemFonts;
+	static final String[] _systemFonts = {"caption", "icon", "menu",
+			"message-box", "small-caption", "status-bar"};
 
-	    if (!find && fontWeight == null) {
-		try {
-		    fontWeight = new CssFontWeight(ac, expression);
-		    find = true;
-		} catch (InvalidParamException e) {
-		    // we have now (or not)
-		    // [ 'font-style' || 'font-variant' || 'font-weight' ]?
-		    //break;
+	static {
+		normal = CssIdent.getIdent("normal");
+		systemFonts = new HashMap<String, CssIdent>();
+		for (String s : _systemFonts) {
+			systemFonts.put(s, CssIdent.getIdent(s));
 		}
-	    }
-
-	    if (find && op != SPACE) {
-		throw new InvalidParamException("operator",
-						((new Character(op)).toString()), ac);
-	    }
 	}
 
-	// "normal" values
-	CssExpression normalExpr = new CssExpression();
-	normalExpr.addValue(normal);
-
-	for(int i = 0; i < normalNb; i++) {
-	    if (fontStyle == null) {
-		fontStyle = new CssFontStyle(ac, normalExpr);
-		normalExpr.starts();
-	    }
-	    else if (fontVariant == null) {
-		fontVariant = new CssFontVariant(ac, normalExpr);
-		normalExpr.starts();
-	    }
-	    else if (fontWeight == null) {
-		fontWeight = new CssFontWeight(ac, normalExpr);
-		normalExpr.starts();
-	    }
-	}
-
-	val = expression.getValue();
-	op = expression.getOperator();
-
-	if (val == null) {
-	    throw new InvalidParamException("few-value", getPropertyName(), ac);
-	}
-
-	if(val.equals(inherit)) {
-	    throw new InvalidParamException("unrecognize", ac);
-	}
-
-	fontSize = new CssFontSize(ac, expression);
-
-    if (val.getType() == CssTypes.CSS_SWITCH) {
-        expression.next();
-        val = expression.getValue();
-	    op = expression.getOperator();
-	    if(expression.getValue().equals(inherit)) {
-		throw new InvalidParamException("unrecognize", ac);
-	    }
-	    lineHeight = new CssLineHeight(ac, expression);
-	}
-
-	if(expression.getValue().equals(inherit)) {
-	    throw new InvalidParamException("unrecognize", ac);
-	}
-
-	if (op == SPACE && expression.getValue() != null) {
-	    fontFamily = new CssFontFamily(ac, expression, true);
-	} else {
-	    expression.starts();
-	    throw new InvalidParamException("few-value", expression.toString(), ac);
+	/**
+	 * Create a new CssFontSize
+	 */
+	public CssFont() {
 	}
-	setByUser();
-    }
 
-    public CssFont(ApplContext ac, CssExpression expression)
-	throws InvalidParamException {
-	this(ac, expression, false);
-    }
+	/**
+	 * Creates a new CssFontSize
+	 *
+	 * @param expression The expression for this property
+	 * @throws org.w3c.css.util.InvalidParamException
+	 *          Expressions are incorrect
+	 */
+	public CssFont(ApplContext ac, CssExpression expression, boolean check)
+			throws InvalidParamException {
 
-    /**
-     * Returns the value of this property
-     */
-    public Object get() {
-	return null;
-    }
+		setByUser();
 
-    /**
-     * Returns a string representation of the object.
-     */
-    public String toString() {
-	if (value != null) {
-	    return value.toString();
-	} else {
-	    String ret = "";
-	    if (fontStyle != null) {
-		ret += " " + fontStyle;
-	    }
-	    if (fontVariant != null) {
-		ret += " " + fontVariant;
-	    }
-	    if (fontWeight != null) {
-		ret += " " + fontWeight;
-	    }
-	    if(fontSize != null) {
-		ret += " " + fontSize;
-	    }
-	    if (lineHeight != null) {
-		ret += "/" + lineHeight;
-	    }
-	    if (fontFamily.size() != 0) {
-		ret += " " + fontFamily;
-	    }
-	    return ret.substring(1);
-	}
-    }
+		CssValue val;
+		char op;
 
-    /**
-     * Set this property to be important.
-     * Overrides this method for a macro
-     */
-    public void setImportant() {
-	super.setImportant();
-	if (value == null) {
-	    if(fontStyle != null)
-		fontStyle.important = true;
-	    if(fontVariant != null)
-		fontVariant.important = true;
-	    if(fontWeight != null)
-		fontWeight.important = true;
-	    if(fontSize != null)
-		fontSize.important = true;
-	    if(lineHeight != null)
-		lineHeight.important = true;
-	    if(fontFamily != null)
-		fontFamily.important = true;
-	}
-    }
+		boolean gotNormal = false;
+		int state = 0;
 
-    /**
-     * Returns true if this property is important.
-     * Overrides this method for a macro
-     */
-    public boolean getImportant() {
-	if (value != null) {
-	    return super.getImportant();
-	} else {
-	    return ((fontStyle == null || fontStyle.important) &&
-		    (fontVariant == null || fontVariant.important) &&
-		    (fontWeight == null || fontWeight.important) &&
-		    (fontSize == null || fontSize.important) &&
-		    (lineHeight == null || lineHeight.important) &&
-		    (fontFamily == null || fontFamily.important));
-	}
-    }
+		while (!expression.end()) {
+			val = expression.getValue();
+			op = expression.getOperator();
+			switch (val.getType()) {
+				case CssTypes.CSS_IDENT:
+					if (inherit.equals(val)) {
+						if (expression.getCount() != 1) {
+							throw new InvalidParamException("value",
+									val.toString(),
+									getPropertyName(), ac);
+						}
+						value = inherit;
+						break;
+					}
+					CssIdent ident;
+					ident = systemFonts.get(val.toString());
+					if (ident != null) {
+						if (expression.getCount() != 1) {
+							throw new InvalidParamException("value",
+									val.toString(),
+									getPropertyName(), ac);
+						}
+						value = ident;
+						break;
+					}
 
-    /**
-     * Add this property to the CssStyle
-     *
-     * @param style The CssStyle
-     */
-    public void addToStyle(ApplContext ac, CssStyle style) {
-	if (value != null) {
-	    ((Css1Style) style).cssFont.value = value;
-	} else {
-	    if(fontStyle != null)
-		fontStyle.addToStyle(ac, style);
-	    if(fontVariant != null)
-		fontVariant.addToStyle(ac, style);
-	    if(fontSize != null)
-		fontSize.addToStyle(ac, style);
-	    if(fontWeight != null)
-		fontWeight.addToStyle(ac, style);
-	    if(lineHeight != null)
-		lineHeight.addToStyle(ac, style);
-	    if(fontFamily != null)
-		fontFamily.addToStyle(ac, style);
-	}
-    }
+					// first font-style
+					ident = (CssIdent) val;
+					if (state == 0) {
+						// now check for possible font values
+						// first the strange case of 'normal'
+						// which sets up to three values...
+						// we keep it around for the final check
+						if (normal.equals((CssIdent) val)) {
+							gotNormal = true;
+							break;
+						}
+						int pos = CssFontStyle.allowed_values.indexOf(ident);
+						if (pos >= 0) {
+							if (fontStyle != null) {
+								throw new InvalidParamException("value",
+										val.toString(),
+										getPropertyName(), ac);
+							}
+							fontStyle = new org.w3c.css.properties.css21.CssFontStyle();
+							fontStyle.value = CssFontStyle.allowed_values.get(pos);
+							break;
+						}
+						// font-variant
+						CssIdent v = CssFontVariant.getAllowedFontVariant(ident);
+						if (v != null) {
+							if (fontVariant != null) {
+								throw new InvalidParamException("value",
+										val.toString(),
+										getPropertyName(), ac);
+							}
+							fontVariant = new CssFontVariant();
+							fontVariant.value = v;
+							break;
+						}
+						// font-weight
+						v = CssFontWeight.allowed_values.get(ident.toString());
+						if (v != null) {
+							if (fontWeight != null) {
+								throw new InvalidParamException("value",
+										val.toString(),
+										getPropertyName(), ac);
+							}
+							fontWeight = new CssFontWeight();
+							fontWeight.value = v;
+							break;
+						}
+					}
 
-    /**
-     * 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 (value == null) {
-	    if(fontStyle != null)
-		fontStyle.setInfo(line, source);
-	    if(fontVariant != null)
-		fontVariant.setInfo(line, source);
-	    if(fontWeight != null)
-		fontWeight.setInfo(line, source);
-	    if(fontSize != null)
-		fontSize.setInfo(line, source);
-	    if(lineHeight != null)
-		lineHeight.setInfo(line, source);
-	    if(fontFamily != null)
-		fontFamily.setInfo(line, source);
-	}
-    }
+					// check if we moved past and we now got
+					// a font-size
+					if (state == 0) {
+						CssIdent v = CssFontSize.allowed_values.get(ident.toString());
+						if (v != null) {
+							// we got a FontSize, so no more style/variant/weight
+							state = 1;
+							if (fontSize != null) {
+								throw new InvalidParamException("value",
+										val.toString(),
+										getPropertyName(), ac);
+							}
+							fontSize = new CssFontSize();
+							fontSize.value = v;
+							break;
+						}
+					}
+					// still nothing? It must be a font-family then...
+					// let the fun begin ;)
+					fontFamily = new CssFontFamily(ac, expression, check);
+					state = 2;
+					// expression.next is called, so continue instead
+					// of next
+					continue;
+				case CssTypes.CSS_SWITCH:
+					// sanity check, it must happen only after a fontSize
+					if (fontSize == null || state != 1) {
+						throw new InvalidParamException("value",
+								val.toString(),
+								getPropertyName(), ac);
+					}
+					expression.next();
+					if (expression.end()) {
+						throw new InvalidParamException("value",
+								expression.toString(),
+								getPropertyName(), ac);
+					}
+					// let's parse a line-height
+					lineHeight = new CssLineHeight(ac, expression, false);
+					state = 1;
+					// expression.next is called, so continue instead
+					// of next
+					continue;
 
-    /**
-     * Compares two properties for equality.
-     *
-     * @param property The other property.
-     */
-    public boolean equals(CssProperty property) {
-	return false;
-    }
+				case CssTypes.CSS_NUMBER:
+					// must be a font-weight
+					if (state == 0 && fontWeight == null) {
+						fontWeight = new CssFontWeight(ac, expression, false);
+						// expression.next is called, so continue instead
+						// of next
+						continue;
+					}
+					throw new InvalidParamException("value",
+							val.toString(),
+							getPropertyName(), 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 (fontStyle != null) {
-	    fontStyle.setSelectors(selector);
-	}
-	if (fontVariant != null) {
-	    fontVariant.setSelectors(selector);
-	}
-	if (fontWeight != null) {
-	    fontWeight.setSelectors(selector);
-	}
-	if (fontSize != null) {
-	    fontSize.setSelectors(selector);
-	}
-	if (lineHeight != null) {
-	    lineHeight.setSelectors(selector);
-	}
-	if (fontFamily != null) {
-	    fontFamily.setSelectors(selector);
-	}
-    }
+				case CssTypes.CSS_PERCENTAGE:
+				case CssTypes.CSS_LENGTH:
+					if (state == 0 && fontSize == null) {
+						fontSize = new CssFontSize(ac, expression, false);
+						state = 1;
+						// expression.next is called, so continue instead
+						// of next
+						continue;
+					}
+					throw new InvalidParamException("value",
+							val.toString(),
+							getPropertyName(), ac);
+				default:
+					throw new InvalidParamException("value",
+							val.toString(),
+							getPropertyName(), ac);
+			}
+			if (op != SPACE) {
+				throw new InvalidParamException("operator",
+						Character.toString(op),
+						ac);
+			}
+			expression.next();
+		}
+		if (gotNormal) {
+			if (fontSize == null) {
+				fontSize = new CssFontSize();
+				fontSize.value = normal;
+			}
+			if (fontVariant == null) {
+				fontVariant = new CssFontVariant();
+				fontVariant.value = normal;
+			}
+			if (fontWeight == null) {
+				fontWeight = new CssFontWeight();
+				fontWeight.value = normal;
 
-    /**
-     * 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).getFont();
-	} else {
-	    return ((Css1Style) style).cssFont;
+			}
+		}
 	}
-    }
 
-    /**
-     * Returns the name of this property
-     */
-    public String getPropertyName() {
-	return "font";
-    }
-
-    private CssIdent checkIdent(CssIdent ident) {
-	int hash = ident.hashCode();
-	for (int i = 0; i < CssFontConstant.FONT.length; i++) {
-	    if (hash_values[i] == hash) {
-		return ident;
-	    }
+	public CssFont(ApplContext ac, CssExpression expression)
+			throws InvalidParamException {
+		this(ac, expression, false);
 	}
 
-	return null;
-    }
-
-    static {
-	hash_values = new int[CssFontConstant.FONT.length];
-	for (int i=0; i<CssFontConstant.FONT.length; i++)
-	    hash_values[i] = CssFontConstant.FONT[i].hashCode();
-    }
 }
 
-
-
-
-

Index: CssFontVariant.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css1/CssFontVariant.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- CssFontVariant.java	5 Jan 2010 13:49:43 -0000	1.4
+++ CssFontVariant.java	4 Aug 2012 21:17:05 -0000	1.5
@@ -1,178 +1,80 @@
-//
 // $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.CssIdent;
+import org.w3c.css.values.CssTypes;
+import org.w3c.css.values.CssValue;
 
 /**
- *   <H4>
- *     &nbsp;&nbsp; 'font-variant'
- *   </H4>
- *   <P>
- *   <EM>Value:</EM> normal | small-caps<BR>
- *   <EM>Initial:</EM> normal<BR>
- *   <EM>Applies to:</EM> all elements<BR>
- *   <EM>Inherited:</EM> yes<BR>
- *   <EM>Percentage values:</EM> N/A<BR>
- *   <P> Another type of variation within a font family is the small-caps. In a
- *   small-caps font the lower case letters look similar to the uppercase ones,
- *   but in a smaller size and with slightly different proportions. The
- *   'font-variant' property selects that font.
- *   <P> A value of 'normal' selects a font that is not a small-caps font,
- *   'small-caps' selects a small-caps font. It is acceptable (but not required)
- *   in CSS1 if the small-caps font is a created by taking a normal font and
- *   replacing the lower case letters by scaled uppercase characters. As a last
- *   resort, uppercase letters will be used as replacement for a small-caps
- *   font.
- *   <P> The following example results in an 'H3' element in small-caps, with
- *   emphasized words in oblique small-caps:
- *   <PRE>
- *   H3 { font-variant: small-caps }
- *   EM { font-style: oblique }
- *   </PRE>
- *   <P> There may be other variants in the font family as well, such as fonts
- *   with old-style numerals, small-caps numerals, condensed or expanded
- *   letters, etc.  CSS1 has no properties that select those.
- *   <P> <EM>CSS1 core:</EM> insofar as this property causes text to be
- *   transformed to uppercase, the same considerations as for 'text-transform'
- *   apply
- *
- * @see CssFont
- * @see TextTransform
- * @version $Revision$
+ * @spec http://www.w3.org/TR/2008/REC-CSS1-20080411/#font-variant
  */
-public class CssFontVariant extends CssProperty implements CssFontConstant {
-
-    int value;
-
-    /**
-     * Create a new CssFontVariant
-     */
-    public CssFontVariant() {
-	// nothing to do
-    }
-
-    /**
-     * Creates a new CssFontVariant
-     *
-     * @param expression the font variant
-     * @exception InvalidParamException Values are incorrect
-     */
-    public CssFontVariant(ApplContext ac, CssExpression expression,
-	    boolean check)
-	    throws InvalidParamException {
+public class CssFontVariant extends org.w3c.css.properties.css.CssFontVariant {
 
-	if(check && expression.getCount() > 1) {
-	    throw new InvalidParamException("unrecognize", ac);
-	}
+	public static final CssIdent normal = CssIdent.getIdent("normal");
+	public static final CssIdent smallCaps = CssIdent.getIdent("small-caps");
 
-	setByUser();
-	if (expression.getValue() instanceof CssIdent) {
-	    int hash = expression.getValue().hashCode();
-	    for (int i=0; i<hash_values.length; i++)
-		if (hash_values[i] == hash) {
-		    value = i;
-		    expression.next();
-		    return;
+	public static final CssIdent getAllowedFontVariant(CssIdent ident) {
+		if (smallCaps.equals(ident)) {
+			return smallCaps;
 		}
+		if (normal.equals(ident)) {
+			return normal;
+		}
+		return null;
 	}
 
-	throw new InvalidParamException("value", expression.getValue(),
-					getPropertyName(), ac);
-    }
-
-    public CssFontVariant(ApplContext ac, CssExpression expression)
-	throws InvalidParamException {
-	this(ac, expression, false);
-    }
-
-    /**
-     * Returns the current value
-     */
-    public Object get() {
-	return FONTVARIANT[value];
-    }
-
-    /**
-     * Returns true if this property is "softly" inherited
-     * e.g. his value equals inherit
-     */
-    public boolean isSoftlyInherited() {
-	return value == FONTVARIANT.length - 1;
-    }
-
-    /**
-     * Returns a string representation of the object.
-     */
-    public String toString() {
-	return FONTVARIANT[value];
-    }
+	/**
+	 * Creates a new CssFontVariant
+	 *
+	 * @param expression The expression for this property
+	 * @throws org.w3c.css.util.InvalidParamException
+	 *          Expressions are incorrect
+	 */
+	public CssFontVariant(ApplContext ac, CssExpression expression, boolean check)
+			throws InvalidParamException {
+		if (check && expression.getCount() > 1) {
+			throw new InvalidParamException("unrecognize", ac);
+		}
+		setByUser();
 
-    /**
-     * Returns the name of this property
-     */
-    public String getPropertyName() {
-	return "font-variant";
-    }
+		CssValue val;
+		char op;
 
-    /**
-     * Add this property to the CssStyle.
-     *
-     * @param style The CssStyle
-     */
-    public void addToStyle(ApplContext ac, CssStyle style) {
-	CssFont cssFont = ((Css1Style) style).cssFont;
-	if (cssFont.fontVariant != null)
-	    style.addRedefinitionWarning(ac, this);
-	cssFont.fontVariant = this;
-    }
+		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) {
-	if (resolve) {
-	    return ((Css1Style) style).getFontVariant();
-	} else {
-	    return ((Css1Style) style).cssFont.fontVariant;
+		if (val.getType() == CssTypes.CSS_IDENT) {
+			CssIdent ident = (CssIdent) val;
+			if (smallCaps.equals(ident)) {
+				value = smallCaps;
+			} else if (normal.equals(ident)) {
+				value = normal;
+			} else {
+				throw new InvalidParamException("value",
+						val.toString(),
+						getPropertyName(), ac);
+			}
+		} else {
+			throw new InvalidParamException("value",
+					val.toString(),
+					getPropertyName(), ac);
+		}
+		expression.next();
 	}
-    }
-
-    /**
-     * Compares two properties for equality.
-     *
-     * @param value The other property.
-     */
-    public boolean equals(CssProperty property) {
-	return (property instanceof CssFontVariant &&
-		((CssFontVariant) property).value == value);
-    }
-
-    /**
-     * Is the value of this property is a default value.
-     * It is used by all macro for the function <code>print</code>
-     */
-    public boolean isDefault() {
-	return value == 0;
-    }
 
-    private static int[] hash_values;
+	public CssFontVariant(ApplContext ac, CssExpression expression)
+			throws InvalidParamException {
+		this(ac, expression, false);
+	}
 
-    static {
-	hash_values = new int[FONTVARIANT.length];
-	for (int i=0;i<FONTVARIANT.length;i++)
-	    hash_values[i] = FONTVARIANT[i].hashCode();
-    }
+	public CssFontVariant() {
+	}
 }
+

Index: CssFontStyle.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css1/CssFontStyle.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- CssFontStyle.java	5 Jan 2010 13:49:43 -0000	1.4
+++ CssFontStyle.java	4 Aug 2012 21:17:05 -0000	1.5
@@ -1,172 +1,81 @@
-//
 // $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.CssIdent;
+import org.w3c.css.values.CssTypes;
+import org.w3c.css.values.CssValue;
+
+import java.util.ArrayList;
 
 /**
- *   <H4>
- *     &nbsp;&nbsp; 'font-style'
- *   </H4>
- *   <P>
- *   <EM>Value:</EM> normal | italic | oblique<BR>
- *   <EM>Initial:</EM> normal<BR>
- *   <EM>Applies to:</EM> all elements<BR>
- *   <EM>Inherited:</EM> yes<BR>
- *   <EM>Percentage values:</EM> N/A<BR>
- *   <P> The 'font-style' property selects between normal (sometimes referred to
- *   as "roman" or "upright"), italic and oblique faces within a font family.
- *   <P> A value of 'normal' selects a font that is classified as 'normal' in
- *   the UA's font database, while 'oblique' selects a font that is labeled
- *   'oblique'.  A value of 'italic' selects a font that is labeled 'italic',
- *   or, if that is not available, one labeled 'oblique'.
- *   <P> The font that is labeled 'oblique' in the UA's font database may
- *   actually have been generated by electronically slanting a normal font.
- *   <P> Fonts with Oblique, Slanted or Incline in their names will typically be
- *   labeled 'oblique' in the UA's font database. Fonts with <EM>Italic,
- *   Cursive</EM> or <EM>Kursiv</EM> in their names will typically be labeled
- *   'italic'.
- *   <PRE>
- *   H1, H2, H3 { font-style: italic }
- *   H1 EM { font-style: normal }
- * </PRE>
- *   <P>
- *   In the example above, emphasized text within 'H1' will appear in a normal
- *   face.
- *
- * @version $Revision$
+ * @spec http://www.w3.org/TR/2008/REC-CSS1-20080411/#font-style
  */
-public class CssFontStyle extends CssProperty implements CssFontConstant {
-
-    int value;
-
-    /**
-     * Create a new CssFontStyle
-     */
-    public CssFontStyle() {
-	// nothing to do
-    }
-
-    /**
-     * Creates a new CssFontStyle
-     *
-     * @param expression the font style
-     * @exception InvalidParamException values are incorrect
-     */
-    public CssFontStyle(ApplContext ac, CssExpression expression,
-	    boolean check) throws InvalidParamException {
+public class CssFontStyle extends org.w3c.css.properties.css.CssFontStyle {
 
-	if(check && expression.getCount() > 1) {
-	    throw new InvalidParamException("unrecognize", ac);
-	}
+	static final String[] _allowed_values = {"italic", "normal", "oblique"};
+	static final ArrayList<CssIdent> allowed_values;
 
-	setByUser();
-	if (expression.getValue() instanceof CssIdent) {
-	    int hash = ((CssIdent) expression.getValue()).hashCode();
-	    for (int i=0; i<hash_values.length; i++)
-		if (hash_values[i] == hash) {
-		    value = i;
-		    expression.next();
-		    return;
+	static {
+		allowed_values = new ArrayList<CssIdent>(3);
+		for (String s : _allowed_values) {
+			allowed_values.add(CssIdent.getIdent(s));
 		}
 	}
 
-	throw new InvalidParamException("value", expression.getValue(),
-					getPropertyName(), ac);
-    }
-
-    public CssFontStyle(ApplContext ac, CssExpression expression)
-	throws InvalidParamException {
-	this(ac, expression, false);
-    }
-
-    /**
-     * Returns the current value
-     */
-    public Object get() {
-	return FONTSTYLE[value];
-    }
-
-    /**
-     * Returns true if this property is "softly" inherited
-     * e.g. his value equals inherit
-     */
-    public boolean isSoftlyInherited() {
-	return value == FONTSTYLE.length - 1;
-    }
+	/**
+	 * Create a new CssFontStyle
+	 */
+	public CssFontStyle() {
+	}
 
-    /**
-     * Returns a string representation of the object.
-     */
-    public String toString() {
-	return FONTSTYLE[value];
-    }
+	/**
+	 * Creates a new CssFontStyle
+	 *
+	 * @param expression The expression for this property
+	 * @throws org.w3c.css.util.InvalidParamException
+	 *          Expressions are incorrect
+	 */
+	public CssFontStyle(ApplContext ac, CssExpression expression, boolean check)
+			throws InvalidParamException {
+		if (check && expression.getCount() > 1) {
+			throw new InvalidParamException("unrecognize", ac);
+		}
+		setByUser();
 
-    /**
-     * Returns the name of this property
-     */
-    public String getPropertyName() {
-	return "font-style";
-    }
+		CssValue val;
+		char op;
 
-    /**
-     * Add this property to the CssStyle.
-     *
-     * @param style The CssStyle
-     */
-    public void addToStyle(ApplContext ac, CssStyle style) {
-	CssFont cssFont = ((Css1Style) style).cssFont;
-	if (cssFont.fontStyle != null)
-	    style.addRedefinitionWarning(ac, this);
-	cssFont.fontStyle = this;
-    }
+		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) {
-	if (resolve) {
-	    return ((Css1Style) style).getFontStyle();
-	} else {
-	    return ((Css1Style) style).cssFont.fontStyle;
+		if (val.getType() == CssTypes.CSS_IDENT) {
+			CssIdent ident = (CssIdent) val;
+			int pos = allowed_values.indexOf(ident);
+			if (pos < 0) {
+				throw new InvalidParamException("value",
+						val.toString(),
+						getPropertyName(), ac);
+			}
+			value = allowed_values.get(pos);
+		} else {
+			throw new InvalidParamException("value",
+					val.toString(),
+					getPropertyName(), ac);
+		}
+		expression.next();
 	}
-    }
-
-    /**
-     * Compares two properties for equality.
-     *
-     * @param value The other property.
-     */
-    public boolean equals(CssProperty property) {
-	return (property instanceof CssFontStyle &&
-		((CssFontStyle) property).value == value);
-    }
 
-    /**
-     * Is the value of this property is a default value.
-     * It is used by all macro for the function <code>print</code>
-     */
-    public boolean isDefault() {
-	return value == 0;
-    }
-
-    private static int[] hash_values;
+	public CssFontStyle(ApplContext ac, CssExpression expression)
+			throws InvalidParamException {
+		this(ac, expression, false);
+	}
 
-    static {
-	hash_values = new int[FONTSTYLE.length];
-	for (int i=0; i<FONTSTYLE.length; i++)
-	    hash_values[i] = FONTSTYLE[i].hashCode();
-    }
 }
+

Index: Css1Style.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css1/Css1Style.java,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- Css1Style.java	25 Apr 2012 20:21:55 -0000	1.26
+++ Css1Style.java	4 Aug 2012 21:17:05 -0000	1.27
@@ -31,14 +31,8 @@
     /**
      * Font properties
      */
-    public CssFont cssFont = new CssFont();
-    public CssFontCSS2 cssFontCSS2 = new CssFontCSS2();
-    public CssFontCSS1 cssFontCSS1 = new CssFontCSS1();
-    public CssFontStretch cssFontStretch;
-    public CssFontStretchCSS2 cssFontStretchCSS2;
-    public CssFontStretchCSS1 cssFontStretchCSS1;
-    public CssFontSizeAdjust cssFontSizeAdjust;
-    public CssFontSizeAdjustCSS2 cssFontSizeAdjustCSS2;
+    public org.w3c.css.properties.css.CssFont cssFont = new org.w3c.css.properties.css.CssFont();
+
 
     /* Color and Background properties */
     /**
@@ -278,210 +272,71 @@
     /**
      * Get the font-style property
      */
-    public final CssFontStyle getFontStyle() {
+    public final org.w3c.css.properties.css.CssFontStyle getFontStyle() {
         if (cssFont.fontStyle == null) {
             cssFont.fontStyle =
-                    (CssFontStyle) style.CascadingOrder(new CssFontStyle(),
+                    (org.w3c.css.properties.css.CssFontStyle) style.CascadingOrder(new org.w3c.css.properties.css.CssFontStyle(),
                             style, selector);
         }
         return cssFont.fontStyle;
     }
 
-    public final CssFontStyleCSS2 getFontStyleCSS2() {
-        if (cssFontCSS2.fontStyle == null) {
-            cssFontCSS2.fontStyle =
-                    (CssFontStyleCSS2) style.CascadingOrder(new CssFontStyleCSS2(),
-                            style, selector);
-        }
-        return cssFontCSS2.fontStyle;
-    }
-
-    public final CssFontStyleCSS1 getFontStyleCSS1() {
-        if (cssFontCSS1.fontStyle == null) {
-            cssFontCSS1.fontStyle =
-                    (CssFontStyleCSS1) style.CascadingOrder(new CssFontStyleCSS1(),
-                            style, selector);
-        }
-        return cssFontCSS1.fontStyle;
-    }
-
     /**
      * Get the font-variant property
      */
-    public final CssFontVariant getFontVariant() {
+    public final org.w3c.css.properties.css.CssFontVariant getFontVariant() {
         if (cssFont.fontVariant == null) {
             cssFont.fontVariant =
-                    (CssFontVariant) style.CascadingOrder(new CssFontVariant(),
+                    (org.w3c.css.properties.css.CssFontVariant) style.CascadingOrder(new org.w3c.css.properties.css.CssFontVariant(),
                             style, selector);
         }
         return cssFont.fontVariant;
     }
 
-    public final CssFontVariantCSS2 getFontVariantCSS2() {
-        if (cssFontCSS2.fontVariant == null) {
-            cssFontCSS2.fontVariant =
-                    (CssFontVariantCSS2) style.CascadingOrder(new CssFontVariantCSS2(),
-                            style, selector);
-        }
-        return cssFontCSS2.fontVariant;
-    }
 
-    public final CssFontVariantCSS1 getFontVariantCSS1() {
-        if (cssFontCSS1.fontVariant == null) {
-            cssFontCSS1.fontVariant =
-                    (CssFontVariantCSS1) style.CascadingOrder(new CssFontVariantCSS1(),
-                            style, selector);
-        }
-        return cssFontCSS1.fontVariant;
-    }
 
     /**
      * Get the font-weight property
      */
-    public final CssFontWeightCSS2 getFontWeightCSS2() {
-        if (cssFontCSS2.fontWeight == null) {
-            cssFontCSS2.fontWeight =
-                    (CssFontWeightCSS2) style.CascadingOrder(new CssFontWeightCSS2(),
-                            style, selector);
-        }
-        return cssFontCSS2.fontWeight;
-    }
-
-    public final CssFontWeight getFontWeight() {
+    public final org.w3c.css.properties.css.CssFontWeight getFontWeight() {
         if (cssFont.fontWeight == null) {
             cssFont.fontWeight =
-                    (CssFontWeight) style.CascadingOrder(new CssFontWeight(),
+                    (org.w3c.css.properties.css.CssFontWeight) style.CascadingOrder(new org.w3c.css.properties.css.CssFontWeight(),
                             style, selector);
         }
         return cssFont.fontWeight;
     }
 
-    public final CssFontWeightCSS1 getFontWeightCSS1() {
-        if (cssFontCSS1.fontWeight == null) {
-            cssFontCSS1.fontWeight =
-                    (CssFontWeightCSS1) style.CascadingOrder(new CssFontWeightCSS1(),
-                            style, selector);
-        }
-        return cssFontCSS1.fontWeight;
-    }
-
-    /**
-     * Get the font-stretch property
-     */
-    public final CssFontStretch getFontStretch() {
-        if (cssFontStretch == null) {
-            cssFontStretch =
-                    (CssFontStretch) style.CascadingOrder(new CssFontStretch(),
-                            style, selector);
-        }
-        return cssFontStretch;
-    }
-
-    public final CssFontStretchCSS2 getFontStretchCSS2() {
-        if (cssFontStretchCSS2 == null) {
-            cssFontStretchCSS2 =
-                    (CssFontStretchCSS2) style.CascadingOrder(new CssFontStretchCSS2(),
-                            style, selector);
-        }
-        return cssFontStretchCSS2;
-    }
-
-    public final CssFontStretchCSS1 getFontStretchCSS1() {
-        if (cssFontStretchCSS1 == null) {
-            cssFontStretchCSS1 =
-                    (CssFontStretchCSS1) style.CascadingOrder(new CssFontStretchCSS1(),
-                            style, selector);
-        }
-        return cssFontStretchCSS1;
-    }
 
     /**
      * Get the font-size property
      */
-    public final CssFontSizeCSS2 getFontSizeCSS2() {
-        if (cssFontCSS2.fontSize == null) {
-            cssFontCSS2.fontSize =
-                    (CssFontSizeCSS2) style.CascadingOrder(new CssFontSizeCSS2(),
-                            style, selector);
-        }
-        return cssFontCSS2.fontSize;
-    }
 
-    public final CssFontSize getFontSize() {
+    public final org.w3c.css.properties.css.CssFontSize getFontSize() {
         if (cssFont.fontSize == null) {
             cssFont.fontSize =
-                    (CssFontSize) style.CascadingOrder(new CssFontSize(),
+                    (org.w3c.css.properties.css.CssFontSize) style.CascadingOrder(new org.w3c.css.properties.css.CssFontSize(),
                             style, selector);
         }
         return cssFont.fontSize;
     }
 
-    public final CssFontSizeCSS1 getFontSizeCSS1() {
-        if (cssFontCSS1.fontSize == null) {
-            cssFontCSS1.fontSize =
-                    (CssFontSizeCSS1) style.CascadingOrder(new CssFontSizeCSS1(),
-                            style, selector);
-        }
-        return cssFontCSS1.fontSize;
-    }
-
-    /**
-     * Get the font-size-adjust property
-     */
-    public final CssFontSizeAdjustCSS2 getFontSizeAdjustCSS2() {
-        if (cssFontSizeAdjustCSS2 == null) {
-            cssFontSizeAdjustCSS2 =
-                    (CssFontSizeAdjustCSS2) style.CascadingOrder(
-                            new CssFontSizeAdjustCSS2(),
-                            style, selector);
-        }
-        return cssFontSizeAdjustCSS2;
-    }
-
-    public final CssFontSizeAdjust getFontSizeAdjust() {
-        if (cssFontSizeAdjust == null) {
-            cssFontSizeAdjust =
-                    (CssFontSizeAdjust) style.CascadingOrder(
-                            new CssFontSizeAdjust(),
-                            style, selector);
-        }
-        return cssFontSizeAdjust;
-    }
-
     /**
      * Get the font-family property
      */
-    public final CssFontFamily getFontFamily() {
+    public final org.w3c.css.properties.css.CssFontFamily getFontFamily() {
         if (cssFont.fontFamily == null) {
             cssFont.fontFamily =
-                    (CssFontFamily) style.CascadingOrder(new CssFontFamily(),
+                    (org.w3c.css.properties.css.CssFontFamily) style.CascadingOrder(new org.w3c.css.properties.css.CssFontFamily(),
                             style, selector);
         }
         return cssFont.fontFamily;
     }
 
-    public final CssFontFamilyCSS2 getFontFamilyCSS2() {
-        if (cssFontCSS2.fontFamily == null) {
-            cssFontCSS2.fontFamily =
-                    (CssFontFamilyCSS2) style.CascadingOrder(new CssFontFamilyCSS2(),
-                            style, selector);
-        }
-        return cssFontCSS2.fontFamily;
-    }
-
-    public final CssFontFamilyCSS1 getFontFamilyCSS1() {
-        if (cssFontCSS1.fontFamily == null) {
-            cssFontCSS1.fontFamily =
-                    (CssFontFamilyCSS1) style.CascadingOrder(new CssFontFamilyCSS1(),
-                            style, selector);
-        }
-        return cssFontCSS1.fontFamily;
-    }
-
     /**
      * Get the font property
      */
-    public final CssFont getFont() {
+    public final org.w3c.css.properties.css.CssFont getFont() {
         if (cssFont.value != null) {
             // nothing
         } else {
@@ -507,57 +362,6 @@
         return cssFont;
     }
 
-    public final CssFontCSS2 getFontCSS2() {
-        if (cssFontCSS2.value != null) {
-            // nothing
-        } else {
-            if (cssFontCSS2.fontStyle == null) {
-                cssFontCSS2.fontStyle = getFontStyleCSS2();
-            }
-            if (cssFontCSS2.fontVariant == null) {
-                cssFontCSS2.fontVariant = getFontVariantCSS2();
-            }
-            if (cssFontCSS2.fontWeight == null) {
-                cssFontCSS2.fontWeight = getFontWeightCSS2();
-            }
-            if (cssFontCSS2.fontSize == null) {
-                cssFontCSS2.fontSize = getFontSizeCSS2();
-            }
-            if (cssFontCSS2.lineHeight == null) {
-                cssFontCSS2.lineHeight = getLineHeightCSS2();
-            }
-            if (cssFontCSS2.fontFamily == null) {
-                cssFontCSS2.fontFamily = getFontFamilyCSS2();
-            }
-        }
-        return cssFontCSS2;
-    }
-
-    public final CssFontCSS1 getFontCSS1() {
-        if (cssFontCSS1.value != null) {
-            // nothing
-        } else {
-            if (cssFontCSS1.fontStyle == null) {
-                cssFontCSS1.fontStyle = getFontStyleCSS1();
-            }
-            if (cssFontCSS1.fontVariant == null) {
-                cssFontCSS1.fontVariant = getFontVariantCSS1();
-            }
-            if (cssFontCSS1.fontWeight == null) {
-                cssFontCSS1.fontWeight = getFontWeightCSS1();
-            }
-            if (cssFontCSS1.fontSize == null) {
-                cssFontCSS1.fontSize = getFontSizeCSS1();
-            }
-            if (cssFontCSS1.lineHeight == null) {
-                cssFontCSS1.lineHeight = getLineHeightCSS1();
-            }
-            if (cssFontCSS1.fontFamily == null) {
-                cssFontCSS1.fontFamily = getFontFamilyCSS1();
-            }
-        }
-        return cssFontCSS1;
-    }
 
     /*
      * Color and Background properties
@@ -883,33 +687,15 @@
     /**
      * Get the line-height property
      */
-    public final CssLineHeight getLineHeight() {
+    public final org.w3c.css.properties.css.CssLineHeight getLineHeight() {
         if (cssFont.lineHeight == null) {
             cssFont.lineHeight =
-                    (CssLineHeight) style.CascadingOrder(new CssLineHeight(),
+                    (org.w3c.css.properties.css.CssLineHeight) style.CascadingOrder(new CssLineHeight(),
                             style, selector);
         }
         return cssFont.lineHeight;
     }
 
-    public final CssLineHeightCSS2 getLineHeightCSS2() {
-        if (cssFontCSS2.lineHeight == null) {
-            cssFontCSS2.lineHeight =
-                    (CssLineHeightCSS2) style.CascadingOrder(new CssLineHeightCSS2(),
-                            style, selector);
-        }
-        return cssFontCSS2.lineHeight;
-    }
-
-    public final CssLineHeightCSS1 getLineHeightCSS1() {
-        if (cssFontCSS1.lineHeight == null) {
-            cssFontCSS1.lineHeight =
-                    (CssLineHeightCSS1) style.CascadingOrder(new CssLineHeightCSS1(),
-                            style, selector);
-        }
-        return cssFontCSS1.lineHeight;
-    }
-
     /*
      * Box properties
      */
@@ -1690,40 +1476,11 @@
     private void findConflictsFontFamily(ApplContext ac, Warnings warnings,
                                          CssSelectors selector,
                                          CssSelectors[] allSelectors) {
-        // first CSS2 (the default)
-        if (cssFontCSS2.fontFamily != null) {
-            if (!cssFontCSS2.fontFamily.containsGenericFamily()) {
-                warnings.addWarning(new Warning(cssFontCSS2.fontFamily,
-                        "no-generic-family", 2, ac));
-            }
-            if (cssFontCSS2.fontFamily.withSpace) {
-                warnings.addWarning(new Warning(cssFontCSS2.fontFamily,
-                        "with-space", 1, ac));
-            }
-            return;
-        }
-        // CSS 3
         if (cssFont.fontFamily != null) {
-            if (!cssFont.fontFamily.containsGenericFamily()) {
+            if (!cssFont.fontFamily.hasGenericFamily()) {
                 warnings.addWarning(new Warning(cssFont.fontFamily,
                         "no-generic-family", 2, ac));
             }
-            if (cssFont.fontFamily.withSpace) {
-                warnings.addWarning(new Warning(cssFont.fontFamily,
-                        "with-space", 1, ac));
-            }
-            return;
-        }
-        // CSS1
-        if (cssFontCSS1.fontFamily != null) {
-            if (!cssFontCSS1.fontFamily.containsGenericFamily()) {
-                warnings.addWarning(new Warning(cssFontCSS1.fontFamily,
-                        "no-generic-family", 2, ac));
-            }
-            if (cssFontCSS1.fontFamily.withSpace) {
-                warnings.addWarning(new Warning(cssFontCSS1.fontFamily,
-                        "with-space", 1, ac));
-            }
         }
     }
 

Index: CssLineHeight.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css1/CssLineHeight.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- CssLineHeight.java	5 Jan 2010 13:49:43 -0000	1.5
+++ CssLineHeight.java	4 Aug 2012 21:17:05 -0000	1.6
@@ -1,13 +1,10 @@
-//
 // $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;
@@ -15,187 +12,82 @@
 import org.w3c.css.values.CssLength;
 import org.w3c.css.values.CssNumber;
 import org.w3c.css.values.CssPercentage;
+import org.w3c.css.values.CssTypes;
 import org.w3c.css.values.CssValue;
 
 /**
- *   <H4>
- *     &nbsp;&nbsp; 'line-height'
- *   </H4>
- *   <P>
- *   <EM>Value:</EM> normal | &lt;number&gt; | &lt;length&gt; |
- *   &lt;percentage&gt;<BR>
- *   <EM>Initial:</EM> normal<BR>
- *   <EM>Applies to:</EM> all elements<BR>
- *   <EM>Inherited:</EM> yes<BR>
- *   <EM>Percentage values:</EM> relative to the font size of the element itself<BR>
- *   <P>
- *   The property sets the distance between two adjacent lines' baselines.
- *   <P> When a numerical value is specified, the line height is given by the
- *   font size of the current element multiplied with the numerical value. This
- *   differs from a percentage value in the way it inherits: when a numerical
- *   value is specified, child elements will inherit the factor itself, not the
- *   resultant value (as is the case with <A
- *   HREF="#percentage-units">percentage</A> and other units).
- *   <P>
- *   Negative values are not allowed.
- *   <P>
- *   The three rules in the example below have the same resultant line height:
- *   <PRE>
- *   DIV { line-height: 1.2; font-size: 10pt }     /* number * /
- *   DIV { line-height: 1.2em; font-size: 10pt }   /* length * /
- *   DIV { line-height: 120%; font-size: 10pt }    /* percentage * /
- * </PRE>
- *
- * @version $Revision$
+ * @spec http://www.w3.org/TR/2008/REC-CSS1-20080411/#line-height
  */
-public class CssLineHeight extends CssProperty {
-
-
-    private CssValue value;
-    private static CssIdent normal = new CssIdent("normal");
-    private static CssIdent number = new CssIdent("number");
-    private static CssIdent none = new CssIdent("none");
-    private static CssIdent initial = new CssIdent("initial");
-
-    /**
-     * Create a new CssLineHeight
-     */
-    public CssLineHeight() {
-	value = normal;
-    }
+public class CssLineHeight extends org.w3c.css.properties.css.CssLineHeight {
 
-    /**
-     * Creates a new CssLineHeight
-     *
-     * @param expression The expression for this property
-     * @exception InvalidParamException The expression is incorrect
-     */
-    public CssLineHeight(ApplContext ac, CssExpression expression,
-	    boolean check) throws InvalidParamException {
+	public static final CssIdent normal = CssIdent.getIdent("normal");
 
-	if(check && expression.getCount() > 1) {
-	    throw new InvalidParamException("unrecognize", ac);
+	/**
+	 * Create a new CssLineHeight
+	 */
+	public CssLineHeight() {
 	}
 
-	CssValue val = expression.getValue();
-
-	setByUser();
+	/**
+	 * Creates a new CssLineHeight
+	 *
+	 * @param expression The expression for this property
+	 * @throws org.w3c.css.util.InvalidParamException
+	 *          Expressions are incorrect
+	 */
+	public CssLineHeight(ApplContext ac, CssExpression expression, boolean check)
+			throws InvalidParamException {
+		if (check && expression.getCount() > 1) {
+			throw new InvalidParamException("unrecognize", ac);
+		}
+		setByUser();
+		CssValue val = expression.getValue();
 
-	if (val instanceof CssNumber || val instanceof CssLength ||
-	        val instanceof CssPercentage) {
-	    float v = ((Number) val.get()).floatValue();
-	    if (v >= 0) {
-		value = val;
-		expression.next();
-		return;
-	    } else {
-		throw new InvalidParamException("negative-value",
-						Float.toString(v), ac);
-	    }
-	} else if (inherit.equals(val)) {
-	    value = inherit;
-	    expression.next();
-	    return;
-	} else if (normal.equals(val)) {
-	    value = normal;
-	    expression.next();
-	    return;
-	} else if (number.equals(val)) {
-		value = number;
-		expression.next();
-		return;
-	} else if (none.equals(val)) {
-		value = none;
-		expression.next();
-		return;
-	} else if (initial.equals(val)) {
-		value = initial;
+		switch (val.getType()) {
+			case CssTypes.CSS_IDENT:
+				if (normal.equals(val)) {
+					value = normal;
+				} else {
+					throw new InvalidParamException("value", val.toString(),
+							getPropertyName(), ac);
+				}
+				break;
+			case CssTypes.CSS_LENGTH:
+				CssLength length = (CssLength) val;
+				if (!length.isPositive()) {
+					throw new InvalidParamException("negative-value",
+							val.toString(), ac);
+				}
+				value = val;
+				break;
+			case CssTypes.CSS_NUMBER:
+				CssNumber number = (CssNumber) val;
+				if (!number.isPositive()) {
+					throw new InvalidParamException("negative-value",
+							val.toString(), ac);
+				}
+				value = val;
+				break;
+			case CssTypes.CSS_PERCENTAGE:
+				CssPercentage percent = (CssPercentage) val;
+				if (!percent.isPositive()) {
+					throw new InvalidParamException("negative-value",
+							val.toString(), ac);
+				}
+				value = val;
+				break;
+			default:
+				throw new InvalidParamException("value", val.toString(),
+						getPropertyName(), ac);
+		}
 		expression.next();
-		return;
 	}
 
-	throw new InvalidParamException("value", expression.getValue(),
-					getPropertyName(), ac);
-    }
-
-    public CssLineHeight(ApplContext ac, CssExpression expression)
-	throws InvalidParamException {
-	this(ac, expression, false);
-    }
-
-    /**
-     * Returns the value of this property
-     */
-    public Object get() {
-	if (value == null)
-	    return normal;
-	return value;
-    }
-
-    /**
-     * Returns the name of this property
-     */
-    public String getPropertyName() {
-	return "line-height";
-    }
-
-    /**
-     * Returns true if this property is "softly" inherited
-     * e.g. his value equals inherit
-     */
-    public boolean isSoftlyInherited() {
-	return value == inherit;
-    }
-
-    /**
-     * Returns a string representation of the object.
-     */
-    public String toString() {
-	return value.toString();
-    }
-
-    /**
-     * Add this property to the CssStyle.
-     *
-     * @param style The CssStyle
-     */
-    public void addToStyle(ApplContext ac, CssStyle style) {
-	CssFont cssFont = ((Css1Style) style).cssFont;
-	if (cssFont.lineHeight != null)
-	    style.addRedefinitionWarning(ac, this);
-	cssFont.lineHeight = 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).getLineHeight();
-	} else {
-	    return ((Css1Style) style).cssFont.lineHeight;
+	public CssLineHeight(ApplContext ac, CssExpression expression)
+			throws InvalidParamException {
+		this(ac, expression, false);
 	}
-    }
 
-    /**
-     * Compares two properties for equality.
-     *
-     * @param value The other property.
-     */
-    public boolean equals(CssProperty property) {
-	return (property instanceof CssLineHeight &&
-		((CssLineHeight) property).value == value);
-    }
-
-    /**
-     * Is the value of this property is a default value.
-     * It is used by all macro for the function <code>print</code>
-     */
-    public boolean isDefault() {
-	return value == normal;
-    }
 
 }
+

Index: CssFontSize.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css1/CssFontSize.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- CssFontSize.java	5 Jan 2010 13:49:43 -0000	1.4
+++ CssFontSize.java	4 Aug 2012 21:17:05 -0000	1.5
@@ -1,14 +1,10 @@
-//
 // $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;
@@ -16,220 +12,95 @@
 import org.w3c.css.values.CssLength;
 import org.w3c.css.values.CssNumber;
 import org.w3c.css.values.CssPercentage;
+import org.w3c.css.values.CssTypes;
 import org.w3c.css.values.CssValue;
 
+import java.util.HashMap;
 
 /**
- *   <H4>
- *     &nbsp;&nbsp; 'font-size'
- *   </H4>
- *   <P>
- *   <EM>Value:</EM> &lt;absolute-size&gt; | &lt;relative-size&gt; |
- *   &lt;length&gt; | &lt;percentage&gt;<BR>
- *   <EM>Initial:</EM> medium<BR>
- *   <EM>Applies to:</EM> all elements<BR>
- *   <EM>Inherited:</EM> yes<BR>
- *   <EM>Percentage values:</EM> relative to parent element's font size<BR>
- *   <DL>
- *     <DT>
- *       <B>&lt;absolute-size&gt;</B>
- *     <DD> An &lt;absolute-size&gt; keyword is an index to a table of font
- *     sizes computed and kept by the UA. Possible values are: [ xx-small |
- *     x-small | small | medium | large | x-large | xx-large ]. On a computer
- *     screen a scaling factor of 1.5 is suggested between adjacent indexes; if
- *     the 'medium' font is 10pt, the 'large' font could be 15pt. Different
- *     media may need different scaling factors. Also, the UA should take the
- *     quality and availability of fonts into account when computing the
- *     table. The table may be different from one font family to another.
- *     <DT>
- *       <B>&lt;relative-size&gt;</B>
- *     <DD> A &lt;relative-size&gt; keyword is interpreted relative to the table
- *     of font sizes and the font size of the parent element. Possible values
- *     are: [ larger | smaller ]. For example, if the parent element has a font
- *     size of 'medium', a value of 'larger' will make the font size of the
- *     current element be 'large'.  If the parent element's size is not close to
- *     a table entry, the UA is free to interpolate between table entries or
- *     round off to the closest one. The UA may have to extrapolate table values
- *     if the numerical value goes beyond the keywords.
- *   </DL>
- *   <P> Length and percentage values should not take the font size table into
- *   account when calculating the font size of the element.
- *   <P> Negative values are not allowed.
- *   <P> On all other properties, 'em' and 'ex' length values refer to the font
- *   size of the current element. On the 'font-size' property, these length
- *   units refer to the font size of the parent element.
- *   <P>
- *   Note that an application may reinterpret an explicit size, depending on the
- *   context. E.g., inside a VR scene a font may get a different size because
- *   of perspective distortion.
- *   <P>
- *   Examples:
- *   <PRE>
- *   P { font-size: 12pt; }
- *   BLOCKQUOTE { font-size: larger }
- *   EM { font-size: 150% }
- *   EM { font-size: 1.5em }
- *   </PRE>
- *   <P>
- *   If the suggested scaling factor of 1.5 is used, the last three declarations
- *   are identical.
- * @version $Revision$
+ * @spec http://www.w3.org/TR/2008/REC-CSS1-20080411/#font-size
  */
-public class CssFontSize extends CssProperty implements CssFontConstant {
-
-    int value;
-    CssValue cssValue;
-
-    /**
-     * Create a new FontSize
-     */
-    public CssFontSize() {
-	value = 3; // default value is medium
-    }
-
-    /**
-     * Creates a new CssFontSize
-     *
-     * @param expression the expression of the size
-     * @exception InvalidParamException The expression is incorrect
-     */
-    public CssFontSize(ApplContext ac, CssExpression expression,
-	    boolean check) throws InvalidParamException {
+public class CssFontSize extends org.w3c.css.properties.css.CssFontSize {
 
-	if(check && expression.getCount() > 1) {
-	    throw new InvalidParamException("unrecognize", ac);
-	}
+	public static final HashMap<String,CssIdent> allowed_values;
+	static final String[] absolute_values = {"xx-small", "x-small", "small", "medium", "large", "x-large", "xx-large"};
+	static final String[] relative_values = {"smaller", "larger"};
 
-	CssValue val = expression.getValue();
-	setByUser();
-	if (val instanceof CssIdent) {
-	    int hash = val.hashCode();
-	    for (int i=0; i<hash_values.length; i++) {
-		if (hash_values[i] == hash) {
-		    value = i;
-		    cssValue = null;
-		    expression.next();
-		    return;
+	static {
+		allowed_values = new HashMap<String, CssIdent>();
+		for (String s : absolute_values) {
+			allowed_values.put(s, CssIdent.getIdent(s));
+		}
+		for (String s : relative_values) {
+			allowed_values.put(s, CssIdent.getIdent(s));
 		}
-	    }
-	} else if (val instanceof CssPercentage) {
-	    float num = ((Float) val.get()).floatValue();
-	    if (num < 0) {
-		throw new InvalidParamException("negative-value",
-						val.toString(), ac);
-	    }
-	    this.cssValue = val;
-	    expression.next();
-	    return;
-	} else if (val instanceof CssNumber) {
-	    CssValue length = ((CssNumber) val).getLength();
-	    if (length != null) {
-		cssValue = length;
-		expression.next();
-		return;
-	    }
-	} else if (val instanceof CssLength) {
-	    float f = ((Float) val.get()).floatValue();
-	    if (f >= 0) {
-		cssValue = val;
-		expression.next();
-		return;
-	    } else {
-		throw new InvalidParamException("negative-value",
-						val.toString(), ac);
-	    }
+	}
+	/**
+	 * Create a new CssFontSize
+	 */
+	public CssFontSize() {
 	}
 
-	throw new InvalidParamException("value",
-					val, getPropertyName(), ac);
-    }
-
-    public CssFontSize(ApplContext ac, CssExpression expression)
-	throws InvalidParamException {
-	this(ac, expression, false);
-    }
-
-    /**
-     * Returns the current value
-     */
-    public Object get() {
-	if (cssValue != null)
-	    return cssValue;
-	else
-	    return FONTSIZE[value];
-    }
-
-    /**
-     * Returns true if this property is "softly" inherited
-     * e.g. his value equals inherit
-     */
-    public boolean isSoftlyInherited() {
-	return value == FONTSIZE.length - 1;
-    }
-
-    /**
-     * Returns a string representation of the object.
-     */
-    public String toString() {
-	if (cssValue != null)
-	    return cssValue.toString();
-	else
-	    return FONTSIZE[value];
-    }
-
+	/**
+	 * Creates a new CssFontSize
+	 *
+	 * @param expression The expression for this property
+	 * @throws org.w3c.css.util.InvalidParamException
+	 *          Expressions are incorrect
+	 */
+	public CssFontSize(ApplContext ac, CssExpression expression, boolean check)
+			throws InvalidParamException {
+		if (check && expression.getCount() > 1) {
+			throw new InvalidParamException("unrecognize", ac);
+		}
+		setByUser();
 
-    /**
-     * Returns the name of this property
-     */
-    public String getPropertyName() {
-	return "font-size";
-    }
+		CssValue val;
+		char op;
 
-    /**
-     * Add this property to the CssStyle.
-     *
-     * @param style The CssStyle
-     */
-    public void addToStyle(ApplContext ac, CssStyle style) {
-	CssFont cssFont = ((Css1Style) style).cssFont;
-	if (cssFont.fontSize != null)
-	    style.addRedefinitionWarning(ac, this);
-	cssFont.fontSize = this;
-    }
+		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) {
-	if (resolve) {
-	    return ((Css1Style) style).getFontSize();
-	} else {
-	    return ((Css1Style) style).cssFont.fontSize;
+		switch (val.getType()) {
+			case CssTypes.CSS_NUMBER:
+				val = ((CssNumber)val).getLength();
+			case CssTypes.CSS_LENGTH:
+				CssLength l = (CssLength) val;
+				if (!l.isPositive()) {
+					throw new InvalidParamException("negative-value",
+							val.toString(), ac);
+				}
+				value = l;
+				break;
+			case CssTypes.CSS_PERCENTAGE:
+				CssPercentage p = (CssPercentage) val;
+				if (!p.isPositive()) {
+					throw new InvalidParamException("negative-value",
+							val.toString(), ac);
+				}
+				value = p;
+				break;
+			case CssTypes.CSS_IDENT:
+				value = allowed_values.get(val.toString());
+				if (value == null) {
+					throw new InvalidParamException("value",
+							expression.getValue().toString(),
+							getPropertyName(), ac);
+				}
+				break;
+			default:
+				throw new InvalidParamException("value",
+						expression.getValue().toString(),
+						getPropertyName(), ac);
+		}
+		expression.next();
 	}
-    }
 
-    /**
-     * Compares two properties for equality.
-     *
-     * @param value The other property.
-     */
-    public boolean equals(CssProperty property) {
-	if (cssValue == null)
-	    return (property instanceof CssFontSize &&
-		    ((CssFontSize) property).value == value);
-	else
-	    return (property instanceof CssFontSize &&
-		    ((CssFontSize) property).cssValue.equals(cssValue));
-    }
+	public CssFontSize(ApplContext ac, CssExpression expression)
+			throws InvalidParamException {
+		this(ac, expression, false);
+	}
 
-    private static int[] hash_values;
 
-    static {
-	hash_values = new int[FONTSIZE.length];
-	for (int i=0; i<FONTSIZE.length; i++)
-	    hash_values[i] = FONTSIZE[i].hashCode();
-    }
 }
+

Index: CssFontWeight.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css1/CssFontWeight.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- CssFontWeight.java	26 Mar 2012 11:14:39 -0000	1.6
+++ CssFontWeight.java	4 Aug 2012 21:17:05 -0000	1.7
@@ -1,197 +1,95 @@
-//
 // $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.*;
+import org.w3c.css.values.CssExpression;
+import org.w3c.css.values.CssIdent;
+import org.w3c.css.values.CssNumber;
+import org.w3c.css.values.CssTypes;
+import org.w3c.css.values.CssValue;
+
+import java.util.HashMap;
 
 /**
- * <H4>
- * &nbsp;&nbsp; 'font-weight'
- * </H4>
- * <p/>
- * <EM>Value:</EM> normal | bold | bolder | lighter | 100 | 200 | 300 | 400
- * | 500 | 600 | 700 | 800 | 900<BR>
- * <EM>Initial:</EM> normal<BR>
- * <EM>Applies to:</EM> all elements<BR>
- * <EM>Inherited:</EM> yes<BR>
- * <EM>Percentage values:</EM> N/A<BR>
- * <P> The 'font-weight' property selects the weight of the font. The values
- * '100' to '900' form an ordered sequence, where each number indicates a
- * weight that is at least as dark as its predecessor. The keyword 'normal' is
- * synonymous with '400', and 'bold' is synonymous with '700'. Keywords other
- * than 'normal' and 'bold' have been shown to be often confused with font
- * names and a numerical scale was therefore chosen for the 9-value list.
- * <PRE>
- * P { font-weight: normal }    400
- * H1 { font-weight: 700 }      bold
- * </PRE>
- * <p/>
- * The 'bolder' and 'lighter' values select font weights that are relative to
- * the weight inherited from the parent:
- * <PRE>
- * STRONG { font-weight: bolder }
- * </PRE>
- * <p/>
- * Child elements inherit the resultant weight, not the keyword value.
- * <P> Fonts (the font data) typically have one or more properties whose
- * values are names that are descriptive of the "weight" of a font. There is
- * no accepted, universal meaning to these weight names. Their primary role is
- * to distinguish faces of differing darkness within a single font
- * family. Usage across font families is quite variant; for example a font
- * that you might think of as being bold might be described as being
- * <EM>Regular, Roman, Book, Medium, Semi-</EM> or <EM>DemiBold, Bold,</EM> or
- * <EM>Black,</EM> depending on how black the "normal" face of the font is
- * within the design. Because there is no standard usage of names, the weight
- * property values in CSS1 are given on a numerical scale in which the value
- * '400' (or 'normal') corresponds to the "normal" text face for that
- * family. The weight name associated with that face will typically be
- * <EM>Book, Regular, Roman, Normal</EM> or sometimes <EM>Medium</EM>.
- * <p/>
- * The association of other weights within a family to the numerical weight
- * values is intended only to preserve the ordering of darkness within that
- * family. However, the following heuristics tell how the assignment is done
- * in typical cases:
- * <UL>
- * <LI> If the font family already uses a numerical scale with nine values
- * (like e.g. <EM>OpenType</EM> does), the font weights should be mapped
- * directly.
- * <LI> If there is both a face labeled <EM>Medium</EM> and one labeled
- * <EM>Book, Regular, Roman</EM> or <EM>Normal,</EM> then the
- * <EM>Medium</EM> is normally assigned to the '500'.
- * <LI> The font labeled "Bold" will often correspond to the weight value
- * '700'.
- * <LI> If there are fewer then 9 weights in the family, the default
- * algorithm for filling the "holes" is as follows. If '500' is unassigned,
- * it will be assigned the same font as '400'. If any of the values '600',
- * '700', '800' or '900' remains unassigned, they are assigned to the same
- * face as the next darker assigned keyword, if any, or the next lighter one
- * otherwise. If any of '300', '200' or '100' remains unassigned, it is
- * assigned to the next lighter assigned keyword, if any, or the next darker
- * otherwise.
- * </UL>
- * <P> The following two examples illustrate the process. Assume four weights
- * in the "Example1" family, from lightest to darkest: <EM>Regular, Medium,
- * Bold, Heavy.</EM> And assume six weights in the "Example2" family:
- * <EM>Book, Medium, Bold, Heavy, Black, ExtraBlack.</EM> Note how in the
- * second example it has been decided <EM>not</EM> to assign "Example2
- * ExtraBlack" to anything.
- * <PRE>
- * Available faces       |  Assignments  |  Filling the holes
- * ----------------------+---------------+-------------------
- * "Example1 Regular"    |  400          |  100, 200, 300
- * "Example1 Medium"     |  500          |
- * "Example1 Bold"       |  700          |  600
- * "Example1 Heavy"      |  800          |  900
- * </PRE>
- * <PRE>
- * Available faces       |  Assignments  |  Filling the holes
- * ----------------------+---------------+-------------------
- * "Example2 Book"       |  400          |  100, 200, 300
- * "Example2 Medium"     |  500          |
- * "Example2 Bold"       |  700          |  600
- * "Example2 Heavy"      |  800          |
- * "Example2 Black"      |  900          |
- * "Example2 ExtraBlack" |  (none)       |
- * </PRE>
- * <P> Since the intent of the relative keywords 'bolder' and 'lighter' is to
- * darken or lighten the face <EM>within the family</EM> and because a family
- * may not have faces aligned with all the symbolic weight values, the
- * matching of 'bolder' is to the next darker face available on the client
- * within the family and the matching of 'lighter' is to the next lighter face
- * within the family.  To be precise, the meaning of the relative keywords
- * 'bolder' and 'lighter' is as follows:
- * <UL>
- * <LI> 'bolder' selects the next weight that is assigned to a font that is
- * darker than the inherited one. If there is no such weight, it simply
- * results in the next darker numerical value (and the font remains
- * unchanged), unless the inherited value was '900' in which case the
- * resulting weight is also '900'.
- * <LI> 'lighter' is similar, but works in the opposite direction: it
- * selects the next lighter keyword with a different font from the inherited
- * one, unless there is no such font, in which case it selects the next
- * lighter numerical value (and keeps the font unchanged).
- * </UL>
- * <P> There is no guarantee that there will be a darker face for each of the
- * 'font-weight' values; for example, some fonts may have only a normal and a
- * bold face, others may have eight different face weights. There is no
- * guarantee on how a UA will map font faces within a family to weight
- * values. The only guarantee is that a face of a given value will be no less
- * dark than the faces of lighter values.
- *
- * @version $Revision$
+ * @spec http://www.w3.org/TR/2008/REC-CSS1-20080411/#font-weight
  */
-public class CssFontWeight extends CssProperty implements CssFontConstant {
-
-
-    /**
-     * an index in a array
-     *
-     * @see CssFontConstant#FONTWEIGHT
-     */
-    protected int value;
+public class CssFontWeight extends org.w3c.css.properties.css.CssFontWeight {
 
-    // internal hack to compare strings
-    private static int[] hash_values;
+	public static final HashMap<String,CssIdent> allowed_values;
+	static final String[] _allowed_values = {"normal", "bold", "bolder", "lighter"};
 
+	static {
+		allowed_values = new HashMap<String, CssIdent>(_allowed_values.length);
+		for (String s : _allowed_values) {
+			allowed_values.put(s, CssIdent.getIdent(s));
+		}
+	}
     /**
-     * Create a new FontWeight with the default value.
+     * Create a new CssFontWeight
      */
     public CssFontWeight() {
-        // nothing to do
     }
 
     /**
-     * Creates a new CssFontWeight with an expression.
+     * Creates a new CssFontWeight
      *
-     * @param expr the expression
-     * @throws InvalidParamException values are incorrect
+     * @param expression The expression for this property
+     * @throws org.w3c.css.util.InvalidParamException
+     *          Expressions are incorrect
      */
-    public CssFontWeight(ApplContext ac, CssExpression expr, boolean check)
+    public CssFontWeight(ApplContext ac, CssExpression expression, boolean check)
             throws InvalidParamException {
+		if (check && expression.getCount() > 1) {
+			throw new InvalidParamException("unrecognize", ac);
+		}
+		setByUser();
 
-        if (check && expr.getCount() > 1) {
-            throw new InvalidParamException("unrecognize", ac);
-        }
-
-        CssValue val = expr.getValue();
+		CssValue val;
+		char op;
 
-        setByUser();
+		val = expression.getValue();
+		op = expression.getOperator();
 
-        switch (val.getType()) {
-            case CssTypes.CSS_IDENT:
-                int hash = expr.getValue().hashCode();
-                // try to find the hashCode in my internal hack array
-                for (int i = 0; i < hash_values.length; i++) {
-                    if (hash_values[i] == hash) {
-                        this.value = i;
-                        expr.next();
-                        return;
-                    }
-                }
-                throw new InvalidParamException("value", expr.getValue().toString(),
-                        getPropertyName(), ac);
-            case CssTypes.CSS_NUMBER:
-                CssNumber num = (CssNumber) val;
-                if (num.isInteger()) {
-                    int vali = num.getInt();
-                    if (isCorrectWeight(vali)) { // verify the entire part number
-                        this.value = vali;
-                        break;
-                    }
-                }
-            default:
-                throw new InvalidParamException("value", expr.getValue().toString(),
-                        getPropertyName(), ac);
-        }
-        expr.next();
+		switch (val.getType()) {
+			case CssTypes.CSS_NUMBER:
+				CssNumber num = (CssNumber) val;
+				switch(num.getInt()) {
+					case 100:
+					case 200:
+					case 300:
+					case 400:
+					case 500:
+					case 600:
+					case 700:
+					case 800:
+					case 900:
+					   value = num;
+						break;
+					default:
+						throw new InvalidParamException("value",
+								val.toString(),
+								getPropertyName(), ac);
+				}
+				break;
+			case CssTypes.CSS_IDENT:
+				value = allowed_values.get(val.toString());
+				if (value == null) {
+					throw new InvalidParamException("value",
+							val.toString(),
+							getPropertyName(), ac);
+				}
+				break;
+			default:
+				throw new InvalidParamException("value",
+						expression.getValue().toString(),
+						getPropertyName(), ac);
+		}
+		expression.next();
     }
 
     public CssFontWeight(ApplContext ac, CssExpression expression)
@@ -199,95 +97,5 @@
         this(ac, expression, false);
     }
 
-    /**
-     * Returns the current value.
-     */
-    public Object get() {
-        if (value >= 100)
-            return new Integer(value);
-        else
-            return FONTWEIGHT[value];
-    }
-
-
-    /**
-     * Returns true if this property is "softly" inherited
-     * e.g. his value equals inherit
-     */
-    public boolean isSoftlyInherited() {
-        return value == FONTWEIGHT.length - 1;
-    }
-
-    /**
-     * Returns a string representation of the object.
-     */
-    public String toString() {
-        if (value >= 100)
-            return Integer.toString(value);
-        else
-            return FONTWEIGHT[value];
-    }
-
-    /**
-     * Returns the name of this property.
-     */
-    public String getPropertyName() {
-        return "font-weight";
-    }
-
-    /**
-     * Add this property to the CssStyle
-     *
-     * @param style The CssStyle
-     */
-    public void addToStyle(ApplContext ac, CssStyle style) {
-        CssFont cssFont = ((Css1Style) style).cssFont;
-        if (cssFont.fontWeight != null)
-            style.addRedefinitionWarning(ac, this);
-        cssFont.fontWeight = 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).getFontWeight();
-        } else {
-            return ((Css1Style) style).cssFont.fontWeight;
-        }
-    }
-
-    /**
-     * Compares two properties for equality.
-     *
-     * @param value The other property.
-     */
-    public boolean equals(CssProperty property) {
-        return (property instanceof CssFontWeight &&
-                ((CssFontWeight) property).value == value);
-    }
-
-    /**
-     * Is the value of this property is a default value.
-     * It is used by all macro for the function <code>print</code>
-     */
-    public boolean isDefault() {
-        return value == 0;
-    }
-
-    private boolean isCorrectWeight(int val) {
-        val = val / 100;
-        return val > 0 && val < 10;
-    }
-
-    static {
-        hash_values = new int[FONTWEIGHT.length];
-        for (int i = 0; i < FONTWEIGHT.length; i++)
-            hash_values[i] = FONTWEIGHT[i].hashCode();
-    }
 }
 

Index: CssFontFamily.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css1/CssFontFamily.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- CssFontFamily.java	5 Jan 2010 13:49:43 -0000	1.5
+++ CssFontFamily.java	4 Aug 2012 21:17:05 -0000	1.6
@@ -1,372 +1,204 @@
-//
 // $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 java.util.Enumeration;
-import java.util.Vector;
-
-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.util.Util;
 import org.w3c.css.values.CssExpression;
 import org.w3c.css.values.CssIdent;
-import org.w3c.css.values.CssOperator;
-import org.w3c.css.values.CssString;
+import org.w3c.css.values.CssTypes;
 import org.w3c.css.values.CssValue;
 
-/**
- *   <H4>
- *     &nbsp;&nbsp; 'font-family'
- *   </H4>
- *   <P>
- *   <EM>Value:</EM> [[&lt;family-name&gt; | &lt;generic-family&gt;],]*
- *   [&lt;family-name&gt; | &lt;generic-family&gt;]<BR>
- *   <EM>Initial:</EM> UA specific<BR>
- *   <EM>Applies to:</EM> all elements<BR>
- *   <EM>Inherited:</EM> yes<BR>
- *   <EM>Percentage values:</EM> N/A<BR>
- *   <P>
- *   The value is a prioritized list of font family names and/or generic family
- *   names. Unlike most other CSS1 properties, values are separated by a comma
- *   to indicate that they are alternatives:
- *   <PRE>
- *   BODY { font-family: gill, helvetica, sans-serif }
- * </PRE>
- *   <P>
- *   There are two types of list values:
- *   <DL>
- *     <DT>
- *       <STRONG>&lt;family-name&gt;</STRONG>
- *     <DD> The name of a font family of choice. In the last example, "gill" and
- *     "helvetica" are font families.
- *     <DT>
- *       <STRONG>&lt;generic-family&gt;</STRONG>
- *     <DD> In the example above, the last value is a generic family name. The
- *     following generic families are defined:
- *       <UL>
- * 	<LI>
- * 	  'serif' (e.g. Times)
- * 	<LI>
- * 	  'sans-serif' (e.g. Helvetica)
- * 	<LI>
- * 	  'cursive' (e.g. Zapf-Chancery)
- * 	<LI>
- * 	  'fantasy' (e.g. Western)
- * 	<LI>
- * 	  'monospace' (e.g. Courier)
- *       </UL>
- *       <P> Style sheet designers are encouraged to offer a generic font family
- *       as a last alternative.
- *   </DL>
- *   <P>
- *   Font names containing whitespace should be quoted:
- *   <PRE>
- *   BODY { font-family: "new century schoolbook", serif }
- *
- *   &lt;BODY STYLE="font-family: 'My own font', fantasy"&gt;
- *  </PRE>
- *   <P>
- *   If quoting is omitted, any whitespace characters before and after the font
- *   name are ignored and any sequence of whitespace characters inside the font
- *   name is converted to a single space.
- *
- * @see CssFont
- * @version $Revision$
- */
-public class CssFontFamily extends CssProperty implements CssOperator {
-
-    Vector family_name = new Vector();
-
-    boolean inheritedValue;
-
-	CssIdent none = new CssIdent("none");
-	CssValue fontfamily = null;
-
-    static String[] genericFamily = { "serif", "sans-serif", "cursive",
-				      "fantasy", "monospace" };
-
-    static int[] genericFamilyHash;
-
-    boolean withSpace = false;
-
-    /**
-     * Create a new CssFontFamily
-     */
-    public CssFontFamily() {
-    }
+import java.util.ArrayList;
 
-    /**
-     * Create a new CssFontFamily
-     *
-     * @param expression the font name
-     * @exception InvalidParamException The expression is incorrect
-     */
-    public CssFontFamily(ApplContext ac, CssExpression expression,
-	    boolean check)
-	    throws InvalidParamException {
+import static org.w3c.css.values.CssOperator.COMMA;
+import static org.w3c.css.values.CssOperator.SPACE;
 
-	boolean manyValues = expression.getCount() > 1;
+/**
+ * @spec http://www.w3.org/TR/2008/REC-CSS1-20080411/#font-family
+ */
+public class CssFontFamily extends org.w3c.css.properties.css.CssFontFamily {
 
-	boolean family = true;
-	CssValue val = expression.getValue();
-	char op;
+	public static final ArrayList<CssIdent> genericNames;
+	public static final ArrayList<CssIdent> reservedNames;
 
-	setByUser();
-	//@@ and if name is already in the vector ?
+	public static final String[] _genericNames = {
+			"serif",
+			"sans-serif",
+			"cursive",
+			"fantasy",
+			"monospace"};
 
+	public static final String[] _reservedNames = {"inherit",
+			"initial", "default"
+	};
 
-	if (val.equals(inherit)) {
-	    if(expression.getCount() > 1) {
-		throw new InvalidParamException("unrecognize", ac);
-	    }
-	    inheritedValue = true;
-	    expression.next();
-	    return;
-	} else if (val.equals(none)) {
-	    if(expression.getCount() > 1) {
-		throw new InvalidParamException("unrecognize", ac);
-	    }
-	    fontfamily = none;
-	    expression.next();
-	    return;
+	static {
+		genericNames = new ArrayList<CssIdent>();
+		for (String s : _genericNames) {
+			genericNames.add(CssIdent.getIdent(s));
+		}
+		reservedNames = new ArrayList<CssIdent>();
+		for (String s : _reservedNames) {
+			reservedNames.add(CssIdent.getIdent(s));
+		}
 	}
 
-	while (family) {
-	    val = expression.getValue();
-	    op = expression.getOperator();
-
-	    if(manyValues && val != null && val.equals(inherit)) {
-		throw new InvalidParamException("unrecognize", ac);
-	    }
-
-	    if ((op != COMMA) && (op != SPACE)) {
-		throw new InvalidParamException("operator",
-			((new Character(op)).toString()),
-			ac);
-	    }
-
-	    if(val != null && val.equals(inherit)) {
-		throw new InvalidParamException("unrecognize", ac);
-	    }
+	static CssIdent getGenericFontName(CssIdent ident) {
+		int pos = genericNames.indexOf(ident);
+		if (pos >= 0) {
+			return genericNames.get(pos);
+		}
+		return null;
+	}
 
-	    if (val instanceof CssString) {
-		String familyName = null;
-		if (op == COMMA) { // "helvetica", "roman"
-		    familyName = trimToOneSpace(val.toString());
-		    expression.next();
-		} else { // "helvetica" CssValue
-		    familyName = trimToOneSpace(val.toString());
-		    family = false;
-		    expression.next();
+	static CssIdent getReservedFontName(CssIdent ident) {
+		int pos = reservedNames.indexOf(ident);
+		if (pos >= 0) {
+			return reservedNames.get(pos);
 		}
-		if (familyName.length() > 2) {
-		    String tmp = familyName.substring(1, familyName.length()-1);
-		    for (int i = 0; i < genericFamily.length; i++) {
-			if (genericFamily[i].equals(tmp)) {
-			    throw new InvalidParamException("generic-family.quote",
-				    genericFamily[i],
-				    getPropertyName(),
-				    ac);
+		return null;
+	}
+
+	private void checkExpression(ApplContext ac, ArrayList<CssValue> curval,
+								 ArrayList<CssIdent> values, boolean check) {
+		CssIdent val;
+		if (values.size() > 1) {
+			// create a value out of that. We could even create
+			// a CssString for the output (TODO ?)
+			StringBuilder sb = new StringBuilder();
+			boolean addSpace = false;
+			for (CssIdent id : values) {
+				if (addSpace) {
+					sb.append(' ');
+				} else {
+					addSpace = true;
+				}
+				sb.append(id);
 			}
-		    }
-		}
-		family_name.addElement(familyName);
-	    } else if (val instanceof CssIdent) {
-		if (op == COMMA) {
-		    family_name.addElement(convertString(val.toString()));
-		    expression.next();
+			ac.getFrame().addWarning("with-space", 1);
+			val = new CssIdent(sb.toString());
 		} else {
-		    CssValue next = expression.getNextValue();
-
-		    if (next != null) {
-			CssIdent New = new CssIdent(val.get() + " "
-						    + next.get());
-			withSpace = true;
-			expression.remove();
-			op = expression.getOperator();
-			expression.remove();
-			expression.insert(New);
-			expression.setCurrentOperator(op);
-		    } else {
-			family_name.addElement(convertString(val.toString()));
-			expression.next();
-			family = false;
-		    }
+			val = values.get(0);
+			// could be done in the consistency check, but...
+			if (null != getGenericFontName(val)) {
+				hasGenericFontFamily = true;
+			}
+			if (inherit.equals(val)) {
+				val = inherit;
+			}
 		}
-	    } else
-		throw new InvalidParamException("value", expression.getValue(),
-						getPropertyName(), ac);
-	}
-	if(check && !expression.end()) {
-	    throw new InvalidParamException("unrecognize", ac);
+		curval.add(val);
 	}
-	// This looks like obsolete code: (no context, no level, and duplicate 
-	// of a warning handled already in CSS1Style.java
-	// olivier 2006-12-13
-	//if (!containsGenericFamily()) {
-	//    ac.getFrame().addWarning("no-generic-family", "font-family");
-	//}
-    }
 
-    public CssFontFamily(ApplContext ac, CssExpression expression)
-	throws InvalidParamException {
-	this(ac, expression, false);
-    }
+	// final consistency check
+	private void checkValues(ApplContext ac, ArrayList<CssValue> values)
+			throws InvalidParamException {
+		// we need to check that we don't have 'inherit' in multiple values
+		if (values.size() > 1) {
+			for (CssValue val : values) {
+				if (inherit.equals(val)) {
+					throw new InvalidParamException("unrecognize", ac);
+				}
+			}
+		}
+	}
 
-    /**
-     * Returns all fonts name
-     */
-    public Enumeration elements() {
-	return family_name.elements();
-    }
+	/**
+	 * Creates a new CssFontFamily
+	 *
+	 * @param expression The expression for this property
+	 * @throws org.w3c.css.util.InvalidParamException
+	 *          Expressions are incorrect
+	 */
+	public CssFontFamily(ApplContext ac, CssExpression expression, boolean check)
+			throws InvalidParamException {
 
-    /**
-     * Returns the size
-     */
-    public int size() {
-	return family_name.size();
-    }
 
-    /**
-     * Returns the font (null if no font)
-     */
-    public Object get() {
+		ArrayList<CssValue> values = new ArrayList<CssValue>();
 
-		if (fontfamily != null) {
-			return fontfamily;
-		} else if (family_name.size() == 0) {
-		    return null;
+		while (!expression.end()) {
+			char op = expression.getOperator();
+			CssValue val = expression.getValue();
+			switch (val.getType()) {
+				case CssTypes.CSS_STRING:
+					// check it's not a quoted reserved keyword
+					String s = val.toString();
+					if (s.length() > 2) {
+						// we remove quotes and check it's not reserved.
+						CssIdent id = new CssIdent(s.substring(1, s.length() - 1));
+						if (getGenericFontName(id) != null) {
+							ac.getFrame().addWarning("generic-family.quote", 2);
+						}
+					}
+					values.add(val);
+					break;
+				case CssTypes.CSS_IDENT:
+					ArrayList<CssIdent> idval = new ArrayList<CssIdent>();
+					idval.add((CssIdent) val);
+					// we add idents if separated by spaces...
+					expression.next();
+					while (op == SPACE && !expression.end()) {
+						op = expression.getOperator();
+						val = expression.getValue();
+						if (val.getType() == CssTypes.CSS_IDENT) {
+							idval.add((CssIdent) val);
+						} else {
+							throw new InvalidParamException("value", val,
+									getPropertyName(), ac);
+						}
+						expression.next();
+					}
+					checkExpression(ac, values, idval, check);
+					break;
+				default:
+					throw new InvalidParamException("value", val,
+							getPropertyName(), ac);
+			}
+			expression.next();
+			if (!expression.end() && (op != COMMA)) {
+				throw new InvalidParamException("operator",
+						((new Character(op)).toString()), ac);
+			}
 		}
-
-		return family_name.firstElement();
-    }
-
-    /**
-     * Returns true if this property is "softly" inherited
-     * e.g. his value equals inherit
-     */
-    public boolean isSoftlyInherited() {
-	return inheritedValue;
-    }
-
-    /**
-     * Returns a string representation of the object.
-     */
-    public String toString() {
-	if (inheritedValue) {
-	    return inherit.toString();
-	} else {
-	    String r = "";
-	    for (Enumeration e = elements(); e.hasMoreElements();)
-		//		r += ", " + convertString(e.nextElement().toString());
-		r += ", " + e.nextElement().toString();
-	    if (r.length() < 3) {
-		return null;
-	    }
-	    return r.substring(2);
+		checkValues(ac, values);
+		value = (values.size() > 1) ? values : values.get(0);
 	}
-    }
 
-    String convertString (String value) {
-	if (value.indexOf('"') != -1) {
-	    return '\'' + value + '\'';
-	} else if (value.indexOf('\'') != -1) {
-	    return '"' + value + '"';
-	} else {
-	    return value;
+	public CssFontFamily(ApplContext ac, CssExpression expression)
+			throws InvalidParamException {
+		this(ac, expression, false);
 	}
-    }
 
-    /**
-     * Returns the name of this property
-     */
-    public String getPropertyName() {
-	return "font-family";
-    }
-
-    /**
-     * Add this property to the CssStyle.
-     *
-     * @param style The CssStyle
-     */
-    public void addToStyle(ApplContext ac, CssStyle style) {
-	CssFont cssFont = ((Css1Style) style).cssFont;
-
-	if (cssFont.fontFamily != null)
-	    style.addRedefinitionWarning(ac, this);
-	cssFont.fontFamily = 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).getFontFamily();
-	} else {
-	    return ((Css1Style) style).cssFont.fontFamily;
+	/**
+	 * Returns true if this property is "softly" inherited
+	 * e.g. his value is equals to inherit
+	 */
+	public boolean isSoftlyInherited() {
+		return inherit.equals(value);
 	}
-    }
-
-    /**
-     * Compares two properties for equality.
-     *
-     * @param value The other property.
-     */
-    public boolean equals(CssProperty property) {
-	return false; //@@ FIXME
-    }
 
-    private static String trimToOneSpace(String name) {
-	int count = name.length();
-	char[] dst = new char[count];
-	char[] src = new char[count];
-	int index = -1;
-
-	name.getChars(0, count, src, 0);
-	for(int i=0; i < count; i++)
-	    if ( i == 0 || ! Util.isWhiteSpace(src[i]) ||
-		 ( Util.isWhiteSpace(src[i]) &&
-		   !Util.isWhiteSpace(dst[index]) ) )
-		dst[++index] = src[i];
-
-	return new String(dst, 0, index+1);
-    }
+	/**
+	 * Returns a string representation of the object.
+	 */
+	public String toString() {
+		return value.toString();
+	}
 
-    /**
-     * Returns true if this property contains a generic family name
-     */
-    public boolean containsGenericFamily() {
-	if (family_name.size() == 0) {
-	    return true;
-	} else {
-	    for (Enumeration e = family_name.elements();
-		 e.hasMoreElements();) {
-		int hash = ((String) e.nextElement()).toLowerCase().hashCode();
-		for (int i = 0; i < genericFamilyHash.length; i++) {
-		    if (hash == genericFamilyHash[i])
-			return true;
-		}
-	    }
-	    return false;
+	/**
+	 * Compares two properties for equality.
+	 *
+	 * @param property The other property.
+	 */
+	public boolean equals(CssProperty property) {
+		return (property instanceof CssFontFamily &&
+				value.equals(((CssFontFamily) property).value));
 	}
-    }
 
 
-    static {
-	genericFamilyHash = new int[genericFamily.length];
-	for (int i = 0; i < genericFamily.length; i++) {
-	    genericFamilyHash[i] = genericFamily[i].hashCode();
-	}
-    }
 }
+

Received on Saturday, 4 August 2012 21:17:42 UTC