- From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
- Date: Wed, 14 Sep 2011 16:31:51 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/2002/css-validator/org/w3c/css/css In directory hutz:/tmp/cvs-serv24952/css Modified Files: CssValidator.java StyleSheetGenerator.java Log Message: reworking profile/version check ot avoid doing too many string comparisons, and user defaulting Index: StyleSheetGenerator.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/css/StyleSheetGenerator.java,v retrieving revision 1.30 retrieving revision 1.31 diff -u -d -r1.30 -r1.31 --- StyleSheetGenerator.java 29 Aug 2011 07:21:00 -0000 1.30 +++ StyleSheetGenerator.java 14 Sep 2011 16:31:49 -0000 1.31 @@ -12,6 +12,7 @@ import org.w3c.css.parser.Errors; import org.w3c.css.properties.PropertiesLoader; import org.w3c.css.util.ApplContext; +import org.w3c.css.util.CssVersion; import org.w3c.css.util.InvalidParamException; import org.w3c.css.util.Messages; import org.w3c.css.util.Utf8Properties; @@ -175,10 +176,10 @@ context.put("rules_count", new Integer(items.size())); context.put("no_errors_report", Boolean.FALSE); context.put("charset", ac.getContentEncoding()); - context.put("cssversion", ac.getCssVersion()); - context.put("css_profile", ac.getProfile()); - context.put("css", ac.getMsg().getString(ac.getCssVersion())); - context.put("css_link", getURLProperty("@url-base_" + ac.getCssVersion())); + context.put("cssversion", ac.getCssVersionString()); + context.put("css_profile", ac.getProfileString()); + context.put("css", ac.getMsg().getString(ac.getCssVersionString())); + context.put("css_link", getURLProperty("@url-base_" + ac.getCssVersionString())); context.put("is_valid", (errors.getErrorCount() == 0) ? "true" : "false"); context.put("fake_input", Boolean.valueOf(ac.isInputFake())); context.put("author", "www-validator-css"); @@ -378,7 +379,7 @@ String name = error.getProperty(); String ret; if ((name != null) && (getURLProperty(name) != null) && - PropertiesLoader.getProfile(ac.getCssVersion()).containsKey(name)) { + PropertiesLoader.getProfile(ac.getCssVersionString()).containsKey(name)) { //we add a link information // we check if the property doesn't exist in this css version ht_error.put("link_before_parse_error", @@ -391,9 +392,10 @@ // and CSS1 use the links // and the link is changed in urls.properties String lnk; - if (ac.getCssVersion().equals("css3")) { + CssVersion v = ac.getCssVersion(); + if (v == CssVersion.CSS3) { lnk = getURLProperty("@url-base_css2.1"); - } else if (ac.getCssVersion().equals("css1")) { + } else if (v == CssVersion.CSS1) { lnk = getURLProperty("@url-base_css2"); } else { lnk = context.get("css_link").toString(); Index: CssValidator.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/css/CssValidator.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- CssValidator.java 29 Aug 2011 07:21:00 -0000 1.10 +++ CssValidator.java 14 Sep 2011 16:31:49 -0000 1.11 @@ -110,19 +110,7 @@ // CSS version to use String profile = (String) style.params.get("profile"); - if (profile != null && !"none".equals(profile)) { - if ("css1".equals(profile) || "css2".equals(profile) || "css21".equals(profile) - || "css3".equals(profile) || "svg".equals(profile) - || "svgbasic".equals(profile) || "svgtiny".equals(profile)) { - style.ac.setCssVersion(profile); - } else { - style.ac.setProfile(profile); - style.ac.setCssVersion(PropertiesLoader.config.getProperty("defaultProfile")); - } - } else { - style.ac.setProfile(profile); - style.ac.setCssVersion(PropertiesLoader.config.getProperty("defaultProfile")); - } + style.ac.setCssVersionAndProfile(profile.toLowerCase()); // medium to use style.ac.setMedium((String) style.params.get("medium"));
Received on Wednesday, 14 September 2011 16:32:07 UTC