- From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
- Date: Wed, 05 Oct 2011 07:12:20 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/2002/css-validator/org/w3c/css/properties/css3 In directory hutz:/tmp/cvs-serv6302/org/w3c/css/properties/css3 Modified Files: CssColor.java Added Files: CssColumnCount.java CssColumnFill.java CssColumnGap.java CssColumnRule.java CssColumnRuleColor.java CssColumnRuleStyle.java CssColumnRuleWidth.java CssColumnSpan.java CssColumnWidth.java CssColumns.java Log Message: initial keyword in CSS3 is now checked to be unique, some class reorg, adjustment of column-span to match the last multicol doc --- NEW FILE: CssColumnRuleColor.java --- // $Id: CssColumnRuleColor.java,v 1.5 2011/10/05 07:12:17 ylafon Exp $ // From Sijtsche de Jong (sy.de.jong@let.rug.nl) // Rewritten 2010 Yves lafon <ylafon@w3.org> // // (c) COPYRIGHT 1995-2010 World Wide Web Consortium (MIT, ERCIM and Keio) // Please first read the full copyright statement at // http://www.w3.org/Consortium/Legal/copyright-software-19980720 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.CssValue; /** * http://www.w3.org/TR/2009/CR-css3-multicol-20091217/#column-rule-color * <p/> * Name: column-rule-color * Value: <color> * Initial: same as for 'color' property [CSS21] * Applies to: multicol elements * Inherited: no * Percentages: N/A * Media: visual * Computed value: the same as the computed value for the 'color' * property [CSS21] * <p/> * This property sets the color of the column rule. The <color> values are * defined in [CSS21]. */ public class CssColumnRuleColor extends org.w3c.css.properties.css.CssColumnRuleColor { CssValue color; /** * Create a new CssColumnRuleColor */ public CssColumnRuleColor() { color = initial; } /** * Create a new CssColumnRuleColor * * @param expression The expression for this property * @throws org.w3c.css.util.InvalidParamException Incorrect value */ public CssColumnRuleColor(ApplContext ac, CssExpression expression, boolean check) throws InvalidParamException { setByUser(); CssValue val = expression.getValue(); if (check && expression.getCount() > 1) { throw new InvalidParamException("unrecognize", ac); } if (inherit.equals(val)) { color = inherit; } else if (currentColor.equals(val)) { color = currentColor; } else { try { // we use the latest version of CssColor, aka CSS3 // instead of using CSS21 colors + transparent per spec CssColor tcolor = new CssColor(ac, expression, check); color = tcolor.getColor(); } catch (InvalidParamException e) { throw new InvalidParamException("value", expression.getValue(), getPropertyName(), ac); } } } public CssColumnRuleColor(ApplContext ac, CssExpression expression) throws InvalidParamException { this(ac, expression, false); } /** * Compares two properties for equality. * * @param property The other property. */ public boolean equals(CssProperty property) { return (property instanceof CssColumnRuleColor && color.equals(((CssColumnRuleColor) property).color)); } /** * Returns the value of this property */ public Object get() { return color; } /** * Returns true if this property is "softly" inherited */ public boolean isSoftlyInherited() { return (inherit.equals(color)||currentColor.equals(color)); } /** * Returns a string representation of the object */ public String toString() { return color.toString(); } /** * Is the value of this property a default value * It is used by all macro for the function <code>print</code> */ public boolean isDefault() { return (initial == color); } } --- NEW FILE: CssColumnFill.java --- // $Id: CssColumnFill.java,v 1.3 2011/10/05 07:12:17 ylafon Exp $ // From Sijtsche de Jong (sy.de.jong@let.rug.nl) // Rewritten 2010 Yves Lafon <ylafon@w3.org> // // (c) COPYRIGHT 1995-2010 World Wide Web Consortium (MIT, ERCIM and Keio) // Please first read the full copyright statement at // http://www.w3.org/Consortium/Legal/copyright-software-19980720 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.CssIdent; import org.w3c.css.values.CssTypes; import org.w3c.css.values.CssValue; import java.util.HashMap; /** * http://www.w3.org/TR/2009/CR-css3-multicol-20091217/#filling-columns * <p/> * There are two strategies for filling columns: columns can either be * balanced, or not. If columns are balanced, UAs should minimize the variation * in column length. Otherwise, columns are filled sequentially and will * therefore end up having different lengths. In any case, the user agent * should try to honor the �widows� and �orphans� properties. * <p/> * Name: column-fill * Value: auto | balance * Initial: balance * Applies to: multi-column elements * Inherited: no * Percentages: N/A * Media: see below * Computed value: as specified */ public class CssColumnFill extends org.w3c.css.properties.css.CssColumnFill { CssIdent value; static CssIdent balance; private static HashMap<String, CssIdent> allowed_values; static { balance = CssIdent.getIdent("balance"); allowed_values = new HashMap<String, CssIdent>(); allowed_values.put("balance", balance); allowed_values.put("auto", CssIdent.getIdent("auto")); } /** * Create a new CssColumnWidth */ public CssColumnFill() { value = initial; } /** * Create a new CssColumnFill * * @param ac the context * @param expression The expression for this property * @param check if length check is needed * @throws org.w3c.css.util.InvalidParamException Incorrect value */ public CssColumnFill(ApplContext ac, CssExpression expression, boolean check) throws InvalidParamException { setByUser(); CssValue val = expression.getValue(); if (check && expression.getCount() > 1) { throw new InvalidParamException("unrecognize", ac); } if (val.getType() != CssTypes.CSS_IDENT) { throw new InvalidParamException("value", expression.getValue(), getPropertyName(), ac); } // ident, so inherit, or allowed value if (inherit.equals(val)) { value = inherit; } else { val = allowed_values.get(val.toString()); if (val == null) { throw new InvalidParamException("value", expression.getValue(), getPropertyName(), ac); } value = (CssIdent) val; } expression.next(); } public CssColumnFill(ApplContext ac, CssExpression expression) throws InvalidParamException { this(ac, expression, false); } /** * Compares two properties for equality. * * @param property The other property. */ public boolean equals(CssProperty property) { return (property instanceof CssColumnFill && value.equals(((CssColumnFill) property).value)); } /** * Returns the value of this property */ public Object get() { return value; } /** * Returns true if this property is "softly" inherited */ public boolean isSoftlyInherited() { return (inherit == value); } /** * Returns a string representation of the object */ public String toString() { return value.toString(); } /** * Is the value of this property a default value * It is used by all macro for the function <code>print</code> */ public boolean isDefault() { return (initial == value); } } --- NEW FILE: CssColumnWidth.java --- // $Id: CssColumnWidth.java,v 1.7 2011/10/05 07:12:18 ylafon Exp $ // From Sijtsche de Jong (sy.de.jong@let.rug.nl) // Rewriten 2010 Yves Lafon <ylafon@w3.org> // // (c) COPYRIGHT 1995-2010 World Wide Web Consortium (MIT, ERCIM and Keio) // Please first read the full copyright statement at // http://www.w3.org/Consortium/Legal/copyright-software-19980720 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.CssIdent; import org.w3c.css.values.CssLength; import org.w3c.css.values.CssNumber; import org.w3c.css.values.CssTypes; import org.w3c.css.values.CssValue; /** * http://www.w3.org/TR/2009/CR-css3-multicol-20091217/#column-width * <p/> * Name: column-width * Value: <length> | auto * Initial: auto * Applies to: non-replaced block-level elements (except table elements), * table cells, and inline-block elements * Inherited: no * Percentages: N/A * Media: visual * Computed value: the absolute length * <p/> * This property describes the width of columns in multicol elements. */ public class CssColumnWidth extends org.w3c.css.properties.css.CssColumnWidth { private static final String propertyName = "column-width"; CssValue width; static CssIdent auto; static { auto = CssIdent.getIdent("auto"); } /** * Create a new CssColumnWidth */ public CssColumnWidth() { width = initial; } /** * Create a new CssColumnWidth * * @param expression The expression for this property * @throws org.w3c.css.util.InvalidParamException Incorrect value */ public CssColumnWidth(ApplContext ac, CssExpression expression, boolean check) throws InvalidParamException { setByUser(); CssValue val = expression.getValue(); Float value; switch (val.getType()) { case CssTypes.CSS_NUMBER: val = ((CssNumber) val).getLength(); // if we didn't fall in the first trap, there is another one :) throw new InvalidParamException("strictly-positive", expression.getValue(), getPropertyName(), ac); case CssTypes.CSS_LENGTH: value = (Float) ((CssLength) val).get(); if (value == null || value.floatValue() <= 0.0) { throw new InvalidParamException("strictly-positive", expression.getValue(), getPropertyName(), ac); } width = val; break; case CssTypes.CSS_IDENT: if (inherit.equals(val)) { width = inherit; break; } else if (auto.equals(val)) { width = auto; break; } default: throw new InvalidParamException("value", expression.getValue(), getPropertyName(), ac); } expression.next(); } public CssColumnWidth(ApplContext ac, CssExpression expression) throws InvalidParamException { this(ac, expression, false); } /** * Compares two properties for equality. * * @param property The other property. */ public boolean equals(CssProperty property) { return (property instanceof CssColumnWidth && width.equals(((CssColumnWidth) property).width)); } /** * Returns the value of this property */ public Object get() { return width; } /** * Returns true if this property is "softly" inherited */ public boolean isSoftlyInherited() { return (inherit == width); } /** * Returns a string representation of the object */ public String toString() { return width.toString(); } /** * Is the value of this property a default value * It is used by all macro for the function <code>print</code> */ public boolean isDefault() { return (auto == initial); } } --- NEW FILE: CssColumns.java --- // $Id: CssColumns.java,v 1.3 2011/10/05 07:12:18 ylafon Exp $ // From Sijtsche de Jong (sy.de.jong@let.rug.nl) // Rewritten 2010 Yves Lafon <ylafon@w3.org> // // (c) COPYRIGHT 1995-2010 World Wide Web Consortium (MIT, ERCIM and Keio) // Please first read the full copyright statement at // http://www.w3.org/Consortium/Legal/copyright-software-19980720 package org.w3c.css.properties.css3; 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.CssTypes; import org.w3c.css.values.CssValue; import static org.w3c.css.values.CssOperator.SPACE; /** * http://www.w3.org/TR/2009/CR-css3-multicol-20091217/#columns * <p/> * Name: columns * Value: <‘column-width’> || <‘column-count’> * Initial: see individual properties * Applies to: non-replaced block-level elements (except table elements), * table cells, and inline-block elements * Inherited: no * Percentages: N/A * Media: visual * Computed value: see individual properties * <p/> * This is a shorthand property for setting ‘column-width’ and ‘column-count’. * Omitted values are set to their initial values. * * @see CssColumnWidth * @see org.w3c.css.properties.css3.CssColumnCount */ public class CssColumns extends org.w3c.css.properties.css.CssColumns { private static final String propertyName = "columns"; CssIdent value = null; CssColumnWidth width = null; CssColumnCount count = null; /** * Create a new CssColumns */ public CssColumns() { } /** * Create a new CssColumns * * @param ac the context * @param expression The expression for this property * @param check if checking is enforced * @throws org.w3c.css.util.InvalidParamException Incorrect values */ public CssColumns(ApplContext ac, CssExpression expression, boolean check) throws InvalidParamException { CssValue val; char op; int nb_val = expression.getCount(); int nb_auto = 0; if (check && nb_val > 2) { throw new InvalidParamException("unrecognize", ac); } setByUser(); while (!expression.end()) { val = expression.getValue(); op = expression.getOperator(); if (op != SPACE) { throw new InvalidParamException("operator", ((new Character(op)).toString()), ac); } switch (val.getType()) { case CssTypes.CSS_NUMBER: if (count != null) { throw new InvalidParamException("unrecognize", ac); } count = new CssColumnCount(ac, expression); break; case CssTypes.CSS_LENGTH: if (width != null) { throw new InvalidParamException("unrecognize", ac); } width = new CssColumnWidth(ac, expression); break; case CssTypes.CSS_IDENT: if (inherit.equals((CssIdent) val)) { if (nb_val > 1) { throw new InvalidParamException("unrecognize", ac); } value = inherit; expression.next(); break; } if (CssColumnCount.auto.equals((CssIdent) val)) { nb_auto++; expression.next(); break; } default: throw new InvalidParamException("value", expression.getValue(), getPropertyName(), ac); } } if (nb_val == 1) { if (nb_auto == 1) { value = CssIdent.getIdent("auto"); } } else { if (nb_auto == 2) { count = new CssColumnCount(); width = new CssColumnWidth(); } else if (nb_auto == 1) { if (count != null) { width = new CssColumnWidth(); } else { count = new CssColumnCount(); } } } } public CssColumns(ApplContext ac, CssExpression expression) throws InvalidParamException { this(ac, expression, false); } /** * Add this property to the CssStyle * * @param style The CssStyle */ public void addToStyle(ApplContext ac, CssStyle style) { if (((Css3Style) style).cssColumns != null) style.addRedefinitionWarning(ac, this); ((Css3Style) style).cssColumns = this; if (count != null) { count.addToStyle(ac, style); } if (width != null) { width.addToStyle(ac, style); } } /** * 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).getColumns(); } else { return ((Css3Style) style).cssColumns; } } /** * Compares two properties for equality. * * @param property The other property. */ public boolean equals(CssProperty property) { return false; } /** * Returns the value of this property */ public Object get() { // TODO must use a compound value, like in background properties return value; } /** * Returns true if this property is "softly" inherited */ public boolean isSoftlyInherited() { return (inherit == value); } /** * Returns a string representation of the object */ public String toString() { StringBuilder sb = new StringBuilder(); boolean first = true; if (value != null) { return value.toString(); } if (count != null) { sb.append(count); first = false; } if (width != null) { if (!first) { sb.append(' '); } sb.append(width); } return sb.toString(); } } --- NEW FILE: CssColumnSpan.java --- // $Id: CssColumnSpan.java,v 1.7 2011/10/05 07:12:18 ylafon Exp $ // From Sijtsche de Jong (sy.de.jong@let.rug.nl) // Rewritten 2010 Yves Lafon <ylafon@w3.org> // (c) COPYRIGHT 1995-2010 // World Wide Web Consortium (MIT, ERCIM, Keio University) // // Please first read the full copyright statement at // http://www.w3.org/Consortium/Legal/copyright-software-19980720 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.CssIdent; import org.w3c.css.values.CssTypes; import org.w3c.css.values.CssValue; /** * http://www.w3.org/TR/2009/CR-css3-multicol-20091217/#column-span * * Name: column-span * Value: 1 | all * Initial: 1 * Applies to: static, non-floating elements * Inherited: no * Percentages: N/A * Media: visual * Computed value: as specified * * This property describes how many columns an element spans across. */ public class CssColumnSpan extends org.w3c.css.properties.css.CssColumnSpan { CssValue value; ApplContext ac; static CssIdent all; static { all = new CssIdent("all"); } /** * Create a new CssColumnSpan */ public CssColumnSpan() { value = initial; } /** * Create a new CssColumnSpan * * @param expression The expression for this property * @throws org.w3c.css.util.InvalidParamException Values are incorrect */ public CssColumnSpan(ApplContext ac, CssExpression expression, boolean check) throws InvalidParamException { this.ac = ac; setByUser(); // tell this property is set by the user CssValue val = expression.getValue(); switch (val.getType()) { case CssTypes.CSS_IDENT: if (all.equals(val)) { value = all; break; } if (none.equals(val)) { value = all; break; } if (inherit.equals(val)) { value = inherit; break; } default: throw new InvalidParamException("value", val.toString(), getPropertyName(), ac); } } public CssColumnSpan(ApplContext ac, CssExpression expression) throws InvalidParamException { this(ac, expression, false); } /** * Compares two properties for equality. * * @param property The other property. */ public boolean equals(CssProperty property) { return (property instanceof CssColumnSpan && value.equals(((CssColumnSpan) property).value)); } /** * Returns the value of this property */ public Object get() { return value; } /** * Returns true if this property is "softly" inherited */ public boolean isSoftlyInherited() { return (value == inherit); } /** * Returns a string representation of the object */ public String toString() { return value.toString(); } /** * Is the value of this property a default value * It is used by all macro for the function <code>print</code> */ public boolean isDefault() { // we only have 3 values return (initial == value); } } --- NEW FILE: CssColumnRule.java --- // $Id: CssColumnRule.java,v 1.6 2011/10/05 07:12:17 ylafon Exp $ // From Sijtsche de Jong (sy.de.jong@let.rug.nl) // Rewritten 2010 Yves Lafon <ylafon@w3.org> // // (c) COPYRIGHT 1995-2010 World Wide Web Consortium (MIT, ERCIM and Keio) // Please first read the full copyright statement at // http://www.w3.org/Consortium/Legal/copyright-software-19980720 package org.w3c.css.properties.css3; 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.CssTypes; import org.w3c.css.values.CssValue; import static org.w3c.css.values.CssOperator.SPACE; /** * http://www.w3.org/TR/2009/CR-css3-multicol-20091217/#column-rule * <p/> * Name: column-rule * Value: <column-rule-width> || <border-style> || * [ <color> | transparent ] * Initial: see individual properties * Applies to: multicol elements * Inherited: no * Percentages: N/A * Media: visual * Computed value: see individual properties * <p/> * This property is a shorthand for setting 'column-rule-width', * 'column-rule-style', and 'column-rule-color' at the same place in the * style sheet. Omitted values are set to their initial values. */ public class CssColumnRule extends org.w3c.css.properties.css.CssColumnRule { CssIdent value = null; CssColumnRuleWidth rule_width = null; CssColumnRuleStyle rule_style = null; CssColumnRuleColor rule_color = null; /** * Create a new CssColumnRule */ public CssColumnRule() { } /** * Create a new CssColumnRule * * @param expression The expression for this property * @throws org.w3c.css.util.InvalidParamException Incorrect values */ public CssColumnRule(ApplContext ac, CssExpression expression, boolean check) throws InvalidParamException { CssValue val; char op; int nb_val = expression.getCount(); if (check && nb_val > 3) { throw new InvalidParamException("unrecognize", ac); } setByUser(); while (!expression.end()) { val = expression.getValue(); op = expression.getOperator(); if (op != SPACE) { throw new InvalidParamException("operator", ((new Character(op)).toString()), ac); } switch (val.getType()) { case CssTypes.CSS_FUNCTION: case CssTypes.CSS_COLOR: if (rule_color != null) { throw new InvalidParamException("unrecognize", ac); } rule_color = new CssColumnRuleColor(ac, expression); break; case CssTypes.CSS_NUMBER: case CssTypes.CSS_LENGTH: if (rule_width != null) { throw new InvalidParamException("unrecognize", ac); } rule_width = new CssColumnRuleWidth(ac, expression); break; case CssTypes.CSS_IDENT: if (inherit.equals(val)) { if (nb_val > 1) { throw new InvalidParamException("unrecognize", ac); } value = inherit; expression.next(); break; } if (rule_color == null) { try { rule_color = new CssColumnRuleColor(ac, expression); break; } catch (Exception ex) { } } if (rule_width == null) { try { rule_width = new CssColumnRuleWidth(ac, expression); break; } catch (Exception ex) { } } if (rule_style == null) { try { rule_style = new CssColumnRuleStyle(ac, expression); break; } catch (Exception ex) { } } default: throw new InvalidParamException("value", expression.getValue(), getPropertyName(), ac); } } } public CssColumnRule(ApplContext ac, CssExpression expression) throws InvalidParamException { this(ac, expression, false); } /** * Add this property to the CssStyle * * @param style The CssStyle */ public void addToStyle(ApplContext ac, CssStyle style) { if (((Css3Style) style).cssColumnRule != null) style.addRedefinitionWarning(ac, this); ((Css3Style) style).cssColumnRule = this; if (rule_style != null) { rule_style.addToStyle(ac, style); } if (rule_color != null) { rule_color.addToStyle(ac, style); } if (rule_width != null) { rule_width.addToStyle(ac, style); } } /** * 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).getColumnRule(); } else { return ((Css3Style) style).cssColumnRule; } } /** * Compares two properties for equality. * * @param property The other property. */ public boolean equals(CssProperty property) { return false; } /** * Returns the value of this property */ public Object get() { return value; } /** * Returns a string representation of the object */ public String toString() { StringBuilder sb = new StringBuilder(); boolean first = true; if (value != null) { return value.toString(); } if (rule_color != null) { sb.append(rule_color); first = false; } if (rule_width != null) { if (!first) { sb.append(' '); } sb.append(rule_width); } if (rule_style != null) { if (!first) { sb.append(' '); } sb.append(rule_style); } return sb.toString(); } } --- NEW FILE: CssColumnCount.java --- // $Id: CssColumnCount.java,v 1.6 2011/10/05 07:12:17 ylafon Exp $ // From Sijtsche de Jong (sy.de.jong@let.rug.nl) // Rewritten 2010 Yves Lafon <ylafon@w3.org> // // (c) COPYRIGHT 1995-2010 World Wide Web Consortium (MIT, ERCIM and Keio) // Please first read the full copyright statement at // http://www.w3.org/Consortium/Legal/copyright-software-19980720 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.CssIdent; import org.w3c.css.values.CssNumber; import org.w3c.css.values.CssTypes; import org.w3c.css.values.CssValue; /** * http://www.w3.org/TR/2009/CR-css3-multicol-20091217/#cc * <p/> * Name: column-count * Value: <integer> | auto * Initial: auto * Applies to: non-replaced block-level elements (except table elements), * table cells, and inline-block elements * Inherited: no * Percentages: N/A * Media: visual * Computed value: specified value * <p/> * This property describes the number of columns of a multicol element. */ public class CssColumnCount extends org.w3c.css.properties.css.CssColumnCount { CssValue count; static CssIdent auto = CssIdent.getIdent("auto"); /** * Create a new CssColumnCount */ public CssColumnCount() { count = auto; } /** * Create a new CssColumnCount * * @param expression The expression for this property * @throws org.w3c.css.util.InvalidParamException Incorrect value */ public CssColumnCount(ApplContext ac, CssExpression expression, boolean check) throws InvalidParamException { setByUser(); CssValue val = expression.getValue(); CssNumber num; switch (val.getType()) { case CssTypes.CSS_NUMBER: num = (CssNumber) val; if (!num.isInteger()) { throw new InvalidParamException("integer", expression.getValue(), getPropertyName(), ac); } if (num.getInt() <= 0) { throw new InvalidParamException("strictly-positive", expression.getValue(), getPropertyName(), ac); } count = val; break; case CssTypes.CSS_IDENT: if (auto.equals(val)) { count = auto; break; } if (inherit.equals(val)) { count = inherit; break; } default: throw new InvalidParamException("value", expression.getValue(), getPropertyName(), ac); } expression.next(); } public CssColumnCount(ApplContext ac, CssExpression expression) throws InvalidParamException { this(ac, expression, false); } /** * Compares two properties for equality. * * @param property The other property. */ public boolean equals(CssProperty property) { return (property instanceof CssColumnCount && count.equals(((CssColumnCount) property).count)); } /** * Returns the value of this property */ public Object get() { return count; } /** * Returns true if this property is "softly" inherited */ public boolean isSoftlyInherited() { return (count == inherit); } /** * Returns a string representation of the object */ public String toString() { return count.toString(); } /** * Is the value of this property a default value * It is used by alle macro for the function <code>print</code> */ public boolean isDefault() { return (count == auto); } } --- NEW FILE: CssColumnRuleWidth.java --- // // $Id: CssColumnRuleWidth.java,v 1.5 2011/10/05 07:12:18 ylafon Exp $ // From Sijtsche de Jong (sy.de.jong@let.rug.nl) // // (c) COPYRIGHT 1995-2000 World Wide Web Consortium (MIT, INRIA, Keio University) // Please first read the full copyright statement at // http://www.w3.org/Consortium/Legal/copyright-software-19980720 package org.w3c.css.properties.css3; import org.w3c.css.properties.css.CssProperty; import org.w3c.css.properties.css1.CssBorderFaceWidthCSS2; import org.w3c.css.util.ApplContext; import org.w3c.css.util.InvalidParamException; import org.w3c.css.values.CssExpression; import org.w3c.css.values.CssValue; /** * http://www.w3.org/TR/css3-multicol/ * <p/> * <EM>Value:</EM> <border-width><BR> * <EM>Initial:</EM>medium<BR> * <EM>Applies to:</EM>multicol elements<BR> * <EM>Inherited:</EM>no<BR> * <EM>Percentages:</EM>N/A<BR> * <EM>Media:</EM>:visual */ public class CssColumnRuleWidth extends org.w3c.css.properties.css.CssColumnRuleWidth { CssValue value; /** * Create a new CssColumnRuleWidth */ public CssColumnRuleWidth() { value = initial; // nothing to do } /** * Create a new CssColumnRuleWidth * * @param expression The expression for this property * @throws org.w3c.css.util.InvalidParamException * Incorrect value */ public CssColumnRuleWidth(ApplContext ac, CssExpression expression, boolean check) throws InvalidParamException { setByUser(); CssValue val = expression.getValue(); if (check && expression.getCount() > 1) { throw new InvalidParamException("unrecognize", ac); } try { CssBorderFaceWidthCSS2 _spec; _spec = new CssBorderFaceWidthCSS2(ac, expression); value = _spec.getValue(); } catch (InvalidParamException e) { throw new InvalidParamException("value", expression.getValue(), getPropertyName(), ac); } } public CssColumnRuleWidth(ApplContext ac, CssExpression expression) throws InvalidParamException { this(ac, expression, false); } /** * Compares two properties for equality. * * @param property The other property. */ public boolean equals(CssProperty property) { return (property instanceof CssColumnRuleWidth && value.equals(((CssColumnRuleWidth) property).value)); } /** * Returns the value of this property */ public Object get() { return value; } /** * Returns true if this property is "softly" inherited */ public boolean isSoftlyInherited() { return inherit.equals(value); } /** * Returns a string representation of the object */ public String toString() { return value.toString(); } /** * Is the value of this property a default value * It is used by alle macro for the function <code>print</code> */ public boolean isDefault() { return (initial == value); } } --- NEW FILE: CssColumnRuleStyle.java --- // $Id: CssColumnRuleStyle.java,v 1.7 2011/10/05 07:12:17 ylafon Exp $ // From Sijtsche de Jong (sy.de.jong@let.rug.nl) // Rewritten Yves lafon <ylafon@w3.org> // // (c) COPYRIGHT 1995-2010 World Wide Web Consortium // (MIT, ERCIM, Keio University) // // Please first read the full copyright statement at // http://www.w3.org/Consortium/Legal/copyright-software-19980720 package org.w3c.css.properties.css3; import org.w3c.css.properties.css.CssProperty; import org.w3c.css.properties.css1.CssBorderStyleCSS2; 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; /** * http://www.w3.org/TR/2009/CR-css3-multicol-20091217/#column-rule-style * * Name: column-rule-style * Value: <‘border-style’> * Initial: none * Applies to: multicol elements * Inherited: no * Percentages: N/A * Media: visual * Computed value: specified value * * The ‘column-rule-style’ property sets the style of the rule between columns * of an element. The <border-style> values are defined in [CSS21]. */ public class CssColumnRuleStyle extends org.w3c.css.properties.css.CssColumnRuleStyle { CssIdent value; /** * Create a new CssColumnRuleStyle */ public CssColumnRuleStyle() { value = initial; } /** * Create a new CssColumnRuleStyle * * @param ac the context * @param expression The expression for this property * @param check if check on length is required * @throws org.w3c.css.util.InvalidParamException Incorrect value */ public CssColumnRuleStyle(ApplContext ac, CssExpression expression, boolean check) throws InvalidParamException { setByUser(); CssValue val = expression.getValue(); // too many values if (check && expression.getCount() > 1) { throw new InvalidParamException("unrecognize", ac); } // we only use Css Ident part of the CssBorderStyle acceptable values if (val.getType() != CssTypes.CSS_IDENT) { throw new InvalidParamException("value", expression.getValue(), getPropertyName(), ac); } CssIdent ident = (CssIdent) val; if (inherit.equals(ident)) { value = inherit; } else if (CssBorderStyleCSS2.acceptable_values.contains(ident)) { value = ident; } else { throw new InvalidParamException("value", expression.getValue(), getPropertyName(), ac); } expression.next(); } public CssColumnRuleStyle(ApplContext ac, CssExpression expression) throws InvalidParamException { this(ac, expression, false); } /** * Compares two properties for equality. * * @param property The other property. */ public boolean equals(CssProperty property) { return (property instanceof CssColumnRuleStyle && value.equals(((CssColumnRuleStyle) property).value)); } /** * Returns the value of this property */ public Object get() { return value; } /** * Returns true if this property is "softly" inherited */ public boolean isSoftlyInherited() { return (inherit == value); } /** * Returns a string representation of the object */ public String toString() { return value.toString(); } /** * Is the value of this property a default value * It is used by all macro for the function <code>print</code> */ public boolean isDefault() { return value == initial; } } --- NEW FILE: CssColumnGap.java --- // $Id: CssColumnGap.java,v 1.5 2011/10/05 07:12:17 ylafon Exp $ // From Sijtsche de Jong (sy.de.jong@let.rug.nl) // Rewritten 2010 Yves Lafon <ylafon@w3.org> // // COPYRIGHT (c) 1995-2010 World Wide Web Consortium, (MIT, ERCIM and Keio) // Please first read the full copyright statement at // http://www.w3.org/Consortium/Legal/copyright-software-19980720 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.CssIdent; import org.w3c.css.values.CssLength; import org.w3c.css.values.CssNumber; import org.w3c.css.values.CssTypes; import org.w3c.css.values.CssValue; /** * http://www.w3.org/TR/2009/CR-css3-multicol-20091217/#column-gap * <p/> * Name: column-gap * Value: <length> | normal * Initial: normal * Applies to: multicol elements * Inherited: no * Percentages: N/A * Media: visual * Computed value: absolute length or ‚Äònormal‚Äô * <p/> * The ‚Äòcolumn-gap‚Äô property sets the gap between columns. If there is a * column rule between columns, it will appear in the middle of the gap. * <p/> * The ‚Äònormal‚Äô value is UA-specific. A value of ‚Äò1em‚Äô is suggested. * <p/> * Column gaps cannot be negative. */ public class CssColumnGap extends org.w3c.css.properties.css.CssColumnGap { CssValue columngap; static CssIdent normal; static { normal = CssIdent.getIdent("normal"); } /** * Create a new CssColumnGap */ public CssColumnGap() { columngap = initial; } /** * Create a new CssColumnGap */ public CssColumnGap(ApplContext ac, CssExpression expression, boolean check) throws InvalidParamException { setByUser(); CssValue val = expression.getValue(); Float value; switch (val.getType()) { case CssTypes.CSS_NUMBER: val = ((CssNumber) val).getLength(); case CssTypes.CSS_LENGTH: value = (Float) ((CssLength) val).get(); if (value == null || value.floatValue() < 0.0) { throw new InvalidParamException("negative-value", expression.getValue(), getPropertyName(), ac); } columngap = val; break; case CssTypes.CSS_IDENT: if (normal.equals(val)) { columngap = normal; break; } if (inherit.equals(val)) { columngap = inherit; break; } default: throw new InvalidParamException("value", expression.getValue(), getPropertyName(), ac); } expression.next(); } public CssColumnGap(ApplContext ac, CssExpression expression) throws InvalidParamException { this(ac, expression, false); } /** * Compares two properties for equality. * * @param property The other property. */ public boolean equals(CssProperty property) { return (property instanceof CssColumnGap && columngap.equals(((CssColumnGap) property).columngap)); } /** * Returns the value of this property */ public Object get() { return columngap; } /** * Returns true if this property is "softly" inherited */ public boolean isSoftlyInherited() { return (inherit == columngap); } /** * Returns a string representation of the object */ public String toString() { return columngap.toString(); } /** * Is the value of this property a default value * It is used by all macro for the function <code>print</code> */ public boolean isDefault() { return (columngap == initial); } } Index: CssColor.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css3/CssColor.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- CssColor.java 4 Oct 2011 13:05:25 -0000 1.1 +++ CssColor.java 5 Oct 2011 07:12:17 -0000 1.2 @@ -10,7 +10,6 @@ import org.w3c.css.util.InvalidParamException; import org.w3c.css.values.CssExpression; import org.w3c.css.values.CssFunction; -import org.w3c.css.values.CssIdent; import org.w3c.css.values.CssTypes; import org.w3c.css.values.CssValue; @@ -19,7 +18,6 @@ * @version $Revision$ */ public class CssColor extends org.w3c.css.properties.css.CssColor { - private static CssIdent same = CssIdent.getIdent("currentColor"); CssValue color; org.w3c.css.values.CssColor tempcolor = new org.w3c.css.values.CssColor(); @@ -53,8 +51,8 @@ case CssTypes.CSS_IDENT: if (inherit.equals(val)) { color = inherit; - } else if (same.equals(val)) { - color = same; + } else if (currentColor.equals(val)) { + color = currentColor; } else { color = new org.w3c.css.values.CssColor(ac, (String) val.get()); } @@ -125,7 +123,7 @@ * Returns the color */ public org.w3c.css.values.CssColor getColor() { - if (inherit.equals(color) || same.equals(color)) { + if (inherit.equals(color) || currentColor.equals(color)) { /* System.err.println("[ERROR] org.w3c.css.properties.CssColor"); System.err.println("[ERROR] value is inherited"); @@ -141,7 +139,7 @@ * e.g. his value equals inherit */ public boolean isSoftlyInherited() { - return inherit.equals(color) || same.equals(color); + return inherit.equals(color) || currentColor.equals(color); } /**
Received on Wednesday, 5 October 2011 07:12:29 UTC