- From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
- Date: Tue, 16 Oct 2012 20:44:01 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/2002/css-validator/org/w3c/css/properties/css2 In directory hutz:/tmp/cvs-serv19650/css2 Modified Files: Css2Style.java CssBorderStyle.java CssBorderWidth.java 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:43:59 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.css2; 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/2008/REC-CSS2-20080411/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); } } Index: Css2Style.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css2/Css2Style.java,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- Css2Style.java 11 Oct 2012 13:17:36 -0000 1.14 +++ Css2Style.java 16 Oct 2012 20:43:59 -0000 1.15 @@ -13,6 +13,10 @@ import org.w3c.css.properties.css.CssMaxWidth; import org.w3c.css.properties.css.CssMinHeight; import org.w3c.css.properties.css.CssMinWidth; +import org.w3c.css.properties.css.CssOutline; +import org.w3c.css.properties.css.CssOutlineColor; +import org.w3c.css.properties.css.CssOutlineStyle; +import org.w3c.css.properties.css.CssOutlineWidth; import org.w3c.css.properties.css.CssPosition; import org.w3c.css.properties.css.CssRight; import org.w3c.css.properties.css.CssTextShadow; @@ -52,6 +56,11 @@ public CssMinHeight cssMinHeight; public CssMaxHeight cssMaxHeight; + public CssOutlineWidth cssOutlineWidth; + public CssOutlineStyle cssOutlineStyle; + public CssOutlineColor cssOutlineColor; + public CssOutline cssOutline; + /** * Get the azimuth */ @@ -245,4 +254,36 @@ } return cssMaxHeight; } + + public final CssOutlineWidth getOutlineWidth() { + if (cssOutlineWidth == null) { + cssOutlineWidth = + (CssOutlineWidth) style.CascadingOrder(new CssOutlineWidth(), style, selector); + } + return cssOutlineWidth; + } + + public final CssOutlineStyle getOutlineStyle() { + if (cssOutlineStyle == null) { + cssOutlineStyle = + (CssOutlineStyle) style.CascadingOrder(new CssOutlineStyle(), style, selector); + } + return cssOutlineStyle; + } + + public final CssOutlineColor getOutlineColor() { + if (cssOutlineColor == null) { + cssOutlineColor = + (CssOutlineColor) style.CascadingOrder(new CssOutlineColor(), style, selector); + } + return cssOutlineColor; + } + + public final CssOutline getOutline() { + if (cssOutline == null) { + cssOutline = + (CssOutline) style.CascadingOrder(new CssOutline(), style, selector); + } + return cssOutline; + } } --- NEW FILE: CssOutlineStyle.java --- // $Id: CssOutlineStyle.java,v 1.1 2012/10/16 20:43:59 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.css2; import org.w3c.css.util.ApplContext; import org.w3c.css.util.InvalidParamException; import org.w3c.css.values.CssExpression; /** * @spec http://www.w3.org/TR/2008/REC-CSS2-20080411/ui.html#propdef-outline-style * @see org.w3c.css.properties.css2.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); } } Index: CssBorderStyle.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css2/CssBorderStyle.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- CssBorderStyle.java 26 Apr 2012 12:40:07 -0000 1.2 +++ CssBorderStyle.java 16 Oct 2012 20:43:59 -0000 1.3 @@ -36,7 +36,7 @@ } } - static CssIdent getMatchingIdent(CssIdent ident) { + public static CssIdent getMatchingIdent(CssIdent ident) { for (CssIdent id : allowed_values) { if (id.equals(ident)) { return id; @@ -151,7 +151,7 @@ * Check the border-*-style and returns a value. * It makes sense to do it only once for all the sides, so by having the code here. */ - protected static CssValue checkBorderSideStyle(ApplContext ac, CssProperty caller, CssExpression expression, + public static CssValue checkBorderSideStyle(ApplContext ac, CssProperty caller, CssExpression expression, boolean check) throws InvalidParamException { if (check && expression.getCount() > 1) { throw new InvalidParamException("unrecognize", ac); --- NEW FILE: CssOutline.java --- // $Id: CssOutline.java,v 1.1 2012/10/16 20:43:59 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.css2; 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/2008/REC-CSS2-20080411/ui.html#propdef-outline * @see CssBorderStyle * @see 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); } } Index: CssBorderWidth.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css2/CssBorderWidth.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- CssBorderWidth.java 26 Apr 2012 12:40:07 -0000 1.2 +++ CssBorderWidth.java 16 Oct 2012 20:43:59 -0000 1.3 @@ -37,7 +37,7 @@ /* * Get the cached ident if it matches null otherwise */ - static CssIdent getMatchingIdent(CssIdent ident) { + public static CssIdent getMatchingIdent(CssIdent ident) { for (CssIdent id : allowed_values) { if (id.equals(ident)) { return id; @@ -163,7 +163,7 @@ * Check the border-*-width and returns a value. * It makes sense to do it only once for all the sides, so by having the code here. */ - protected static CssValue checkBorderSideWidth(ApplContext ac, CssProperty caller, CssExpression expression, + public static CssValue checkBorderSideWidth(ApplContext ac, CssProperty caller, CssExpression expression, boolean check) throws InvalidParamException { if (check && expression.getCount() > 1) { throw new InvalidParamException("unrecognize", ac); --- NEW FILE: CssOutlineWidth.java --- // $Id: CssOutlineWidth.java,v 1.1 2012/10/16 20:43:59 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.css2; import org.w3c.css.util.ApplContext; import org.w3c.css.util.InvalidParamException; import org.w3c.css.values.CssExpression; /** * @spec http://www.w3.org/TR/2008/REC-CSS2-20080411/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:03 UTC