- From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
- Date: Wed, 17 Oct 2012 13:50:07 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/2002/css-validator/org/w3c/css/properties/css3 In directory hutz:/tmp/cvs-serv3905/css3 Modified Files: Css3Style.java CssIcon.java Log Message: icon per http://www.w3.org/TR/2012/WD-css3-ui-20120117/#icon Index: Css3Style.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css3/Css3Style.java,v retrieving revision 1.134 retrieving revision 1.135 diff -u -d -r1.134 -r1.135 --- Css3Style.java 17 Oct 2012 09:53:56 -0000 1.134 +++ Css3Style.java 17 Oct 2012 13:50:04 -0000 1.135 @@ -62,6 +62,7 @@ import org.w3c.css.properties.css.CssFontVariantPosition; import org.w3c.css.properties.css.CssHangingPunctuation; import org.w3c.css.properties.css.CssHyphens; +import org.w3c.css.properties.css.CssIcon; import org.w3c.css.properties.css.CssImeMode; import org.w3c.css.properties.css.CssJustifyContent; import org.w3c.css.properties.css.CssLineBreak; @@ -215,6 +216,7 @@ public CssImeMode cssImeMode; public CssNavIndex cssNavIndex; public CssTextOverflow cssTextOverflow; + public CssIcon cssIcon; CssDropInitialAfterAdjust cssDropInitialAfterAdjust; CssDropInitialAfterAlign cssDropInitialAfterAlign; @@ -229,7 +231,6 @@ CssLineStackingStrategy cssLineStackingStrategy; CssTextHeight cssTextHeight; CssAppearance cssAppearance; - CssIcon cssIcon; CssNavUp cssNavUp; CssNavRight cssNavRight; CssNavDown cssNavDown; Index: CssIcon.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css3/CssIcon.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- CssIcon.java 5 Jan 2010 13:49:52 -0000 1.3 +++ CssIcon.java 17 Oct 2012 13:50:04 -0000 1.4 @@ -1,178 +1,94 @@ -// // $Id$ -// From Philippe Le Hegaret (Philippe.Le_Hegaret@sophia.inria.fr) -// Updated september 14th 2000 by Sijtsche de Jong (sy.de.jong@let.rug.nl) +// Author: Yves Lafon <ylafon@w3.org> // -// (c) COPYRIGHT MIT and INRIA, 1997. +// (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 java.util.Vector; -import org.w3c.css.parser.CssStyle; -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.CssIdent; -import org.w3c.css.values.CssOperator; -import org.w3c.css.values.CssURL; +import org.w3c.css.values.CssLayerList; +import org.w3c.css.values.CssTypes; import org.w3c.css.values.CssValue; -/** - * @version $Revision$ - */ -public class CssIcon extends CssProperty - implements CssOperator { - - int value; - CssValue icon; - Vector uris = new Vector(); - CssIdent auto = new CssIdent("auto"); - boolean inheritedValue; - - /** - * Create a new CssIcon - */ - public CssIcon() { - value = 0; - } - - /** - * Create a new CssIcon - * - * @param expression The expression for this property - * @exception InvalidParamException Values are incorrect - */ - public CssIcon(ApplContext ac, CssExpression expression, - boolean check) throws InvalidParamException { - - CssValue val = expression.getValue(); - char op = expression.getOperator(); - - setByUser(); - boolean correct = false; +import java.util.ArrayList; +import static org.w3c.css.values.CssOperator.COMMA; - if (val.equals(inherit)) { - inheritedValue = true; - icon = inherit; - expression.next(); - return; - } else if (val.equals(auto)) { - icon = auto; - expression.next(); - return; - } +/** + * @spec http://www.w3.org/TR/2012/WD-css3-ui-20120117/#icon + */ +public class CssIcon extends org.w3c.css.properties.css.CssIcon { - while (val != null) { - if (val instanceof CssURL) { - uris.addElement(val); - expression.next(); - val = expression.getValue(); - op = expression.getOperator(); - correct = true; - } else { - throw new InvalidParamException("value", - val.toString(), getPropertyName(), ac); - } - } + public static final CssIdent auto = CssIdent.getIdent("auto"); - if (!correct) { - throw new InvalidParamException("value", - val.toString(), getPropertyName(), ac); + /** + * Create a new CssIcon + */ + public CssIcon() { + value = initial; } - } - - public CssIcon(ApplContext ac, CssExpression expression) - throws InvalidParamException { - this(ac, expression, false); - } - - /** - * Returns the value of this property - */ - public Object get() { - return null; - } - - /** - * Returns the name of this property - */ - public String getPropertyName() { - return "icon"; - } - - /** - * Returns true if this property is "softly" inherited - * e.g. his value equals inherit - */ - public boolean isSoftlyInherited() { - return inheritedValue; - } - - /** - * Returns a string representation of the object. - */ - public String toString() { - if (icon != null) { - return icon.toString(); - } else { - int i = 0; - int l = uris.size(); - String ret = ""; - while (i != l) { - ret += uris.elementAt(i++) + - (new Character(COMMA)).toString() + " "; - } - return ret; - } - } + /** + * Creates a new CssIcon + * + * @param expression The expression for this property + * @throws org.w3c.css.util.InvalidParamException + * Expressions are incorrect + */ + public CssIcon(ApplContext ac, CssExpression expression, boolean check) + throws InvalidParamException { + setByUser(); - /** - * Add this property to the CssStyle. - * - * @param style The CssStyle - */ - public void addToStyle(ApplContext ac, CssStyle style) { - Css3Style style0 = (Css3Style) style; - if (style0.cssIcon != null) - style0.addRedefinitionWarning(ac, this); - style0.cssIcon = this; - } + CssValue val; + char op; + ArrayList<CssValue> values = new ArrayList<CssValue>(); - /** - * Get this property in the style. - * - * @param style The style where the property is - * @param resolve if true, resolve the style to find this property - */ - public CssProperty getPropertyInStyle(CssStyle style, boolean resolve) { - if (resolve) { - return ((Css3Style) style).getIcon(); - } else { - return ((Css3Style) style).cssIcon; + while (!expression.end()) { + val = expression.getValue(); + op = expression.getOperator(); + switch (val.getType()) { + case CssTypes.CSS_URL: + values.add(val); + break; + case CssTypes.CSS_IDENT: + if (inherit.equals(val)) { + if (expression.getCount() > 1) { + throw new InvalidParamException("value", + inherit.toString(), + getPropertyName(), ac); + } + values.add(inherit); + break; + } + if (auto.equals(val)) { + if (expression.getCount() > 1) { + throw new InvalidParamException("value", + auto.toString(), + getPropertyName(), ac); + } + values.add(auto); + break; + } + default: + throw new InvalidParamException("value", + val.toString(), + getPropertyName(), ac); + } + expression.next(); + if (!expression.end() && (op != COMMA)) { + throw new InvalidParamException("operator", + ((new Character(op)).toString()), ac); + } } - } - - /** - * Compares two properties for equality. - * - * @param value The other property. - */ - public boolean equals(CssProperty property) { - return (property instanceof CssIcon - && value == ((CssIcon) property).value); - } - - /** - * Is the value of this property is a default value. - * It is used by all macro for the function <code>print</code> - */ - public boolean isDefault() { - return value == 0; - } + value = (values.size() == 1) ? values.get(0) : new CssLayerList(values); + } + public CssIcon(ApplContext ac, CssExpression expression) + throws InvalidParamException { + this(ac, expression, false); + } } +
Received on Wednesday, 17 October 2012 13:50:16 UTC