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

2002/css-validator/org/w3c/css/properties/css3 CssFlexBasis.java,NONE,1.1 Css3Style.java,1.109,1.110

From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
Date: Sun, 07 Oct 2012 14:45:54 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1TKs78-0002n7-K3@lionel-hutz.w3.org>
Update of /sources/public/2002/css-validator/org/w3c/css/properties/css3
In directory hutz:/tmp/cvs-serv10667/css3

Modified Files:
	Css3Style.java 
Added Files:
	CssFlexBasis.java 
Log Message:
flex-basis per http://www.w3.org/TR/2012/CR-css3-flexbox-20120918/#flex-basis-propdef

--- NEW FILE: CssFlexBasis.java ---
// $Id: CssFlexBasis.java,v 1.1 2012/10/07 14:45:52 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.CssLength;
import org.w3c.css.values.CssPercentage;
import org.w3c.css.values.CssTypes;
import org.w3c.css.values.CssValue;

/**
 * @spec http://www.w3.org/TR/2012/CR-css3-flexbox-20120918/#flex-basis-propdef
 * @see CssWidth
 */
public class CssFlexBasis extends org.w3c.css.properties.css.CssFlexBasis {

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

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

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

		/**
		 * WARNING - this is a replication of CSS3 Width parsing
		 * instead of creating a new object. This is because the exception
		 * would be tight to width's getPropertyName()
		 */

		CssValue val = expression.getValue();

		setByUser();

		switch (val.getType()) {
			case CssTypes.CSS_IDENT:
				CssIdent ident = (CssIdent) val;
				if (inherit.equals(val)) {
					value = inherit;
				} else if (auto.equals(val)) {
					value = auto;
				} else {
					throw new InvalidParamException("unrecognize", ac);
				}
				break;
			case CssTypes.CSS_NUMBER:
			case CssTypes.CSS_LENGTH:
				CssLength l = val.getLength();
				l.checkPositiveness(ac, this);
				value = l;
				break;
			case CssTypes.CSS_PERCENTAGE:
				CssPercentage p = val.getPercentage();
				p.checkPositiveness(ac, this);
				value = p;
				break;
			default:
				throw new InvalidParamException("value", val, getPropertyName(), ac);
		}
		expression.next();
	}

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

	/**
	 * Is the value of this property is a default value.
	 * It is used by all macro for the function <code>print</code>
	 */
	public boolean isDefault() {
		return ((value == auto) || (value == initial));
	}
}


Index: Css3Style.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css3/Css3Style.java,v
retrieving revision 1.109
retrieving revision 1.110
diff -u -d -r1.109 -r1.110
--- Css3Style.java	7 Oct 2012 13:37:29 -0000	1.109
+++ Css3Style.java	7 Oct 2012 14:45:52 -0000	1.110
@@ -32,6 +32,7 @@
 import org.w3c.css.properties.css.CssColumnSpan;
 import org.w3c.css.properties.css.CssColumnWidth;
 import org.w3c.css.properties.css.CssColumns;
+import org.w3c.css.properties.css.CssFlexBasis;
 import org.w3c.css.properties.css.CssFlexDirection;
 import org.w3c.css.properties.css.CssFlexFlow;
 import org.w3c.css.properties.css.CssFlexGrow;
@@ -161,6 +162,7 @@
 	public CssAlignContent cssAlignContent;
 	public CssAlignItems cssAlignItems;
 	public CssAlignSelf cssAlignSelf;
+	public CssFlexBasis cssFlexBasis;
 	public CssFlexDirection cssFlexDirection;
 	public CssFlexWrap cssFlexWrap;
 	public CssFlexFlow cssFlexFlow;
@@ -1173,6 +1175,15 @@
 		return cssAlignSelf;
 	}
 
+	public CssFlexBasis getFlexBasis() {
+		if (cssFlexBasis == null) {
+			cssFlexBasis =
+					(CssFlexBasis) style.CascadingOrder(
+							new CssFlexBasis(), style, selector);
+		}
+		return cssFlexBasis;
+	}
+	
 	public CssFlexDirection getFlexDirection() {
 		if (cssFlexDirection == null) {
 			cssFlexDirection =
Received on Sunday, 7 October 2012 14:45:56 UTC

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