W3C home > Mailing lists > Public > www-validator-cvs@w3.org > January 2013

CVS 2002/css-validator/org/w3c/css/properties/css2

From: CVS User ylafon <cvsmail@w3.org>
Date: Sun, 06 Jan 2013 21:06:49 +0000
Message-Id: <E1TrxQf-0007Nw-0P@roscoe.w3.org>
To: www-validator-cvs@w3.org
Update of /sources/public/2002/css-validator/org/w3c/css/properties/css2
In directory roscoe:/tmp/cvs-serv28321/css2

Modified Files:
	Css2Style.java 
Added Files:
	CssPlayDuring.java 
Log Message:
play-during

--- /sources/public/2002/css-validator/org/w3c/css/properties/css2/Css2Style.java	2013/01/04 15:41:44	1.45
+++ /sources/public/2002/css-validator/org/w3c/css/properties/css2/Css2Style.java	2013/01/06 21:06:48	1.46
@@ -1,5 +1,5 @@
 //
-// $Id: Css2Style.java,v 1.45 2013/01/04 15:41:44 ylafon Exp $
+// $Id: Css2Style.java,v 1.46 2013/01/06 21:06:48 ylafon Exp $
 // From Philippe Le Hegaret (Philippe.Le_Hegaret@sophia.inria.fr)
 //
 // (c) COPYRIGHT MIT and INRIA, 1997.
@@ -39,6 +39,7 @@
 import org.w3c.css.properties.css.CssPauseBefore;
 import org.w3c.css.properties.css.CssPitch;
 import org.w3c.css.properties.css.CssPitchRange;
+import org.w3c.css.properties.css.CssPlayDuring;
 import org.w3c.css.properties.css.CssPosition;
 import org.w3c.css.properties.css.CssQuotes;
 import org.w3c.css.properties.css.CssRichness;
@@ -54,8 +55,6 @@
 import org.w3c.css.properties.css.CssTop;
 import org.w3c.css.properties.css.CssUnicodeBidi;
 import org.w3c.css.properties.css.CssVisibility;
-import org.w3c.css.properties.css.CssVoiceDuration;
-import org.w3c.css.properties.css.CssVoiceStress;
 import org.w3c.css.properties.css.CssVolume;
 import org.w3c.css.util.ApplContext;
 import org.w3c.css.util.Warning;
@@ -63,7 +62,7 @@
 import org.w3c.css.values.CssIdent;
 
 /**
- * @version $Revision: 1.45 $
+ * @version $Revision: 1.46 $
  */
 public class Css2Style extends ACssStyle {
 
@@ -88,6 +87,7 @@
 	public CssPauseAfter cssPauseAfter;
 	public CssPauseBefore cssPauseBefore;
 	public CssPause cssPause;
+	public CssPlayDuring cssPlayDuring;
 
 
 	/**
@@ -663,6 +663,14 @@
 		return cssPause;
 	}
 
+	public final CssPlayDuring getPlayDuring() {
+		if (cssPlayDuring == null) {
+			cssPlayDuring =
+					(CssPlayDuring) style.CascadingOrder(new CssPlayDuring(),
+							style, selector);
+		}
+		return cssPlayDuring;
+	}
 	
 	/**
 	 * Find conflicts in this Style

--- /sources/public/2002/css-validator/org/w3c/css/properties/css2/CssPlayDuring.java	2013/01/06 21:06:49	NONE
+++ /sources/public/2002/css-validator/org/w3c/css/properties/css2/CssPlayDuring.java	2013/01/06 21:06:49	1.1
// $Id: CssPlayDuring.java,v 1.1 2013/01/06 21:06:48 ylafon Exp $
// Author: Yves Lafon <ylafon@w3.org>
//
// (c) COPYRIGHT MIT, ERCIM and Keio University, 2013.
// 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 org.w3c.css.values.CssValueList;

import java.util.ArrayList;

import static org.w3c.css.values.CssOperator.SPACE;

/**
 * @spec http://www.w3.org/TR/2008/REC-CSS2-20080411/aural.html#propdef-play-during
 */
public class CssPlayDuring extends org.w3c.css.properties.css.CssPlayDuring {

	public static final CssIdent auto, mix, repeat;

	static {
		auto = CssIdent.getIdent("auto");
		mix = CssIdent.getIdent("mix");
		repeat = CssIdent.getIdent("repeat");
	}

	public static final CssIdent getAllowedIdent(CssIdent ident) {
		if (auto.equals(ident)) {
			return auto;
		}
		if (none.equals(ident)) {
			return none;
		}
		return null;
	}

	/**
	 * Create a new CssPlayDuring
	 */
	public CssPlayDuring() {
	}

	/**
	 * Creates a new CssPlayDuring
	 *
	 * @param expression The expression for this property
	 * @throws org.w3c.css.util.InvalidParamException
	 *          Expressions are incorrect
	 */
	public CssPlayDuring(ApplContext ac, CssExpression expression, boolean check)
			throws InvalidParamException {
		if (check && expression.getCount() > 3) {
			throw new InvalidParamException("unrecognize", ac);
		}
		setByUser();

		CssValue val, repeatVal, mixVal;
		char op;

		val = expression.getValue();
		op = expression.getOperator();

		switch (val.getType()) {
			case CssTypes.CSS_URL:
				value = val;
				if (expression.getRemainingCount() > 1) {
					expression.next();
					if (op != SPACE) {
						throw new InvalidParamException("operator",
								((new Character(op)).toString()), ac);
					}
					val = expression.getValue();
					op = expression.getOperator();
					// the grammar says mix? repeat?
					// most probably against what was intended (see CSS21).
					if (val.getType() != CssTypes.CSS_IDENT) {
						throw new InvalidParamException("value",
								val.toString(),
								getPropertyName(), ac);
					}
					repeatVal = null;
					mixVal = null;
					if (repeat.equals(val)) {
						repeatVal = repeat;
					} else if (mix.equals(val)) {
						mixVal = mix;
					} else {
						throw new InvalidParamException("value",
								val.toString(),
								getPropertyName(), ac);
					}
					// and now the second value...
					if (expression.getRemainingCount() > 1) {
						expression.next();
						if (op != SPACE) {
							throw new InvalidParamException("operator",
									((new Character(op)).toString()), ac);
						}
						val = expression.getValue();
						if (val.getType() != CssTypes.CSS_IDENT) {
							throw new InvalidParamException("value",
									val.toString(),
									getPropertyName(), ac);
						}
						if (repeatVal == null && repeat.equals(val)) {
							repeatVal = repeat;
						/* }  else if (mixVal == null && mix.equals(val)) {
							mixVal = mix; */
						} else {
							throw new InvalidParamException("value",
									val.toString(),
									getPropertyName(), ac);
						}
					}
					ArrayList<CssValue> values = new ArrayList<CssValue>(4);
					values.add(value);
					if (mixVal != null) {
						values.add(mixVal);
					}
					if (repeatVal != null) {
						values.add(repeatVal);
					}
					value = new CssValueList(values);
				}
				break;
			case CssTypes.CSS_IDENT:
				if (expression.getCount() == 1) {
					CssIdent id = (CssIdent) val;
					if (inherit.equals(id)) {
						value = inherit;
						break;
					}
					value = getAllowedIdent(id);
					if (value != null) {
						break;
					}
				}
			default:
				throw new InvalidParamException("value",
						val.toString(),
						getPropertyName(), ac);
		}
		expression.next();
	}

	public CssPlayDuring(ApplContext ac, CssExpression expression)
			throws InvalidParamException {
		this(ac, expression, false);
	}
}
Received on Sunday, 6 January 2013 21:06:50 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Sunday, 6 January 2013 21:07:22 GMT