- From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
- Date: Fri, 28 Sep 2012 09:51:37 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/2002/css-validator/org/w3c/css/properties/css2 In directory hutz:/tmp/cvs-serv2754/css2 Modified Files: Css2Style.java Added Files: CssPosition.java Log Message: position per relevant spec (need to dig TV profile link) Index: Css2Style.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css2/Css2Style.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- Css2Style.java 27 Sep 2012 14:57:31 -0000 1.9 +++ Css2Style.java 28 Sep 2012 09:51:35 -0000 1.10 @@ -9,6 +9,7 @@ import org.w3c.css.properties.aural.ACssStyle; import org.w3c.css.properties.css.CssBottom; import org.w3c.css.properties.css.CssLeft; +import org.w3c.css.properties.css.CssPosition; import org.w3c.css.properties.css.CssRight; import org.w3c.css.properties.css.CssTextShadow; import org.w3c.css.properties.css.CssTop; @@ -40,6 +41,7 @@ public CssLeft cssLeft; public CssRight cssRight; + public CssPosition cssPosition; /** * Get the azimuth @@ -191,4 +193,15 @@ } return cssRight; } + + /** + * Get the position property + */ + public final CssPosition getPosition() { + if (cssPosition == null) { + cssPosition = + (CssPosition) style.CascadingOrder(new CssPosition(), style, selector); + } + return cssPosition; + } } --- NEW FILE: CssPosition.java --- // $Id: CssPosition.java,v 1.1 2012/09/28 09:51:35 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.css2; 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/2008/REC-CSS2-20080411/visuren.html#propdef-position */ public class CssPosition extends org.w3c.css.properties.css.CssPosition { public static final CssIdent[] allowed_values; static { String[] _allowed_values = {"static", "relative", "absolute", "fixed"}; 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 CssPosition */ public CssPosition() { } /** * Creates a new CssPosition * * @param expression The expression for this property * @throws org.w3c.css.util.InvalidParamException * Expressions are incorrect */ public CssPosition(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 id = (CssIdent) val; if (inherit.equals(id)) { value = inherit; } else { value = getAllowedIdent(id); if (value == null) { throw new InvalidParamException("value", val.toString(), getPropertyName(), ac); } } } else { throw new InvalidParamException("value", val.toString(), getPropertyName(), ac); } expression.next(); } public CssPosition(ApplContext ac, CssExpression expression) throws InvalidParamException { this(ac, expression, false); } }
Received on Friday, 28 September 2012 09:51:40 UTC