- From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
- Date: Fri, 31 Aug 2012 21:12:06 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/2002/css-validator/org/w3c/css/properties/css3
In directory hutz:/tmp/cvs-serv18585/css3
Modified Files:
Css3Style.java
Added Files:
CssTextEmphasisPosition.java
Log Message:
text-emphasis-position per http://www.w3.org/TR/2012/WD-css3-text-20120814/#text-emphasis-position0
Index: Css3Style.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css3/Css3Style.java,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -d -r1.56 -r1.57
--- Css3Style.java 31 Aug 2012 19:52:34 -0000 1.56
+++ Css3Style.java 31 Aug 2012 21:12:04 -0000 1.57
@@ -47,6 +47,7 @@
import org.w3c.css.properties.css.CssTextDecorationColor;
import org.w3c.css.properties.css.CssTextDecorationStyle;
import org.w3c.css.properties.css.CssTextEmphasisColor;
+import org.w3c.css.properties.css.CssTextEmphasisPosition;
import org.w3c.css.properties.css.CssTextEmphasisStyle;
import org.w3c.css.properties.css.CssTextJustify;
import org.w3c.css.properties.css.CssWordBreak;
@@ -149,6 +150,7 @@
public CssTextDecorationStyle cssTextDecorationStyle;
public CssTextDecorationColor cssTextDecorationColor;
public CssTextEmphasisColor cssTextEmphasisColor;
+ public CssTextEmphasisPosition cssTextEmphasisPosition;
public CssTextEmphasisStyle cssTextEmphasisStyle;
public CssTabSize cssTabSize;
@@ -1434,6 +1436,15 @@
return cssTextEmphasisColor;
}
+ public CssTextEmphasisPosition getTextEmphasisPosition() {
+ if (cssTextEmphasisPosition == null) {
+ cssTextEmphasisPosition =
+ (CssTextEmphasisPosition) style.CascadingOrder(
+ new CssTextEmphasisPosition(), style, selector);
+ }
+ return cssTextEmphasisPosition;
+ }
+
public CssTextEmphasisStyle getTextEmphasisStyle() {
if (cssTextEmphasisStyle == null) {
cssTextEmphasisStyle =
--- NEW FILE: CssTextEmphasisPosition.java ---
// $Id: CssTextEmphasisPosition.java,v 1.1 2012/08/31 21:12:04 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.CssOperator;
import org.w3c.css.values.CssTypes;
import org.w3c.css.values.CssValue;
import org.w3c.css.values.CssValueList;
import java.util.ArrayList;
/**
* @spec http://www.w3.org/TR/2012/WD-css3-text-20120814/#text-emphasis-position0
*/
public class CssTextEmphasisPosition extends org.w3c.css.properties.css.CssTextEmphasisPosition {
public static final CssIdent[] vertValues;
public static final CssIdent[] horiValues;
static {
String[] _vertValues = {"above", "below"};
String[] _horiValues = {"right", "left"};
vertValues = new CssIdent[_vertValues.length];
int i = 0;
for (String s : _vertValues) {
vertValues[i++] = CssIdent.getIdent(s);
}
horiValues = new CssIdent[_horiValues.length];
i = 0;
for (String s : _horiValues) {
horiValues[i++] = CssIdent.getIdent(s);
}
}
public static final CssIdent getVerticalValues(CssIdent ident) {
for (CssIdent id : vertValues) {
if (id.equals(ident)) {
return id;
}
}
return null;
}
public static final CssIdent getHorizontalValues(CssIdent ident) {
for (CssIdent id : horiValues) {
if (id.equals(ident)) {
return id;
}
}
return null;
}
public static final CssIdent getAllowedValue(CssIdent ident) {
CssIdent v = getVerticalValues(ident);
if (v == null) {
v = getHorizontalValues(ident);
}
return v;
}
/**
* Create a new CssTextEmphasisPosition
*/
public CssTextEmphasisPosition() {
value = initial;
}
/**
* Creates a new CssTextEmphasisPosition
*
* @param expression The expression for this property
* @throws org.w3c.css.util.InvalidParamException
* Expressions are incorrect
*/
public CssTextEmphasisPosition(ApplContext ac, CssExpression expression, boolean check)
throws InvalidParamException {
if (check && expression.getCount() > 2) {
throw new InvalidParamException("unrecognize", ac);
}
setByUser();
CssValue val;
char op;
CssIdent vValue = null;
CssIdent hValue = null;
val = expression.getValue();
op = expression.getOperator();
if (val.getType() != CssTypes.CSS_IDENT) {
throw new InvalidParamException("value",
val.toString(),
getPropertyName(), ac);
}
CssIdent ident = (CssIdent) val;
if (inherit.equals(ident)) {
value = inherit;
if (check && expression.getCount() != 1) {
throw new InvalidParamException("value",
val.toString(),
getPropertyName(), ac);
}
} else {
boolean match = false;
int nbgot = 0;
do {
match = false;
if (vValue == null) {
vValue = getVerticalValues(ident);
match = (vValue != null);
}
if (!match && hValue == null) {
hValue = getHorizontalValues(ident);
match = (hValue != null);
}
if (!match) {
throw new InvalidParamException("value",
val.toString(),
getPropertyName(), ac);
}
nbgot++;
if (expression.getRemainingCount() == 1 || (nbgot == 2)) {
// if we have both, exit
// (needed only if check == false...
break;
}
if (op != CssOperator.SPACE) {
throw new InvalidParamException("operator",
((new Character(op)).toString()), ac);
}
expression.next();
val = expression.getValue();
op = expression.getOperator();
if (val.getType() != CssTypes.CSS_IDENT) {
throw new InvalidParamException("value",
val.toString(),
getPropertyName(), ac);
}
ident = (CssIdent) val;
} while (!expression.end());
// now construct the value
if (hValue != null && vValue != null) {
ArrayList<CssValue> v = new ArrayList<CssValue>(2);
v.add(vValue);
v.add(hValue);
value = new CssValueList(v);
} else {
// TODO FIXME specific error (one value missing)
throw new InvalidParamException("value",
expression.toString(),
getPropertyName(), ac);
}
}
expression.next();
}
public CssTextEmphasisPosition(ApplContext ac, CssExpression expression)
throws InvalidParamException {
this(ac, expression, false);
}
}
Received on Friday, 31 August 2012 21:12:10 UTC