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

CVS 2002/css-validator/org/w3c/css/properties/css3

From: CVS User ylafon <cvsmail@w3.org>
Date: Wed, 28 Nov 2012 09:18:17 +0000
Message-Id: <E1Tddmb-0003r5-RE@roscoe.w3.org>
To: www-validator-cvs@w3.org
Update of /sources/public/2002/css-validator/org/w3c/css/properties/css3
In directory roscoe:/tmp/cvs-serv14774/css3

Modified Files:
	Css3Style.java 
Added Files:
	CssObjectFit.java 
Log Message:
object-fit per http://www.w3.org/TR/2012/CR-css3-images-20120417/#object-fit

--- /sources/public/2002/css-validator/org/w3c/css/properties/css3/Css3Style.java	2012/11/05 17:36:13	1.139
+++ /sources/public/2002/css-validator/org/w3c/css/properties/css3/Css3Style.java	2012/11/28 09:18:17	1.140
@@ -1,6 +1,6 @@
 //
 
-// $Id: Css3Style.java,v 1.139 2012/11/05 17:36:13 ylafon Exp $
+// $Id: Css3Style.java,v 1.140 2012/11/28 09:18:17 ylafon Exp $
 // From Sijtsche de Jong (sy.de.jong@let.rug.nl)
 //
 // COPYRIGHT (c) 1995-2000 World Wide Web Consortium, (MIT, INRIA, Keio University)
@@ -75,6 +75,7 @@
 import org.w3c.css.properties.css.CssNavDown;
 import org.w3c.css.properties.css.CssNavLeft;
 import org.w3c.css.properties.css.CssNavRight;
+import org.w3c.css.properties.css.CssObjectFit;
 import org.w3c.css.properties.css.CssOpacity;
 import org.w3c.css.properties.css.CssOrder;
 import org.w3c.css.properties.css.CssOutlineOffset;
@@ -230,6 +231,8 @@
 
 	public CssOverflowX cssOverflowX;
 	public CssOverflowY	cssOverflowY;
+	
+	public CssObjectFit cssObjectFit;
 
 	CssDropInitialAfterAdjust cssDropInitialAfterAdjust;
 	CssDropInitialAfterAlign cssDropInitialAfterAlign;
@@ -1400,6 +1403,15 @@
 		return cssTextOverflow;
 	}
 
+	public CssObjectFit getObjectFit() {
+		if (cssObjectFit == null) {
+			cssObjectFit =
+					(CssObjectFit) style.CascadingOrder(
+							new CssObjectFit(), style, selector);
+		}
+		return cssObjectFit;
+	}
+	
 	///
 
 	/**

--- /sources/public/2002/css-validator/org/w3c/css/properties/css3/CssObjectFit.java	2012/11/28 09:18:17	NONE
+++ /sources/public/2002/css-validator/org/w3c/css/properties/css3/CssObjectFit.java	2012/11/28 09:18:17	1.1
// $Id: CssObjectFit.java,v 1.1 2012/11/28 09:18:17 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/CR-css3-images-20120417/#object-fit
 */
public class CssObjectFit extends org.w3c.css.properties.css.CssObjectFit {

	public static final CssIdent[] allowed_values;

	static {
		String[] _allowed_values = {"fill", "contain", "cover", "none", "scale-down"};
		allowed_values = new CssIdent[_allowed_values.length];
		int i = 0;
		for (String s : _allowed_values) {
			allowed_values[i++] = CssIdent.getIdent(s);
		}
	}

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


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

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

		CssValue val;
		char op;

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

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

	public CssObjectFit(ApplContext ac, CssExpression expression)
			throws InvalidParamException {
		this(ac, expression, false);
	}
}
Received on Wednesday, 28 November 2012 09:18:18 UTC

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