2002/css-validator/org/w3c/css/values CssColor.java,1.23,1.24

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

Modified Files:
	CssColor.java 
Log Message:
color function now checked at parsing time

Index: CssColor.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/values/CssColor.java,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- CssColor.java	18 Oct 2012 09:39:51 -0000	1.23
+++ CssColor.java	7 Nov 2012 14:28:35 -0000	1.24
@@ -8,6 +8,7 @@
 package org.w3c.css.values;
 
 import org.w3c.css.util.ApplContext;
+import org.w3c.css.util.CssVersion;
 import org.w3c.css.util.InvalidParamException;
 import org.w3c.css.util.Util;
 
@@ -359,6 +360,13 @@
 
     public void setRGBAColor(CssExpression exp, ApplContext ac)
             throws InvalidParamException {
+		// RGBA defined in CSS3 and onward
+		if (ac.getCssVersion().compareTo(CssVersion.CSS3) < 0) {
+			StringBuilder sb = new StringBuilder();
+			sb.append("rgba(").append(exp.toStringFromStart()).append(')');
+			throw new InvalidParamException("notversion", sb.toString(),
+					ac.getCssVersionString(), ac);
+		}
         rgba = new RGBA();
         __setRGBAColor(rgba, exp, ac);
     }
@@ -470,6 +478,13 @@
 
     public void setHSLColor(CssExpression exp, ApplContext ac)
             throws InvalidParamException {
+		// HSL defined in CSS3 and onward
+		if (ac.getCssVersion().compareTo(CssVersion.CSS3) < 0) {
+			StringBuilder sb = new StringBuilder();
+			sb.append("hsl(").append(exp.toStringFromStart()).append(')');
+			throw new InvalidParamException("notversion", sb.toString(),
+					ac.getCssVersionString(), ac);
+		}
         color = null;
         hsl = new HSL();
 
@@ -529,6 +544,14 @@
 
     public void setHSLAColor(CssExpression exp, ApplContext ac)
             throws InvalidParamException {
+		// RGBA defined in CSS3 and onward
+		if (ac.getCssVersion().compareTo(CssVersion.CSS3) < 0) {
+			StringBuilder sb = new StringBuilder();
+			sb.append("hsla(").append(exp.toStringFromStart()).append(')');
+			throw new InvalidParamException("notversion", sb.toString(),
+					ac.getCssVersionString(), ac);
+		}
+
         color = null;
         hsla = new HSLA();
 

Received on Wednesday, 7 November 2012 14:28:38 UTC