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

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

From: CVS User ylafon <cvsmail@w3.org>
Date: Thu, 03 Jan 2013 14:57:09 +0000
Message-Id: <E1TqmEH-00046j-3v@roscoe.w3.org>
To: www-validator-cvs@w3.org
Update of /sources/public/2002/css-validator/org/w3c/css/properties/css3
In directory roscoe:/tmp/cvs-serv15672/css3

Added Files:
	CssCue.java CssCueAfter.java CssCueBefore.java 
Log Message:
cue/cue-before/cue-after per css2/css21/css3 http://www.w3.org/TR/2012/CR-css3-speech-20120320/#cue


--- /sources/public/2002/css-validator/org/w3c/css/properties/css3/CssCue.java	2013/01/03 14:57:09	NONE
+++ /sources/public/2002/css-validator/org/w3c/css/properties/css3/CssCue.java	2013/01/03 14:57:09	1.1
// $Id: CssCue.java,v 1.1 2013/01/03 14:57:08 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.css3;

import org.w3c.css.util.ApplContext;
import org.w3c.css.util.InvalidParamException;
import org.w3c.css.values.CssExpression;
import org.w3c.css.values.CssOperator;
import org.w3c.css.values.CssValue;
import org.w3c.css.values.CssValueList;

import java.util.ArrayList;

/**
 * @spec http://www.w3.org/TR/2011/REC-CSS2-20110607/aural.html#propdef-cue
 */
public class CssCue extends org.w3c.css.properties.css.CssCue {

	/**
	 * Create a new CssCue
	 */
	public CssCue() {
		value = initial;
		cssCueAfter = new CssCueAfter();
		cssCueBefore = new CssCueBefore();
	}

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

		char op;

		cssCueBefore = new CssCueBefore(ac, expression, false);
		if (expression.end()) {
			cssCueAfter = new CssCueAfter();
			cssCueAfter.value = cssCueBefore.value;
			value = cssCueBefore.value;
		} else {
			op = expression.getOperator();
			if (op != CssOperator.SPACE) {
				throw new InvalidParamException("operator",
						((new Character(op)).toString()), ac);
			}
			cssCueAfter = new CssCueAfter(ac, expression, false);
			if (cssCueBefore.value == inherit || cssCueAfter.value == inherit) {
				throw new InvalidParamException("value",
						inherit, getPropertyName(), ac);
			}
			ArrayList<CssValue> values = new ArrayList<CssValue>(2);
			values.add(cssCueBefore.value);
			values.add(cssCueAfter.value);
			value = new CssValueList(values);
		}
	}

	public CssCue(ApplContext ac, CssExpression expression)
			throws InvalidParamException {
		this(ac, expression, false);
	}
}

--- /sources/public/2002/css-validator/org/w3c/css/properties/css3/CssCueAfter.java	2013/01/03 14:57:09	NONE
+++ /sources/public/2002/css-validator/org/w3c/css/properties/css3/CssCueAfter.java	2013/01/03 14:57:09	1.1
// $Id: CssCueAfter.java,v 1.1 2013/01/03 14:57:08 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.css3;

import org.w3c.css.util.ApplContext;
import org.w3c.css.util.InvalidParamException;
import org.w3c.css.values.CssExpression;
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/2012/CR-css3-speech-20120320/#cue-after
 */
public class CssCueAfter extends org.w3c.css.properties.css.CssCueAfter {

	/**
	 * Create a new CssCueAfter
	 */
	public CssCueAfter() {
		value = initial;
	}

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

		CssValue val;
		char op;

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

		switch (val.getType()) {
			case CssTypes.CSS_URL:
				value = val;
				// now let's check for a volume...
				if (expression.getRemainingCount() > 1) {
					CssValue vnext = expression.getNextValue();
					if (vnext.getType() == CssTypes.CSS_VOLUME) {
						// we got a volume, so let's do extra checks, then
						// construct the value...
						if (op != SPACE) {
							throw new InvalidParamException("operator",
									((new Character(op)).toString()), ac);
						}
						expression.next();
						ArrayList<CssValue> values = new ArrayList<CssValue>(2);
						values.add(val);
						values.add(vnext);
						value = new CssValueList(values);
					} else if (check) {
						throw new InvalidParamException("value",
								vnext, getPropertyName(), ac);
					}
				}
				break;
			case CssTypes.CSS_IDENT:
				if (inherit.equals(val)) {
					if (expression.getCount() > 1) {
						throw new InvalidParamException("value",
								inherit, getPropertyName(), ac);
					}
					value = inherit;
					break;
				}
				if (none.equals(val)) {
					if (check && expression.getCount() > 1) {
						throw new InvalidParamException("value",
								inherit, getPropertyName(), ac);
					}
					value = none;
					break;
				}
			default:
				throw new InvalidParamException("value",
						val.toString(),
						getPropertyName(), ac);
		}
		expression.next();
	}

	public CssCueAfter(ApplContext ac, CssExpression expression)
			throws InvalidParamException {
		this(ac, expression, false);
	}
}

--- /sources/public/2002/css-validator/org/w3c/css/properties/css3/CssCueBefore.java	2013/01/03 14:57:09	NONE
+++ /sources/public/2002/css-validator/org/w3c/css/properties/css3/CssCueBefore.java	2013/01/03 14:57:09	1.1
// $Id: CssCueBefore.java,v 1.1 2013/01/03 14:57:09 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.css3;

import org.w3c.css.util.ApplContext;
import org.w3c.css.util.InvalidParamException;
import org.w3c.css.values.CssExpression;
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/2012/CR-css3-speech-20120320/#cue-before
 */
public class CssCueBefore extends org.w3c.css.properties.css.CssCueBefore {

	/**
	 * Create a new CssCueBefore
	 */
	public CssCueBefore() {
		value = initial;
	}

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

		CssValue val;
		char op;

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

		switch (val.getType()) {
			case CssTypes.CSS_URL:
				value = val;
				// now let's check for a volume...
				if (expression.getRemainingCount() > 1) {
					CssValue vnext = expression.getNextValue();
					if (vnext.getType() == CssTypes.CSS_VOLUME) {
						// we got a volume, so let's do extra checks, then
						// construct the value...
						if (op != SPACE) {
							throw new InvalidParamException("operator",
									((new Character(op)).toString()), ac);
						}
						expression.next();
						ArrayList<CssValue> values = new ArrayList<CssValue>(2);
						values.add(val);
						values.add(vnext);
						value = new CssValueList(values);
					} else if (check) {
						throw new InvalidParamException("value",
								vnext, getPropertyName(), ac);
					}
				}
				break;
			case CssTypes.CSS_IDENT:
				if (inherit.equals(val)) {
					if (expression.getCount() > 1) {
						throw new InvalidParamException("value",
								inherit, getPropertyName(), ac);
					}
					value = inherit;
					break;
				}
				if (none.equals(val)) {
					if (check && expression.getCount() > 1) {
						throw new InvalidParamException("value",
								inherit, getPropertyName(), ac);
					}
					value = none;
					break;
				}
			default:
				throw new InvalidParamException("value",
						val.toString(),
						getPropertyName(), ac);
		}
		expression.next();
	}

	public CssCueBefore(ApplContext ac, CssExpression expression)
			throws InvalidParamException {
		this(ac, expression, false);
	}
}
Received on Thursday, 3 January 2013 14:57:10 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 3 January 2013 14:57:26 GMT