2002/css-validator/org/w3c/css/parser/analyzer CssParser.jj,1.35,1.36

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

Modified Files:
	CssParser.jj 
Log Message:
http://www.w3.org/Bugs/Public/show_bug.cgi?id=3424 squashed
when comma separated selectors were used, the value set was shared, but
the properties contains the selectors in use, so it was matching always the last one.
Now the vector of CssProperty is now duplicated and each set is considered as different.


Index: CssParser.jj
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/parser/analyzer/CssParser.jj,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -d -r1.35 -r1.36
--- CssParser.jj	26 Mar 2008 20:55:17 -0000	1.35
+++ CssParser.jj	27 Mar 2008 13:18:52 -0000	1.36
@@ -1136,7 +1136,7 @@
 void ruleSet() :
 { CssSelectors contextual;
     Vector<CssSelectors> context_set = new Vector<CssSelectors>();
-    Vector value_set = null;
+    Vector<CssProperty> value_set = null;
     currentContext = context_set;
 }
 {
@@ -1165,8 +1165,22 @@
 			ac.getFrame().addWarning("no-declaration");
 			} else {*/
 		if (value_set != null) {
-		    for (Enumeration e = context_set.elements(); e.hasMoreElements();) {
-			handleRule((CssSelectors) e.nextElement(), value_set);
+		    boolean first = true;
+		    for (Enumeration e = context_set.elements(); e.hasMoreElements();) {	
+			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();
@@ -1184,7 +1198,7 @@
     }
 }
 
-Vector declarations() :
+Vector<CssProperty> declarations() :
 {
     if(!validSelector) {        
         validSelector = true;
@@ -1193,7 +1207,7 @@
     }
 
     CssProperty values;
-    Vector value_set   = new Vector();
+    Vector<CssProperty> value_set   = new Vector<CssProperty>();
     boolean wrong_value = true;
 }
 {    

Received on Thursday, 27 March 2008 13:19:26 UTC