W3C home > Mailing lists > Public > www-validator-cvs@w3.org > November 2012

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

From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
Date: Wed, 07 Nov 2012 14:28:37 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1TW6cP-0004B5-Q1@lionel-hutz.w3.org>
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

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:17:53 UTC