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

2002/css-validator/org/w3c/css/properties/css3 CssBackgroundClip.java,1.4,1.5

From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
Date: Mon, 13 Feb 2012 19:07:15 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1Rx1F5-0004bE-SG@lionel-hutz.w3.org>
Update of /sources/public/2002/css-validator/org/w3c/css/properties/css3
In directory hutz:/tmp/cvs-serv17665

Modified Files:
	CssBackgroundClip.java 
Log Message:
added bg clip value per http://www.w3.org/TR/2011/CR-css3-background-20110215/#the-background-clip

Index: CssBackgroundClip.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css3/CssBackgroundClip.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- CssBackgroundClip.java	4 Oct 2011 13:05:25 -0000	1.4
+++ CssBackgroundClip.java	13 Feb 2012 19:07:13 -0000	1.5
@@ -17,6 +17,7 @@
 import org.w3c.css.values.CssValue;
 
 import java.util.ArrayList;
+import java.util.HashMap;
 
 import static org.w3c.css.values.CssOperator.COMMA;
 
@@ -37,18 +38,20 @@
 public class CssBackgroundClip extends org.w3c.css.properties.css.CssBackgroundClip {
 
     public final static CssIdent border_box;
-    public final static CssIdent padding_box;
-
+    public static HashMap<String, CssIdent> allowed_values;
+    public final static String val[] = {"border-box", "padding-box", "content-box"};
     Object value;
 
     static {
         border_box = CssIdent.getIdent("border-box");
-        padding_box = CssIdent.getIdent("padding-box");
+        for (String s : val) {
+            allowed_values.put(s, CssIdent.getIdent(s));
+        }
     }
 
     public static boolean isMatchingIdent(CssIdent ident) {
-        return (border_box.equals(ident) ||
-                padding_box.equals(ident));
+        return allowed_values.containsValue(ident);
+ 
     }
 
     /**
@@ -69,6 +72,7 @@
         ArrayList<CssValue> values = new ArrayList<CssValue>();
 
         CssValue val;
+        CssIdent matchingIdent;
         char op;
 
         while (!expression.end()) {
@@ -85,11 +89,10 @@
                         }
                         values.add(inherit);
                         break;
-                    } else if (border_box.equals(val)) {
-                        values.add(border_box);
-                        break;
-                    } else if (padding_box.equals(val)) {
-                        values.add(padding_box);
+                    }
+                    matchingIdent = allowed_values.get(val.toString());
+                    if (matchingIdent != null) {
+                        values.add(matchingIdent);
                         break;
                     }
                 default:
Received on Monday, 13 February 2012 19:07:17 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 26 April 2012 12:55:33 GMT