- From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
- Date: Tue, 15 Dec 2009 17:23:51 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/2002/css-validator/org/w3c/css/properties/css3 In directory hutz:/tmp/cvs-serv6113 Modified Files: CssColumnWidth.java Log Message: check the length of the column, should be greater than 0 Index: CssColumnWidth.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css3/CssColumnWidth.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- CssColumnWidth.java 27 Mar 2008 15:50:31 -0000 1.3 +++ CssColumnWidth.java 15 Dec 2009 17:23:49 -0000 1.4 @@ -14,13 +14,14 @@ import org.w3c.css.util.InvalidParamException; import org.w3c.css.values.CssExpression; import org.w3c.css.values.CssIdent; +import org.w3c.css.values.CssLength; import org.w3c.css.values.CssNumber; import org.w3c.css.values.CssTypes; import org.w3c.css.values.CssValue; /** * <P> - * <EM>Value:</EM> <integer> || auto || inherit<BR> + * <EM>Value:</EM> <integer> || auto <BR> * <EM>Initial:</EM>auto<BR> * <EM>Applies to:</EM>block-level elements<BR> * <EM>Inherited:</EM>no<BR> @@ -37,6 +38,7 @@ CssValue width; static CssIdent auto; + static { auto = new CssIdent("auto"); } @@ -59,16 +61,30 @@ setByUser(); CssValue val = expression.getValue(); + Float value; switch (val.getType()) { case CssTypes.CSS_NUMBER: val = ((CssNumber)val).getLength(); + // if we didn't fall in the first trap, there is another one :) + throw new InvalidParamException("strictly-positive", + expression.getValue(), + getPropertyName(), ac); case CssTypes.CSS_LENGTH: + value = (Float) ((CssLength)val).get(); + if (value == null || value.floatValue() <= 0.0) { + throw new InvalidParamException("strictly-positive", + expression.getValue(), + getPropertyName(), ac); + } width = val; break; case CssTypes.CSS_IDENT: - if (inherit.equals(val) || auto.equals(val)) { - width = val; + if (inherit.equals(val)) { + width = inherit; + break; + } else if ( auto.equals(val)) { + width = auto; break; } default:
Received on Tuesday, 15 December 2009 17:23:53 UTC