- From: CVS User ylafon <cvsmail@w3.org>
- Date: Mon, 17 Dec 2012 14:28:31 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/2002/css-validator/org/w3c/css/values In directory roscoe:/tmp/cvs-serv13453 Modified Files: CssNumber.java CssPercentage.java Log Message: warning for lt --- /sources/public/2002/css-validator/org/w3c/css/values/CssNumber.java 2012/10/03 15:11:18 1.21 +++ /sources/public/2002/css-validator/org/w3c/css/values/CssNumber.java 2012/12/17 14:28:29 1.22 @@ -1,4 +1,4 @@ -// $Id: CssNumber.java,v 1.21 2012/10/03 15:11:18 ylafon Exp $ +// $Id: CssNumber.java,v 1.22 2012/12/17 14:28:29 ylafon Exp $ // From Philippe Le Hegaret (Philippe.Le_Hegaret@sophia.inria.fr) // // (c) COPYRIGHT MIT, ERCIM and Keio University, 2011 @@ -14,7 +14,7 @@ /** * A CSS number. * - * @version $Revision: 1.21 $ + * @version $Revision: 1.22 $ */ public class CssNumber extends CssCheckableValue implements CssValueFloat { @@ -301,7 +301,7 @@ } /** - * check if the value is positive or null + * check if the value is lower or equal than... * * @param ac the validation context * @param property the property the value is defined in @@ -315,4 +315,21 @@ toString(), other.toPlainString(), ac); } } + + /** + * check if the value is lower or equal than... + * + * @param ac the validation context + * @param property the property the value is defined in + * @throws InvalidParamException + */ + public void warnLowerEqualThan(ApplContext ac, double d, CssProperty property) { + BigDecimal other = BigDecimal.valueOf(d); + if (value.compareTo(other) > 0) { + String[] s = new String[2]; + s[0] = toString(); + s[1] = Double.toHexString(d); + ac.getFrame().addWarning("lowerequal", s); + } + } } --- /sources/public/2002/css-validator/org/w3c/css/values/CssPercentage.java 2012/10/03 09:49:18 1.15 +++ /sources/public/2002/css-validator/org/w3c/css/values/CssPercentage.java 2012/12/17 14:28:31 1.16 @@ -1,5 +1,5 @@ // -// $Id: CssPercentage.java,v 1.15 2012/10/03 09:49:18 ylafon Exp $ +// $Id: CssPercentage.java,v 1.16 2012/12/17 14:28:31 ylafon Exp $ // From Philippe Le Hegaret (Philippe.Le_Hegaret@sophia.inria.fr) // // (c) COPYRIGHT MIT, ERCIM and Keio University, 2010. @@ -33,7 +33,7 @@ * In all inherited CSS1 properties, if the value is specified as a percentage, * child elements inherit the resultant value, not the percentage value. * - * @version $Revision: 1.15 $ + * @version $Revision: 1.16 $ */ public class CssPercentage extends CssCheckableValue { @@ -210,4 +210,37 @@ ac.getFrame().addWarning("negative", toString()); } } + + /** + * check if the value is lower or equal than... + * + * @param ac the validation context + * @param property the property the value is defined in + * @throws InvalidParamException + */ + public void checkLowerEqualThan(ApplContext ac, double d, CssProperty property) + throws InvalidParamException { + BigDecimal other = BigDecimal.valueOf(d); + if (value.compareTo(other) > 0) { + throw new InvalidParamException("lowerequal", + toString(), other.toPlainString(), ac); + } + } + + /** + * check if the value is lower or equal than... + * + * @param ac the validation context + * @param property the property the value is defined in + * @throws InvalidParamException + */ + public void warnLowerEqualThan(ApplContext ac, double d, CssProperty property) { + BigDecimal other = BigDecimal.valueOf(d); + if (value.compareTo(other) > 0) { + String[] s = new String[2]; + s[0] = toString(); + s[1] = Double.toHexString(d) + '%'; + ac.getFrame().addWarning("lowerequal", s); + } + } }
Received on Monday, 17 December 2012 14:28:38 UTC