- From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
- Date: Tue, 25 Sep 2012 19:51:30 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/2002/css-validator/org/w3c/css/properties/css3 In directory hutz:/tmp/cvs-serv23779/css3 Modified Files: Css3Style.java CssFontSize.java Added Files: CssPadding.java CssPaddingBottom.java CssPaddingLeft.java CssPaddingRight.java CssPaddingTop.java Removed Files: CssPaddingBottomCSS3.java CssPaddingCSS3.java CssPaddingLeftCSS3.java CssPaddingRightCSS3.java CssPaddingSideCSS3.java CssPaddingTopCSS3.java Log Message: padding for CSS1/2/21 and CSS3 --- NEW FILE: CssPaddingLeft.java --- // $Id: CssPaddingLeft.java,v 1.1 2012/09/25 19:51:27 ylafon Exp $ // Author: Yves Lafon <ylafon@w3.org> // // (c) COPYRIGHT MIT, ERCIM and Keio University, 2012. // Please first read the full copyright statement in file COPYRIGHT.html package org.w3c.css.properties.css3; import org.w3c.css.util.ApplContext; import org.w3c.css.util.InvalidParamException; import org.w3c.css.values.CssExpression; /** * @spec http://www.w3.org/TR/2007/WD-css3-box-20070809/#padding-left */ public class CssPaddingLeft extends org.w3c.css.properties.css.CssPaddingLeft { /** * Create a new CssPaddingLeft */ public CssPaddingLeft() { value = initial; } /** * Set the value of the property<br/> * Does not check the number of values * * @param expression The expression for this property * @throws org.w3c.css.util.InvalidParamException * The expression is incorrect */ public CssPaddingLeft(ApplContext ac, CssExpression expression) throws InvalidParamException { this(ac, expression, false); } /** * Set the value of the property * * @param expression The expression for this property * @param check set it to true to check the number of values * @throws org.w3c.css.util.InvalidParamException * The expression is incorrect */ public CssPaddingLeft(ApplContext ac, CssExpression expression, boolean check) throws InvalidParamException { setByUser(); CssPadding.checkValue(ac, expression, check, this); } } --- NEW FILE: CssPaddingTop.java --- // $Id: CssPaddingTop.java,v 1.1 2012/09/25 19:51:27 ylafon Exp $ // Author: Yves Lafon <ylafon@w3.org> // // (c) COPYRIGHT MIT, ERCIM and Keio University, 2012. // Please first read the full copyright statement in file COPYRIGHT.html package org.w3c.css.properties.css3; import org.w3c.css.util.ApplContext; import org.w3c.css.util.InvalidParamException; import org.w3c.css.values.CssExpression; /** * @spec http://www.w3.org/TR/2007/WD-css3-box-20070809/#padding-top */ public class CssPaddingTop extends org.w3c.css.properties.css.CssPaddingTop { /** * Create a new CssPaddingTop */ public CssPaddingTop() { value = initial; } /** * Set the value of the property<br/> * Does not check the number of values * * @param expression The expression for this property * @throws org.w3c.css.util.InvalidParamException * The expression is incorrect */ public CssPaddingTop(ApplContext ac, CssExpression expression) throws InvalidParamException { this(ac, expression, false); } /** * Set the value of the property * * @param expression The expression for this property * @param check set it to true to check the number of values * @throws org.w3c.css.util.InvalidParamException * The expression is incorrect */ public CssPaddingTop(ApplContext ac, CssExpression expression, boolean check) throws InvalidParamException { setByUser(); CssPadding.checkValue(ac, expression, check, this); } } --- NEW FILE: CssPaddingRight.java --- // $Id: CssPaddingRight.java,v 1.1 2012/09/25 19:51:27 ylafon Exp $ // Author: Yves Lafon <ylafon@w3.org> // // (c) COPYRIGHT MIT, ERCIM and Keio University, 2012. // Please first read the full copyright statement in file COPYRIGHT.html package org.w3c.css.properties.css3; import org.w3c.css.util.ApplContext; import org.w3c.css.util.InvalidParamException; import org.w3c.css.values.CssExpression; /** * @spec http://www.w3.org/TR/2007/WD-css3-box-20070809/#padding-right */ public class CssPaddingRight extends org.w3c.css.properties.css.CssPaddingRight { /** * Create a new CssPaddingRight */ public CssPaddingRight() { value = initial; } /** * Set the value of the property<br/> * Does not check the number of values * * @param expression The expression for this property * @throws org.w3c.css.util.InvalidParamException * The expression is incorrect */ public CssPaddingRight(ApplContext ac, CssExpression expression) throws InvalidParamException { this(ac, expression, false); } /** * Set the value of the property * * @param expression The expression for this property * @param check set it to true to check the number of values * @throws org.w3c.css.util.InvalidParamException * The expression is incorrect */ public CssPaddingRight(ApplContext ac, CssExpression expression, boolean check) throws InvalidParamException { setByUser(); CssPadding.checkValue(ac, expression, check, this); } } Index: Css3Style.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css3/Css3Style.java,v retrieving revision 1.94 retrieving revision 1.95 diff -u -d -r1.94 -r1.95 --- Css3Style.java 5 Sep 2012 12:06:06 -0000 1.94 +++ Css3Style.java 25 Sep 2012 19:51:27 -0000 1.95 @@ -170,11 +170,6 @@ CssMaxHeightCSS3 cssMaxHeightCSS3; CssMinWidthCSS3 cssMinWidthCSS3; CssMinHeightCSS3 cssMinHeightCSS3; - CssPaddingCSS3 cssPaddingCSS3; - CssPaddingBottomCSS3 cssPaddingBottomCSS3; - CssPaddingTopCSS3 cssPaddingTopCSS3; - CssPaddingLeftCSS3 cssPaddingLeftCSS3; - CssPaddingRightCSS3 cssPaddingRightCSS3; public org.w3c.css.properties.css.CssBorderImageSource getBorderImageSource() { if (cssBorder.borderImage.source == null) { @@ -787,51 +782,6 @@ return cssMinWidthCSS3; } - public CssPaddingCSS3 getPaddingCSS3() { - if (cssPaddingCSS3 == null) { - cssPaddingCSS3 = - (CssPaddingCSS3) style.CascadingOrder( - new CssPaddingCSS3(), style, selector); - } - return cssPaddingCSS3; - } - - public CssPaddingTopCSS3 getPaddingTopCSS3() { - if (cssPaddingTopCSS3 == null) { - cssPaddingTopCSS3 = - (CssPaddingTopCSS3) style.CascadingOrder( - new CssPaddingTopCSS3(), style, selector); - } - return cssPaddingTopCSS3; - } - - public CssPaddingBottomCSS3 getPaddingBottomCSS3() { - if (cssPaddingBottomCSS3 == null) { - cssPaddingBottomCSS3 = - (CssPaddingBottomCSS3) style.CascadingOrder( - new CssPaddingBottomCSS3(), style, selector); - } - return cssPaddingBottomCSS3; - } - - public CssPaddingLeftCSS3 getPaddingLeftCSS3() { - if (cssPaddingLeftCSS3 == null) { - cssPaddingLeftCSS3 = - (CssPaddingLeftCSS3) style.CascadingOrder( - new CssPaddingLeftCSS3(), style, selector); - } - return cssPaddingLeftCSS3; - } - - public CssPaddingRightCSS3 getPaddingRightCSS3() { - if (cssPaddingRightCSS3 == null) { - cssPaddingRightCSS3 = - (CssPaddingRightCSS3) style.CascadingOrder( - new CssPaddingRightCSS3(), style, selector); - } - return cssPaddingRightCSS3; - } - public CssMarqueeDirection getMarqueeDirection() { if (cssMarqueeDirection == null) { cssMarqueeDirection = --- NEW FILE: CssPaddingBottom.java --- // $Id: CssPaddingBottom.java,v 1.1 2012/09/25 19:51:27 ylafon Exp $ // Author: Yves Lafon <ylafon@w3.org> // // (c) COPYRIGHT MIT, ERCIM and Keio University, 2012. // Please first read the full copyright statement in file COPYRIGHT.html package org.w3c.css.properties.css3; import org.w3c.css.util.ApplContext; import org.w3c.css.util.InvalidParamException; import org.w3c.css.values.CssExpression; /** * @spec http://www.w3.org/TR/2007/WD-css3-box-20070809/#padding-bottom */ public class CssPaddingBottom extends org.w3c.css.properties.css.CssPaddingBottom { /** * Create a new CssPaddingBottom */ public CssPaddingBottom() { value = initial; } /** * Set the value of the property<br/> * Does not check the number of values * * @param expression The expression for this property * @throws org.w3c.css.util.InvalidParamException * The expression is incorrect */ public CssPaddingBottom(ApplContext ac, CssExpression expression) throws InvalidParamException { this(ac, expression, false); } /** * Set the value of the property * * @param expression The expression for this property * @param check set it to true to check the number of values * @throws org.w3c.css.util.InvalidParamException * The expression is incorrect */ public CssPaddingBottom(ApplContext ac, CssExpression expression, boolean check) throws InvalidParamException { setByUser(); CssPadding.checkValue(ac, expression, check, this); } } --- CssPaddingCSS3.java DELETED --- --- CssPaddingLeftCSS3.java DELETED --- --- CssPaddingTopCSS3.java DELETED --- --- CssPaddingRightCSS3.java DELETED --- Index: CssFontSize.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css3/CssFontSize.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- CssFontSize.java 10 Sep 2012 17:04:58 -0000 1.5 +++ CssFontSize.java 25 Sep 2012 19:51:27 -0000 1.6 @@ -22,10 +22,12 @@ public class CssFontSize extends org.w3c.css.properties.css.CssFontSize { public static final CssIdent[] allowed_values; - static final String[] absolute_values = {"xx-small", "x-small", "small", "medium", "large", "x-large", "xx-large"}; - static final String[] relative_values = {"smaller", "larger"}; + static { + String[] absolute_values = {"xx-small", "x-small", "small", "medium", "large", "x-large", "xx-large"}; + String[] relative_values = {"smaller", "larger"}; + allowed_values = new CssIdent[absolute_values.length + relative_values.length]; int i = 0; for (String s : absolute_values) { --- CssPaddingBottomCSS3.java DELETED --- --- CssPaddingSideCSS3.java DELETED --- --- NEW FILE: CssPadding.java --- // $Id: CssPadding.java,v 1.1 2012/09/25 19:51:27 ylafon Exp $ // Author: Yves Lafon <ylafon@w3.org> // // (c) COPYRIGHT MIT, ERCIM and Keio University, 2012. // Please first read the full copyright statement in file COPYRIGHT.html package org.w3c.css.properties.css3; import org.w3c.css.properties.css.CssProperty; import org.w3c.css.util.ApplContext; import org.w3c.css.util.InvalidParamException; import org.w3c.css.values.CssExpression; import org.w3c.css.values.CssLength; import org.w3c.css.values.CssPercentage; import org.w3c.css.values.CssTypes; import org.w3c.css.values.CssValue; import org.w3c.css.values.CssValueList; import java.util.ArrayList; import static org.w3c.css.values.CssOperator.SPACE; /** * @spec http://www.w3.org/TR/2007/WD-css3-box-20070809/#padding1 */ public class CssPadding extends org.w3c.css.properties.css.CssPadding { /** * Create a new CssPadding */ public CssPadding() { value = initial; } /** * Set the value of the property<br/> * Does not check the number of values * * @param expression The expression for this property * @throws org.w3c.css.util.InvalidParamException * The expression is incorrect */ public CssPadding(ApplContext ac, CssExpression expression) throws InvalidParamException { this(ac, expression, false); } /** * Set the value of the property * * @param expression The expression for this property * @param check set it to true to check the number of values * @throws org.w3c.css.util.InvalidParamException * The expression is incorrect */ public CssPadding(ApplContext ac, CssExpression expression, boolean check) throws InvalidParamException { if (check && expression.getCount() > 4) { throw new InvalidParamException("unrecognize", ac); } CssValue val; char op; ArrayList<CssValue> v = new ArrayList<CssValue>(); boolean gotInherit = false; while (!expression.end()) { val = expression.getValue(); op = expression.getOperator(); switch (val.getType()) { case CssTypes.CSS_NUMBER: case CssTypes.CSS_LENGTH: CssLength l = val.getLength(); l.checkPositiveness(ac, this); v.add(val); break; case CssTypes.CSS_PERCENTAGE: CssPercentage p = val.getPercentage(); p.checkPositiveness(ac, this); v.add(val); break; case CssTypes.CSS_IDENT: if (inherit.equals(val)) { v.add(inherit); gotInherit = true; break; } // if not inherit, or not an ident // let it flow to the exception default: throw new InvalidParamException("value", val.toString(), getPropertyName(), ac); } if (op != SPACE) { throw new InvalidParamException("operator", ((new Character(op)).toString()), ac); } expression.next(); } // now we check the number of values... paddingBottom = new CssPaddingBottom(); paddingLeft = new CssPaddingLeft(); paddingTop = new CssPaddingTop(); paddingRight = new CssPaddingRight(); if (gotInherit) { if (v.size() > 1) { throw new InvalidParamException("unrecognize", ac); } value = inherit; paddingBottom.value = inherit; paddingTop.value = inherit; paddingLeft.value = inherit; paddingRight.value = inherit; } else { switch (v.size()) { case 1: paddingTop.value = v.get(0); paddingRight.value = v.get(0); paddingBottom.value = v.get(0); paddingLeft.value = v.get(0); break; case 2: paddingTop.value = v.get(0); paddingRight.value = v.get(1); paddingBottom.value = v.get(0); paddingLeft.value = v.get(1); break; case 3: paddingTop.value = v.get(0); paddingRight.value = v.get(1); paddingBottom.value = v.get(2); paddingLeft.value = v.get(1); break; case 4: paddingTop.value = v.get(0); paddingRight.value = v.get(1); paddingBottom.value = v.get(2); paddingLeft.value = v.get(3); break; default: // can't happen unless we are not checking // the size throw new InvalidParamException("unrecognize", ac); } } value = new CssValueList(v); } // for use by individual padding-* properties protected static CssValue checkValue(ApplContext ac, CssExpression expression, boolean check, CssProperty caller) throws InvalidParamException { if (check && expression.getCount() > 1) { throw new InvalidParamException("unrecognize", ac); } CssValue val; char op; val = expression.getValue(); op = expression.getOperator(); switch (val.getType()) { case CssTypes.CSS_NUMBER: case CssTypes.CSS_LENGTH: CssLength l = val.getLength(); l.checkPositiveness(ac, caller); expression.next(); return val; case CssTypes.CSS_PERCENTAGE: CssPercentage p = val.getPercentage(); p.checkPositiveness(ac, caller); return val; case CssTypes.CSS_IDENT: if (inherit.equals(val)) { expression.next(); return inherit; } // if not inherit, or not an ident // let it flow to the exception } throw new InvalidParamException("value", val.toString(), caller.getPropertyName(), ac); } }
Received on Tuesday, 25 September 2012 19:51:31 UTC