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

2002/css-validator/org/w3c/css/properties/css3 CssOutline.java,NONE,1.1 CssOutlineColor.java,NONE,1.1 CssOutlineStyle.java,NONE,1.1 CssOutlineWidth.java,NONE,1.1 CSS3Default.properties,1.1,1.2 Css3Style.java,1.130,1.131 CssOutlineOffset.java,1.3,1.4

From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
Date: Tue, 16 Oct 2012 20:44:03 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1TODzf-00059k-AK@lionel-hutz.w3.org>
Update of /sources/public/2002/css-validator/org/w3c/css/properties/css3
In directory hutz:/tmp/cvs-serv19650/css3

Modified Files:
	CSS3Default.properties Css3Style.java CssOutlineOffset.java 
Added Files:
	CssOutline.java CssOutlineColor.java CssOutlineStyle.java 
	CssOutlineWidth.java 
Log Message:
outline/outline-color/outline-width/outline-style per css2 2.1 and http://www.w3.org/TR/2012/WD-css3-ui-20120117/ outline-offset per http://www.w3.org/TR/2012/WD-css3-ui-20120117/

--- NEW FILE: CssOutlineColor.java ---
// $Id: CssOutlineColor.java,v 1.1 2012/10/16 20:44: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.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.CssTypes;
import org.w3c.css.values.CssValue;

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

	public static final CssIdent invert = CssIdent.getIdent("invert");

	public static final CssIdent getMatchingIdent(CssIdent ident) {
		if (invert.equals(ident)) {
			return ident;
		}
		return null;
	}

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

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

		setByUser();
		CssValue val = expression.getValue();

		switch (val.getType()) {
			case CssTypes.CSS_COLOR:
				value = val;
				expression.next();
				break;
			case CssTypes.CSS_IDENT:
				if (invert.equals(val)) {
					value = invert;
					expression.next();
					break;
				}
				if (inherit.equals(val)) {
					value = inherit;
					expression.next();
					break;
				}
				// else, we must parse as a color value
				// colors might be a function (for now)
			case CssTypes.CSS_FUNCTION:
				try {
					CssColor tcolor = new CssColor(ac, expression, check);
					value = tcolor.getColor();
				} catch (InvalidParamException e) {
					// we recreate the exception, as it will have
					// the wrong property name otherwise
					throw new InvalidParamException("value",
							expression.getValue(),
							getPropertyName(), ac);
				}
			default:
				throw new InvalidParamException("value", val.toString(),
						getPropertyName(), ac);
		}
	}

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

}


Index: Css3Style.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css3/Css3Style.java,v
retrieving revision 1.130
retrieving revision 1.131
diff -u -d -r1.130 -r1.131
--- Css3Style.java	15 Oct 2012 15:08:25 -0000	1.130
+++ Css3Style.java	16 Oct 2012 20:44:00 -0000	1.131
@@ -70,6 +70,7 @@
 import org.w3c.css.properties.css.CssMarqueeStyle;
 import org.w3c.css.properties.css.CssOpacity;
 import org.w3c.css.properties.css.CssOrder;
+import org.w3c.css.properties.css.CssOutlineOffset;
 import org.w3c.css.properties.css.CssOverflowStyle;
 import org.w3c.css.properties.css.CssOverflowWrap;
 import org.w3c.css.properties.css.CssPerspective;
@@ -207,7 +208,8 @@
 
 	public CssBoxSizing cssBoxSizing;
 	public CssResize cssResize;
-	
+	public CssOutlineOffset cssOutlineOffset;
+
 	CssDropInitialAfterAdjust cssDropInitialAfterAdjust;
 	CssDropInitialAfterAlign cssDropInitialAfterAlign;
 	CssDropInitialBeforeAdjust cssDropInitialBeforeAdjust;
@@ -227,7 +229,6 @@
 	CssNavRight cssNavRight;
 	CssNavDown cssNavDown;
 	CssNavLeft cssNavLeft;
-	CssOutlineOffset cssOutlineOffset;
 	CssOverflowX cssOverflowX;
 	CssOverflowY cssOverflowY;
 	CssRubySpan cssRubySpan;
@@ -1387,7 +1388,7 @@
 		}
 		return cssTransform;
 	}
-	
+
 	///
 
 	/**

Index: CSS3Default.properties
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css3/CSS3Default.properties,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- CSS3Default.properties	23 Aug 2005 16:24:20 -0000	1.1
+++ CSS3Default.properties	16 Oct 2012 20:44:00 -0000	1.2
@@ -12,7 +12,7 @@
 ruby-align.inherited:			true
 ruby-overhang.inherited:		true
 box-sizing.inherited:			false
-resizer.inherited:			false
+resize.inherited:			false
 key-equivalent.inherited:		false
 tab-index.inherited:			false
 user-input.inherited:			false

--- NEW FILE: CssOutline.java ---
// $Id: CssOutline.java,v 1.1 2012/10/16 20:44: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.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.CssTypes;
import org.w3c.css.values.CssValue;

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

/**
 * @spec http://www.w3.org/TR/2012/WD-css3-ui-20120117/#outline
 * @see org.w3c.css.properties.css3.CssBorderStyle
 * @see org.w3c.css.properties.css3.CssBorderWidth
 */
public class CssOutline extends org.w3c.css.properties.css.CssOutline {

	/**
	 * Create a new CssOutline
	 */
	public CssOutline() {
		_color = new CssOutlineColor();
		_style = new org.w3c.css.properties.css21.CssOutlineStyle();
		_width = new CssOutlineWidth();
	}

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

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

		setByUser();

		CssValue val;
		char op;

		_color = new CssOutlineColor();
		_style = new CssOutlineStyle();
		_width = new CssOutlineWidth();

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

			switch (val.getType()) {
				case CssTypes.CSS_NUMBER:
				case CssTypes.CSS_LENGTH:
					if (_width.value == null) {
						CssExpression ex = new CssExpression();
						ex.addValue(val);
						_width = new CssOutlineWidth(ac, ex, check);
						break;
					}
					// else, we already got one...
					throw new InvalidParamException("value",
							val.toString(),
							getPropertyName(), ac);
				case CssTypes.CSS_COLOR:
					if (_color.value == null) {
						CssExpression ex = new CssExpression();
						ex.addValue(val);
						_color = new CssOutlineColor(ac, ex, check);
						break;
					}
					// else, we already got one...
					throw new InvalidParamException("value",
							val.toString(),
							getPropertyName(), ac);
				case CssTypes.CSS_IDENT:
					if (inherit.equals(val)) {
						if (expression.getCount() != 1) {
							throw new InvalidParamException("value",
									val.toString(),
									getPropertyName(), ac);
						}
						value = inherit;
						break;
					}
					CssIdent ident = (CssIdent) val;
					// let's try to find which ident we have...
					if (_style.value == null) {
						CssIdent match = CssOutlineStyle.getMatchingIdent(ident);
						if (match != null) {
							_style.value = match;
							break;
						}
					}
					if (_width.value == null) {
						CssIdent match = CssBorderWidth.getMatchingIdent(ident);
						if (match != null) {
							_width.value = match;
							break;
						}
					}
					if (_color.value == null) {
						CssIdent match = CssOutlineColor.getMatchingIdent(ident);
						if (match != null) {
							_color.value = match;
							break;
						} else {
							CssExpression ex = new CssExpression();
							ex.addValue(val);
							_color = new CssOutlineColor(ac, ex, check);
							break;
						}
					}
					// unrecognized... fail
				default:
					throw new InvalidParamException("value",
							val.toString(),
							getPropertyName(), ac);
			}
			expression.next();
			if (op != SPACE) {
				throw new InvalidParamException("operator",
						Character.toString(op),
						ac);
			}
		}
	}

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

}


--- NEW FILE: CssOutlineStyle.java ---
// $Id: CssOutlineStyle.java,v 1.1 2012/10/16 20:44: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.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.CssTypes;
import org.w3c.css.values.CssValue;

/**
 * @spec http://www.w3.org/TR/2012/WD-css3-ui-20120117/#outline-style
 * @see org.w3c.css.properties.css3.CssBorderStyle
 */
public class CssOutlineStyle extends org.w3c.css.properties.css.CssOutlineStyle {

	public static final CssIdent auto = CssIdent.getIdent("auto");

	public static final CssIdent getMatchingIdent(CssIdent ident) {
		if (auto.equals(ident)) {
			return auto;
		}
		return CssBorderStyle.getMatchingIdent(ident);
	}

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

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

		CssValue val = expression.getValue();

		setByUser();

		// css3 adds an 'auto' value on top of border-style values
		value = null;
		if (val.getType() == CssTypes.CSS_IDENT) {
			CssIdent id_val = (CssIdent) val;
			if (inherit.equals(id_val)) {
				value = inherit;
			} else if (auto.equals(id_val)) {
				value = auto;
			}
		}
		// if we got a match, work on the expression, otherwise
		// delegate to border-style
		if (value != null) {
			expression.next();
		} else {
			// here we delegate to BorderStyle implementation
			value = CssBorderStyle.checkBorderSideStyle(ac, this, expression, check);
		}
	}

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

}


--- NEW FILE: CssOutlineWidth.java ---
// $Id: CssOutlineWidth.java,v 1.1 2012/10/16 20:44: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.css3;

import org.w3c.css.util.ApplContext;
import org.w3c.css.util.InvalidParamException;
import org.w3c.css.values.CssExpression;

/**
 * @spec http://www.w3.org/TR/2012/WD-css3-ui-20120117/#outline-width
 * @see CssBorderWidth
 */
public class CssOutlineWidth extends org.w3c.css.properties.css.CssOutlineWidth {

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

	/**
	 * Creates a new CssOutlineWidth
	 *
	 * @param expression The expression for this property
	 * @throws org.w3c.css.util.InvalidParamException
	 *          Expressions are incorrect
	 */
	public CssOutlineWidth(ApplContext ac, CssExpression expression, boolean check)
			throws InvalidParamException {
		setByUser();
		// here we delegate to BorderWidth implementation
		value = CssBorderWidth.checkBorderSideWidth(ac, this, expression, check);
	}

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

}


Index: CssOutlineOffset.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css3/CssOutlineOffset.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- CssOutlineOffset.java	5 Jan 2010 13:49:54 -0000	1.3
+++ CssOutlineOffset.java	16 Oct 2012 20:44:01 -0000	1.4
@@ -1,139 +1,65 @@
-//
 // $Id$
-// From Sijtsche de Jong (sy.de.jong@let.rug.nl)
+// Author: Yves Lafon <ylafon@w3.org>
 //
-// (c) COPYLeft 1995-2000  World Wide Web Consortium (MIT, INRIA, Keio University)
-// Please first read the full copyLeft statement at
-// http://www.w3.org/Consortium/Legal/copyLeft-software-19980720
-
+// (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.properties.css.CssProperty;
 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.CssLength;
-import org.w3c.css.values.CssNumber;
+import org.w3c.css.values.CssTypes;
 import org.w3c.css.values.CssValue;
 
-public class CssOutlineOffset extends CssProperty {
-
-    CssValue outlineOffset;
-    ApplContext ac;
+/**
+ * @spec http://www.w3.org/TR/2012/WD-css3-ui-20120117/#outline-offset0
+ */
+public class CssOutlineOffset extends org.w3c.css.properties.css.CssOutlineOffset {
 
-    static CssIdent auto = new CssIdent("auto");
+	/**
+	 * Create a new CssOutlineOffset
+	 */
+	public CssOutlineOffset() {
+	}
 
-    /**
-     * Create a new CssOutlineOffset
-     */
-    public CssOutlineOffset() {
-	// nothing to do
-    }
+	/**
+	 * Creates a new CssOutlineOffset
+	 *
+	 * @param expression The expression for this property
+	 * @throws org.w3c.css.util.InvalidParamException
+	 *          Expressions are incorrect
+	 */
+	public CssOutlineOffset(ApplContext ac, CssExpression expression, boolean check)
+			throws InvalidParamException {
+		if (check && expression.getCount() > 1) {
+			throw new InvalidParamException("unrecognize", ac);
+		}
 
-    /**
-     * Create a new CssOutlineOffset
-     *
-     * @param expression The expression for this property
-     * @exception InvalidParamException Incorrect value
-     */
-    public CssOutlineOffset(ApplContext ac, CssExpression expression,
-	    boolean check) throws InvalidParamException {
+		CssValue val = expression.getValue();
 
-	this.ac = ac;
-	setByUser();
-	CssValue val = expression.getValue();
+		setByUser();
 
-	if (val.equals(inherit)) {
-	    outlineOffset = val;
-	    expression.next();
-	} else if (val instanceof CssLength) {
-	    outlineOffset = val;
-	    expression.next();
-	} else {
-	    throw new InvalidParamException("value", expression.getValue(),
-					    getPropertyName(), ac);
+		switch (val.getType()) {
+			case CssTypes.CSS_NUMBER:
+				val.getLength();
+			case CssTypes.CSS_LENGTH:
+				value = val;
+				break;
+			case CssTypes.CSS_IDENT:
+				if (inherit.equals(val)) {
+					value = inherit;
+					break;
+				}
+			default:
+				throw new InvalidParamException("value", expression.getValue(),
+						getPropertyName(), ac);
+		}
+		expression.next();
 	}
-    }
 
-    public CssOutlineOffset(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) {
-	if (((Css3Style) style).cssOutlineOffset != null)
-	    style.addRedefinitionWarning(ac, this);
-	((Css3Style) style).cssOutlineOffset = this;
-    }
-
-    /**
-     * Get this property in the style.
-     *
-     * @param style The style where the property is
-     * @param resolve if true, resolve the style to find this property
-     */
-    public CssProperty getPropertyInStyle(CssStyle style, boolean resolve) {
-	if (resolve) {
-	    return ((Css3Style) style).getOutlineOffset();
-	}
-	else {
-	    return ((Css3Style) style).cssOutlineOffset;
+	public CssOutlineOffset(ApplContext ac, CssExpression expression)
+			throws InvalidParamException {
+		this(ac, expression, false);
 	}
-    }
-
-    /**
-     * Compares two properties for equality.
-     *
-     * @param value The other property.
-     */
-    public boolean equals(CssProperty property) {
-	return (property instanceof CssOutlineOffset &&
-		outlineOffset.equals(((CssOutlineOffset) property).outlineOffset));
-    }
-
-    /**
-     * Returns the name of this property
-     */
-    public String getPropertyName() {
-	return "outline-offset";
-    }
-
-    /**
-     * Returns the value of this property
-     */
-    public Object get() {
-	return outlineOffset;
-    }
-
-    /**
-     * Returns true if this property is "softly" inherited
-     */
-    public boolean isSoftlyInherited() {
-	return outlineOffset.equals(inherit);
-    }
-
-    /**
-     * Returns a string representation of the object
-     */
-    public String toString() {
-	return outlineOffset.toString();
-    }
-
-    /**
-     * Is the value of this property a default value
-     * It is used by alle macro for the function <code>print</code>
-     */
-    public boolean isDefault() {
-
-		CssNumber cssnum = new CssNumber(ac, (float) 0.0);
-        return outlineOffset.toString() == cssnum.toString();
-    }
-
 }
+
Received on Tuesday, 16 October 2012 20:44:05 UTC

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