- From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
- Date: Wed, 05 Sep 2012 11:41:10 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/2002/css-validator/org/w3c/css/properties/css3 In directory hutz:/tmp/cvs-serv29975/css3 Modified Files: CssMarqueeDirection.java Css3Style.java Log Message: marquee-direction per http://www.w3.org/TR/2008/CR-css3-marquee-20081205/#marquee-direction Index: Css3Style.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css3/Css3Style.java,v retrieving revision 1.89 retrieving revision 1.90 diff -u -d -r1.89 -r1.90 --- Css3Style.java 5 Sep 2012 10:03:07 -0000 1.89 +++ Css3Style.java 5 Sep 2012 11:41:08 -0000 1.90 @@ -42,6 +42,7 @@ import org.w3c.css.properties.css.CssHangingPunctuation; import org.w3c.css.properties.css.CssHyphens; import org.w3c.css.properties.css.CssLineBreak; +import org.w3c.css.properties.css.CssMarqueeDirection; import org.w3c.css.properties.css.CssOpacity; import org.w3c.css.properties.css.CssOverflowWrap; import org.w3c.css.properties.css.CssTabSize; @@ -128,6 +129,8 @@ public CssHangingPunctuation cssHangingPunctuation; public CssTabSize cssTabSize; + public CssMarqueeDirection cssMarqueeDirection; + CssDropInitialAfterAdjust cssDropInitialAfterAdjust; CssDropInitialAfterAlign cssDropInitialAfterAlign; CssDropInitialBeforeAdjust cssDropInitialBeforeAdjust; @@ -165,7 +168,6 @@ CssPaddingLeftCSS3 cssPaddingLeftCSS3; CssPaddingRightCSS3 cssPaddingRightCSS3; CssMarquee cssMarquee; - CssMarqueeDirection cssMarqueeDirection; CssMarqueeRepetition cssMarqueeRepetition; CssMarqueeSpeed cssMarqueeSpeed; CssMarqueeStyle cssMarqueeStyle; Index: CssMarqueeDirection.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css3/CssMarqueeDirection.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- CssMarqueeDirection.java 5 Jan 2010 13:49:53 -0000 1.3 +++ CssMarqueeDirection.java 5 Sep 2012 11:41:08 -0000 1.4 @@ -1,144 +1,88 @@ -// // $Id$ -// From Sijtsche de Jong (sy.de.jong@let.rug.nl) +// Author: Yves Lafon <ylafon@w3.org> // -// (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 - +// (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.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; +/** + * @spec http://www.w3.org/TR/2008/CR-css3-marquee-20081205/#marquee-direction + */ +public class CssMarqueeDirection extends org.w3c.css.properties.css.CssMarqueeDirection { -public class CssMarqueeDirection extends CssProperty { - - CssValue mdir; - - static CssIdent auto = new CssIdent("auto"); - - private static String[] values = { - "forwards", "backwards", "ahead", "reverse", - "left", "right", "up", "down", "auto", "initial", "inherit" - }; - - /** - * Create a new CssMarqueeDirection - */ - public CssMarqueeDirection() { - mdir = auto; - } - - /** - * Create a new CssMarqueeDirection - * - * @param expression The expression for this property - * @exception InvalidParamException Incorrect values - */ - public CssMarqueeDirection(ApplContext ac, CssExpression expression, - boolean check) throws InvalidParamException { - setByUser(); - CssValue val = expression.getValue(); - - int i = 0; + private static CssIdent[] allowed_values; - for (;i < values.length; i++) { - if (val.toString().equals(values[i])) { - mdir = val; - expression.next(); - break; - } + static { + String id_values[] = {"forward", "reverse"}; + allowed_values = new CssIdent[id_values.length]; + int i = 0; + for (String s : id_values) { + allowed_values[i++] = CssIdent.getIdent(s); + } } - if (i == values.length) { - throw new InvalidParamException("value", - expression.getValue(), - getPropertyName(), ac); + public static CssIdent getMatchingIdent(CssIdent ident) { + for (CssIdent id : allowed_values) { + if (id.equals(ident)) { + return id; + } + } + return null; } - } - - public CssMarqueeDirection(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).cssMarqueeDirection != null) - style.addRedefinitionWarning(ac, this); - ((Css3Style) style).cssMarqueeDirection = this; - } - - /** - * 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).getMarqueeDirection(); - } - else { - return ((Css3Style) style).cssMarqueeDirection; + /** + * Create a new CssMarqueeDirection + */ + public CssMarqueeDirection() { + value = initial; } - } - - /** - * Compares two properties for equality. - * - * @param value The other property. - */ - public boolean equals(CssProperty property) { - return (property instanceof CssMarqueeDirection && - mdir.equals(((CssMarqueeDirection) property).mdir)); - } - /** - * Returns the name of this property - */ - public String getPropertyName() { - return "marquee-direction"; - } - - /** - * Returns the value of this property - */ - public Object get() { - return mdir; - } - - /** - * Returns true if this property is "softly" inherited - */ - public boolean isSoftlyInherited() { - return mdir.equals(inherit); - } + /** + * Creates a new CssMarqueeDirection + * + * @param expression The expression for this property + * @throws org.w3c.css.util.InvalidParamException + * Expressions are incorrect + */ + public CssMarqueeDirection(ApplContext ac, CssExpression expression, boolean check) + throws InvalidParamException { + setByUser(); + CssValue val = expression.getValue(); - /** - * Returns a string representation of the object - */ - public String toString() { - return mdir.toString(); - } + if (check && expression.getCount() > 1) { + throw new InvalidParamException("unrecognize", ac); + } - /** - * 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 mdir == auto; - } + 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 = getMatchingIdent((CssIdent) val); + if (val == null) { + throw new InvalidParamException("value", + expression.getValue(), + getPropertyName(), ac); + } + value = val; + } + expression.next(); + } + public CssMarqueeDirection(ApplContext ac, CssExpression expression) + throws InvalidParamException { + this(ac, expression, false); + } } +
Received on Wednesday, 5 September 2012 11:41:13 UTC