- From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
- Date: Tue, 15 Dec 2009 16:59:45 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/2002/css-validator/org/w3c/css/properties/css3 In directory hutz:/tmp/cvs-serv32347 Modified Files: CssColumnCount.java Log Message: Fixed CssColumnCount to allow only strictly positive integers. Index: CssColumnCount.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css3/CssColumnCount.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- CssColumnCount.java 14 Sep 2005 15:15:04 -0000 1.2 +++ CssColumnCount.java 15 Dec 2009 16:59:43 -0000 1.3 @@ -15,6 +15,7 @@ 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; /** @@ -54,20 +55,36 @@ setByUser(); CssValue val = expression.getValue(); + CssNumber num; - if (val.equals(inherit)) { - count = val; - expression.next(); - } else if (val.equals(auto)) { - count = val; - expression.next(); - } else if (val instanceof CssNumber) { + switch(val.getType()) { + case CssTypes.CSS_NUMBER: + num = (CssNumber) val; + if (!num.isInteger()) { + throw new InvalidParamException("integer",expression.getValue(), + getPropertyName(), ac); + } + if (num.getInt() <= 0) { + throw new InvalidParamException("strictly-positive", + expression.getValue(), + getPropertyName(), ac); + } count = val; - expression.next(); - } else { + break; + case CssTypes.CSS_IDENT: + if (auto.equals(val)) { + count = auto; + break; + } + if (inherit.equals(val)) { + count = inherit; + break; + } + default: throw new InvalidParamException("value", expression.getValue(), getPropertyName(), ac); } + expression.next(); } public CssColumnCount(ApplContext ac, CssExpression expression) @@ -95,8 +112,7 @@ public CssProperty getPropertyInStyle(CssStyle style, boolean resolve) { if (resolve) { return ((Css3Style) style).getColumnCount(); - } - else { + } else { return ((Css3Style) style).cssColumnCount; } } @@ -129,7 +145,7 @@ * Returns true if this property is "softly" inherited */ public boolean isSoftlyInherited() { - return count.equals(inherit); + return (count == inherit); } /** @@ -146,5 +162,4 @@ public boolean isDefault() { return (count == auto); } - }
Received on Tuesday, 15 December 2009 16:59:55 UTC