2002/css-validator/org/w3c/css/parser AtRuleKeyframes.java,1.1,1.2

Update of /sources/public/2002/css-validator/org/w3c/css/parser
In directory hutz:/tmp/cvs-serv1180/parser

Modified Files:
	AtRuleKeyframes.java 
Log Message:
checking selector value

Index: AtRuleKeyframes.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/parser/AtRuleKeyframes.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- AtRuleKeyframes.java	10 Oct 2012 07:47:30 -0000	1.1
+++ AtRuleKeyframes.java	10 Oct 2012 13:55:30 -0000	1.2
@@ -5,8 +5,41 @@
 // Please first read the full copyright statement in file COPYRIGHT.html
 package org.w3c.css.parser;
 
+import org.w3c.css.util.ApplContext;
+import org.w3c.css.util.InvalidParamException;
+import org.w3c.css.values.CssIdent;
+import org.w3c.css.values.CssPercentage;
+import org.w3c.css.values.CssTypes;
+import org.w3c.css.values.CssValue;
+
 public class AtRuleKeyframes extends AtRule {
 
+	static final CssIdent to, from;
+
+	static {
+		to = CssIdent.getIdent("to");
+		from = CssIdent.getIdent("from");
+	}
+
+	public static void checkSelectorValue(CssValue selector, ApplContext ac)
+			throws InvalidParamException {
+		switch (selector.getType()) {
+			case CssTypes.CSS_PERCENTAGE:
+				CssPercentage percentage = selector.getPercentage();
+				if (!percentage.isPositive() || percentage.floatValue() > 100.f) {
+					 throw new InvalidParamException("range", ac);
+				}
+				break;
+			case CssTypes.CSS_IDENT:
+				CssIdent id = (CssIdent) selector;
+				if (to.equals(id) || from.equals(id)) {
+					break;
+				}
+			default:
+				throw new InvalidParamException("selectorname", selector.toString(), ac);
+		}
+	}
+
 	String name = null;
 
 	public String keyword() {
@@ -38,6 +71,7 @@
 	public String lookupPrefix() {
 		return "";
 	}
+
 	/**
 	 * Returns a string representation of the object.
 	 */

Received on Wednesday, 10 October 2012 13:55:38 UTC