2002/css-validator/org/w3c/css/properties/css2 CssCounterReset.java,NONE,1.1 Css2Style.java,1.24,1.25

Update of /sources/public/2002/css-validator/org/w3c/css/properties/css2
In directory hutz:/tmp/cvs-serv2284/css2

Modified Files:
	Css2Style.java 
Added Files:
	CssCounterReset.java 
Log Message:
counter-reset per css2/21/3

Index: Css2Style.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css2/Css2Style.java,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- Css2Style.java	6 Nov 2012 09:49:49 -0000	1.24
+++ Css2Style.java	6 Nov 2012 11:22:01 -0000	1.25
@@ -11,6 +11,7 @@
 import org.w3c.css.properties.css.CssBottom;
 import org.w3c.css.properties.css.CssClip;
 import org.w3c.css.properties.css.CssCounterIncrement;
+import org.w3c.css.properties.css.CssCounterReset;
 import org.w3c.css.properties.css.CssCursor;
 import org.w3c.css.properties.css.CssDirection;
 import org.w3c.css.properties.css.CssLeft;
@@ -85,6 +86,7 @@
 	public CssOverflow cssOverflow;
 	public CssQuotes cssQuotes;
 	public CssCounterIncrement cssCounterIncrement;
+	public CssCounterReset cssCounterReset;
 
 	/**
 	 * Get the azimuth
@@ -412,6 +414,17 @@
 		}
 		return cssCounterIncrement;
 	}
+	/**
+	 * Get the counter-reset property
+	 */
+	public final CssCounterReset getCounterReset() {
+		if (cssCounterReset == null) {
+			cssCounterReset =
+					(CssCounterReset) style.CascadingOrder(new CssCounterReset(),
+							style, selector);
+		}
+		return cssCounterReset;
+	}
 
 	/**
 	 * Find conflicts in this Style

--- NEW FILE: CssCounterReset.java ---
// $Id: CssCounterReset.java,v 1.1 2012/11/06 11:22:01 ylafon Exp $
// Author: Yves Lafon <ylafon@w3.org>
//
// (c) COPYRIGHT MIT, ERCIM and Keio University, 2012.
// 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.CssNumber;
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/generate.html#propdef-counter-reset
 */
public class CssCounterReset extends org.w3c.css.properties.css.CssCounterReset {

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

	/**
	 * Creates a new CssCounterReset
	 *
	 * @param expression The expression for this property
	 * @throws org.w3c.css.util.InvalidParamException
	 *          Expressions are incorrect
	 */
	public CssCounterReset(ApplContext ac, CssExpression expression, boolean check)
			throws InvalidParamException {
		setByUser();

		CssValue val;
		char op;
		boolean intallowed = false;
		ArrayList<CssValue> v = new ArrayList<CssValue>();

		while (!expression.end()) {
			val = expression.getValue();
			op = expression.getOperator();
			switch (val.getType()) {
				case CssTypes.CSS_IDENT:
					if (inherit.equals(val)) {
						value = inherit;
						if (expression.getCount() > 1) {
							throw new InvalidParamException("value", val,
									getPropertyName(), ac);
						}
						break;
					}
					if (none.equals(val)) {
						value = none;
						if (expression.getCount() > 1) {
							throw new InvalidParamException("value", val,
									getPropertyName(), ac);
						}
						break;
					}
					v.add(val);
					intallowed = true;
					break;
				case CssTypes.CSS_NUMBER:
					if (intallowed) {
						// we allow int only after an ident
						intallowed = false;
						CssNumber n = val.getNumber();
						n.checkInteger(ac, this);
						v.add(val);
						break;
					}
					// if int wasn't allowed, let it fail
				default:
					throw new InvalidParamException("value", val,
							getPropertyName(), ac);
			}
			if (op != SPACE) {
				throw new InvalidParamException("operator",
						((new Character(op)).toString()), ac);
			}
			expression.next();
		}
		// check it's not inherit or none
		if (v.size() > 0) {
			value = (v.size() == 1) ? v.get(0) : new CssValueList(v);
		}
	}

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

}

Received on Tuesday, 6 November 2012 11:22:04 UTC