- From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
- Date: Mon, 10 Sep 2012 17:05:00 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/2002/css-validator/org/w3c/css/properties/css3 In directory hutz:/tmp/cvs-serv25724/properties/css3 Modified Files: CssBackgroundSize.java CssBorder.java CssBorderImageOutset.java CssBorderImageSlice.java CssBorderImageWidth.java CssBorderRadius.java CssBorderWidth.java CssBoxShadow.java CssColumnCount.java CssColumnGap.java CssColumnWidth.java CssFontFeatureSettings.java CssFontSize.java CssHeight.java CssLineHeight.java CssMarqueePlayCount.java CssTextShadow.java CssWidth.java CssZIndex.java Log Message: value-driven range checking Index: CssTextShadow.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css3/CssTextShadow.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- CssTextShadow.java 6 Sep 2012 12:37:58 -0000 1.4 +++ CssTextShadow.java 10 Sep 2012 17:04:58 -0000 1.5 @@ -149,10 +149,7 @@ // sanity check third length if present must not be negative if (lcount == 3) { CssLength l = values.get(2).getLength(); - if (!l.isPositive()) { - throw new InvalidParamException("negative-value", - l, getPropertyName(), ac); - } + l.checkPositiveness(ac, this); } // sanity check we need two to three length if (lcount < 2 || lcount > 3) { Index: CssBorder.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css3/CssBorder.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- CssBorder.java 6 Sep 2012 12:37:57 -0000 1.3 +++ CssBorder.java 10 Sep 2012 17:04:58 -0000 1.4 @@ -121,10 +121,7 @@ case CssTypes.CSS_NUMBER: case CssTypes.CSS_LENGTH: CssLength length = val.getLength(); - if (!length.isPositive()) { - throw new InvalidParamException("negative-value", expression.getValue(), - caller.getPropertyName(), ac); - } + length.checkPositiveness(ac, caller); _width = val; break; case CssTypes.CSS_COLOR: Index: CssZIndex.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css3/CssZIndex.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- CssZIndex.java 6 Sep 2012 12:37:58 -0000 1.2 +++ CssZIndex.java 10 Sep 2012 17:04:58 -0000 1.3 @@ -11,6 +11,7 @@ import org.w3c.css.util.InvalidParamException; 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; @@ -47,13 +48,10 @@ setByUser(); switch (val.getType()) { case CssTypes.CSS_NUMBER: - if (val.getNumber().isInteger()) { - value = val; - break; - } - throw new InvalidParamException("integer", - val.toString(), - getPropertyName(), ac); + CssNumber number = val.getNumber(); + number.checkInteger(ac, this); + value = val; + break; case CssTypes.CSS_IDENT: CssIdent ide = (CssIdent) val; if (inherit.equals(ide)) { Index: CssBackgroundSize.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css3/CssBackgroundSize.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- CssBackgroundSize.java 6 Sep 2012 12:37:57 -0000 1.7 +++ CssBackgroundSize.java 10 Sep 2012 17:04:58 -0000 1.8 @@ -84,10 +84,7 @@ case CssTypes.CSS_NUMBER: case CssTypes.CSS_LENGTH: CssLength l = val.getLength(); - if (!l.isPositive()) { - throw new InvalidParamException("negative-value", - val.toString(), ac); - } + l.checkPositiveness(ac, this); if (is_complete) { vl = new CssValueList(); vl.add(val); @@ -100,10 +97,7 @@ case CssTypes.CSS_PERCENTAGE: // per spec only non-negative values are allowed CssPercentage p = val.getPercentage(); - if (!p.isPositive()) { - throw new InvalidParamException("negative-value", - val.toString(), ac); - } + p.checkPositiveness(ac, this); if (is_complete) { vl = new CssValueList(); vl.add(val); Index: CssHeight.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css3/CssHeight.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- CssHeight.java 6 Sep 2012 12:37:57 -0000 1.3 +++ CssHeight.java 10 Sep 2012 17:04:58 -0000 1.4 @@ -58,18 +58,12 @@ case CssTypes.CSS_NUMBER: case CssTypes.CSS_LENGTH: CssLength l = val.getLength(); - if (!l.isPositive()) { - throw new InvalidParamException("negative-value", - val.toString(), ac); - } + l.checkPositiveness(ac, this); value = l; break; case CssTypes.CSS_PERCENTAGE: CssPercentage p = val.getPercentage(); - if (!p.isPositive()) { - throw new InvalidParamException("negative-value", - val.toString(), ac); - } + p.checkPositiveness(ac, this); value = p; break; default: Index: CssColumnWidth.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css3/CssColumnWidth.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- CssColumnWidth.java 6 Sep 2012 12:37:57 -0000 1.12 +++ CssColumnWidth.java 10 Sep 2012 17:04:58 -0000 1.13 @@ -22,9 +22,6 @@ public class CssColumnWidth extends org.w3c.css.properties.css.CssColumnWidth { - private static final String propertyName = "column-width"; - - static CssIdent auto; static { @@ -64,11 +61,7 @@ getPropertyName(), ac); case CssTypes.CSS_LENGTH: CssLength l = val.getLength(); - if (l == null || !l.isStrictlyPositive()) { - throw new InvalidParamException("strictly-positive", - expression.getValue(), - getPropertyName(), ac); - } + l.checkStrictPositiveness(ac, this); value = val; break; case CssTypes.CSS_IDENT: Index: CssMarqueePlayCount.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css3/CssMarqueePlayCount.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- CssMarqueePlayCount.java 10 Sep 2012 11:47:17 -0000 1.4 +++ CssMarqueePlayCount.java 10 Sep 2012 17:04:58 -0000 1.5 @@ -50,11 +50,7 @@ switch (val.getType()) { case CssTypes.CSS_NUMBER: CssNumber num = val.getNumber(); - if (!num.isInteger()) { - throw new InvalidParamException("integer", - val.toString(), - getPropertyName(), ac); - } + num.checkInteger(ac, this); num.checkPositiveness(ac, this); value = num; break; Index: CssBorderRadius.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css3/CssBorderRadius.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- CssBorderRadius.java 6 Sep 2012 12:37:57 -0000 1.8 +++ CssBorderRadius.java 10 Sep 2012 17:04:58 -0000 1.9 @@ -64,18 +64,12 @@ case CssTypes.CSS_NUMBER: case CssTypes.CSS_LENGTH: CssLength length = val.getLength(); - if (!length.isPositive()) { - throw new InvalidParamException("negative-value", expression.getValue(), - getPropertyName(), ac); - } + length.checkPositiveness(ac, this); cur_radius.add(length); break; case CssTypes.CSS_PERCENTAGE: CssPercentage percentage = val.getPercentage(); - if (!percentage.isPositive()) { - throw new InvalidParamException("negative-value", expression.getValue(), - getPropertyName(), ac); - } + percentage.checkPositiveness(ac, this); cur_radius.add(percentage); break; case CssTypes.CSS_SWITCH: @@ -204,18 +198,12 @@ case CssTypes.CSS_NUMBER: case CssTypes.CSS_LENGTH: CssLength length = val.getLength(); - if (!length.isPositive()) { - throw new InvalidParamException("negative-value", expression.getValue(), - caller.getPropertyName(), ac); - } + length.checkPositiveness(ac, caller); res.add(length); break; case CssTypes.CSS_PERCENTAGE: CssPercentage percentage = val.getPercentage(); - if (!percentage.isPositive()) { - throw new InvalidParamException("negative-value", expression.getValue(), - caller.getPropertyName(), ac); - } + percentage.checkPositiveness(ac, caller); res.add(percentage); break; case CssTypes.CSS_IDENT: Index: CssFontFeatureSettings.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css3/CssFontFeatureSettings.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- CssFontFeatureSettings.java 6 Sep 2012 12:37:57 -0000 1.4 +++ CssFontFeatureSettings.java 10 Sep 2012 17:04:58 -0000 1.5 @@ -140,11 +140,7 @@ switch (val.getType()) { case CssTypes.CSS_NUMBER: CssNumber n = val.getNumber(); - if (!n.isPositive()) { - throw new InvalidParamException("negative-value", - val.toString(), - getPropertyName(), ac); - } + n.checkPositiveness(ac, this); v.add(n); break; case CssTypes.CSS_IDENT: Index: CssColumnCount.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css3/CssColumnCount.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- CssColumnCount.java 6 Sep 2012 12:37:57 -0000 1.11 +++ CssColumnCount.java 10 Sep 2012 17:04:58 -0000 1.12 @@ -53,15 +53,8 @@ switch (val.getType()) { case CssTypes.CSS_NUMBER: num = val.getNumber(); - if (!num.isInteger()) { - throw new InvalidParamException("integer", - expression.getValue(), getPropertyName(), ac); - } - if (!num.isStrictlyPositive()) { - throw new InvalidParamException("strictly-positive", - expression.getValue(), - getPropertyName(), ac); - } + num.checkInteger(ac, this); + num.checkStrictPositiveness(ac, this); value = val; break; case CssTypes.CSS_IDENT: Index: CssBorderWidth.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css3/CssBorderWidth.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- CssBorderWidth.java 6 Sep 2012 12:37:57 -0000 1.3 +++ CssBorderWidth.java 10 Sep 2012 17:04:58 -0000 1.4 @@ -95,10 +95,7 @@ case CssTypes.CSS_NUMBER: case CssTypes.CSS_LENGTH: CssLength length = val.getLength(); - if (!length.isPositive()) { - throw new InvalidParamException("negative-value", expression.getValue(), - getPropertyName(), ac); - } + length.checkPositiveness(ac, this); res.add(length); break; case CssTypes.CSS_IDENT: @@ -177,10 +174,7 @@ case CssTypes.CSS_NUMBER: case CssTypes.CSS_LENGTH: CssLength length = val.getLength(); - if (!length.isPositive()) { - throw new InvalidParamException("negative-value", expression.getValue(), - caller.getPropertyName(), ac); - } + length.checkPositiveness(ac, caller); retval = length; break; case CssTypes.CSS_IDENT: Index: CssLineHeight.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css3/CssLineHeight.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- CssLineHeight.java 6 Sep 2012 12:37:58 -0000 1.3 +++ CssLineHeight.java 10 Sep 2012 17:04:58 -0000 1.4 @@ -60,26 +60,17 @@ break; case CssTypes.CSS_LENGTH: CssLength length = val.getLength(); - if (!length.isPositive()) { - throw new InvalidParamException("negative-value", - val.toString(), ac); - } + length.checkPositiveness(ac, this); value = val; break; case CssTypes.CSS_NUMBER: CssNumber number = val.getNumber(); - if (!number.isPositive()) { - throw new InvalidParamException("negative-value", - val.toString(), ac); - } + number.checkPositiveness(ac, this); value = val; break; case CssTypes.CSS_PERCENTAGE: CssPercentage percent = val.getPercentage(); - if (!percent.isPositive()) { - throw new InvalidParamException("negative-value", - val.toString(), ac); - } + percent.checkPositiveness(ac, this); value = val; break; default: Index: CssColumnGap.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css3/CssColumnGap.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- CssColumnGap.java 6 Sep 2012 12:37:57 -0000 1.10 +++ CssColumnGap.java 10 Sep 2012 17:04:58 -0000 1.11 @@ -54,11 +54,7 @@ case CssTypes.CSS_NUMBER: case CssTypes.CSS_LENGTH: CssLength l = val.getLength(); - if (l == null || !l.isPositive()) { - throw new InvalidParamException("negative-value", - expression.getValue(), - getPropertyName(), ac); - } + l.checkPositiveness(ac, this); columngap = val; break; case CssTypes.CSS_IDENT: Index: CssFontSize.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css3/CssFontSize.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- CssFontSize.java 6 Sep 2012 12:37:57 -0000 1.4 +++ CssFontSize.java 10 Sep 2012 17:04:58 -0000 1.5 @@ -76,18 +76,12 @@ case CssTypes.CSS_NUMBER: case CssTypes.CSS_LENGTH: CssLength l = val.getLength(); - if (!l.isPositive()) { - throw new InvalidParamException("negative-value", - val.toString(), ac); - } + l.checkPositiveness(ac, this); value = l; break; case CssTypes.CSS_PERCENTAGE: CssPercentage p = val.getPercentage(); - if (!p.isPositive()) { - throw new InvalidParamException("negative-value", - val.toString(), ac); - } + p.checkPositiveness(ac, this); value = p; break; case CssTypes.CSS_IDENT: Index: CssWidth.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css3/CssWidth.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- CssWidth.java 6 Sep 2012 12:37:58 -0000 1.3 +++ CssWidth.java 10 Sep 2012 17:04:58 -0000 1.4 @@ -58,18 +58,12 @@ case CssTypes.CSS_NUMBER: case CssTypes.CSS_LENGTH: CssLength l = val.getLength(); - if (!l.isPositive()) { - throw new InvalidParamException("negative-value", - val.toString(), ac); - } + l.checkPositiveness(ac, this); value = l; break; case CssTypes.CSS_PERCENTAGE: CssPercentage p = val.getPercentage(); - if (!p.isPositive()) { - throw new InvalidParamException("negative-value", - val.toString(), ac); - } + p.checkPositiveness(ac, this); value = p; break; default: Index: CssBoxShadow.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css3/CssBoxShadow.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- CssBoxShadow.java 6 Sep 2012 12:37:57 -0000 1.12 +++ CssBoxShadow.java 10 Sep 2012 17:04:58 -0000 1.13 @@ -149,12 +149,7 @@ break; case 3: CssLength length = val.getLength(); - if (!length.isPositive()) { - throw new InvalidParamException("negative-value", - expression.getValue(), - getPropertyName(), ac); - - } + length.checkPositiveness(ac, this); value.blur_radius = length; break; case 4: Index: CssBorderImageWidth.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css3/CssBorderImageWidth.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- CssBorderImageWidth.java 6 Sep 2012 12:37:57 -0000 1.3 +++ CssBorderImageWidth.java 10 Sep 2012 17:04:58 -0000 1.4 @@ -64,26 +64,17 @@ switch (val.getType()) { case CssTypes.CSS_NUMBER: CssNumber num = val.getNumber(); - if (!num.isPositive()) { - throw new InvalidParamException("negative-value", num, - getPropertyName(), ac); - } + num.checkPositiveness(ac, this); valueList.add(val); break; case CssTypes.CSS_LENGTH: CssLength length = val.getLength(); - if (!length.isPositive()) { - throw new InvalidParamException("negative-value", length, - getPropertyName(), ac); - } + length.checkPositiveness(ac, this); valueList.add(val); break; case CssTypes.CSS_PERCENTAGE: CssPercentage percent = val.getPercentage(); - if (!percent.isPositive()) { - throw new InvalidParamException("negative-value", percent, - getPropertyName(), ac); - } + percent.checkPositiveness(ac, this); valueList.add(val); break; case CssTypes.CSS_IDENT: Index: CssBorderImageSlice.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css3/CssBorderImageSlice.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- CssBorderImageSlice.java 6 Sep 2012 12:37:57 -0000 1.3 +++ CssBorderImageSlice.java 10 Sep 2012 17:04:58 -0000 1.4 @@ -64,18 +64,13 @@ switch (val.getType()) { case CssTypes.CSS_NUMBER: CssNumber num = val.getNumber(); - if (!num.isPositive()) { - throw new InvalidParamException("negative-value", expression.getValue(), - getPropertyName(), ac); - } + num.checkPositiveness(ac, this); valueList.add(val); break; case CssTypes.CSS_PERCENTAGE: CssPercentage percent = val.getPercentage(); - if (!percent.isPositive()) { - throw new InvalidParamException("negative-value", expression.getValue(), - getPropertyName(), ac); - } + percent.checkPositiveness(ac, this); + // TODO range checking if (percent.floatValue() > 100f) { ac.getFrame().addWarning("out-of-range", percent.toString()); } Index: CssBorderImageOutset.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css3/CssBorderImageOutset.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- CssBorderImageOutset.java 6 Sep 2012 12:37:57 -0000 1.3 +++ CssBorderImageOutset.java 10 Sep 2012 17:04:58 -0000 1.4 @@ -52,18 +52,12 @@ switch (val.getType()) { case CssTypes.CSS_NUMBER: CssNumber num = val.getNumber(); - if (!num.isPositive()) { - throw new InvalidParamException("negative-value", num, - getPropertyName(), ac); - } + num.checkPositiveness(ac, this); valueList.add(val); break; case CssTypes.CSS_LENGTH: CssLength length = val.getLength(); - if (!length.isPositive()) { - throw new InvalidParamException("negative-value", length, - getPropertyName(), ac); - } + length.checkPositiveness(ac, this); valueList.add(val); break; case CssTypes.CSS_IDENT:
Received on Monday, 10 September 2012 17:05:06 UTC