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

2002/css-validator/org/w3c/css/properties/css3 CssTextOverflow.java,1.3,1.4 Css3Style.java,1.133,1.134

From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
Date: Wed, 17 Oct 2012 09:53:58 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1TOQK6-0004aT-Ha@lionel-hutz.w3.org>
Update of /sources/public/2002/css-validator/org/w3c/css/properties/css3
In directory hutz:/tmp/cvs-serv17561/css3

Modified Files:
	Css3Style.java 
Added Files:
	CssTextOverflow.java 
Log Message:
text-overflow per http://www.w3.org/TR/2012/WD-css3-ui-20120117/#text-overflow0

Index: Css3Style.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css3/Css3Style.java,v
retrieving revision 1.133
retrieving revision 1.134
diff -u -d -r1.133 -r1.134
--- Css3Style.java	17 Oct 2012 09:30:00 -0000	1.133
+++ Css3Style.java	17 Oct 2012 09:53:56 -0000	1.134
@@ -89,6 +89,7 @@
 import org.w3c.css.properties.css.CssTextEmphasisPosition;
 import org.w3c.css.properties.css.CssTextEmphasisStyle;
 import org.w3c.css.properties.css.CssTextJustify;
+import org.w3c.css.properties.css.CssTextOverflow;
 import org.w3c.css.properties.css.CssTextUnderlinePosition;
 import org.w3c.css.properties.css.CssTransform;
 import org.w3c.css.properties.css.CssTransformOrigin;
@@ -213,6 +214,7 @@
 	public CssOutlineOffset cssOutlineOffset;
 	public CssImeMode cssImeMode;
 	public CssNavIndex cssNavIndex;
+	public CssTextOverflow cssTextOverflow;
 
 	CssDropInitialAfterAdjust cssDropInitialAfterAdjust;
 	CssDropInitialAfterAlign cssDropInitialAfterAlign;
@@ -1401,6 +1403,15 @@
 		return cssImeMode;
 	}
 
+	public CssTextOverflow getTextOverflow() {
+		if (cssTextOverflow == null) {
+			cssTextOverflow =
+					(CssTextOverflow) style.CascadingOrder(
+							new CssTextOverflow(), style, selector);
+		}
+		return cssTextOverflow;
+	}
+
 	///
 
 	/**

--- NEW FILE: CssTextOverflow.java ---
// $Id: CssTextOverflow.java,v 1.4 2012/10/17 09:53:56 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.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.CssLayerList;
import org.w3c.css.values.CssTypes;
import org.w3c.css.values.CssValue;

import java.util.ArrayList;

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

/**
 * @spec http://www.w3.org/TR/2012/WD-css3-ui-20120117/#text-overflow0
 */
public class CssTextOverflow extends org.w3c.css.properties.css.CssTextOverflow {

	public static final CssIdent[] allowed_values;

	static {
		String[] _allowed_values = {"clip", "ellipsis"};
		allowed_values = new CssIdent[_allowed_values.length];
		int i = 0;
		for (String s : _allowed_values) {
			allowed_values[i++] = CssIdent.getIdent(s);
		}
	}

	public static CssIdent getAllowedIdent(CssIdent ident) {
		for (CssIdent id : allowed_values) {
			if (id.equals(ident)) {
				return id;
			}
		}
		return null;
	}

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

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


		if (check && expression.getCount() > 2) {
			throw new InvalidParamException("unrecognize", ac);
		}

		setByUser();

		CssValue val;
		char op;
		ArrayList<CssValue> values = new ArrayList<CssValue>();

		while (!expression.end()) {
			val = expression.getValue();
			op = expression.getOperator();
			switch (val.getType()) {
				case CssTypes.CSS_STRING:
					values.add(val);
					break;
				case CssTypes.CSS_IDENT:
					if (inherit.equals(val)) {
						if (expression.getCount() > 1) {
							throw new InvalidParamException("value",
									inherit.toString(),
									getPropertyName(), ac);
						}
						values.add(inherit);
						break;
					}
					CssIdent match = getAllowedIdent((CssIdent) val);
					if (match != null) {
						values.add(match);
						break;
					}
					// unrecognized, let it fail
				default:
					throw new InvalidParamException("value",
							val.toString(),
							getPropertyName(), ac);
			}
			if (op != SPACE) {
				throw new InvalidParamException("operator",
						((new Character(op)).toString()), ac);
			}
			expression.next();

		}
		value = (values.size() == 1) ? values.get(0) : new CssLayerList(values);
	}

	public CssTextOverflow(ApplContext ac, CssExpression expression)
			throws InvalidParamException {
		this(ac, expression, false);
	}
}
Received on Wednesday, 17 October 2012 09:53:59 UTC

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