- From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
- Date: Wed, 05 Sep 2012 11:50:05 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/2002/css-validator/org/w3c/css/properties/css3
In directory hutz:/tmp/cvs-serv8411/css3
Modified Files:
CssMarqueeStyle.java Css3Style.java
Log Message:
marquee-style per http://www.w3.org/TR/2008/CR-css3-marquee-20081205/#marquee-style
Index: Css3Style.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css3/Css3Style.java,v
retrieving revision 1.91
retrieving revision 1.92
diff -u -d -r1.91 -r1.92
--- Css3Style.java 5 Sep 2012 11:46:21 -0000 1.91
+++ Css3Style.java 5 Sep 2012 11:50:03 -0000 1.92
@@ -44,6 +44,7 @@
import org.w3c.css.properties.css.CssLineBreak;
import org.w3c.css.properties.css.CssMarqueeDirection;
import org.w3c.css.properties.css.CssMarqueeSpeed;
+import org.w3c.css.properties.css.CssMarqueeStyle;
import org.w3c.css.properties.css.CssOpacity;
import org.w3c.css.properties.css.CssOverflowWrap;
import org.w3c.css.properties.css.CssTabSize;
@@ -132,6 +133,7 @@
public CssMarqueeDirection cssMarqueeDirection;
public CssMarqueeSpeed cssMarqueeSpeed;
+ public CssMarqueeStyle cssMarqueeStyle;
CssDropInitialAfterAdjust cssDropInitialAfterAdjust;
CssDropInitialAfterAlign cssDropInitialAfterAlign;
@@ -171,7 +173,6 @@
CssPaddingRightCSS3 cssPaddingRightCSS3;
CssMarquee cssMarquee;
CssMarqueeRepetition cssMarqueeRepetition;
- CssMarqueeStyle cssMarqueeStyle;
public org.w3c.css.properties.css.CssBorderImageSource getBorderImageSource() {
if (cssBorder.borderImage.source == null) {
Index: CssMarqueeStyle.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css3/CssMarqueeStyle.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- CssMarqueeStyle.java 5 Jan 2010 13:49:53 -0000 1.3
+++ CssMarqueeStyle.java 5 Sep 2012 11:50:03 -0000 1.4
@@ -1,140 +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;
-public class CssMarqueeStyle extends CssProperty {
-
- CssValue mstyle;
-
- static CssIdent alternate = new CssIdent("alternate");
-
- private static String[] values = {
- "none", "slide", "scroll", "alternate", "initial", "inherit"
- };
-
- /**
- * Create a new CssMarqueeStyle
- */
- public CssMarqueeStyle() {
- mstyle = alternate;
- }
+/**
+ * @spec http://www.w3.org/TR/2008/CR-css3-marquee-20081205/#marquee-style
+ */
+public class CssMarqueeStyle extends org.w3c.css.properties.css.CssMarqueeStyle {
- /**
- * Create a new CssMarqueeStyle
- *
- * @param expression The expression for this property
- * @exception InvalidParamException Incorrect values
- */
- public CssMarqueeStyle(ApplContext ac, CssExpression expression,
- boolean check) throws InvalidParamException {
- setByUser();
- CssValue val = expression.getValue();
+ private static CssIdent[] allowed_values;
- int i = 0;
- for (;i < values.length; i++) {
- if (val.toString().equals(values[i])) {
- mstyle = val;
- expression.next();
- break;
- }
- }
- if (i == values.length) {
- throw new InvalidParamException("value",
- expression.getValue(),
- getPropertyName(), ac);
+ static {
+ String id_values[] = {"scroll", "slide", "alternate"};
+ allowed_values = new CssIdent[id_values.length];
+ int i = 0;
+ for (String s : id_values) {
+ allowed_values[i++] = CssIdent.getIdent(s);
+ }
}
- }
-
- public CssMarqueeStyle(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).cssMarqueeStyle != null)
- style.addRedefinitionWarning(ac, this);
- ((Css3Style) style).cssMarqueeStyle = 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).getMarqueeStyle();
- }
- else {
- return ((Css3Style) style).cssMarqueeStyle;
+ public static CssIdent getMatchingIdent(CssIdent ident) {
+ for (CssIdent id : allowed_values) {
+ if (id.equals(ident)) {
+ return id;
+ }
+ }
+ return null;
}
- }
-
- /**
- * Compares two properties for equality.
- *
- * @param value The other property.
- */
- public boolean equals(CssProperty property) {
- return (property instanceof CssMarqueeStyle &&
- mstyle.equals(((CssMarqueeStyle) property).mstyle));
- }
-
- /**
- * Returns the name of this property
- */
- public String getPropertyName() {
- return "marquee-style";
- }
- /**
- * Returns the value of this property
- */
- public Object get() {
- return mstyle;
- }
+ /**
+ * Create a new CssMarqueeStyle
+ */
+ public CssMarqueeStyle() {
+ value = initial;
+ }
- /**
- * Returns true if this property is "softly" inherited
- */
- public boolean isSoftlyInherited() {
- return mstyle.equals(inherit);
- }
+ /**
+ * Creates a new CssMarqueeStyle
+ *
+ * @param expression The expression for this property
+ * @throws org.w3c.css.util.InvalidParamException
+ * Expressions are incorrect
+ */
+ public CssMarqueeStyle(ApplContext ac, CssExpression expression, boolean check)
+ throws InvalidParamException {
+ setByUser();
+ CssValue val = expression.getValue();
- /**
- * Returns a string representation of the object
- */
- public String toString() {
- return mstyle.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 mstyle == alternate;
- }
+ 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 CssMarqueeStyle(ApplContext ac, CssExpression expression)
+ throws InvalidParamException {
+ this(ac, expression, false);
+ }
}
+
Received on Wednesday, 5 September 2012 11:50:07 UTC