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

2002/css-validator/org/w3c/css/properties/css3 CssFlexFlow.java,NONE,1.1 Css3Style.java,1.104,1.105

From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
Date: Sun, 07 Oct 2012 12:49:07 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1TKqI7-0004nh-SA@lionel-hutz.w3.org>
Update of /sources/public/2002/css-validator/org/w3c/css/properties/css3
In directory hutz:/tmp/cvs-serv18321/css3

Modified Files:
	Css3Style.java 
Added Files:
	CssFlexFlow.java 
Log Message:
added flex-flow showhand (shorthands are evil) http://www.w3.org/TR/2012/CR-css3-flexbox-20120918/#flex-flow

Index: Css3Style.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css3/Css3Style.java,v
retrieving revision 1.104
retrieving revision 1.105
diff -u -d -r1.104 -r1.105
--- Css3Style.java	7 Oct 2012 12:16:46 -0000	1.104
+++ Css3Style.java	7 Oct 2012 12:49:05 -0000	1.105
@@ -33,6 +33,7 @@
 import org.w3c.css.properties.css.CssColumnWidth;
 import org.w3c.css.properties.css.CssColumns;
 import org.w3c.css.properties.css.CssFlexDirection;
+import org.w3c.css.properties.css.CssFlexFlow;
 import org.w3c.css.properties.css.CssFlexWrap;
 import org.w3c.css.properties.css.CssFontFeatureSettings;
 import org.w3c.css.properties.css.CssFontKerning;
@@ -158,6 +159,7 @@
 	public CssAlignSelf cssAlignSelf;
 	public CssFlexDirection cssFlexDirection;
 	public CssFlexWrap cssFlexWrap;
+	public CssFlexFlow cssFlexFlow;
 	
 	CssDropInitialAfterAdjust cssDropInitialAfterAdjust;
 	CssDropInitialAfterAlign cssDropInitialAfterAlign;
@@ -1180,7 +1182,15 @@
 		}
 		return cssFlexWrap;
 	}
-	
+
+	public CssFlexFlow getFlexFlow() {
+		if (cssFlexFlow == null) {
+			cssFlexFlow =
+					(CssFlexFlow) style.CascadingOrder(
+							new CssFlexFlow(), style, selector);
+		}
+		return cssFlexFlow;
+	}
 	///
 
 	/**

--- NEW FILE: CssFlexFlow.java ---
// $Id: CssFlexFlow.java,v 1.1 2012/10/07 12:49:05 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.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;

/**
 * @spec http://www.w3.org/TR/2012/CR-css3-flexbox-20120918/#flex-flow
 */
public class CssFlexFlow extends org.w3c.css.properties.css.CssFlexFlow {

	private CssFlexDirection flexDirection;
	private CssFlexWrap flexWrap;

	/**
	 * Create a new CssFlexFlow
	 */
	public CssFlexFlow() {
		value = initial;
		flexDirection = new CssFlexDirection();
		flexWrap = new CssFlexWrap();
	}

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

		CssValue directionVal = null;
		CssValue wrapVal = null;
		CssValue val;
		char op;

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

			switch (val.getType()) {
				case CssTypes.CSS_IDENT:
					CssIdent ident = (CssIdent) val;
					if (inherit.equals(ident)) {
						value = inherit;
						if (expression.getCount() > 1) {
							throw new InvalidParamException("value",
									val.toString(),
									getPropertyName(), ac);
						}
						break;
					}
					if (directionVal == null) {
						directionVal = CssFlexDirection.getAllowedIdent(ident);
						if (directionVal != null) {
							break;
						}
					}
					if (wrapVal == null) {
						wrapVal = CssFlexWrap.getAllowedIdent(ident);
						if (wrapVal != null) {
							break;
						}
					}
				default:
					throw new InvalidParamException("value",
							val.toString(),
							getPropertyName(), ac);
			}
			if (op != CssOperator.SPACE) {
				throw new InvalidParamException("operator",
						((new Character(op)).toString()), ac);
			}
			expression.next();
		}
		// for addToStyle, redefinitions and equality check
		flexDirection = new CssFlexDirection();
		flexWrap = new CssFlexWrap();
		if (value == inherit) {
			flexDirection.value = inherit;
			flexWrap.value = inherit;
		} else {
			CssValueList v = new CssValueList();
			if (directionVal != null) {
				v.add(directionVal);
				flexDirection.value = directionVal;
			}
			if (wrapVal != null) {
				v.add(wrapVal);
				flexWrap.value = wrapVal;
			}
			value = v;
		}
	}

	public CssFlexFlow(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) {
		super.addToStyle(ac, style);
		flexDirection.addToStyle(ac, style);
		flexWrap.addToStyle(ac, style);
	}
}
Received on Sunday, 7 October 2012 12:49:08 UTC

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