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

2002/css-validator/org/w3c/css/properties/css3 CssTextUnderlinePosition.java,NONE,1.1 Css3Style.java,1.59,1.60

From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
Date: Sun, 02 Sep 2012 11:25:39 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1T88J9-00039l-MN@lionel-hutz.w3.org>
Update of /sources/public/2002/css-validator/org/w3c/css/properties/css3
In directory hutz:/tmp/cvs-serv12077/css3

Modified Files:
	Css3Style.java 
Added Files:
	CssTextUnderlinePosition.java 
Log Message:
text-underline-position per http://www.w3.org/TR/2012/WD-css3-text-20120814/#text-underline-position0

Index: Css3Style.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css3/Css3Style.java,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -d -r1.59 -r1.60
--- Css3Style.java	1 Sep 2012 20:21:12 -0000	1.59
+++ Css3Style.java	2 Sep 2012 11:25:37 -0000	1.60
@@ -52,6 +52,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.CssTextUnderlinePosition;
 import org.w3c.css.properties.css.CssWordBreak;
 import org.w3c.css.util.ApplContext;
 import org.w3c.css.util.Util;
@@ -80,11 +81,6 @@
 	CssTextAfterOverflow cssTextAfterOverflow;
 	CssPunctuationTrim cssPunctuationTrim;
 	CssTextAutoSpace cssTextAutoSpace;
-	CssTextUlStyle cssTextUlStyle;
-	CssTextUlColor cssTextUlColor;
-	CssTextUlMode cssTextUlMode;
-	CssTextUlPos cssTextUlPos;
-	CssTextUnderLine cssTextUnderLine;
 	CssTextCombine cssTextCombine;
 	CssMedia cssMedia;
 	CssDisplayModel cssDisplayModel;
@@ -156,6 +152,7 @@
 	public CssTextEmphasisColor cssTextEmphasisColor;
 	public CssTextEmphasisPosition cssTextEmphasisPosition;
 	public CssTextEmphasisStyle cssTextEmphasisStyle;
+	public CssTextUnderlinePosition cssTextUnderlinePosition;
 	public CssTabSize cssTabSize;
 
 	CssDropInitialAfterAdjust cssDropInitialAfterAdjust;
@@ -441,50 +438,6 @@
 		return cssTextAutoSpace;
 	}
 
-	public CssTextUlStyle getTextUlStyle() {
-		if (cssTextUlStyle == null) {
-			cssTextUlStyle =
-					(CssTextUlStyle) style.CascadingOrder(
-							new CssTextUlStyle(), style, selector);
-		}
-		return cssTextUlStyle;
-	}
-
-	public CssTextUlColor getTextUlColor() {
-		if (cssTextUlColor == null) {
-			cssTextUlColor =
-					(CssTextUlColor) style.CascadingOrder(
-							new CssTextUlColor(), style, selector);
-		}
-		return cssTextUlColor;
-	}
-
-	public CssTextUlMode getTextUlMode() {
-		if (cssTextUlMode == null) {
-			cssTextUlMode =
-					(CssTextUlMode) style.CascadingOrder(
-							new CssTextUlMode(), style, selector);
-		}
-		return cssTextUlMode;
-	}
-
-	public CssTextUlPos getTextUlPos() {
-		if (cssTextUlPos == null) {
-			cssTextUlPos =
-					(CssTextUlPos) style.CascadingOrder(
-							new CssTextUlPos(), style, selector);
-		}
-		return cssTextUlPos;
-	}
-
-	public CssTextUnderLine getTextUnderLine() {
-		if (cssTextUnderLine == null) {
-			cssTextUnderLine =
-					(CssTextUnderLine) style.CascadingOrder(
-							new CssTextUnderLine(), style, selector);
-		}
-		return cssTextUnderLine;
-	}
 
 	public CssTextCombine getTextCombine() {
 		if (cssTextCombine == null) {
@@ -1475,7 +1428,16 @@
 		}
 		return cssTextEmphasisStyle;
 	}
-	
+
+	public CssTextUnderlinePosition getTextUnderlinePosition() {
+		if (cssTextUnderlinePosition == null) {
+			cssTextUnderlinePosition =
+					(CssTextUnderlinePosition) style.CascadingOrder(
+							new CssTextUnderlinePosition(), style, selector);
+		}
+		return cssTextUnderlinePosition;
+	}
+
 	public CssTabSize getTabSize() {
 		if (cssTabSize == null) {
 			cssTabSize =

--- NEW FILE: CssTextUnderlinePosition.java ---
// $Id: CssTextUnderlinePosition.java,v 1.1 2012/09/02 11:25:37 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.CssOperator;
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-underline-position0
 */
public class CssTextUnderlinePosition extends org.w3c.css.properties.css.CssTextUnderlinePosition {

	public static final CssIdent auto, alphabetic, below;
	public static final CssIdent[] horizontalValues;

	static {
		String[] _horizontalValues = {"left", "right"};
		horizontalValues = new CssIdent[_horizontalValues.length];
		int i = 0;
		for (String s : _horizontalValues) {
			horizontalValues[i++] = CssIdent.getIdent(s);
		}
		alphabetic = CssIdent.getIdent("alphabetic");
		below = CssIdent.getIdent("below");
		auto = CssIdent.getIdent("auto");
	}

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

	public static final CssIdent getAllowedValue(CssIdent ident) {
		if (auto.equals(ident)) {
			return auto;
		}
		if (alphabetic.equals(ident)) {
			return alphabetic;
		}
		if (below.equals(ident)) {
			return below;
		}
		return getHorizontalValue(ident);
	}

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

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

		CssValue val;
		char op;

		CssIdent horValue = null;
		CssIdent verValue = null;

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

		if (val.getType() != CssTypes.CSS_IDENT) {
			throw new InvalidParamException("value",
					val.toString(),
					getPropertyName(), ac);
		}

		CssIdent ident = (CssIdent) val;
		if (inherit.equals(ident)) {
			value = inherit;
			if (check && expression.getCount() != 1) {
				throw new InvalidParamException("value",
						val.toString(),
						getPropertyName(), ac);
			}
		} else if (auto.equals(ident)) {
			value = auto;
			if (check && expression.getCount() != 1) {
				throw new InvalidParamException("value",
						val.toString(),
						getPropertyName(), ac);
			}
		} else if (alphabetic.equals(ident)) {
			value = alphabetic;
			if (check && expression.getCount() != 1) {
				throw new InvalidParamException("value",
						val.toString(),
						getPropertyName(), ac);
			}
		} else {
			int nbgot = 0;
			do {
				boolean match = false;
				if (verValue == null && below.equals(ident)) {
					verValue = below;
					match = true;
				} else if (horValue == null) {
					horValue = getHorizontalValue(ident);
					match = (horValue != null);
				}
				if (!match) {
					throw new InvalidParamException("value",
							val.toString(),
							getPropertyName(), ac);
				}
				nbgot++;
				if (expression.getRemainingCount() == 1 || (!check && nbgot == 2)) {
					// if we have both, exit
					// (needed only if check == false...
					break;
				}
				if (op != CssOperator.SPACE) {
					throw new InvalidParamException("operator",
							((new Character(op)).toString()), ac);
				}
				expression.next();
				val = expression.getValue();
				op = expression.getOperator();
				if (val.getType() != CssTypes.CSS_IDENT) {
					throw new InvalidParamException("value",
							val.toString(),
							getPropertyName(), ac);
				}
				ident = (CssIdent) val;
			} while (!expression.end());
			// now construct the value
			ArrayList<CssValue> v = new ArrayList<CssValue>(nbgot);
			if (horValue != null) {
				v.add(horValue);
			}
			if (verValue != null) {
				v.add(verValue);
			}
			value = (nbgot > 1) ? new CssValueList(v) : v.get(0);
		}
		expression.next();

	}

	public CssTextUnderlinePosition(ApplContext ac, CssExpression expression)
			throws InvalidParamException {
		this(ac, expression, false);
	}
}
Received on Sunday, 2 September 2012 11:25:41 UTC

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