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

2002/css-validator/org/w3c/css/properties/css1 CssBackgroundConstants.java,1.3,1.4 CssBackgroundImage.java,1.3,1.4 CssBackgroundImageCSS1.java,1.3,1.4 CssBackgroundImageCSS2.java,1.4,1.5 CssBackgroundPositionCSS2.java,1.8,1.9 CssBackgroundRepeatCSS1.java,1.3,1.4 CssBackgroundRepeatCSS2.java,1.4,1.5

From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
Date: Wed, 11 Feb 2009 21:41:12 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1LXMpU-0005nl-Mx@lionel-hutz.w3.org>

Update of /sources/public/2002/css-validator/org/w3c/css/properties/css1
In directory hutz:/tmp/cvs-serv22264

Modified Files:
	CssBackgroundConstants.java CssBackgroundImage.java 
	CssBackgroundImageCSS1.java CssBackgroundImageCSS2.java 
	CssBackgroundPositionCSS2.java CssBackgroundRepeatCSS1.java 
	CssBackgroundRepeatCSS2.java 
Log Message:
small rewrites

Index: CssBackgroundImageCSS2.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css1/CssBackgroundImageCSS2.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- CssBackgroundImageCSS2.java	25 Mar 2008 18:43:30 -0000	1.4
+++ CssBackgroundImageCSS2.java	11 Feb 2009 21:41:10 -0000	1.5
@@ -37,7 +37,8 @@
  * @version $Revision$ */
 public class CssBackgroundImageCSS2 extends CssProperty {
 
-    CssValue url;
+    CssValue url = null;
+    boolean inherited = false;
 
     public static CssIdent none;
     private static final String property_name = "background-image";
@@ -83,7 +84,7 @@
 		break;
 	    }
 	    if (none.equals(val)) {
-		url = none;
+		inherited = true;
 		break;
 	    }
 	default:
@@ -110,16 +111,16 @@
      * e.g. his value equals inherit
      */
     public boolean isSoftlyInherited() {
-	if (url != null) {
-	    return inherit.equals(url);
-	}
-	return false;
+	return inherited;
     }
 
     /**
      * Returns a string representation of the object.
      */
     public String toString() {
+	if (inherited) {
+	    return inherit.toString();
+	}
 	if (url != null) {
 	    return url.toString();
 	}

Index: CssBackgroundRepeatCSS2.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css1/CssBackgroundRepeatCSS2.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- CssBackgroundRepeatCSS2.java	25 Mar 2008 18:43:30 -0000	1.4
+++ CssBackgroundRepeatCSS2.java	11 Feb 2009 21:41:10 -0000	1.5
@@ -11,6 +11,7 @@
 import org.w3c.css.util.InvalidParamException;
 import org.w3c.css.values.CssExpression;
 import org.w3c.css.values.CssIdent;
+import org.w3c.css.values.CssTypes;
 import org.w3c.css.values.CssValue;
 
 /**
@@ -44,6 +45,8 @@
 public class CssBackgroundRepeatCSS2 extends CssProperty
 	implements CssBackgroundConstants {
 
+    private static final String property_name = "background-repeat";
+
     int repeat;
 
     private static int[] hash_values;
@@ -70,7 +73,7 @@
 	CssValue val = expression.getValue();
 	setByUser();
 
-	if (val instanceof CssIdent) {
+	if (val.getType() == CssTypes.CSS_IDENT) {
 	    int hash = val.hashCode();
 	    for (int i =0; i < REPEAT.length; i++) {
 		if (hash_values[i] == hash) {
@@ -80,7 +83,6 @@
 		}
 	    }
 	}
-
 	throw new InvalidParamException("value", expression.getValue(),
 					getPropertyName(), ac);
     }
@@ -102,7 +104,7 @@
      * e.g. his value equals inherit
      */
     public boolean isSoftlyInherited() {
-	return repeat == 4;
+	return (repeat == 4);
     }
 
     /**
@@ -116,7 +118,7 @@
      * Returns the name of this property
      */
     public String getPropertyName() {
-	return "background-repeat";
+	return property_name;
     }
 
     /**

Index: CssBackgroundConstants.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css1/CssBackgroundConstants.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- CssBackgroundConstants.java	14 Sep 2005 15:14:31 -0000	1.3
+++ CssBackgroundConstants.java	11 Feb 2009 21:41:10 -0000	1.4
@@ -11,10 +11,10 @@
  */
 public interface CssBackgroundConstants {
   static String[] REPEAT = { "repeat", "repeat-x", "repeat-y", "no-repeat", "inherit" };
-
+    
   static String[] ATTACHMENT = { "scroll", "fixed", "inherit" };
-    static String[] ATTACHMENTMOB = { "scroll", "inherit" };
-
+  static String[] ATTACHMENTMOB = { "scroll", "inherit" };
+    
   static String[] POSITION = { "top", "center", "bottom", "left", "right", "inherit" };
 
   /**

Index: CssBackgroundImage.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css1/CssBackgroundImage.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- CssBackgroundImage.java	14 Sep 2005 15:14:31 -0000	1.3
+++ CssBackgroundImage.java	11 Feb 2009 21:41:10 -0000	1.4
@@ -12,6 +12,7 @@
 import org.w3c.css.util.InvalidParamException;
 import org.w3c.css.values.CssExpression;
 import org.w3c.css.values.CssIdent;
+import org.w3c.css.values.CssTypes;
 import org.w3c.css.values.CssURL;
 import org.w3c.css.values.CssValue;
 
@@ -36,7 +37,8 @@
  * @version $Revision$ */
 public class CssBackgroundImage extends CssProperty {
 
-    CssValue url;
+    CssValue url      = null ;
+    boolean inherited = false;
 
     private static CssIdent none = new CssIdent("none");
 
@@ -63,19 +65,24 @@
 	setByUser();
 
 	CssValue val = expression.getValue();
-	if (val instanceof CssURL) {
+
+	switch(val.getType()) {
+	case CssTypes.CSS_URL:
 	    url = val;
-	    expression.next();
-	} else if (val.equals(inherit)) {
-	    url = inherit;
-	    expression.next();
-	} else if (val.equals(none)) {
-	    url = none;
-	    expression.next();
-	} else {
-	    throw new InvalidParamException("value", expression.getValue(),
+	    break;
+	case CssTypes.CSS_IDENT:
+	    if (inherit.equals(val)) {
+		inherited = true;
+		break;
+	    } else if (none.equals(val)) {
+		url = none;
+		break;
+	    }
+	default:
+	    throw new InvalidParamException("value", val,
 					    getPropertyName(), ac);
 	}
+	expression.next();
     }
 
     public CssBackgroundImage(ApplContext ac, CssExpression expression)
@@ -95,16 +102,16 @@
      * e.g. his value equals inherit
      */
     public boolean isSoftlyInherited() {
-	if (url != null) {
-	    return url.equals(inherit);
-	}
-	return false;
+	return inherited;
     }
 
     /**
      * Returns a string representation of the object.
      */
     public String toString() {
+	if (inherited) {
+	    return inherit.toString();
+	}
 	if (url != null) {
 	    return url.toString();
 	}

Index: CssBackgroundPositionCSS2.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css1/CssBackgroundPositionCSS2.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- CssBackgroundPositionCSS2.java	25 Mar 2008 18:43:30 -0000	1.8
+++ CssBackgroundPositionCSS2.java	11 Feb 2009 21:41:10 -0000	1.9
@@ -13,9 +13,9 @@
 import org.w3c.css.values.CssIdent;
 import org.w3c.css.values.CssLength;
 import org.w3c.css.values.CssNumber;
-//import org.w3c.css.values.CssNumber;
 import org.w3c.css.values.CssOperator;
 import org.w3c.css.values.CssPercentage;
+import org.w3c.css.values.CssTypes;
 import org.w3c.css.values.CssValue;
 
 /**
@@ -65,7 +65,8 @@
  *     <LI>
  *       'bottom left' and 'left bottom' mean the same as '0% 100%'.
  *     <LI>
- *       'bottom', 'bottom center' and 'center bottom' mean the same as '50% 100%'.
+ *       'bottom', 'bottom center' and 'center bottom' mean the same as 
+         '50% 100%'.
  *     <LI>
  *       'bottom right' and 'right bottom' mean the same as '100% 100%'.
  *   </UL>
@@ -104,7 +105,7 @@
      * Create a new CssBackgroundPositionCSS2
      */
     public CssBackgroundPositionCSS2() {
-	first = DefaultValue0;
+	first  = DefaultValue0;
 	second = DefaultValue0;
     }
 
@@ -117,213 +118,133 @@
     public CssBackgroundPositionCSS2(ApplContext ac, CssExpression expression,
 	    boolean check) throws InvalidParamException {
 
-	if(check && expression.getCount() > 2) {
+	int nb_val =  expression.getCount();
+	boolean first_is_keyword, second_is_keyword;
+	int index_first, index_second;
+
+	if(check && nb_val > 2) {
 	    throw new InvalidParamException("unrecognize", ac);
 	}
 
 	setByUser();
-	CssValue val = expression.getValue();
-	char op  = expression.getOperator();
+	CssValue nextval;
+	CssValue val     = expression.getValue();
+	char     op      = expression.getOperator();
 
 	if (op != SPACE)
 	    throw new  InvalidParamException("operator",
 					     ((new Character(op)).toString()),
 					     ac);
-
-	if (val.equals(inherit)) {
-	    if(expression.getCount() > 1) {
-		throw new InvalidParamException("unrecognize", ac);
-	    }
-	    first = inherit;
-	    second = inherit;
-	    expression.next();
-	    return;
+	
+	if (nb_val == 1) { /* default to 'center' */
+	    second_is_keyword = true;
+	    second = null;
 	}
 
-	CssValue next = expression.getNextValue();
+	index_first = -1;
+	index_second = -1;
 
-	if(val instanceof CssIdent) {
-	    int index1 = IndexOfIdent((String) val.get());
-	    if(index1 == -1) {
-		throw new InvalidParamException("value", val, "background-position", ac);
-	    }
-	    // two keywords
-	    if(next instanceof CssIdent) {
-		int index2 = IndexOfIdent((String) next.get());
-		if(index2 == -1 && check) {
-		    throw new InvalidParamException("value", next, "background-position", ac);
-		}
-		// one is vertical, the other is horizontal
-		// or the two are 'center'
-		if((isHorizontal(index1) && isVertical(index2)) ||
-			(isHorizontal(index2) && isVertical(index1))) {
-		    first = val;
-		    second = next;
-		}
-		// both are horizontal or vertical but not 'center'
-		else if(check){
-		    throw new InvalidParamException("incompatible",
-			    val, next, ac);
-		}
-		else {
-		    first = val;
-		}
-	    }
-	    // a keyword and a percentage/length
-	    else if(next instanceof CssLength || next instanceof CssPercentage
-		    || next instanceof CssNumber) {
-		if(isHorizontal(index1)) {
-		    if(next instanceof CssNumber) {
-			next = ((CssNumber) next).getLength();
-		    }
-		    setFirst(val);
-		    setSecond(next);
-		}
-		// if the keyword is the first value, it can only be an
-		// horizontal one
-		else {
-		    throw new InvalidParamException("incompatible",
-			    val, next, ac);
+	first = null;
+	switch(val.getType()) {
+	case CssTypes.CSS_IDENT:
+	    /* check for inherit, only one value allowed */
+	    if (inherit.equals(val)) {
+		if(nb_val > 1) {
+		    throw new InvalidParamException("unrecognize", ac);
 		}
+		first = inherit;
+		second = inherit;
+		expression.next();
+		return;
 	    }
-	    // only one value
-	    else if(next == null || !check) {
-		first = val;
-	    }
-	    // the second value is invalid
-	    else if(check) {
-		throw new InvalidParamException("value", next,
-			getPropertyName(), ac);
+	    first_is_keyword = true;
+	    // FIXME do something better
+	    index_first = IndexOfIdent((String) val.get());
+	    if(index_first == -1) {
+		throw new InvalidParamException("value", val,
+						"background-position", ac);
 	    }
+	    first = val;
+	    break;
+	case CssTypes.CSS_NUMBER:
+	    val = ((CssNumber) val).getLength();
+	case CssTypes.CSS_PERCENTAGE:
+	case CssTypes.CSS_LENGTH:
+	    first_is_keyword = false;
+	    first = val;
+	    break;
+	default:
+	    throw new InvalidParamException("value", val,
+					    "background-position", ac);
 	}
-	else if(val instanceof CssLength || val instanceof CssPercentage ||
-		val instanceof CssNumber) {
-	    if(val instanceof CssNumber) {
-		val = ((CssNumber) val).getLength();
-	    }
-	    if(next instanceof CssIdent) {
-		int index = IndexOfIdent((String) next.get());
-		if(check && index == -1) {
-		    throw new InvalidParamException("value", next, "background-position", ac);
-		}
-		// the keyword must be a vertical one
-		if(isVertical(index)) {
-		    setFirst(val);
-		    setSecond(next);
-		}
-		else if(check) {
-		    throw new InvalidParamException("incompatible",
-			    val, next, ac);
-		}
-		else {
-		    setFirst(val);
-		}
-	    }
-	    else if(next instanceof CssLength || next instanceof CssPercentage
-		    || next instanceof CssNumber) {
-		if(next instanceof CssNumber) {
-		    next = ((CssNumber) next).getLength();
-		}
-		first = val;
-		second = next;
+	if (nb_val == 1) {
+	    if (first != null) {
+		expression.next();
 	    }
-	    else if(next == null || !check) {
-		first = val;
+	    return;
+	}
+	/* now check the second value */
+	nextval = expression.getNextValue();
+	second = null;
+	switch(nextval.getType()) {
+	case CssTypes.CSS_IDENT:
+	    if (inherit.equals(nextval)) {
+		throw new InvalidParamException("unrecognize", ac);
 	    }
-	    else {
-		throw new InvalidParamException("incompatible", val, next, ac);
+	    index_second = IndexOfIdent((String) nextval.get());
+	    if(index_second == -1 && check) {
+		throw new InvalidParamException("value", nextval, 
+						"background-position", ac);
 	    }
-	}
-	else if(check) {
-	    throw new InvalidParamException("value", expression.getValue(),
-		    getPropertyName(), ac);
-	}
-
-	// we only move the cursor if we found valid values
-	if(first != null) {
-	    expression.next();
-	}
-	if(second != null) {
-	    expression.next();
-	}
-	/*
-	else if (val instanceof CssIdent
-	    && (index=IndexOfIdent((String) val.get())) != INVALID) {
-	    CssValue next = expression.getNextValue();
-	    expression.next();
-	    if (next == null) {
-		getPercentageFromIdent(index, INVALID);
-	    } else if(next instanceof CssIdent) {
-		int index2 = IndexOfIdent((String) next.get());
-		if(next != null && next.equals(inherit)) {
-		    throw new InvalidParamException("unrecognize", ac);
-		}
-		if (index2 != INVALID) {
-		    getPercentageFromIdent(index, index2);
-		    expression.next();
+	    if (first_is_keyword) {
+		// two keywords, check that they are compatible
+		if((isHorizontal(index_first) && isVertical(index_second)) ||
+		   (isHorizontal(index_second) && isVertical(index_first))) {
+		    second = nextval;
 		} else {
-		    getPercentageFromIdent(index, INVALID);
-		}
-	    }
-	    else if (next instanceof CssLength ||
-		next instanceof CssPercentage || next instanceof CssNumber) {
-		if (next instanceof CssNumber) {
-		    next = ((CssNumber) next).getLength();
-		}
-		if(index == POSITION_LEFT || index == POSITION_RIGHT ||
-			index == POSITION_CENTER) {
-		    vertical = next;
-		}
-		else {
-		    throw new InvalidParamException("incompatible", val ,
-			    next , ac);
+		    if (check) {
+			throw new InvalidParamException("incompatible",
+							val, nextval, ac);
+		    }
 		}
-		expression.next();
-	    }
-	    else {
-		throw new InvalidParamException("incompatible", val ,
-			next , ac);
+	    } else {
+	// first was not a keyword, so second should be vertical
+	// http://www.w3.org/TR/CSS21/colors.html#propdef-background-position
+		if (isVertical(index_second)) {
+		    second = nextval;
+		} else {
+        // FIXME, should we create a better error msg, like "wrong order" ?
+		    if (check) {
+			throw new InvalidParamException("incompatible",
+							val, nextval, ac);
+		    }
+		} 
 	    }
-	} else if (val instanceof CssLength ||
-		   val instanceof CssPercentage || val instanceof CssNumber) {
-	    if (val instanceof CssNumber) {
-		val = ((CssNumber) val).getLength();
+	    break;
+	case CssTypes.CSS_NUMBER:
+	    nextval = ((CssNumber) nextval).getLength();
+	case CssTypes.CSS_PERCENTAGE:
+	case CssTypes.CSS_LENGTH:
+	    if (first_is_keyword) {
+       	// check that the first is indeed horizontal
+       	// http://www.w3.org/TR/CSS21/colors.html#propdef-background-position
+		if (!isHorizontal(index_first) && check) {
+		    throw new InvalidParamException("incompatible",
+						    val, nextval, ac);
+		} 
 	    }
-	    horizontal = val;
+	    second = nextval;
+	    break;
+	default:
+	    throw new InvalidParamException("value", nextval,
+					    "background-position", ac);
+	}
+	if (first != null) {
 	    expression.next();
-	    CssValue next = expression.getValue();
-	    if(next != null && next.equals(inherit)) {
-		throw new InvalidParamException("unrecognize", ac);
-	    }
-	    System.out.println(next);
-	    if (next instanceof CssLength ||
-		next instanceof CssPercentage || next instanceof CssNumber) {
-		if (next instanceof CssNumber) {
-		    next = ((CssNumber) next).getLength();
-		}
-		vertical = next;
+	    if (second != null) {
 		expression.next();
 	    }
-	    else if(next instanceof CssIdent) {
-		int index2 = IndexOfIdent((String) next.get());
-		if(index2 == POSITION_TOP || index2 == POSITION_BOTTOM ||
-			index2 == POSITION_CENTER) {
-		    getPercentageFromIdent(INVALID, index2);
-		    horizontal = val;
-		}
-		else {
-		    throw new InvalidParamException("incompatible",
-			    horizontal, next, ac);
-		}
-	    }
-	    else if(next != null) {
-		throw new InvalidParamException("incompatible",
-			horizontal, val, ac);
-	    }
-	} else {
-	    throw new InvalidParamException("value", expression.getValue(),
-					    getPropertyName(), ac);
-	}*/
+	}   
     }
 
     protected boolean isHorizontal(int index) {
@@ -412,34 +333,20 @@
 	if (first == inherit) {
 	    return inherit.toString();
 	} else {
-	    String ret = "";
+	    StringBuilder sb = new StringBuilder();
 	    if (first != null) {
-		ret += first;
+		sb.append(first);
 	    }
 	    if (second != null) {
-		if (!ret.equals("")) {
-		    ret += " ";
+		if (first != null) {
+		    sb.append(' ');
 		}
-		ret += second;
+		sb.append(second);
 	    }
-
-	    return ret;
+	    return sb.toString();
 	}
     }
-    /*
-    private void getPercentageFromIdent(int first, int second) {
-	horizontal = DefaultValue50;
-	vertical = DefaultValue50;
-	if (first == POSITION_LEFT || second == POSITION_LEFT)
-	    horizontal = DefaultValue0;
-	if (first == POSITION_RIGHT || second == POSITION_RIGHT)
-	    horizontal = DefaultValue100;
-	if (first == POSITION_TOP || second == POSITION_TOP)
-	    vertical = DefaultValue0;
-	if (first == POSITION_BOTTOM || second == POSITION_BOTTOM)
-	    vertical = DefaultValue100;
-    }
-    */
+
     /**
      * Add this property to the CssStyle.
      *
@@ -472,9 +379,11 @@
      * @param value The other property.
      */
     public boolean equals(CssProperty property) {
-	return (property instanceof CssBackgroundPositionCSS2 &&
-		first.equals(((CssBackgroundPositionCSS2) property).first)
-		&& second.equals(((CssBackgroundPositionCSS2) property).second));
+	if (!(property instanceof CssBackgroundPositionCSS2)) {
+	    return false;
+	}
+	CssBackgroundPositionCSS2 cprop = (CssBackgroundPositionCSS2) property;
+	return (first.equals(cprop.first) && second.equals(cprop.second));
     }
 
     /**
@@ -504,10 +413,7 @@
 
     private static int[] hash_values;
 
-    //private static int INVALID = -1;
     private static CssPercentage DefaultValue0 = new CssPercentage(0);
-    //private static CssPercentage DefaultValue50 = new CssPercentage(50);
-    //private static CssPercentage DefaultValue100 = new CssPercentage(100);
 
     static {
 	hash_values = new int[POSITION.length];

Index: CssBackgroundRepeatCSS1.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css1/CssBackgroundRepeatCSS1.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- CssBackgroundRepeatCSS1.java	14 Sep 2005 15:14:31 -0000	1.3
+++ CssBackgroundRepeatCSS1.java	11 Feb 2009 21:41:10 -0000	1.4
@@ -11,6 +11,7 @@
 import org.w3c.css.util.InvalidParamException;
 import org.w3c.css.values.CssExpression;
 import org.w3c.css.values.CssIdent;
+import org.w3c.css.values.CssTypes;
 import org.w3c.css.values.CssValue;
 
 /**
@@ -44,7 +45,9 @@
 public class CssBackgroundRepeatCSS1 extends CssProperty
 	implements CssBackgroundConstants {
 
-    int repeat;
+    private static final String property_name = "background-repeat";
+
+   int repeat;
 
     private static int[] hash_values;
 
@@ -70,7 +73,7 @@
 	CssValue val = expression.getValue();
 	setByUser();
 
-	if (val instanceof CssIdent) {
+	if (val.getType() == CssTypes.CSS_IDENT) {
 	    int hash = val.hashCode();
 	    for (int i =0; i < REPEAT.length; i++) {
 		if (hash_values[i] == hash) {
@@ -116,7 +119,7 @@
      * Returns the name of this property
      */
     public String getPropertyName() {
-	return "background-repeat";
+	return property_name;
     }
 
     /**

Index: CssBackgroundImageCSS1.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css1/CssBackgroundImageCSS1.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- CssBackgroundImageCSS1.java	14 Sep 2005 15:14:31 -0000	1.3
+++ CssBackgroundImageCSS1.java	11 Feb 2009 21:41:10 -0000	1.4
@@ -12,6 +12,7 @@
 import org.w3c.css.util.InvalidParamException;
 import org.w3c.css.values.CssExpression;
 import org.w3c.css.values.CssIdent;
+import org.w3c.css.values.CssTypes;
 import org.w3c.css.values.CssURL;
 import org.w3c.css.values.CssValue;
 
@@ -36,7 +37,8 @@
  * @version $Revision$ */
 public class CssBackgroundImageCSS1 extends CssProperty {
 
-    CssValue url;
+    CssValue url = null;
+    boolean inherited = false;
 
     private static CssIdent none = new CssIdent("none");
 
@@ -63,16 +65,24 @@
 	setByUser();
 
 	CssValue val = expression.getValue();
-	if (val instanceof CssURL) {
+
+	switch(val.getType()) {
+	case CssTypes.CSS_URL:
 	    url = val;
-	    expression.next();
-	} else if (val.equals(none)) {
-	    url = none;
-	    expression.next();
-	} else {
-	    throw new InvalidParamException("value", expression.getValue(),
+	    break;
+	case CssTypes.CSS_IDENT:
+	    if (inherit.equals(val)) {
+		inherited = true;
+		break;
+	    } else if (none.equals(val)) {
+		url = none;
+		break;
+	    }
+	default:
+	    throw new InvalidParamException("value", val,
 					    getPropertyName(), ac);
 	}
+	expression.next();
     }
 
     public CssBackgroundImageCSS1(ApplContext ac, CssExpression expression)
@@ -92,16 +102,16 @@
      * e.g. his value equals inherit
      */
     public boolean isSoftlyInherited() {
-	if (url != null) {
-	    return url.equals(inherit);
-	}
-	return false;
+	return inherited;
     }
 
     /**
      * Returns a string representation of the object.
      */
     public String toString() {
+	if (inherited) {
+	    return inherit.toString();
+	}
 	if (url != null) {
 	    return url.toString();
 	}
Received on Wednesday, 11 February 2009 21:41:21 GMT

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