- From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
- Date: Thu, 23 Aug 2012 14:05:12 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/2002/css-validator/org/w3c/css/properties/css3 In directory hutz:/tmp/cvs-serv19057 Modified Files: CssFont.java Log Message: case sensitivity of idents Index: CssFont.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css3/CssFont.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- CssFont.java 23 Aug 2012 13:55:34 -0000 1.5 +++ CssFont.java 23 Aug 2012 14:05:10 -0000 1.6 @@ -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,18 +22,27 @@ 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; + } /** * Create a new CssFontSize */ @@ -74,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:05:18 UTC