- From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
- Date: Fri, 24 Aug 2012 07:16:24 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/2002/css-validator/org/w3c/css/properties/css1 In directory hutz:/tmp/cvs-serv7645/css1 Modified Files: CssWhiteSpace.java Log Message: ident case sensitivity Index: CssWhiteSpace.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css1/CssWhiteSpace.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- CssWhiteSpace.java 9 Feb 2012 17:36:29 -0000 1.6 +++ CssWhiteSpace.java 24 Aug 2012 07:16:22 -0000 1.7 @@ -12,74 +12,64 @@ import org.w3c.css.values.CssTypes; import org.w3c.css.values.CssValue; -import java.util.HashMap; - /** * @version $Revision$ * @spec http://www.w3.org/TR/2008/REC-CSS1-20080411/#white-space */ public class CssWhiteSpace extends org.w3c.css.properties.css.CssWhiteSpace { - CssValue value; - - public static HashMap<String, CssIdent> allowed_values; - - static { - allowed_values = new HashMap<String, CssIdent>(); - String[] WHITESPACE = { - "normal", "pre", "nowrap" - }; - - for (String aWS : WHITESPACE) { - allowed_values.put(aWS, CssIdent.getIdent(aWS)); - } - } + public static CssIdent[] allowed_values; - /** - * Create a new CssWhiteSpace - * - * @param expression The expression for this property - * @throws InvalidParamException values are incorrect - */ - public CssWhiteSpace(ApplContext ac, CssExpression expression, boolean check) - throws InvalidParamException { + static { + String[] WHITESPACE = { + "normal", "pre", "nowrap" + }; + allowed_values = new CssIdent[WHITESPACE.length]; + int i = 0; + for (String aWS : WHITESPACE) { + allowed_values[i++] = CssIdent.getIdent(aWS); + } + } - if (check && expression.getCount() > 1) { - throw new InvalidParamException("unrecognize", ac); - } + public static final CssIdent getMatchingIdent(CssIdent ident) { + for (CssIdent id : allowed_values) { + if (id.equals(ident)) { + return id; + } + } + return null; + } - CssValue val = expression.getValue(); - setByUser(); + /** + * Create a new CssWhiteSpace + * + * @param expression The expression for this property + * @throws InvalidParamException values are incorrect + */ + public CssWhiteSpace(ApplContext ac, CssExpression expression, boolean check) + throws InvalidParamException { - if (val.getType() == CssTypes.CSS_IDENT) { - value = allowed_values.get(val.toString()); - if (value != null) { - expression.next(); - return; - } - } - throw new InvalidParamException("value", expression.getValue(), - getPropertyName(), ac); - } + if (check && expression.getCount() > 1) { + throw new InvalidParamException("unrecognize", ac); + } - public CssWhiteSpace(ApplContext ac, CssExpression expression) - throws InvalidParamException { - this(ac, expression, false); - } + CssValue val = expression.getValue(); + setByUser(); - /** - * Returns true if this property is "softly" inherited - * e.g. his value equals inherit - */ - public boolean isSoftlyInherited() { - return (inherit == value); - } + if (val.getType() == CssTypes.CSS_IDENT) { + value = getMatchingIdent((CssIdent) val); + if (value != null) { + expression.next(); + return; + } + } + throw new InvalidParamException("value", expression.getValue(), + getPropertyName(), ac); + } - /** - * Returns a string representation of the object. - */ - public String toString() { - return value.toString(); - } + public CssWhiteSpace(ApplContext ac, CssExpression expression) + throws InvalidParamException { + this(ac, expression, false); + } }
Received on Friday, 24 August 2012 07:16:25 UTC