- 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/values
In directory hutz:/tmp/cvs-serv25724/values
Modified Files:
CssCheckableValue.java CssLength.java CssNumber.java
CssPercentage.java
Log Message:
value-driven range checking
Index: CssPercentage.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/values/CssPercentage.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- CssPercentage.java 6 Sep 2012 12:37:58 -0000 1.11
+++ CssPercentage.java 10 Sep 2012 17:04:58 -0000 1.12
@@ -7,6 +7,7 @@
package org.w3c.css.values;
+import org.w3c.css.properties.css.CssProperty;
import org.w3c.css.util.ApplContext;
import org.w3c.css.util.InvalidParamException;
@@ -34,7 +35,7 @@
*
* @version $Revision$
*/
-public class CssPercentage extends CssValue {
+public class CssPercentage extends CssCheckableValue {
public static final int type = CssTypes.CSS_PERCENTAGE;
@@ -158,4 +159,33 @@
public CssPercentage getPercentage() throws InvalidParamException {
return this;
}
+
+ /**
+ * check if the value is positive or null
+ * @param ac the validation context
+ * @param property the property the value is defined in
+ * @throws InvalidParamException
+ */
+ public void checkPositiveness(ApplContext ac, CssProperty property)
+ throws InvalidParamException {
+ if (!isPositive()) {
+ throw new InvalidParamException("negative-value",
+ toString(), property.getPropertyName(), ac);
+ }
+ }
+
+ /**
+ * check if the value is strictly positive
+ * @param ac the validation context
+ * @param property the property the value is defined in
+ * @throws InvalidParamException
+ */
+ public void checkStrictPositiveness(ApplContext ac, CssProperty property)
+ throws InvalidParamException {
+ if (!isStrictlyPositive()) {
+ throw new InvalidParamException("strictly-positive",
+ toString(), property.getPropertyName(), ac);
+ }
+ }
+
}
Index: CssLength.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/values/CssLength.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- CssLength.java 10 Sep 2012 11:58:31 -0000 1.14
+++ CssLength.java 10 Sep 2012 17:04:58 -0000 1.15
@@ -273,23 +273,10 @@
public void checkStrictPositiveness(ApplContext ac, CssProperty property)
throws InvalidParamException {
if (!isStrictlyPositive()) {
- throw new InvalidParamException("negative-value",
+ throw new InvalidParamException("strictly-positive",
toString(), property.getPropertyName(), ac);
}
}
- /**
- * check if the value is an integer
- * @param ac the validation context
- * @param property the property the value is defined in
- * @throws InvalidParamException
- */
- public void checkInteger(ApplContext ac, CssProperty property)
- throws InvalidParamException {
- }
-
- public boolean isInteger() {
- return false;
- }
}
Index: CssCheckableValue.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/values/CssCheckableValue.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- CssCheckableValue.java 10 Sep 2012 11:58:31 -0000 1.2
+++ CssCheckableValue.java 10 Sep 2012 17:04:58 -0000 1.3
@@ -22,8 +22,18 @@
abstract void checkStrictPositiveness(ApplContext ac, CssProperty property)
throws InvalidParamException;
- abstract boolean isInteger();
- abstract void checkInteger(ApplContext ac, CssProperty property)
- throws InvalidParamException;
+ public boolean isInteger() {
+ return false;
+ }
+
+ /**
+ * check if the value is an integer
+ * @param ac the validation context
+ * @param property the property the value is defined in
+ * @throws InvalidParamException
+ */
+ public void checkInteger(ApplContext ac, CssProperty property)
+ throws InvalidParamException {
+ }
}
Index: CssNumber.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/values/CssNumber.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- CssNumber.java 10 Sep 2012 11:58:31 -0000 1.15
+++ CssNumber.java 10 Sep 2012 17:04:58 -0000 1.16
@@ -251,7 +251,7 @@
public void checkStrictPositiveness(ApplContext ac, CssProperty property)
throws InvalidParamException {
if (!isStrictlyPositive()) {
- throw new InvalidParamException("negative-value",
+ throw new InvalidParamException("strictly-positive",
toString(), property.getPropertyName(), ac);
}
}
Received on Monday, 10 September 2012 17:05:05 UTC