W3C home > Mailing lists > Public > www-validator-cvs@w3.org > November 2012

2002/css-validator/org/w3c/css/properties/css2 CssQuotes.java,NONE,1.1 Css2Style.java,1.22,1.23

From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
Date: Mon, 05 Nov 2012 21:46:52 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1TVUVQ-0000gr-8t@lionel-hutz.w3.org>
Update of /sources/public/2002/css-validator/org/w3c/css/properties/css2
In directory hutz:/tmp/cvs-serv2504/css2

Modified Files:
	Css2Style.java 
Added Files:
	CssQuotes.java 
Log Message:
quotes per css1/2/21/3

Index: Css2Style.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css2/Css2Style.java,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- Css2Style.java	5 Nov 2012 17:36:12 -0000	1.22
+++ Css2Style.java	5 Nov 2012 21:46:50 -0000	1.23
@@ -24,6 +24,7 @@
 import org.w3c.css.properties.css.CssOutlineWidth;
 import org.w3c.css.properties.css.CssOverflow;
 import org.w3c.css.properties.css.CssPosition;
+import org.w3c.css.properties.css.CssQuotes;
 import org.w3c.css.properties.css.CssRight;
 import org.w3c.css.properties.css.CssTextShadow;
 import org.w3c.css.properties.css.CssTop;
@@ -81,6 +82,7 @@
 	public CssUnicodeBidi cssUnicodeBidi;
 	public CssVisibility cssVisibility;
 	public CssOverflow cssOverflow;
+	public CssQuotes cssQuotes;
 
 	/**
 	 * Get the azimuth
@@ -387,6 +389,17 @@
 		return cssOverflow;
 	}
 	/**
+	 * Get the quotes property
+	 */
+	public final CssQuotes getQuotes() {
+		if (cssQuotes == null) {
+			cssQuotes =
+					(CssQuotes) style.CascadingOrder(new CssQuotes(),
+							style, selector);
+		}
+		return cssQuotes;
+	}
+	/**
 	 * Find conflicts in this Style
 	 *
 	 * @param warnings     For warnings reports.

--- NEW FILE: CssQuotes.java ---
// $Id: CssQuotes.java,v 1.1 2012/11/05 21:46:50 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.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-quotes
 */
public class CssQuotes extends org.w3c.css.properties.css.CssQuotes {

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

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

		setByUser();

		CssValue val;
		char op;

		switch (expression.getCount()) {
			case 1:
				val = expression.getValue();
				if (val.getType() != CssTypes.CSS_IDENT) {
					throw new InvalidParamException("value", val,
							getPropertyName(), ac);
				}
				if (inherit.equals(val)) {
					value = inherit;
					expression.next();
					break;
				}
				if (none.equals(val)) {
					value = none;
					expression.next();
					break;
				}
				throw new InvalidParamException("value", val,
						getPropertyName(), ac);
			default:
				if (expression.getCount() % 2 == 1) {
					// odd number, one missing value
					throw new InvalidParamException("few-value", getPropertyName(), ac);
				}
				ArrayList<CssValue> v = new ArrayList<CssValue>();

				while (!expression.end()) {
					for (int i = 0; i < 2; i++) {
						val = expression.getValue();
						op = expression.getOperator();
						if (val.getType() != CssTypes.CSS_STRING) {
							throw new InvalidParamException("value", val,
									getPropertyName(), ac);
						}
						v.add(val);
						if (op != SPACE) {
							throw new InvalidParamException("operator",
									((new Character(op)).toString()), ac);
						}
						expression.next();
					}
				}
				value = new CssValueList(v);
		}
	}

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

}
Received on Monday, 5 November 2012 21:46:54 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:17:53 UTC