- From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
- Date: Thu, 26 Apr 2012 09:20:03 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/2002/css-validator/org/w3c/css/properties/css3 In directory hutz:/tmp/cvs-serv32464/w3c/css/properties/css3 Modified Files: CssBorderImage.java Log Message: stricter checking around the state change Index: CssBorderImage.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css3/CssBorderImage.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- CssBorderImage.java 25 Apr 2012 20:22:05 -0000 1.4 +++ CssBorderImage.java 26 Apr 2012 09:20:00 -0000 1.5 @@ -41,7 +41,8 @@ // state 1, we check only <?border-image-width?> ( first / after <?border-image-slice?>) // state 2, we check only for <?border-image-outset?> CssExpression newexp; - CssValue val, tval; + CssValue val = null; + CssValue tval; char op; while (!expression.end()) { @@ -53,8 +54,14 @@ if (source != null) { throw new InvalidParamException("unrecognize", ac); } - // newexp = new CssExpression(); - // newexp.addValue(val); + // right after the / in step 2 we must have a slice and outset or width + if (state > 0) { + if ((slice == null) || + ((state == 1 && width == null) || (state == 2 && outset == null))) { + throw new InvalidParamException("value", val.toString(), + getPropertyName(), ac); + } + } // work on this expression as it consumes only one token source = new CssBorderImageSource(ac, expression, false); // we must reset the operator @@ -63,7 +70,7 @@ break; case CssTypes.CSS_SWITCH: state++; - if (state > 2) { + if (slice == null || state > 2) { throw new InvalidParamException("value", val.toString(), getPropertyName(), ac); } @@ -81,7 +88,7 @@ } switch (state) { case 0: - // state 0, we can only have slice or repeat + // state 0, we can only have slice or repeat or image // slice tval = CssBorderImageSlice.getMatchingIdent((CssIdent) val); if (tval != null) { @@ -143,16 +150,27 @@ throw new InvalidParamException("value", val.toString(), getPropertyName(), ac); } + // right after the / in step 2 we must have a slice or outset + if ((state == 1 && width == null) || (state == 2 && outset == null)) { + throw new InvalidParamException("value", val.toString(), + getPropertyName(), ac); + } repeat = new CssBorderImageRepeat(ac, newexp, check); state = 0; break; } // TODO check for border-image! (none) if (CssBorderImageSource.isMatchingIdent((CssIdent) val)) { + System.err.println("*** matching image slice=" + slice); if (source != null) { throw new InvalidParamException("value", val.toString(), getPropertyName(), ac); } + // right after the / in step 2 we must have a slice or outset + if ((state == 1 && width == null) || (state == 2 && outset == null)) { + throw new InvalidParamException("value", val.toString(), + getPropertyName(), ac); + } source = new CssBorderImageSource(ac, expression, false); state = 0; break; @@ -275,6 +293,11 @@ ac); } } + if (val.getType() == CssTypes.CSS_SWITCH) { + // we can't end by a / + throw new InvalidParamException("value", val.toString(), + getPropertyName(), ac); + } shorthand = true; }
Received on Thursday, 26 April 2012 09:20:06 UTC