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

2002/css-validator/org/w3c/css/properties/css3 CssFontLanguageOverride.java,1.1,1.2

From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
Date: Tue, 07 Aug 2012 20:45:55 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1SyqfZ-0002NF-QT@lionel-hutz.w3.org>
Update of /sources/public/2002/css-validator/org/w3c/css/properties/css3
In directory hutz:/tmp/cvs-serv9070/w3c/css/properties/css3

Modified Files:
	CssFontLanguageOverride.java 
Log Message:
add language tag check

Index: CssFontLanguageOverride.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css3/CssFontLanguageOverride.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- CssFontLanguageOverride.java	6 Aug 2012 11:56:21 -0000	1.1
+++ CssFontLanguageOverride.java	7 Aug 2012 20:45:53 -0000	1.2
@@ -12,6 +12,9 @@
 import org.w3c.css.values.CssString;
 import org.w3c.css.values.CssTypes;
 import org.w3c.css.values.CssValue;
+import org.w3c.css.values.external.OpenTypeLanguageSystemTag;
+
+import java.util.Arrays;
 
 /**
  * @spec http://www.w3.org/TR/2011/WD-css3-fonts-20111004/#propdef-font-language-override
@@ -60,6 +63,16 @@
 							expression.getValue().toString(),
 							getPropertyName(), ac);
 				}
+				// we extract the 3 letters from the quotes...
+				String tag = s.toString().substring(1,4).toUpperCase();
+				// valid values are specified here.
+				int idx = Arrays.binarySearch(OpenTypeLanguageSystemTag.tags, tag);
+				if (idx < 0) {
+					// TODO specific error code
+					throw new InvalidParamException("value",
+							expression.getValue().toString(),
+							getPropertyName(), ac);
+				}
 				value = s;
 				break;
 			case CssTypes.CSS_IDENT:
Received on Tuesday, 7 August 2012 20:46:27 UTC

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