- From: CVS User ylafon <cvsmail@w3.org>
- Date: Thu, 30 Jan 2014 15:09:54 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/2002/css-validator/org/w3c/css/properties/css2
In directory roscoe:/tmp/cvs-serv23373/css2
Modified Files:
Css2Style.java
Added Files:
CssMarks.java
Log Message:
marks per css2/css3
--- /sources/public/2002/css-validator/org/w3c/css/properties/css2/Css2Style.java 2014/01/29 21:03:02 1.50
+++ /sources/public/2002/css-validator/org/w3c/css/properties/css2/Css2Style.java 2014/01/30 15:09:53 1.51
@@ -1,5 +1,5 @@
//
-// $Id: Css2Style.java,v 1.50 2014/01/29 21:03:02 ylafon Exp $
+// $Id: Css2Style.java,v 1.51 2014/01/30 15:09:53 ylafon Exp $
// From Philippe Le Hegaret (Philippe.Le_Hegaret@sophia.inria.fr)
//
// (c) COPYRIGHT MIT and INRIA, 1997.
@@ -24,6 +24,7 @@
import org.w3c.css.properties.css.CssEmptyCells;
import org.w3c.css.properties.css.CssLeft;
import org.w3c.css.properties.css.CssMarkerOffset;
+import org.w3c.css.properties.css.CssMarks;
import org.w3c.css.properties.css.CssMaxHeight;
import org.w3c.css.properties.css.CssMaxWidth;
import org.w3c.css.properties.css.CssMinHeight;
@@ -68,7 +69,7 @@
import org.w3c.css.values.CssIdent;
/**
- * @version $Revision: 1.50 $
+ * @version $Revision: 1.51 $
*/
public class Css2Style extends Css1Style {
@@ -99,6 +100,7 @@
public CssPageBreakAfter cssPageBreakAfter;
public CssPageBreakBefore cssPageBreakBefore;
public CssPageBreakInside cssPageBreakInside;
+ public CssMarks cssMarks;
/**
* font properties
@@ -257,6 +259,18 @@
}
/**
+ * Get the marks property
+ */
+ public final CssMarks getMarks() {
+ if (cssMarks == null) {
+ cssMarks =
+ (CssMarks) style.CascadingOrder(new CssMarks(),
+ style, selector);
+ }
+ return cssMarks;
+ }
+
+ /**
* get the font-stretch property
*
* @return a CssFontStretch instance
--- /sources/public/2002/css-validator/org/w3c/css/properties/css2/CssMarks.java 2014/01/30 15:09:54 NONE
+++ /sources/public/2002/css-validator/org/w3c/css/properties/css2/CssMarks.java 2014/01/30 15:09:54 1.1
// $Id: CssMarks.java,v 1.1 2014/01/30 15:09:53 ylafon Exp $
// Author: Yves Lafon <ylafon@w3.org>
//
// (c) COPYRIGHT MIT, ERCIM, Keio University, Beihang University 2014.
// 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;
import org.w3c.css.values.CssValueList;
import java.util.ArrayList;
import static org.w3c.css.values.CssOperator.SPACE;
/**
* @spec http://www.w3.org/TR/2008/REC-CSS2-20080411/page.html#crop-mark-prop
*/
public class CssMarks extends org.w3c.css.properties.css.CssMarks {
public static final CssIdent[] allowed_values;
static {
String[] _allowed_values = {"crop", "cross"};
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 CssMarks
*/
public CssMarks() {
}
/**
* Creates a new CssMarks
*
* @param expression The expression for this property
* @throws org.w3c.css.util.InvalidParamException
* Expressions are incorrect
*/
public CssMarks(ApplContext ac, CssExpression expression, boolean check)
throws InvalidParamException {
if (check && expression.getCount() > 2) {
throw new InvalidParamException("unrecognize", ac);
}
setByUser();
CssValue val;
char op;
val = expression.getValue();
op = expression.getOperator();
ArrayList<CssValue> vals = new ArrayList<>();
while (!expression.end()) {
val = expression.getValue();
op = expression.getOperator();
switch (val.getType()) {
case CssTypes.CSS_IDENT:
if (inherit.equals(val)) {
if (expression.getCount() > 1) {
throw new InvalidParamException("unrecognize", ac);
}
value = inherit;
break;
}
if (none.equals(val)) {
value = none;
break;
}
// now we go to other values...
CssIdent id = (CssIdent) val;
CssValue v = getAllowedIdent((CssIdent) val);
if (v != null) {
vals.add(v);
break;
}
// unrecognized ident.. fail!
default:
throw new InvalidParamException("value", val,
getPropertyName(), ac);
}
if (op != SPACE) {
throw new InvalidParamException("operator",
((new Character(op)).toString()), ac);
}
expression.next();
}
// extra checks
if (vals.size() != 0) {
// inherit or none are single value
if (value == inherit || value == none) {
throw new InvalidParamException("value", vals.get(0),
getPropertyName(), ac);
}
// if we have two values and those are the same...
if (vals.size() == 2 && (vals.get(0) == vals.get(1))) {
throw new InvalidParamException("value", vals.get(0),
getPropertyName(), ac);
}
// and set the value (the empty arraylist is taken care of during parsing)
value = (vals.size() == 1) ? vals.get(0) : new CssValueList(vals);
}
}
public CssMarks(ApplContext ac, CssExpression expression)
throws InvalidParamException {
this(ac, expression, false);
}
}
Received on Thursday, 30 January 2014 15:10:03 UTC