2002/css-validator/org/w3c/css/properties/css3 CssTextEmphasis.java,NONE,1.1 Css3Style.java,1.62,1.63

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

Modified Files:
	Css3Style.java 
Added Files:
	CssTextEmphasis.java 
Log Message:
text-emphasis per http://www.w3.org/TR/2012/WD-css3-text-20120814/#text-emphasis0

Index: Css3Style.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css3/Css3Style.java,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -d -r1.62 -r1.63
--- Css3Style.java	3 Sep 2012 20:35:45 -0000	1.62
+++ Css3Style.java	4 Sep 2012 09:10:58 -0000	1.63
@@ -49,6 +49,7 @@
 import org.w3c.css.properties.css.CssTextDecorationLine;
 import org.w3c.css.properties.css.CssTextDecorationSkip;
 import org.w3c.css.properties.css.CssTextDecorationStyle;
+import org.w3c.css.properties.css.CssTextEmphasis;
 import org.w3c.css.properties.css.CssTextEmphasisColor;
 import org.w3c.css.properties.css.CssTextEmphasisPosition;
 import org.w3c.css.properties.css.CssTextEmphasisStyle;
@@ -149,6 +150,7 @@
 	public CssTextDecorationLine cssTextDecorationLine;
 	public CssTextDecorationSkip cssTextDecorationSkip;
 	public CssTextDecorationStyle cssTextDecorationStyle;
+	public CssTextEmphasis cssTextEmphasis;
 	public CssTextEmphasisColor cssTextEmphasisColor;
 	public CssTextEmphasisPosition cssTextEmphasisPosition;
 	public CssTextEmphasisStyle cssTextEmphasisStyle;
@@ -1401,7 +1403,16 @@
 		}
 		return cssTextDecorationSkip;
 	}
-	
+
+	public CssTextEmphasis getTextEmphasis() {
+		if (cssTextEmphasis == null) {
+			cssTextEmphasis =
+					(CssTextEmphasis) style.CascadingOrder(
+							new CssTextEmphasis(), style, selector);
+		}
+		return cssTextEmphasis;
+	}
+
 	public CssTextEmphasisColor getTextEmphasisColor() {
 		if (cssTextEmphasisColor == null) {
 			cssTextEmphasisColor =

--- NEW FILE: CssTextEmphasis.java ---
// $Id: CssTextEmphasis.java,v 1.1 2012/09/04 09:10:58 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.css3;

import org.w3c.css.parser.CssStyle;
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;

/**
 * @spec http://www.w3.org/TR/2012/WD-css3-text-20120814/#text-emphasis0
 */
public class CssTextEmphasis extends org.w3c.css.properties.css.CssTextEmphasis {

	CssTextEmphasisColor colorValue = new CssTextEmphasisColor();
	CssTextEmphasisStyle styleValue = new CssTextEmphasisStyle();

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

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

		CssValue val;
		char op;

		while (!expression.end()) {
			val = expression.getValue();
			op = expression.getOperator();

			switch (val.getType()) {
				case CssTypes.CSS_STRING:
					if (styleExp == null) {
						styleExp = new CssExpression();
					}
					styleExp.addValue(val);
					expression.next();
					break;
				case CssTypes.CSS_IDENT:
					CssIdent ident = (CssIdent) val;
					CssIdent id = CssTextEmphasisStyle.getAllowedValue(ident);
					if (id != null) {
						if (styleExp == null) {
							styleExp = new CssExpression();
						}
						styleExp.addValue(val);
						expression.next();
						break;
					}
					// or else, it should be a color...
				default:
					// we can't have two colors
					if (color != null) {
						throw new InvalidParamException("value",
								val, getPropertyName(), ac);
					}
					CssColor c = new CssColor(ac, expression, false);
					color = c.getColor();
					// color can be first or last
					if (styleExp != null && expression.getRemainingCount() != 0) {
						if (color != null) {
							throw new InvalidParamException("value",
									val, getPropertyName(), ac);
						}
					}
			}
		}
		// parse the style exp
		if (styleExp != null) {
			styleValue = new CssTextEmphasisStyle(ac, styleExp, check);
			value = styleValue.value;
		}
		if (color != null) {
			colorValue.value = color;
			if (styleExp == null) {
				value = color;
			} else {
				ArrayList<CssValue> v = new ArrayList<CssValue>(2);
				v.add(styleValue.value);
				v.add(color);
				value = new CssValueList(v);
			}
		}
	}

	public CssTextEmphasis(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) {
		super.addToStyle(ac, style);
		// and the individual...
		colorValue.addToStyle(ac, style);
		styleValue.addToStyle(ac, style);
	}
}

Received on Tuesday, 4 September 2012 09:11:06 UTC