- From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
- Date: Tue, 07 Aug 2012 20:45:55 +0000
- To: www-validator-cvs@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