2002/css-validator/org/w3c/css/properties/css3 CssOverflow.java,NONE,1.1 Css3Style.java,1.138,1.139 CssOverflowX.java,1.3,1.4 CssOverflowY.java,1.3,1.4 CssOverflowCSS3.java,1.3,NONE

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

Modified Files:
	Css3Style.java CssOverflowX.java CssOverflowY.java 
Added Files:
	CssOverflow.java 
Removed Files:
	CssOverflowCSS3.java 
Log Message:
overflow per css2/21/3 overflow-x and overflow-y per css3 http://www.w3.org/TR/2007/WD-css3-box-20070809/#overflow

Index: CssOverflowX.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css3/CssOverflowX.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- CssOverflowX.java	5 Jan 2010 13:49:54 -0000	1.3
+++ CssOverflowX.java	5 Nov 2012 17:36:13 -0000	1.4
@@ -1,150 +1,44 @@
-//
 // $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.CssValue;
-
-public class CssOverflowX extends CssProperty {
-
-    CssValue overflowX;
 
-    static CssIdent auto = new CssIdent("auto");
-    static CssIdent visible = new CssIdent("visible");
-    static CssIdent hidden = new CssIdent("hidden");
-    static CssIdent scroll = new CssIdent("scroll");
-    static CssIdent initial = new CssIdent("initial");
-
-    /**
-     * Create a new CssOverflowX
-     */
-    public CssOverflowX() {
-	// nothing to do
-    }
-
-    /**
-     * Create a new CssOverflowX
-     *
-     * @param expression The expression for this property
-     * @exception InvalidParamException Incorrect value
-     */
-    public CssOverflowX(ApplContext ac, CssExpression expression,
-	    boolean check) throws InvalidParamException {
-
-	setByUser();
-	CssValue val = expression.getValue();
+/**
+ * @spec http://www.w3.org/TR/2007/WD-css3-box-20070809/#overflow-x
+ * @see CssOverflow
+ */
+public class CssOverflowX extends org.w3c.css.properties.css.CssOverflowX {
 
-	if (val.equals(inherit)) {
-	    overflowX = val;
-	    expression.next();
-	} else if (val.equals(visible)) {
-	    overflowX = val;
-	    expression.next();
-	} else if (val.equals(hidden)) {
-	    overflowX = val;
-	    expression.next();
-	} else if (val.equals(scroll)) {
-	    overflowX = val;
-	    expression.next();
-	} else if (val.equals(auto)) {
-	    overflowX = val;
-	    expression.next();
-	} else if (val.equals(initial)) {
-	    overflowX = val;
-	    expression.next();
-	} else {
-	    throw new InvalidParamException("value", expression.getValue(),
-		    getPropertyName(), ac);
+	/**
+	 * Create a new CssOverflowX
+	 */
+	public CssOverflowX() {
 	}
-    }
-
-    public CssOverflowX(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).cssOverflowX != null)
-	    style.addRedefinitionWarning(ac, this);
-	((Css3Style) style).cssOverflowX = 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).getOverflowX();
-	}
-	else {
-	    return ((Css3Style) style).cssOverflowX;
+	/**
+	 * Creates a new CssOverflowX
+	 *
+	 * @param expression The expression for this property
+	 * @throws org.w3c.css.util.InvalidParamException
+	 *          Expressions are incorrect
+	 */
+	public CssOverflowX(ApplContext ac, CssExpression expression, boolean check)
+			throws InvalidParamException {
+		setByUser();
+		value = CssOverflow.checkOverflowAxis(ac, expression, check, this);
 	}
-    }
-
-    /**
-     * Compares two properties for equality.
-     *
-     * @param value The other property.
-     */
-    public boolean equals(CssProperty property) {
-	return (property instanceof CssOverflowX &&
-		overflowX.equals(((CssOverflowX) property).overflowX));
-    }
 
-    /**
-     * Returns the name of this property
-     */
-    public String getPropertyName() {
-	return "overflow-x";
-    }
-
-    /**
-     * Returns the value of this property
-     */
-    public Object get() {
-	return overflowX;
-    }
-
-    /**
-     * Returns true if this property is "softly" inherited
-     */
-    public boolean isSoftlyInherited() {
-	return overflowX.equals(inherit);
-    }
-
-    /**
-     * Returns a string representation of the object
-     */
-    public String toString() {
-	return overflowX.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() {
+	public CssOverflowX(ApplContext ac, CssExpression expression)
+			throws InvalidParamException {
+		this(ac, expression, false);
+	}
 
-	return overflowX == visible;
-    }
 
 }
+

Index: Css3Style.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css3/Css3Style.java,v
retrieving revision 1.138
retrieving revision 1.139
diff -u -d -r1.138 -r1.139
--- Css3Style.java	5 Nov 2012 15:35:25 -0000	1.138
+++ Css3Style.java	5 Nov 2012 17:36:13 -0000	1.139
@@ -79,7 +79,9 @@
 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.CssOverflowX;
 import org.w3c.css.properties.css.CssOverflowWrap;
+import org.w3c.css.properties.css.CssOverflowY;
 import org.w3c.css.properties.css.CssPerspective;
 import org.w3c.css.properties.css.CssPerspectiveOrigin;
 import org.w3c.css.properties.css.CssResize;
@@ -226,6 +228,9 @@
 	public CssTextOverflow cssTextOverflow;
 	public CssIcon cssIcon;
 
+	public CssOverflowX cssOverflowX;
+	public CssOverflowY	cssOverflowY;
+
 	CssDropInitialAfterAdjust cssDropInitialAfterAdjust;
 	CssDropInitialAfterAlign cssDropInitialAfterAlign;
 	CssDropInitialBeforeAdjust cssDropInitialBeforeAdjust;
@@ -239,12 +244,9 @@
 	CssLineStackingStrategy cssLineStackingStrategy;
 	CssTextHeight cssTextHeight;
 	CssAppearance cssAppearance;
-	CssOverflowX cssOverflowX;
-	CssOverflowY cssOverflowY;
 	CssRubySpan cssRubySpan;
 	CssCrop cssCrop;
 	CssFitPosition cssFitPosition;
-	CssOverflowCSS3 cssOverflowCSS3;
 
 	public org.w3c.css.properties.css.CssBorderImageSource getBorderImageSource() {
 		if (cssBorder.borderImage.source == null) {
@@ -785,15 +787,6 @@
 		return cssFitPosition;
 	}
 
-	public CssOverflowCSS3 getOverflowCSS3() {
-		if (cssOverflowCSS3 == null) {
-			cssOverflowCSS3 =
-					(CssOverflowCSS3) style.CascadingOrder(
-							new CssOverflowCSS3(), style, selector);
-		}
-		return cssOverflowCSS3;
-	}
-
 	public CssMarqueeDirection getMarqueeDirection() {
 		if (cssMarqueeDirection == null) {
 			cssMarqueeDirection =

Index: CssOverflowY.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css3/CssOverflowY.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- CssOverflowY.java	5 Jan 2010 13:49:54 -0000	1.3
+++ CssOverflowY.java	5 Nov 2012 17:36:13 -0000	1.4
@@ -1,150 +1,44 @@
-//
 // $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.CssValue;
-
-public class CssOverflowY extends CssProperty {
-
-    CssValue overflowY;
 
-    static CssIdent auto = new CssIdent("auto");
-    static CssIdent visible = new CssIdent("visible");
-    static CssIdent hidden = new CssIdent("hidden");
-    static CssIdent scroll = new CssIdent("scroll");
-    static CssIdent initial = new CssIdent("initial");
-
-    /**
-     * Create a new CssOverflowY
-     */
-    public CssOverflowY() {
-	// nothing to do
-    }
-
-    /**
-     * Create a new CssOverflowY
-     *
-     * @param expression The expression for this property
-     * @exception InvalidParamException Incorrect value
-     */
-    public CssOverflowY(ApplContext ac, CssExpression expression,
-	    boolean check) throws InvalidParamException {
-
-	setByUser();
-	CssValue val = expression.getValue();
+/**
+ * @spec http://www.w3.org/TR/2007/WD-css3-box-20070809/#overflow-y
+ * @see org.w3c.css.properties.css3.CssOverflow
+ */
+public class CssOverflowY extends org.w3c.css.properties.css.CssOverflowY {
 
-	if (val.equals(inherit)) {
-	    overflowY = val;
-	    expression.next();
-	} else if (val.equals(visible)) {
-	    overflowY = val;
-	    expression.next();
-	} else if (val.equals(hidden)) {
-	    overflowY = val;
-	    expression.next();
-	} else if (val.equals(scroll)) {
-	    overflowY = val;
-	    expression.next();
-	} else if (val.equals(auto)) {
-	    overflowY = val;
-	    expression.next();
-	} else if (val.equals(initial)) {
-	    overflowY = val;
-	    expression.next();
-	} else {
-	    throw new InvalidParamException("value", expression.getValue(),
-		    getPropertyName(), ac);
+	/**
+	 * Create a new CssOverflowY
+	 */
+	public CssOverflowY() {
 	}
-    }
-
-    public CssOverflowY(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).cssOverflowY != null)
-	    style.addRedefinitionWarning(ac, this);
-	((Css3Style) style).cssOverflowY = 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).getOverflowY();
-	}
-	else {
-	    return ((Css3Style) style).cssOverflowY;
+	/**
+	 * Creates a new CssOverflowY
+	 *
+	 * @param expression The expression for this property
+	 * @throws org.w3c.css.util.InvalidParamException
+	 *          Expressions are incorrect
+	 */
+	public CssOverflowY(ApplContext ac, CssExpression expression, boolean check)
+			throws InvalidParamException {
+		setByUser();
+		value = CssOverflow.checkOverflowAxis(ac, expression, check, this);
 	}
-    }
-
-    /**
-     * Compares two properties for equality.
-     *
-     * @param value The other property.
-     */
-    public boolean equals(CssProperty property) {
-	return (property instanceof CssOverflowY &&
-		overflowY.equals(((CssOverflowY) property).overflowY));
-    }
 
-    /**
-     * Returns the name of this property
-     */
-    public String getPropertyName() {
-	return "overflow-y";
-    }
-
-    /**
-     * Returns the value of this property
-     */
-    public Object get() {
-	return overflowY;
-    }
-
-    /**
-     * Returns true if this property is "softly" inherited
-     */
-    public boolean isSoftlyInherited() {
-	return overflowY.equals(inherit);
-    }
-
-    /**
-     * Returns a string representation of the object
-     */
-    public String toString() {
-	return overflowY.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() {
+	public CssOverflowY(ApplContext ac, CssExpression expression)
+			throws InvalidParamException {
+		this(ac, expression, false);
+	}
 
-	return overflowY == visible;
-    }
 
 }
+

--- CssOverflowCSS3.java DELETED ---

--- NEW FILE: CssOverflow.java ---
// $Id: CssOverflow.java,v 1.1 2012/11/05 17:36:13 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.properties.css.CssProperty;
import org.w3c.css.properties.css2.Css2Style;
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;

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

/**
 * @spec http://www.w3.org/TR/2007/WD-css3-box-20070809/#overflow
 */
public class CssOverflow extends org.w3c.css.properties.css.CssOverflow {

	CssOverflowX cssOverflowX;
	CssOverflowY cssOverflowY;

	public static final CssIdent[] allowed_values;

	static {
		String[] _allowed_values = {"visible", "hidden", "scroll",
				"auto", "no-display", "no-content"};
		int i = 0;
		allowed_values = new CssIdent[_allowed_values.length];
		for (String s : _allowed_values) {
			allowed_values[i++] = CssIdent.getIdent(s);
		}
	}

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

	/**
	 * Create a new CssOverflow
	 */
	public CssOverflow() {
		value = initial;
		cssOverflowX = new CssOverflowX();
		cssOverflowY = new CssOverflowY();
	}

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

		cssOverflowX = new CssOverflowX();
		cssOverflowY = new CssOverflowY();

		switch (expression.getCount()) {
			case 1:
				value = checkOverflowAxis(ac, expression, check, this);
				cssOverflowX.value = value;
				cssOverflowY.value = value;
				break;
			case 2:
				ArrayList<CssValue> v = new ArrayList<CssValue>();
				CssValue val;
				char op = expression.getOperator();
				val =  checkOverflowAxis(ac, expression, false, this);
				if (val == inherit) {
					throw new InvalidParamException("value", val,
							getPropertyName(), ac);
				}
				v.add(val);
				cssOverflowX.value = val;
				if (op != SPACE) {
					throw new InvalidParamException("operator",
							((new Character(op)).toString()), ac);
				}
				val =  checkOverflowAxis(ac, expression, false, this);
				if (val == inherit) {
					throw new InvalidParamException("value", val,
							getPropertyName(), ac);
				}
				v.add(val);
				cssOverflowY.value = val;
				value = new CssValueList(v);
				break;
			default:
				throw new InvalidParamException("unrecognize", ac);
		}
	}

	public CssOverflow(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 (((Css2Style) style).cssOverflow != null)
			style.addRedefinitionWarning(ac, this);
		((Css2Style) style).cssOverflow = this;
		cssOverflowX.addToStyle(ac, style);
		cssOverflowY.addToStyle(ac, style);
	}

	static CssValue checkOverflowAxis(ApplContext ac, CssExpression expression,
									  boolean check, CssProperty caller)
		throws InvalidParamException {
		CssValue value;

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

		CssValue val;
		char op;

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

		if (val.getType() != CssTypes.CSS_IDENT) {
			throw new InvalidParamException("value", val,
					caller.getPropertyName(), ac);
		}
		CssIdent id = (CssIdent) val;
		if (inherit.equals(id)) {
			value = inherit;
		} else {
			value = getAllowedIdent(id);
			if (value == null) {
				throw new InvalidParamException("value",
						val.toString(),
						caller.getPropertyName(), ac);
			}
		}
		expression.next();
		return value;
	}
}

Received on Monday, 5 November 2012 17:36:17 UTC