- From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
- Date: Tue, 16 Oct 2012 20:44:02 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/2002/css-validator/org/w3c/css/properties/css21 In directory hutz:/tmp/cvs-serv19650/css21 Added Files: CssOutline.java CssOutlineColor.java CssOutlineStyle.java CssOutlineWidth.java Log Message: outline/outline-color/outline-width/outline-style per css2 2.1 and http://www.w3.org/TR/2012/WD-css3-ui-20120117/ outline-offset per http://www.w3.org/TR/2012/WD-css3-ui-20120117/ --- NEW FILE: CssOutlineColor.java --- // $Id: CssOutlineColor.java,v 1.1 2012/10/16 20:44:00 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.css21; import org.w3c.css.util.ApplContext; 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; /** * @spec http://www.w3.org/TR/2011/REC-CSS2-20110607/ui.html#propdef-outline-color */ public class CssOutlineColor extends org.w3c.css.properties.css.CssOutlineColor { public static final CssIdent invert = CssIdent.getIdent("invert"); public static final CssIdent getMatchingIdent(CssIdent ident) { if (invert.equals(ident)) { return ident; } return null; } /** * Create a new CssOutlineColor */ public CssOutlineColor() { } /** * Creates a new CssOutlineColor * * @param expression The expression for this property * @throws org.w3c.css.util.InvalidParamException * Expressions are incorrect */ public CssOutlineColor(ApplContext ac, CssExpression expression, boolean check) throws InvalidParamException { if (check && expression.getCount() > 1) { throw new InvalidParamException("unrecognize", ac); } setByUser(); CssValue val = expression.getValue(); switch (val.getType()) { case CssTypes.CSS_COLOR: value = val; break; case CssTypes.CSS_IDENT: if (invert.equals(val)) { value = invert; break; } if (inherit.equals(val)) { value = inherit; break; } // else, we must parse the ident as a color value value = new org.w3c.css.values.CssColor(ac, (String) val.get()); break; default: throw new InvalidParamException("value", val.toString(), getPropertyName(), ac); } expression.next(); } public CssOutlineColor(ApplContext ac, CssExpression expression) throws InvalidParamException { this(ac, expression, false); } } --- NEW FILE: CssOutline.java --- // $Id: CssOutline.java,v 1.1 2012/10/16 20:44:00 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.css21; import org.w3c.css.util.ApplContext; 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; import static org.w3c.css.values.CssOperator.SPACE; /** * @spec http://www.w3.org/TR/2011/REC-CSS2-20110607/ui.html#propdef-outline * @see org.w3c.css.properties.css21.CssBorderStyle * @see org.w3c.css.properties.css21.CssBorderWidth */ public class CssOutline extends org.w3c.css.properties.css.CssOutline { /** * Create a new CssOutline */ public CssOutline() { _color = new CssOutlineColor(); _style = new CssOutlineStyle(); _width = new CssOutlineWidth(); } /** * Creates a new CssOutline * * @param expression The expression for this property * @throws org.w3c.css.util.InvalidParamException * Expressions are incorrect */ public CssOutline(ApplContext ac, CssExpression expression, boolean check) throws InvalidParamException { if (check && expression.getCount() > 3) { throw new InvalidParamException("unrecognize", ac); } setByUser(); CssValue val; char op; _color = new CssOutlineColor(); _style = new CssOutlineStyle(); _width = new CssOutlineWidth(); while (!expression.end()) { val = expression.getValue(); op = expression.getOperator(); switch (val.getType()) { case CssTypes.CSS_NUMBER: case CssTypes.CSS_LENGTH: if (_width.value == null) { CssExpression ex = new CssExpression(); ex.addValue(val); _width = new CssOutlineWidth(ac, ex, check); break; } // else, we already got one... throw new InvalidParamException("value", val.toString(), getPropertyName(), ac); case CssTypes.CSS_COLOR: if (_color.value == null) { CssExpression ex = new CssExpression(); ex.addValue(val); _color = new CssOutlineColor(ac, ex, check); break; } // else, we already got one... throw new InvalidParamException("value", val.toString(), getPropertyName(), ac); case CssTypes.CSS_IDENT: if (inherit.equals(val)) { if (expression.getCount() != 1) { throw new InvalidParamException("value", val.toString(), getPropertyName(), ac); } value = inherit; break; } CssIdent ident = (CssIdent) val; // let's try to find which ident we have... if (_style.value == null) { CssIdent match = CssBorderStyle.getMatchingIdent(ident); if (match != null) { _style.value = match; break; } } if (_width.value == null) { CssIdent match = CssBorderWidth.getMatchingIdent(ident); if (match != null) { _width.value = match; break; } } if (_color.value == null) { CssIdent match = CssOutlineColor.getMatchingIdent(ident); if (match != null) { _color.value = match; break; } else { CssExpression ex = new CssExpression(); ex.addValue(val); _color = new CssOutlineColor(ac, ex, check); break; } } // unrecognized... fail default: throw new InvalidParamException("value", val.toString(), getPropertyName(), ac); } expression.next(); if (op != SPACE) { throw new InvalidParamException("operator", Character.toString(op), ac); } } } public CssOutline(ApplContext ac, CssExpression expression) throws InvalidParamException { this(ac, expression, false); } } --- NEW FILE: CssOutlineStyle.java --- // $Id: CssOutlineStyle.java,v 1.1 2012/10/16 20:44:00 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.css21; import org.w3c.css.util.ApplContext; import org.w3c.css.util.InvalidParamException; import org.w3c.css.values.CssExpression; /** * @spec http://www.w3.org/TR/2011/REC-CSS2-20110607/ui.html#propdef-outline-style * @see org.w3c.css.properties.css21.CssBorderStyle */ public class CssOutlineStyle extends org.w3c.css.properties.css.CssOutlineStyle { /** * Create a new CssOutlineStyle */ public CssOutlineStyle() { } /** * Creates a new CssOutlineStyle * * @param expression The expression for this property * @throws org.w3c.css.util.InvalidParamException * Expressions are incorrect */ public CssOutlineStyle(ApplContext ac, CssExpression expression, boolean check) throws InvalidParamException { setByUser(); // here we delegate to BorderStyle implementation value = CssBorderStyle.checkBorderSideStyle(ac, this, expression, check); } public CssOutlineStyle(ApplContext ac, CssExpression expression) throws InvalidParamException { this(ac, expression, false); } } --- NEW FILE: CssOutlineWidth.java --- // $Id: CssOutlineWidth.java,v 1.1 2012/10/16 20:44:00 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.css21; import org.w3c.css.util.ApplContext; import org.w3c.css.util.InvalidParamException; import org.w3c.css.values.CssExpression; /** * @spec http://www.w3.org/TR/2011/REC-CSS2-20110607/ui.html#propdef-outline-width * @see CssBorderWidth */ public class CssOutlineWidth extends org.w3c.css.properties.css.CssOutlineWidth { /** * Create a new CssOutlineWidth */ public CssOutlineWidth() { } /** * Creates a new CssOutlineWidth * * @param expression The expression for this property * @throws org.w3c.css.util.InvalidParamException * Expressions are incorrect */ public CssOutlineWidth(ApplContext ac, CssExpression expression, boolean check) throws InvalidParamException { setByUser(); // here we delegate to BorderWidth implementation value = CssBorderWidth.checkBorderSideWidth(ac, this, expression, check); } public CssOutlineWidth(ApplContext ac, CssExpression expression) throws InvalidParamException { this(ac, expression, false); } }
Received on Tuesday, 16 October 2012 20:44:04 UTC