2002/css-validator/org/w3c/css/parser AtRuleMedia.java,1.13,1.14 AtRuleMediaCSS1.java,1.5,1.6 AtRuleMediaCSS2.java,1.5,1.6 CssFouffa.java,1.52,1.53 CssPrinterStyle.java,1.4,1.5 CssPropertyFactory.java,1.23,1.24 CssSelectors.java,1.28,1.29 CssStyle.java,1.9,1.10

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

Modified Files:
	AtRuleMedia.java AtRuleMediaCSS1.java AtRuleMediaCSS2.java 
	CssFouffa.java CssPrinterStyle.java CssPropertyFactory.java 
	CssSelectors.java CssStyle.java 
Log Message:
Implementation of css3-background (partial, missing background-color and background, also borders not done)
cf. http://www.w3.org/TR/2009/CR-css3-background-20091217/

moved and corrected implementation of css3-multicol 
cf. http://www.w3.org/TR/2009/CR-css3-multicol-20091217/

Some reorganization of code.


Index: CssSelectors.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/parser/CssSelectors.java,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- CssSelectors.java	25 Feb 2009 20:44:49 -0000	1.28
+++ CssSelectors.java	5 Jan 2010 13:49:33 -0000	1.29
@@ -8,9 +8,8 @@
 package org.w3c.css.parser;
 
 import java.util.ArrayList;
-import java.util.Enumeration;
 
-import org.w3c.css.properties.css1.CssProperty;
+import org.w3c.css.properties.css.CssProperty;
 import org.w3c.css.selectors.AdjacentSiblingSelector;
 import org.w3c.css.selectors.AttributeSelector;
 import org.w3c.css.selectors.ChildSelector;
@@ -23,13 +22,6 @@
 import org.w3c.css.selectors.SelectorsList;
 import org.w3c.css.selectors.TypeSelector;
 import org.w3c.css.selectors.attributes.AttributeExact;
-import org.w3c.css.selectors.pseudofunctions.PseudoFunctionContains;
-import org.w3c.css.selectors.pseudofunctions.PseudoFunctionLang;
-import org.w3c.css.selectors.pseudofunctions.PseudoFunctionNot;
-import org.w3c.css.selectors.pseudofunctions.PseudoFunctionNthChild;
-import org.w3c.css.selectors.pseudofunctions.PseudoFunctionNthLastChild;
-import org.w3c.css.selectors.pseudofunctions.PseudoFunctionNthLastOfType;
-import org.w3c.css.selectors.pseudofunctions.PseudoFunctionNthOfType;
 import org.w3c.css.util.ApplContext;
 import org.w3c.css.util.InvalidParamException;
 import org.w3c.css.util.Messages;

Index: CssPropertyFactory.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/parser/CssPropertyFactory.java,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- CssPropertyFactory.java	10 Dec 2008 15:22:58 -0000	1.23
+++ CssPropertyFactory.java	5 Jan 2010 13:49:33 -0000	1.24
@@ -7,20 +7,20 @@
 
 package org.w3c.css.parser;
 
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.StringTokenizer;
-import java.util.Vector;
-
 import org.w3c.css.properties.PropertiesLoader;
-import org.w3c.css.properties.css1.CssProperty;
+import org.w3c.css.properties.css.CssProperty;
 import org.w3c.css.util.ApplContext;
 import org.w3c.css.util.InvalidParamException;
 import org.w3c.css.util.Utf8Properties;
 import org.w3c.css.values.CssExpression;
 import org.w3c.css.values.CssIdent;
 
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.StringTokenizer;
+import java.util.Vector;
+
 /**
  * @version $Revision$
  * @author Philippe Le Hegaret
@@ -139,7 +139,7 @@
 
 	try {
 	    // create an instance of your property class
-	    Class expressionclass = new CssExpression().getClass();
+	    Class expressionclass = CssExpression.class;
 	    if (expression != null) {
 		expressionclass = expression.getClass();
 	    }
@@ -230,7 +230,7 @@
 		// create an instance of your property class
 		Class[] parametersType = { ac.getClass(), expression.getClass(), boolean.class };
 		Constructor constructor = Class.forName(classname).getConstructor(parametersType);
-		Object[] parameters = { ac, expression, new Boolean(true) };
+		Object[] parameters = { ac, expression, Boolean.TRUE};
 		// invoke the constructor
 		return (CssProperty) constructor.newInstance(parameters);
 			

Index: AtRuleMedia.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/parser/AtRuleMedia.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- AtRuleMedia.java	12 Feb 2009 21:26:34 -0000	1.13
+++ AtRuleMedia.java	5 Jan 2010 13:49:33 -0000	1.14
@@ -13,7 +13,7 @@
 import java.util.Enumeration;
 import java.util.Vector;
 
-import org.w3c.css.properties.css1.CssProperty;
+import org.w3c.css.properties.css.CssProperty;
 import org.w3c.css.util.ApplContext;
 import org.w3c.css.util.InvalidParamException;
 

Index: AtRuleMediaCSS1.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/parser/AtRuleMediaCSS1.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- AtRuleMediaCSS1.java	26 Nov 2007 05:07:17 -0000	1.5
+++ AtRuleMediaCSS1.java	5 Jan 2010 13:49:33 -0000	1.6
@@ -10,21 +10,21 @@
  */
 package org.w3c.css.parser;
 
-import java.util.Enumeration;
-
 import org.w3c.css.util.ApplContext;
 import org.w3c.css.util.InvalidParamException;
 
+import java.util.Enumeration;
+
 /**
  * This class manages all media defines by CSS2
  *
+ * @author Philippe Le Hegaret
  * @version $Revision$
- * @author  Philippe Le Hegaret
  */
 public class AtRuleMediaCSS1 extends AtRuleMedia {
 
     static final String[] mediaCSS1 = {
-	"all"
+            "all"
     };
 
     String[] media = new String[mediaCSS1.length];
@@ -42,57 +42,57 @@
     /**
      * Adds a medium.
      *
-     * @exception InvalidParamException the medium doesn't exist
+     * @throws InvalidParamException the medium doesn't exist
      */
     public AtRuleMedia addMedia(String medium,
-				ApplContext ac) throws InvalidParamException {
+                                ApplContext ac) throws InvalidParamException {
 
-	// do nothing
-	return this;
+        // do nothing
+        return this;
     }
 
     /**
      * Returns the at rule keyword
      */
     public String keyword() {
-	return "media";
+        return "media";
     }
 
     public boolean isEmpty() {
-	return false;
+        return false;
     }
 
     /**
      * The second must be exactly the same of this one
      */
     public boolean canApply(AtRule atRule) {
-	if (atRule instanceof AtRuleMedia) {
-	    return true;
-	} else {
-	    return false;
-	}
+        if (atRule instanceof AtRuleMedia) {
+            return true;
+        } else {
+            return false;
+        }
     }
 
     /**
      * The second must only match this one
      */
     public boolean canMatched(AtRule atRule) {
-	if (atRule instanceof AtRuleMedia) {
-	    return true;
-	} else {
-	    return false;
-	}
+        if (atRule instanceof AtRuleMedia) {
+            return true;
+        } else {
+            return false;
+        }
     }
 
     public Enumeration elements() {
-	return new MediaEnumeration(this);
+        return new MediaEnumeration(this);
     }
 
     /**
      * Returns a string representation of the object.
      */
     public String toString() {
-	return "@" + keyword() + " all ";
+        return "@" + keyword() + " all ";
     }
 
 

Index: CssStyle.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/parser/CssStyle.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- CssStyle.java	28 Mar 2008 16:36:46 -0000	1.9
+++ CssStyle.java	5 Jan 2010 13:49:33 -0000	1.10
@@ -7,10 +7,8 @@
 
 package org.w3c.css.parser;
 
-import java.util.Enumeration;
-
 import org.w3c.css.css.StyleSheet;
-import org.w3c.css.properties.css1.CssProperty;
+import org.w3c.css.properties.css.CssProperty;
 import org.w3c.css.util.ApplContext;
 import org.w3c.css.util.Warning;
 import org.w3c.css.util.Warnings;

Index: CssFouffa.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/parser/CssFouffa.java,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -d -r1.52 -r1.53
--- CssFouffa.java	16 Feb 2009 17:53:39 -0000	1.52
+++ CssFouffa.java	5 Jan 2010 13:49:33 -0000	1.53
@@ -10,46 +10,44 @@
 
 package org.w3c.css.parser;
 
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.net.HttpURLConnection;
-import java.net.URL;
-import java.net.URLConnection;
-import java.util.Enumeration;
[...1306 lines suppressed...]
 
     public CssFouffa(java.io.Reader stream) {
-	super(stream);
-	properties = new CssPropertyFactory("css2");
-	// loadConfig("css2", null);
+        super(stream);
+        properties = new CssPropertyFactory("css2");
+        // loadConfig("css2", null);
     }
 
     public CssFouffa(CssParserTokenManager tm) {
-	super(tm);
-	properties = new CssPropertyFactory("css2");
-	// loadConfig("css2", null);
+        super(tm);
+        properties = new CssPropertyFactory("css2");
+        // loadConfig("css2", null);
     }
 
 }

Index: CssPrinterStyle.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/parser/CssPrinterStyle.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- CssPrinterStyle.java	8 Sep 2005 12:23:33 -0000	1.4
+++ CssPrinterStyle.java	5 Jan 2010 13:49:33 -0000	1.5
@@ -7,7 +7,7 @@
 
 package org.w3c.css.parser;
 
-import org.w3c.css.properties.css1.CssProperty;
+import org.w3c.css.properties.css.CssProperty;
 
 /**
  * This class is invoke by all propperties when a print is required.
@@ -21,8 +21,8 @@
    * Print this property.
    *
    * @param property The property to print.
-   * @see org.w3c.css.properties.css1.CssProperty#toString
-   * @see org.w3c.css.properties.css1.CssProperty#getPropertyName
+   * @see org.w3c.css.properties.css.CssProperty#toString
+   * @see org.w3c.css.properties.css.CssProperty#getPropertyName
    */
   public void print(CssProperty property);
 }

Index: AtRuleMediaCSS2.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/parser/AtRuleMediaCSS2.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- AtRuleMediaCSS2.java	26 Nov 2007 05:07:17 -0000	1.5
+++ AtRuleMediaCSS2.java	5 Jan 2010 13:49:33 -0000	1.6
@@ -10,22 +10,22 @@
  */
 package org.w3c.css.parser;
 
-import java.util.Enumeration;
-
 import org.w3c.css.util.ApplContext;
 import org.w3c.css.util.InvalidParamException;
 
+import java.util.Enumeration;
+
 /**
  * This class manages all media defines by CSS2
  *
+ * @author Philippe Le Hegaret
  * @version $Revision$
- * @author  Philippe Le Hegaret
  */
 public class AtRuleMediaCSS2 extends AtRuleMedia {
 
     static final String[] mediaCSS2 = {
-	"all", "aural", "braille", "embossed", "handheld", "print", "projection",
-	"screen", "tty", "tv", "presentation"
+            "all", "aural", "braille", "embossed", "handheld", "print", "projection",
+            "screen", "tty", "tv", "presentation"
     };
 
     String[] media = new String[mediaCSS2.length];
@@ -35,91 +35,96 @@
     /**
      * Adds a medium.
      *
-     * @exception InvalidParamException the medium doesn't exist
+     * @throws InvalidParamException the medium doesn't exist
      */
     public AtRuleMedia addMedia(String medium,
-				ApplContext ac) throws InvalidParamException {
+                                ApplContext ac) throws InvalidParamException {
 
-	//This medium didn't exist for CSS2
-	//	if ((!cssversion.equals("css3")) && medium.equals("presentation")) {
-	// throw new InvalidParamException("media", medium, ac);
-	//}
+        //This medium didn't exist for CSS2
+        //	if ((!cssversion.equals("css3")) && medium.equals("presentation")) {
+        // throw new InvalidParamException("media", medium, ac);
+        //}
 
-	for (int i = 0; i < mediaCSS2.length; i++) {
-	    if (medium.equals(mediaCSS2[i])) {
-		media[i] = mediaCSS2[i];
-		empty = false;
-		return this;
-	    }
-	}
+        for (int i = 0; i < mediaCSS2.length; i++) {
+            if (medium.equals(mediaCSS2[i])) {
+                media[i] = mediaCSS2[i];
+                empty = false;
+                return this;
+            }
+        }
 
-	throw new InvalidParamException("media", medium, ac);
+        throw new InvalidParamException("media", medium, ac);
     }
 
     /**
      * Returns the at rule keyword
      */
     public String keyword() {
-	return "media";
+        return "media";
     }
 
     public boolean isEmpty() {
-	return empty;
+        return empty;
     }
 
     /**
      * The second must be exactly the same of this one
      */
     public boolean canApply(AtRule atRule) {
-	if (atRule instanceof AtRuleMedia) {
-	    AtRuleMedia second = (AtRuleMedia) atRule;
+        if (atRule instanceof AtRuleMedia) {
+            AtRuleMedia second = (AtRuleMedia) atRule;
 
-	    for (int i = 0; i < media.length; i++) {
-		// strings are exactly the same so I don't have to use equals
-		if (media[i] != second.media[i]) {
-		    return false;
-		}
-	    }
-	    return true;
-	} else {
-	    return false;
-	}
+            for (int i = 0; i < media.length; i++) {
+                // strings are exactly the same so I don't have to use equals
+                if (media[i] != second.media[i]) {
+                    return false;
+                }
+            }
+            return true;
+        } else {
+            return false;
+        }
     }
 
     /**
      * The second must only match this one
      */
     public boolean canMatched(AtRule atRule) {
-	if (atRule instanceof AtRuleMedia) {
-	    AtRuleMedia second = (AtRuleMedia) atRule;
+        if (atRule instanceof AtRuleMedia) {
+            AtRuleMedia second = (AtRuleMedia) atRule;
 
-	    for (int i = 0; i < media.length; i++) {
-		// strings are exactly the same so I don't have to use equals
-		if (media[i] == second.media[i]) {
-		    return true;
-		}
-	    }
-	    return false;
-	} else {
-	    return false;
-	}
+            for (int i = 0; i < media.length; i++) {
+                // strings are exactly the same so I don't have to use equals
+                if (media[i] == second.media[i]) {
+                    return true;
+                }
+            }
+        }
+        return false;
     }
 
     public Enumeration elements() {
-	return new MediaEnumeration(this);
+        return new MediaEnumeration(this);
     }
 
     /**
      * Returns a string representation of the object.
      */
     public String toString() {
-	String ret = "";
-	for (int i = 0; i < media.length; i++) {
-	    if (media[i] != null) {
-		ret += ", " + media[i];
-	    }
-	}
-	return "@" + keyword() + " " + ret.substring(2);
+        StringBuilder sb = new StringBuilder("@");
+        boolean first = true;
+        sb.append(keyword());
+        for (int i = 0; i < media.length; i++) {
+            if (media[i] != null) {
+                if (first) {
+                    first = false;
+                } else {
+                    sb.append(", ");
+                }
+                sb.append(media[i]);
+            }
+        }
+        return sb.toString();
     }
 
 

Received on Tuesday, 5 January 2010 13:50:07 UTC