- From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
- Date: Wed, 09 Dec 2009 17:11:12 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/2002/css-validator/org/w3c/css/properties/css1
In directory hutz:/tmp/cvs-serv7555/org/w3c/css/properties/css1
Modified Files:
CssBackgroundPositionCSS2.java
Log Message:
corner case where more than two values are present, but position only has one in latest position. A real fix would be to check only one or two in the 'background' definition according to the kind of token present (so do the lookup in advance)
Index: CssBackgroundPositionCSS2.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css1/CssBackgroundPositionCSS2.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- CssBackgroundPositionCSS2.java 11 Feb 2009 21:41:10 -0000 1.9
+++ CssBackgroundPositionCSS2.java 9 Dec 2009 17:11:10 -0000 1.10
@@ -186,58 +186,60 @@
/* 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);
- }
- index_second = IndexOfIdent((String) nextval.get());
- if(index_second == -1 && check) {
- throw new InvalidParamException("value", nextval,
- "background-position", ac);
- }
- 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 {
- if (check) {
- throw new InvalidParamException("incompatible",
- val, nextval, ac);
- }
+ if (check || nextval != null) {
+ switch(nextval.getType()) {
+ case CssTypes.CSS_IDENT:
+ if (inherit.equals(nextval)) {
+ throw new InvalidParamException("unrecognize", 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;
+ index_second = IndexOfIdent((String) nextval.get());
+ if(index_second == -1 && check) {
+ throw new InvalidParamException("value", nextval,
+ "background-position", ac);
+ }
+ 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 {
+ if (check) {
+ throw new InvalidParamException("incompatible",
+ val, nextval, ac);
+ }
+ }
} else {
- // FIXME, should we create a better error msg, like "wrong order" ?
- if (check) {
+ // 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);
+ }
+ }
+ }
+ 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);
- }
- }
- }
- 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);
- }
+ }
+ }
+ second = nextval;
+ break;
+ default:
+ throw new InvalidParamException("value", nextval,
+ "background-position", ac);
}
- second = nextval;
- break;
- default:
- throw new InvalidParamException("value", nextval,
- "background-position", ac);
}
if (first != null) {
expression.next();
Received on Wednesday, 9 December 2009 17:11:21 UTC