- From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
- Date: Wed, 05 Oct 2011 07:12:19 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/2002/css-validator/org/w3c/css/properties/css
In directory hutz:/tmp/cvs-serv6302/org/w3c/css/properties/css
Modified Files:
CssColumnCount.java CssColumnFill.java CssColumnGap.java
CssColumnRule.java CssColumnRuleColor.java
CssColumnRuleStyle.java CssColumnRuleWidth.java
CssColumnSpan.java CssColumnWidth.java CssColumns.java
CssProperty.java
Log Message:
initial keyword in CSS3 is now checked to be unique, some class reorg, adjustment of column-span to match the last multicol doc
Index: CssColumnRuleColor.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css/CssColumnRuleColor.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- CssColumnRuleColor.java 4 Oct 2011 13:05:24 -0000 1.3
+++ CssColumnRuleColor.java 5 Oct 2011 07:12:17 -0000 1.4
@@ -16,20 +16,7 @@
import org.w3c.css.values.CssValue;
/**
- * http://www.w3.org/TR/2009/CR-css3-multicol-20091217/#column-rule-color
- * <p/>
- * Name: column-rule-color
- * Value: <color>
- * Initial: same as for 'color' property [CSS21]
- * Applies to: multicol elements
- * Inherited: no
- * Percentages: N/A
- * Media: visual
- * Computed value: the same as the computed value for the 'color'
- * property [CSS21]
- * <p/>
- * This property sets the color of the column rule. The <color> values are
- * defined in [CSS21].
+ * @since CSS3
*/
public class CssColumnRuleColor extends CssProperty {
@@ -53,27 +40,7 @@
*/
public CssColumnRuleColor(ApplContext ac, CssExpression expression,
boolean check) throws InvalidParamException {
-
- setByUser();
- CssValue val = expression.getValue();
-
- if (check && expression.getCount() > 1) {
- throw new InvalidParamException("unrecognize", ac);
- }
- if (inherit.equals(val)) {
- color = inherit;
- } else {
- try {
- // we use the latest version of CssColor, aka CSS3
- // instead of using CSS21 colors + transparent per spec
- org.w3c.css.properties.css3.CssColor tcolor = new org.w3c.css.properties.css3.CssColor(ac, expression, check);
- color = tcolor.getColor();
- } catch (InvalidParamException e) {
- throw new InvalidParamException("value",
- expression.getValue(),
- getPropertyName(), ac);
- }
- }
+ throw new InvalidParamException("unrecognize", ac);
}
public CssColumnRuleColor(ApplContext ac, CssExpression expression)
@@ -134,7 +101,7 @@
* Returns true if this property is "softly" inherited
*/
public boolean isSoftlyInherited() {
- return inherit.equals(color);
+ return inherit == color;
}
/**
Index: CssColumnFill.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css/CssColumnFill.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- CssColumnFill.java 5 Jan 2010 19:49:50 -0000 1.2
+++ CssColumnFill.java 5 Oct 2011 07:12:16 -0000 1.3
@@ -14,28 +14,9 @@
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 java.util.HashMap;
/**
- * http://www.w3.org/TR/2009/CR-css3-multicol-20091217/#filling-columns
- * <p/>
- * There are two strategies for filling columns: columns can either be
- * balanced, or not. If columns are balanced, UAs should minimize the variation
- * in column length. Otherwise, columns are filled sequentially and will
- * therefore end up having different lengths. In any case, the user agent
- * should try to honor the �widows� and �orphans� properties.
- * <p/>
- * Name: column-fill
- * Value: auto | balance
- * Initial: balance
- * Applies to: multi-column elements
- * Inherited: no
- * Percentages: N/A
- * Media: see below
- * Computed value: as specified
+ * @since CSS3
*/
public class CssColumnFill extends CssProperty {
@@ -44,21 +25,10 @@
CssIdent value;
- static CssIdent balance;
- private static HashMap<String, CssIdent> allowed_values;
-
- static {
- balance = CssIdent.getIdent("balance");
- allowed_values = new HashMap<String, CssIdent>();
- allowed_values.put("balance", balance);
- allowed_values.put("auto", CssIdent.getIdent("auto"));
- }
-
/**
* Create a new CssColumnWidth
*/
public CssColumnFill() {
- value = balance;
}
/**
@@ -71,32 +41,7 @@
*/
public CssColumnFill(ApplContext ac, CssExpression expression,
boolean check) throws InvalidParamException {
-
- setByUser();
- CssValue val = expression.getValue();
-
- if (check && expression.getCount() > 1) {
throw new InvalidParamException("unrecognize", ac);
- }
-
- if (val.getType() != CssTypes.CSS_IDENT) {
- throw new InvalidParamException("value",
- expression.getValue(),
- getPropertyName(), ac);
- }
- // ident, so inherit, or allowed value
- if (inherit.equals(val)) {
- value = inherit;
- } else {
- val = allowed_values.get(val.toString());
- if (val == null) {
- throw new InvalidParamException("value",
- expression.getValue(),
- getPropertyName(), ac);
- }
- value = (CssIdent) val;
- }
- expression.next();
}
public CssColumnFill(ApplContext ac, CssExpression expression)
@@ -172,7 +117,7 @@
* It is used by all macro for the function <code>print</code>
*/
public boolean isDefault() {
- return (balance == value);
+ return false;
}
}
Index: CssColumnCount.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css/CssColumnCount.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- CssColumnCount.java 5 Jan 2010 13:49:38 -0000 1.1
+++ CssColumnCount.java 5 Oct 2011 07:12:16 -0000 1.2
@@ -13,25 +13,10 @@
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.CssNumber;
-import org.w3c.css.values.CssTypes;
import org.w3c.css.values.CssValue;
/**
- * http://www.w3.org/TR/2009/CR-css3-multicol-20091217/#cc
- * <p/>
- * Name: column-count
- * Value: <integer> | auto
- * Initial: auto
- * Applies to: non-replaced block-level elements (except table elements),
- * table cells, and inline-block elements
- * Inherited: no
- * Percentages: N/A
- * Media: visual
- * Computed value: specified value
- * <p/>
- * This property describes the number of columns of a multicol element.
+ * @since CSS3
*/
public class CssColumnCount extends CssProperty {
@@ -40,13 +25,10 @@
CssValue count;
- static CssIdent auto = CssIdent.getIdent("auto");
-
/**
* Create a new CssColumnCount
*/
public CssColumnCount() {
- count = auto;
}
/**
@@ -57,39 +39,7 @@
*/
public CssColumnCount(ApplContext ac, CssExpression expression,
boolean check) throws InvalidParamException {
-
- setByUser();
- CssValue val = expression.getValue();
- CssNumber num;
-
- switch (val.getType()) {
- case CssTypes.CSS_NUMBER:
- num = (CssNumber) val;
- if (!num.isInteger()) {
- throw new InvalidParamException("integer",
- expression.getValue(), getPropertyName(), ac);
- }
- if (num.getInt() <= 0) {
- throw new InvalidParamException("strictly-positive",
- expression.getValue(),
- getPropertyName(), ac);
- }
- count = val;
- break;
- case CssTypes.CSS_IDENT:
- if (auto.equals(val)) {
- count = auto;
- break;
- }
- if (inherit.equals(val)) {
- count = inherit;
- break;
- }
- default:
- throw new InvalidParamException("value", expression.getValue(),
- getPropertyName(), ac);
- }
- expression.next();
+ throw new InvalidParamException("unrecognize", ac);
}
public CssColumnCount(ApplContext ac, CssExpression expression)
@@ -165,6 +115,6 @@
* It is used by alle macro for the function <code>print</code>
*/
public boolean isDefault() {
- return (count == auto);
+ return false;
}
}
Index: CssColumnWidth.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css/CssColumnWidth.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- CssColumnWidth.java 5 Jan 2010 13:49:38 -0000 1.1
+++ CssColumnWidth.java 5 Oct 2011 07:12:17 -0000 1.2
@@ -13,45 +13,19 @@
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.CssLength;
-import org.w3c.css.values.CssNumber;
-import org.w3c.css.values.CssTypes;
-import org.w3c.css.values.CssValue;
/**
- * http://www.w3.org/TR/2009/CR-css3-multicol-20091217/#column-width
- * <p/>
- * Name: column-width
- * Value: <length> | auto
- * Initial: auto
- * Applies to: non-replaced block-level elements (except table elements),
- * table cells, and inline-block elements
- * Inherited: no
- * Percentages: N/A
- * Media: visual
- * Computed value: the absolute length
- * <p/>
- * This property describes the width of columns in multicol elements.
+ * @since CSS3
*/
public class CssColumnWidth extends CssProperty {
private static final String propertyName = "column-width";
- CssValue width;
-
- static CssIdent auto;
-
- static {
- auto = CssIdent.getIdent("auto");
- }
-
/**
* Create a new CssColumnWidth
*/
public CssColumnWidth() {
- width = auto;
}
/**
@@ -63,39 +37,8 @@
public CssColumnWidth(ApplContext ac, CssExpression expression,
boolean check) throws InvalidParamException {
- setByUser();
- CssValue val = expression.getValue();
- Float value;
- switch (val.getType()) {
- case CssTypes.CSS_NUMBER:
- val = ((CssNumber) val).getLength();
- // if we didn't fall in the first trap, there is another one :)
- throw new InvalidParamException("strictly-positive",
- expression.getValue(),
- getPropertyName(), ac);
- case CssTypes.CSS_LENGTH:
- value = (Float) ((CssLength) val).get();
- if (value == null || value.floatValue() <= 0.0) {
- throw new InvalidParamException("strictly-positive",
- expression.getValue(),
- getPropertyName(), ac);
- }
- width = val;
- break;
- case CssTypes.CSS_IDENT:
- if (inherit.equals(val)) {
- width = inherit;
- break;
- } else if (auto.equals(val)) {
- width = auto;
- break;
- }
- default:
- throw new InvalidParamException("value", expression.getValue(),
- getPropertyName(), ac);
- }
- expression.next();
+ throw new InvalidParamException("unrecognize", ac);
}
public CssColumnWidth(ApplContext ac, CssExpression expression)
@@ -134,8 +77,7 @@
* @param property The other property.
*/
public boolean equals(CssProperty property) {
- return (property instanceof CssColumnWidth &&
- width.equals(((CssColumnWidth) property).width));
+ return false;
}
/**
@@ -149,21 +91,21 @@
* Returns the value of this property
*/
public Object get() {
- return width;
+ return null;
}
/**
* Returns true if this property is "softly" inherited
*/
public boolean isSoftlyInherited() {
- return (inherit == width);
+ return false;
}
/**
* Returns a string representation of the object
*/
public String toString() {
- return width.toString();
+ return null;
}
/**
@@ -171,7 +113,7 @@
* It is used by all macro for the function <code>print</code>
*/
public boolean isDefault() {
- return (auto == width);
+ return false;
}
}
Index: CssColumns.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css/CssColumns.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- CssColumns.java 5 Jan 2010 13:49:38 -0000 1.1
+++ CssColumns.java 5 Oct 2011 07:12:17 -0000 1.2
@@ -14,27 +14,9 @@
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 static org.w3c.css.values.CssOperator.SPACE;
/**
- * http://www.w3.org/TR/2009/CR-css3-multicol-20091217/#columns
- * <p/>
- * Name: columns
- * Value: <Ôcolumn-widthÕ> || <Ôcolumn-countÕ>
- * Initial: see individual properties
- * Applies to: non-replaced block-level elements (except table elements),
- * table cells, and inline-block elements
- * Inherited: no
- * Percentages: N/A
- * Media: visual
- * Computed value: see individual properties
- * <p/>
- * This is a shorthand property for setting Ôcolumn-widthÕ and Ôcolumn-countÕ.
- * Omitted values are set to their initial values.
- *
+ * @since CSS3
* @see CssColumnWidth
* @see CssColumnCount
*/
@@ -56,81 +38,14 @@
/**
* Create a new CssColumns
*
- * @param ac the context
+ * @param ac the context
* @param expression The expression for this property
- * @param check if checking is enforced
+ * @param check if checking is enforced
* @throws InvalidParamException Incorrect values
*/
public CssColumns(ApplContext ac, CssExpression expression,
boolean check) throws InvalidParamException {
-
- CssValue val;
- char op;
- int nb_val = expression.getCount();
- int nb_auto = 0;
-
- if (check && nb_val > 2) {
- throw new InvalidParamException("unrecognize", ac);
- }
- setByUser();
-
- while (!expression.end()) {
- val = expression.getValue();
- op = expression.getOperator();
- if (op != SPACE) {
- throw new InvalidParamException("operator",
- ((new Character(op)).toString()),
- ac);
- }
- switch (val.getType()) {
- case CssTypes.CSS_NUMBER:
- if (count != null) {
- throw new InvalidParamException("unrecognize", ac);
- }
- count = new CssColumnCount(ac, expression);
- break;
- case CssTypes.CSS_LENGTH:
- if (width != null) {
- throw new InvalidParamException("unrecognize", ac);
- }
- width = new CssColumnWidth(ac, expression);
- break;
- case CssTypes.CSS_IDENT:
- if (inherit.equals((CssIdent) val)) {
- if (nb_val > 1) {
- throw new InvalidParamException("unrecognize", ac);
- }
- value = inherit;
- expression.next();
- break;
- }
- if (CssColumnCount.auto.equals((CssIdent) val)) {
- nb_auto++;
- expression.next();
- break;
- }
- default:
- throw new InvalidParamException("value",
- expression.getValue(),
- getPropertyName(), ac);
- }
- }
- if (nb_val == 1) {
- if (nb_auto == 1) {
- value = CssIdent.getIdent("auto");
- }
- } else {
- if (nb_auto == 2) {
- count = new CssColumnCount();
- width = new CssColumnWidth();
- } else if (nb_auto == 1) {
- if (count != null) {
- width = new CssColumnWidth();
- } else {
- count = new CssColumnCount();
- }
- }
- }
+ throw new InvalidParamException("unrecognize", ac);
}
public CssColumns(ApplContext ac, CssExpression expression)
@@ -199,25 +114,11 @@
public boolean isSoftlyInherited() {
return (inherit == value);
}
+
/**
* Returns a string representation of the object
*/
public String toString() {
- StringBuilder sb = new StringBuilder();
- boolean first = true;
- if (value != null) {
- return value.toString();
- }
- if (count != null) {
- sb.append(count);
- first = false;
- }
- if (width != null) {
- if (!first) {
- sb.append(' ');
- }
- sb.append(width);
- }
- return sb.toString();
+ return value.toString();
}
}
Index: CssColumnSpan.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css/CssColumnSpan.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- CssColumnSpan.java 5 Jan 2010 19:49:50 -0000 1.2
+++ CssColumnSpan.java 5 Oct 2011 07:12:17 -0000 1.3
@@ -15,45 +15,20 @@
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.CssNumber;
-import org.w3c.css.values.CssTypes;
import org.w3c.css.values.CssValue;
/**
- * http://www.w3.org/TR/2009/CR-css3-multicol-20091217/#column-span
- *
- * Name: column-span
- * Value: 1 | all
- * Initial: 1
- * Applies to: static, non-floating elements
- * Inherited: no
- * Percentages: N/A
- * Media: visual
- * Computed value: as specified
- *
- * This property describes how many columns an element spans across.
+ * @since CSS3
*/
public class CssColumnSpan extends CssProperty {
CssValue value;
- ApplContext ac;
-
- static CssIdent all;
- static CssNumber one;
-
- static {
- all = new CssIdent("all");
- one = new CssNumber(1);
- }
/**
* Create a new CssColumnSpan
*/
public CssColumnSpan() {
- value = one;
-
}
/**
@@ -64,32 +39,7 @@
*/
public CssColumnSpan(ApplContext ac, CssExpression expression,
boolean check) throws InvalidParamException {
- this.ac = ac;
- setByUser(); // tell this property is set by the user
- CssValue val = expression.getValue();
-
- switch (val.getType()) {
- case CssTypes.CSS_NUMBER:
- int ival = ((CssNumber) val).getInt();
- if (ival != 1) {
- throw new InvalidParamException("value", val.toString(),
- getPropertyName(), ac);
- }
- value = one;
- break;
- case CssTypes.CSS_IDENT:
- if (all.equals(val)) {
- value = all;
- break;
- }
- if (inherit.equals(val)) {
- value = inherit;
- break;
- }
- default:
- throw new InvalidParamException("value", val.toString(),
- getPropertyName(), ac);
- }
+ throw new InvalidParamException("unrecognize", ac);
}
public CssColumnSpan(ApplContext ac, CssExpression expression)
@@ -135,7 +85,7 @@
/**
* Returns the name of this property
*/
- public String getPropertyName() {
+ public final String getPropertyName() {
return "column-span";
}
@@ -165,8 +115,7 @@
* It is used by all macro for the function <code>print</code>
*/
public boolean isDefault() {
- // we only have 3 values
- return (one == value);
+ return false;
}
}
Index: CssColumnRule.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css/CssColumnRule.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- CssColumnRule.java 4 Oct 2011 13:05:24 -0000 1.3
+++ CssColumnRule.java 5 Oct 2011 07:12:17 -0000 1.4
@@ -13,38 +13,20 @@
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 static org.w3c.css.values.CssOperator.SPACE;
-
/**
- * http://www.w3.org/TR/2009/CR-css3-multicol-20091217/#column-rule
- * <p/>
- * Name: column-rule
- * Value: <column-rule-width> || <border-style> ||
- * [ <color> | transparent ]
- * Initial: see individual properties
- * Applies to: multicol elements
- * Inherited: no
- * Percentages: N/A
- * Media: visual
- * Computed value: see individual properties
- * <p/>
- * This property is a shorthand for setting 'column-rule-width',
- * 'column-rule-style', and 'column-rule-color' at the same place in the
- * style sheet. Omitted values are set to their initial values.
+ * @since CSS3
*/
public class CssColumnRule extends CssProperty {
private static final String propertyName = "column-rule";
- CssIdent value = null;
- CssColumnRuleWidth rule_width = null;
- CssColumnRuleStyle rule_style = null;
- CssColumnRuleColor rule_color = null;
+ CssValue value;;
+ CssColumnRuleWidth rule_width;
+ CssColumnRuleStyle rule_style;
+ CssColumnRuleColor rule_color;
/**
* Create a new CssColumnRule
@@ -60,76 +42,7 @@
*/
public CssColumnRule(ApplContext ac, CssExpression expression,
boolean check) throws InvalidParamException {
-
- CssValue val;
- char op;
- int nb_val = expression.getCount();
-
- if (check && nb_val > 3) {
- throw new InvalidParamException("unrecognize", ac);
- }
- setByUser();
-
- while (!expression.end()) {
- val = expression.getValue();
- op = expression.getOperator();
- if (op != SPACE) {
- throw new InvalidParamException("operator",
- ((new Character(op)).toString()),
- ac);
- }
- switch (val.getType()) {
- case CssTypes.CSS_FUNCTION:
- case CssTypes.CSS_COLOR:
- if (rule_color != null) {
- throw new InvalidParamException("unrecognize", ac);
- }
- rule_color = new CssColumnRuleColor(ac, expression);
- break;
- case CssTypes.CSS_NUMBER:
- case CssTypes.CSS_LENGTH:
- if (rule_width != null) {
- throw new InvalidParamException("unrecognize", ac);
- }
- rule_width = new CssColumnRuleWidth(ac, expression);
- break;
- case CssTypes.CSS_IDENT:
- if (inherit.equals(val)) {
- if (nb_val > 1) {
- throw new InvalidParamException("unrecognize", ac);
- }
- value = inherit;
- expression.next();
- break;
- }
- if (rule_color == null) {
- try {
- rule_color = new CssColumnRuleColor(ac, expression);
- break;
- } catch (Exception ex) {
- }
- }
- if (rule_width == null) {
- try {
- rule_width = new CssColumnRuleWidth(ac, expression);
- break;
- } catch (Exception ex) {
- }
- }
- if (rule_style == null) {
- try {
- rule_style = new CssColumnRuleStyle(ac, expression);
- break;
- } catch (Exception ex) {
- }
- }
-
- default:
- throw new InvalidParamException("value",
- expression.getValue(),
- getPropertyName(), ac);
- }
- }
+ throw new InvalidParamException("unrecognize", ac);
}
public CssColumnRule(ApplContext ac, CssExpression expression)
@@ -198,27 +111,7 @@
* Returns a string representation of the object
*/
public String toString() {
- StringBuilder sb = new StringBuilder();
- boolean first = true;
- if (value != null) {
- return value.toString();
- }
- if (rule_color != null) {
- sb.append(rule_color);
- first = false;
- }
- if (rule_width != null) {
- if (!first) {
- sb.append(' ');
- }
- sb.append(rule_width);
- }
- if (rule_style != null) {
- if (!first) {
- sb.append(' ');
- }
- sb.append(rule_style);
- }
- return sb.toString();
+
+ return value.toString();
}
}
Index: CssColumnGap.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css/CssColumnGap.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- CssColumnGap.java 5 Jan 2010 13:49:38 -0000 1.1
+++ CssColumnGap.java 5 Oct 2011 07:12:17 -0000 1.2
@@ -13,30 +13,10 @@
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.CssLength;
-import org.w3c.css.values.CssNumber;
-import org.w3c.css.values.CssTypes;
import org.w3c.css.values.CssValue;
/**
- * http://www.w3.org/TR/2009/CR-css3-multicol-20091217/#column-gap
- * <p/>
- * Name: column-gap
- * Value: <length> | normal
- * Initial: normal
- * Applies to: multicol elements
- * Inherited: no
- * Percentages: N/A
- * Media: visual
- * Computed value: absolute length or ‘normal’
- * <p/>
- * The ‘column-gap’ property sets the gap between columns. If there is a
- * column rule between columns, it will appear in the middle of the gap.
- * <p/>
- * The ‘normal’ value is UA-specific. A value of ‘1em’ is suggested.
- * <p/>
- * Column gaps cannot be negative.
+ * @since CSS3
*/
public class CssColumnGap extends CssProperty {
@@ -45,17 +25,10 @@
CssValue columngap;
- static CssIdent normal;
-
- static {
- normal = CssIdent.getIdent("normal");
- }
-
/**
* Create a new CssColumnGap
*/
public CssColumnGap() {
- columngap = normal;
}
/**
@@ -63,36 +36,8 @@
*/
public CssColumnGap(ApplContext ac, CssExpression expression,
boolean check) throws InvalidParamException {
- setByUser();
- CssValue val = expression.getValue();
- Float value;
- switch (val.getType()) {
- case CssTypes.CSS_NUMBER:
- val = ((CssNumber) val).getLength();
- case CssTypes.CSS_LENGTH:
- value = (Float) ((CssLength) val).get();
- if (value == null || value.floatValue() < 0.0) {
- throw new InvalidParamException("negative-value",
- expression.getValue(),
- getPropertyName(), ac);
- }
- columngap = val;
- break;
- case CssTypes.CSS_IDENT:
- if (normal.equals(val)) {
- columngap = normal;
- break;
- }
- if (inherit.equals(val)) {
- columngap = inherit;
- break;
- }
- default:
- throw new InvalidParamException("value", expression.getValue(),
- getPropertyName(), ac);
- }
- expression.next();
+ throw new InvalidParamException("unrecognize", ac);
}
public CssColumnGap(ApplContext ac, CssExpression expression)
@@ -169,7 +114,7 @@
* It is used by all macro for the function <code>print</code>
*/
public boolean isDefault() {
- return (columngap == normal);
+ return false;
}
}
Index: CssColumnRuleWidth.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css/CssColumnRuleWidth.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- CssColumnRuleWidth.java 5 Jan 2010 13:49:38 -0000 1.1
+++ CssColumnRuleWidth.java 5 Oct 2011 07:12:17 -0000 1.2
@@ -9,8 +9,6 @@
package org.w3c.css.properties.css;
import org.w3c.css.parser.CssStyle;
-import org.w3c.css.properties.css.CssProperty;
-import org.w3c.css.properties.css1.CssBorderFaceWidthCSS2;
import org.w3c.css.properties.css3.Css3Style;
import org.w3c.css.util.ApplContext;
import org.w3c.css.util.InvalidParamException;
@@ -18,55 +16,34 @@
import org.w3c.css.values.CssValue;
/**
- * http://www.w3.org/TR/css3-multicol/
- * <P>
- * <EM>Value:</EM> <border-width><BR>
- * <EM>Initial:</EM>medium<BR>
- * <EM>Applies to:</EM>multicol elements<BR>
- * <EM>Inherited:</EM>no<BR>
- * <EM>Percentages:</EM>N/A<BR>
- * <EM>Media:</EM>:visual
+ * @since CSS3
*/
public class CssColumnRuleWidth extends CssProperty {
- CssBorderFaceWidthCSS2 value;
+ CssValue value;
/**
* Create a new CssColumnRuleWidth
*/
public CssColumnRuleWidth() {
- // nothing to do
+ // nothing to do
}
/**
* Create a new CssColumnRuleWidth
*
* @param expression The expression for this property
- * @exception InvalidParamException Incorrect value
+ * @throws InvalidParamException Incorrect value
*/
public CssColumnRuleWidth(ApplContext ac, CssExpression expression,
- boolean check) throws InvalidParamException {
-
- setByUser();
- CssValue val = expression.getValue();
-
- if (check && expression.getCount() > 1) {
- throw new InvalidParamException("unrecognize", ac);
- }
-
- try {
- value = new CssBorderFaceWidthCSS2(ac, expression);
- } catch (InvalidParamException e) {
- throw new InvalidParamException("value",
- expression.getValue(),
- getPropertyName(), ac);
- }
+ boolean check) throws InvalidParamException {
+ throw new InvalidParamException("unrecognize", ac);
}
public CssColumnRuleWidth(ApplContext ac, CssExpression expression)
- throws InvalidParamException {
- this(ac, expression, false);
+ throws InvalidParamException {
+ this(ac, expression, false);
}
/**
@@ -75,24 +52,23 @@
* @param style The CssStyle
*/
public void addToStyle(ApplContext ac, CssStyle style) {
- if (((Css3Style) style).cssColumnRuleWidth != null)
- style.addRedefinitionWarning(ac, this);
- ((Css3Style) style).cssColumnRuleWidth = this;
+ if (((Css3Style) style).cssColumnRuleWidth != null)
+ style.addRedefinitionWarning(ac, this);
+ ((Css3Style) style).cssColumnRuleWidth = this;
}
/**
* Get this property in the style.
*
- * @param style The style where the property is
+ * @param style The style where the property is
* @param resolve if true, resolve the style to find this property
*/
public CssProperty getPropertyInStyle(CssStyle style, boolean resolve) {
- if (resolve) {
- return ((Css3Style) style).getColumnRuleWidth();
- }
- else {
- return ((Css3Style) style).cssColumnRuleWidth;
- }
+ if (resolve) {
+ return ((Css3Style) style).getColumnRuleWidth();
+ } else {
+ return ((Css3Style) style).cssColumnRuleWidth;
+ }
}
/**
@@ -101,36 +77,36 @@
* @param value The other property.
*/
public boolean equals(CssProperty property) {
- return (property instanceof CssColumnRuleWidth &&
- value.equals(((CssColumnRuleWidth) property).value));
+ return (property instanceof CssColumnRuleWidth &&
+ value.equals(((CssColumnRuleWidth) property).value));
}
/**
* Returns the name of this property
*/
- public String getPropertyName() {
- return "column-rule-width";
+ public final String getPropertyName() {
+ return "column-rule-width";
}
/**
* Returns the value of this property
*/
public Object get() {
- return value.getValue();
+ return value;
}
/**
* Returns true if this property is "softly" inherited
*/
public boolean isSoftlyInherited() {
- return inherit.equals(value.getValue());
+ return inherit == value;
}
/**
* Returns a string representation of the object
*/
public String toString() {
- return value.toString();
+ return value.toString();
}
/**
@@ -138,7 +114,7 @@
* It is used by alle macro for the function <code>print</code>
*/
public boolean isDefault() {
- return false;
+ return false;
}
}
Index: CssColumnRuleStyle.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css/CssColumnRuleStyle.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- CssColumnRuleStyle.java 5 Jan 2010 13:49:38 -0000 1.1
+++ CssColumnRuleStyle.java 5 Oct 2011 07:12:17 -0000 1.2
@@ -11,29 +11,14 @@
package org.w3c.css.properties.css;
import org.w3c.css.parser.CssStyle;
-import org.w3c.css.properties.css1.CssBorderStyleCSS2;
import org.w3c.css.properties.css3.Css3Style;
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;
/**
- * http://www.w3.org/TR/2009/CR-css3-multicol-20091217/#column-rule-style
- *
- * Name: column-rule-style
- * Value: <Ôborder-styleÕ>
- * Initial: none
- * Applies to: multicol elements
- * Inherited: no
- * Percentages: N/A
- * Media: visual
- * Computed value: specified value
- *
- * The Ôcolumn-rule-styleÕ property sets the style of the rule between columns
- * of an element. The <border-style> values are defined in [CSS21].
+ * @since CSS3
*/
public class CssColumnRuleStyle extends CssProperty {
@@ -46,7 +31,6 @@
* Create a new CssColumnRuleStyle
*/
public CssColumnRuleStyle() {
- value = none;
}
/**
@@ -59,30 +43,7 @@
*/
public CssColumnRuleStyle(ApplContext ac, CssExpression expression,
boolean check) throws InvalidParamException {
-
- setByUser();
- CssValue val = expression.getValue();
- // too many values
- if (check && expression.getCount() > 1) {
throw new InvalidParamException("unrecognize", ac);
- }
- // we only use Css Ident part of the CssBorderStyle acceptable values
- if (val.getType() != CssTypes.CSS_IDENT) {
- throw new InvalidParamException("value",
- expression.getValue(),
- getPropertyName(), ac);
- }
- CssIdent ident = (CssIdent) val;
- if (inherit.equals(ident)) {
- value = inherit;
- } else if (CssBorderStyleCSS2.acceptable_values.contains(ident)) {
- value = ident;
- } else {
- throw new InvalidParamException("value",
- expression.getValue(),
- getPropertyName(), ac);
- }
- expression.next();
}
public CssColumnRuleStyle(ApplContext ac, CssExpression expression)
@@ -158,6 +119,6 @@
* It is used by all macro for the function <code>print</code>
*/
public boolean isDefault() {
- return none.equals(value);
+ return false;
}
}
Index: CssProperty.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css/CssProperty.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- CssProperty.java 9 Sep 2011 12:16:43 -0000 1.2
+++ CssProperty.java 5 Oct 2011 07:12:17 -0000 1.3
@@ -91,12 +91,14 @@
*/
public static final CssIdent initial;
public static final CssIdent none;
+ public static final CssIdent currentColor;
static {
inherit = CssIdent.getIdent("inherit");
transparent = CssIdent.getIdent("transparent");
initial = CssIdent.getIdent("initial");
none = CssIdent.getIdent("none");
+ currentColor = CssIdent.getIdent("currentColor");
}
/**
Received on Wednesday, 5 October 2011 07:12:24 UTC