W3C home > Mailing lists > Public > www-validator-cvs@w3.org > March 2008

2002/css-validator/org/w3c/css/parser/analyzer CssParser.java,1.38,1.39

From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
Date: Thu, 27 Mar 2008 13:20:47 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1Jes2B-0005Zl-24@lionel-hutz.w3.org>

Update of /sources/public/2002/css-validator/org/w3c/css/parser/analyzer
In directory hutz:/tmp/cvs-serv21398

Modified Files:
	CssParser.java 
Log Message:
See CssParser.jj

Index: CssParser.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/parser/analyzer/CssParser.java,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -d -r1.38 -r1.39
--- CssParser.java	26 Mar 2008 20:55:17 -0000	1.38
+++ CssParser.java	27 Mar 2008 13:20:44 -0000	1.39
@@ -1570,7 +1570,7 @@
   final public void ruleSet() throws ParseException {
   CssSelectors contextual;
     Vector<CssSelectors> context_set = new Vector<CssSelectors>();
-    Vector value_set = null;
+    Vector<CssProperty> value_set = null;
     currentContext = context_set;
     try {
       contextual = selector();
@@ -1638,8 +1638,22 @@
 			ac.getFrame().addWarning("no-declaration");
 			} else {*/
                 if (value_set != null) {
+                    boolean first = true;
                     for (Enumeration e = context_set.elements(); e.hasMoreElements();) {
-                        handleRule((CssSelectors) e.nextElement(), value_set);
+                        if (first) {
+                            handleRule((CssSelectors) e.nextElement(), value_set);
+                            first = false;
+                        } else {
+                            // we need to duplicate properties in that case
+                            // as property holds reference to the selectors and it interact
+                            // badly with conflict detection
+                            int vsize = value_set.size();
+                            Vector<CssProperty> v = new Vector<CssProperty>(vsize);
+                            for (int i=0; i<vsize; i++) {
+                                v.addElement(value_set.elementAt(i).duplicate());
+                            }
+                            handleRule((CssSelectors) e.nextElement(), v);
+                        }
                     }
                     setSelectorList(context_set);
                     endOfRule();
@@ -1656,7 +1670,7 @@
     }
   }
 
-  final public Vector declarations() throws ParseException {
+  final public Vector<CssProperty> declarations() throws ParseException {
     if(!validSelector) {
         validSelector = true;
         skip_to_matching_brace();
@@ -1664,7 +1678,7 @@
     }
 
     CssProperty values;
-    Vector value_set   = new Vector();
+    Vector<CssProperty> value_set   = new Vector<CssProperty>();
     boolean wrong_value = true;
     switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
     case IDENT:
Received on Thursday, 27 March 2008 13:21:23 GMT

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