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

2002/css-validator/org/w3c/css/parser CssSelectors.java,1.24,1.25 CssSelectorsConstant.java,1.9,1.10

From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
Date: Thu, 12 Feb 2009 10:32:53 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1LXYsH-0000E7-Ux@lionel-hutz.w3.org>

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

Modified Files:
	CssSelectors.java CssSelectorsConstant.java 
Log Message:
Pseudo Elements and Pseudo Classes are now distinct, and pseudo-elements
are displayed as they should.
General Siblig connectos (CSS3) handled properly.



Index: CssSelectors.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/parser/CssSelectors.java,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- CssSelectors.java	28 Mar 2008 16:36:46 -0000	1.24
+++ CssSelectors.java	12 Feb 2009 10:32:51 -0000	1.25
@@ -11,10 +11,11 @@
 import java.util.Enumeration;
 
 import org.w3c.css.properties.css1.CssProperty;
-import org.w3c.css.selectors.AdjacentSelector;
+import org.w3c.css.selectors.AdjacentSiblingSelector;
 import org.w3c.css.selectors.AttributeSelector;
 import org.w3c.css.selectors.ChildSelector;
 import org.w3c.css.selectors.DescendantSelector;
+import org.w3c.css.selectors.GeneralSiblingSelector;
 import org.w3c.css.selectors.PseudoClassSelector;
 import org.w3c.css.selectors.PseudoElementSelector;
 import org.w3c.css.selectors.PseudoFactory;
@@ -44,7 +45,8 @@
  *
  * @version $Revision$
  */
-public final class CssSelectors extends SelectorsList implements CssSelectorsConstant {
+public final class CssSelectors extends SelectorsList 
+    implements CssSelectorsConstant {
 
     ApplContext ac;
 
@@ -177,17 +179,16 @@
 	return isBlock;
     }
 
-    public void addPseudo(String pseudo) throws InvalidParamException {
-	if(pseudo == null) {
+    public void addPseudoClass(String pseudo) throws InvalidParamException {
+ 	if(pseudo == null) {
 	    return;
 	}
 
 	String profile = ac.getProfile();
 	if(profile == null || profile.equals("") || profile.equals("none")) {
 	    profile = ac.getCssVersion();
-	}
-
-	// is it a pseudo-class?
+	}   
+		// is it a pseudo-class?
 	String[] ps = PseudoFactory.getPseudoClass(profile);
 	if(ps != null) {
 	    for(int i = 0; i < ps.length; i++) {
@@ -198,9 +199,21 @@
 	    }
 	}
 	// it's not a pseudo-class
+        throw new InvalidParamException("pseudo", ":" + pseudo, ac);
+    }
+    
+    public void addPseudoElement(String pseudo) throws InvalidParamException {
+ 	if(pseudo == null) {
+	    return;
+	}
+
+	String profile = ac.getProfile();
+	if(profile == null || profile.equals("") || profile.equals("none")) {
+	    profile = ac.getCssVersion();
+	}   
 
 	// is it a pseudo-element?
-	ps = PseudoFactory.getPseudoElement(profile);
+	String[] ps = PseudoFactory.getPseudoElement(profile);
 	if(ps != null) {
 	    for(int i = 0; i < ps.length; i++) {
 		if(pseudo.equals(ps[i])) {
@@ -211,7 +224,7 @@
 	}
         
         // the ident isn't a valid pseudo-something
-        throw new InvalidParamException("pseudo", ":" + pseudo, ac);
+        throw new InvalidParamException("pseudo", "::" + pseudo, ac);
     }
 
     public void setPseudoFun(String pseudo, String param)
@@ -306,12 +319,19 @@
 	connector = CHILD;
     }
 
-    public void addAdjacent(AdjacentSelector adjacent)
+    public void addAdjacentSibling(AdjacentSiblingSelector adjacent)
     throws InvalidParamException {
-	super.addAdjacent(adjacent);
-	connector = ADJACENT;
+	super.addAdjacentSibling(adjacent);
+	connector = ADJACENT_SIBLING;
     }
 
+    public void addGeneralSibling(GeneralSiblingSelector sibling)
+    throws InvalidParamException {
+	super.addGeneralSibling(sibling);
+	connector = GENERAL_SIBLING;
+    }
+
+
     public void addAttribute(AttributeSelector attribute)
     throws InvalidParamException {
 	int _s = size();

Index: CssSelectorsConstant.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/parser/CssSelectorsConstant.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- CssSelectorsConstant.java	14 Sep 2005 15:14:18 -0000	1.9
+++ CssSelectorsConstant.java	12 Feb 2009 10:32:51 -0000	1.10
@@ -37,6 +37,8 @@
     public static final char DESCENDANT = ' ';
     /** child connector */
     public static final char CHILD = '>';
-    /** adjacent connector */
-    public static final char ADJACENT = '+';
+    /** adjacent sibling connector */
+    public static final char ADJACENT_SIBLING = '+';
+    /** general sibling connector */
+    public static final char GENERAL_SIBLING = '~';
 }
Received on Thursday, 12 February 2009 10:33:02 GMT

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