- From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
- Date: Thu, 23 Aug 2012 14:40:51 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/2002/css-validator/org/w3c/css/properties/css21 In directory hutz:/tmp/cvs-serv8618 Modified Files: CssFont.java Log Message: case sensitivity of idents Index: CssFont.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css21/CssFont.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- CssFont.java 23 Aug 2012 14:33:38 -0000 1.3 +++ CssFont.java 23 Aug 2012 14:40:49 -0000 1.4 @@ -12,7 +12,7 @@ import org.w3c.css.values.CssTypes; import org.w3c.css.values.CssValue; -import java.util.HashMap; +import java.util.Arrays; import static org.w3c.css.values.CssOperator.SPACE; @@ -22,16 +22,26 @@ public class CssFont extends org.w3c.css.properties.css.CssFont { public static final CssIdent normal; - public static final HashMap<String, CssIdent> systemFonts; + public static final CssIdent[] systemFonts; static final String[] _systemFonts = {"caption", "icon", "menu", "message-box", "small-caption", "status-bar"}; static { normal = CssIdent.getIdent("normal"); - systemFonts = new HashMap<String, CssIdent>(); + systemFonts = new CssIdent[_systemFonts.length]; + int i = 0; for (String s : _systemFonts) { - systemFonts.put(s, CssIdent.getIdent(s)); + systemFonts[i++] = CssIdent.getIdent(s); + } + Arrays.sort(systemFonts); + } + + public static final CssIdent getSystemFont(CssIdent ident) { + int idx = Arrays.binarySearch(systemFonts, ident); + if (idx >= 0) { + return systemFonts[idx]; } + return null; } /** @@ -73,7 +83,7 @@ break; } CssIdent ident; - ident = systemFonts.get(val.toString()); + ident = getSystemFont((CssIdent) val); if (ident != null) { if (expression.getCount() != 1) { throw new InvalidParamException("value",
Received on Thursday, 23 August 2012 14:41:08 UTC