- From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
- Date: Mon, 08 Aug 2005 13:19:48 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/2002/css-validator/org/w3c/css/user
In directory hutz:/tmp/cvs-serv27412/org/w3c/css/user
Modified Files:
Css2Style.java Cursor.java CursorATSC.java CursorCSS2.java
Outline.java OutlineATSC.java OutlineColor.java
OutlineColorATSC.java OutlineStyle.java OutlineStyleATSC.java
OutlineWidth.java OutlineWidthATSC.java UserProperties.java
Log Message:
All those changed made by Jean-Guilhem Rouel:
Huge patch, imports fixed (automatic)
Bug fixed: 372, 920, 778, 287, 696, 764, 233
Partial bug fix for 289
Issue with "inherit" in CSS2.
The validator now checks the number of values (extraneous values were previously ignored)
Index: CursorCSS2.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/user/CursorCSS2.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- CursorCSS2.java 8 Apr 2002 21:18:33 -0000 1.2
+++ CursorCSS2.java 8 Aug 2005 13:19:46 -0000 1.3
@@ -9,15 +9,15 @@
package org.w3c.css.user;
import java.util.Vector;
-import org.w3c.css.properties.CssProperty;
import org.w3c.css.parser.CssStyle;
+import org.w3c.css.properties.CssProperty;
+import org.w3c.css.util.ApplContext;
+import org.w3c.css.util.InvalidParamException;
import org.w3c.css.values.CssExpression;
-import org.w3c.css.values.CssValue;
import org.w3c.css.values.CssIdent;
-import org.w3c.css.values.CssURL;
import org.w3c.css.values.CssOperator;
-import org.w3c.css.util.InvalidParamException;
-import org.w3c.css.util.ApplContext;
+import org.w3c.css.values.CssURL;
+import org.w3c.css.values.CssValue;
/**
* @version $Revision$
@@ -50,7 +50,7 @@
* @param expression The expression for this property
* @exception InvalidParamException Values are incorrect
*/
- public CursorCSS2(ApplContext ac, CssExpression expression)
+ public CursorCSS2(ApplContext ac, CssExpression expression, boolean check)
throws InvalidParamException {
CssValue val = expression.getValue();
char op = expression.getOperator();
@@ -58,13 +58,18 @@
setByUser();
if (val.equals(inherit)) {
+ if(expression.getCount() > 1) {
+ throw new InvalidParamException("unrecognize", ac);
+ }
inheritedValue = true;
expression.next();
return;
}
- while ((op == COMMA)
- && (val instanceof CssURL)) {
+ while ((op == COMMA) && (val instanceof CssURL)) {
+ if(val != null && val.equals(inherit)) {
+ throw new InvalidParamException("unrecognize", ac);
+ }
uris.addElement(val);
expression.next();
val = expression.getValue();
@@ -83,6 +88,9 @@
if (hash_values[i] == hash) {
value = i;
expression.next();
+ if(check && !expression.end()) {
+ throw new InvalidParamException("unrecognize", ac);
+ }
return;
}
}
@@ -92,6 +100,11 @@
val.toString(), getPropertyName(), ac);
}
+ public CursorCSS2(ApplContext ac, CssExpression expression)
+ throws InvalidParamException {
+ this(ac, expression, false);
+ }
+
/**
* Returns the value of this property
*/
Index: Css2Style.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/user/Css2Style.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- Css2Style.java 8 Apr 2002 21:18:33 -0000 1.2
+++ Css2Style.java 8 Aug 2005 13:19:46 -0000 1.3
@@ -8,9 +8,6 @@
*/
package org.w3c.css.user;
-import java.util.Enumeration;
-
-import org.w3c.css.util.Warnings;
import org.w3c.css.parser.CssPrinterStyle;
/**
Index: CursorATSC.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/user/CursorATSC.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- CursorATSC.java 8 Apr 2002 21:18:33 -0000 1.2
+++ CursorATSC.java 8 Aug 2005 13:19:46 -0000 1.3
@@ -9,15 +9,15 @@
package org.w3c.css.user;
import java.util.Vector;
-import org.w3c.css.properties.CssProperty;
import org.w3c.css.parser.CssStyle;
+import org.w3c.css.properties.CssProperty;
+import org.w3c.css.util.ApplContext;
+import org.w3c.css.util.InvalidParamException;
import org.w3c.css.values.CssExpression;
-import org.w3c.css.values.CssValue;
import org.w3c.css.values.CssIdent;
-import org.w3c.css.values.CssURL;
import org.w3c.css.values.CssOperator;
-import org.w3c.css.util.InvalidParamException;
-import org.w3c.css.util.ApplContext;
+import org.w3c.css.values.CssURL;
+import org.w3c.css.values.CssValue;
/**
* @version $Revision$
@@ -50,8 +50,8 @@
* @param expression The expression for this property
* @exception InvalidParamException Values are incorrect
*/
- public CursorATSC(ApplContext ac, CssExpression expression)
- throws InvalidParamException {
+ public CursorATSC(ApplContext ac, CssExpression expression,
+ boolean check) throws InvalidParamException {
CssValue val = expression.getValue();
char op = expression.getOperator();
@@ -60,13 +60,18 @@
ac.getFrame().addWarning("atsc", val.toString());
if (val.equals(inherit)) {
+ if(expression.getCount() > 1) {
+ throw new InvalidParamException("unrecognize", ac);
+ }
inheritedValue = true;
expression.next();
return;
}
- while ((op == COMMA)
- && (val instanceof CssURL)) {
+ while ((op == COMMA)&& (val instanceof CssURL)) {
+ if(val != null && val.equals(inherit)) {
+ throw new InvalidParamException("unrecognize", ac);
+ }
uris.addElement(val);
expression.next();
val = expression.getValue();
@@ -85,6 +90,9 @@
if (hash_values[i] == hash) {
value = i;
expression.next();
+ if(check && !expression.end()) {
+ throw new InvalidParamException("unrecognize", ac);
+ }
return;
}
}
@@ -94,6 +102,11 @@
val.toString(), getPropertyName(), ac);
}
+ public CursorATSC(ApplContext ac, CssExpression expression)
+ throws InvalidParamException {
+ this(ac, expression, false);
+ }
+
/**
* Returns the value of this property
*/
Index: OutlineColor.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/user/OutlineColor.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- OutlineColor.java 8 Apr 2002 21:18:33 -0000 1.2
+++ OutlineColor.java 8 Aug 2005 13:19:46 -0000 1.3
@@ -10,13 +10,13 @@
package org.w3c.css.user;
import org.w3c.css.parser.CssStyle;
-import org.w3c.css.values.CssExpression;
-import org.w3c.css.values.CssValue;
-import org.w3c.css.values.CssIdent;
-import org.w3c.css.values.CssColor;
import org.w3c.css.properties.CssProperty;
-import org.w3c.css.util.InvalidParamException;
import org.w3c.css.util.ApplContext;
+import org.w3c.css.util.InvalidParamException;
+import org.w3c.css.values.CssColor;
+import org.w3c.css.values.CssExpression;
+import org.w3c.css.values.CssIdent;
+import org.w3c.css.values.CssValue;
/**
* @version $Revision$
@@ -39,8 +39,13 @@
* @param expression The expression for this property
* @exception InvalidParamException Values are incorrect
*/
- public OutlineColor(ApplContext ac, CssExpression expression)
- throws InvalidParamException {
+ public OutlineColor(ApplContext ac, CssExpression expression,
+ boolean check) throws InvalidParamException {
+
+ if(check && expression.getCount() > 1) {
+ throw new InvalidParamException("unrecognize", ac);
+ }
+
CssValue val = expression.getValue();
setByUser();
@@ -62,6 +67,11 @@
}
}
+ public OutlineColor(ApplContext ac, CssExpression expression)
+ throws InvalidParamException {
+ this(ac, expression, false);
+ }
+
/**
* Returns the value of this property
*/
Index: OutlineATSC.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/user/OutlineATSC.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- OutlineATSC.java 8 Apr 2002 21:18:33 -0000 1.2
+++ OutlineATSC.java 8 Aug 2005 13:19:46 -0000 1.3
@@ -8,15 +8,15 @@
*/
package org.w3c.css.user;
-import org.w3c.css.parser.CssStyle;
-import org.w3c.css.parser.CssSelectors;
import org.w3c.css.parser.CssPrinterStyle;
+import org.w3c.css.parser.CssSelectors;
+import org.w3c.css.parser.CssStyle;
+import org.w3c.css.properties.CssProperty;
+import org.w3c.css.util.ApplContext;
+import org.w3c.css.util.InvalidParamException;
import org.w3c.css.values.CssExpression;
import org.w3c.css.values.CssOperator;
import org.w3c.css.values.CssValue;
-import org.w3c.css.properties.CssProperty;
-import org.w3c.css.util.InvalidParamException;
-import org.w3c.css.util.ApplContext;
/**
* @version $Revision$
@@ -41,7 +41,13 @@
* @param expression The expression for this property
* @exception InvalidParamException Values are incorrect
*/
- public OutlineATSC(ApplContext ac, CssExpression expression) throws InvalidParamException {
+ public OutlineATSC(ApplContext ac, CssExpression expression,
+ boolean check) throws InvalidParamException {
+
+ if(check && expression.getCount() > 3) {
+ throw new InvalidParamException("unrecognize", ac);
+ }
+
CssValue val = expression.getValue();
char op = SPACE;
boolean find = true;
@@ -50,12 +56,15 @@
ac.getFrame().addWarning("atsc", val.toString());
if (val.equals(inherit)) {
+ if(expression.getCount() > 1) {
+ throw new InvalidParamException("unrecognize", ac);
+ }
this.same = true;
color = new OutlineColorATSC(ac, expression);
width = new OutlineWidthATSC();
width.value = inherit;
style = new OutlineStyleATSC();
- style.value = style.BORDERSTYLE.length - 1;
+ style.value = OutlineStyleATSC.BORDERSTYLE.length - 1;
return;
}
@@ -64,6 +73,10 @@
val = expression.getValue();
op = expression.getOperator();
+ if(val != null && val.equals(inherit)) {
+ throw new InvalidParamException("unrecognize", ac);
+ }
+
if (val == null) {
break;
}
@@ -88,17 +101,18 @@
}
}
if (!find && width == null) {
- try {
- width = new OutlineWidthATSC(ac, expression);
- find = true;
- } catch (InvalidParamException e) {
- }
+ width = new OutlineWidthATSC(ac, expression);
+ find = true;
+ }
+ if(val != null && !find) {
+ throw new InvalidParamException("unrecognize", ac);
}
}
if (max_values >= 2) {
throw new InvalidParamException("few-value", getPropertyName(), ac);
}
+ /*
if (color == null) {
color = new OutlineColorATSC();
}
@@ -108,6 +122,12 @@
if (style == null) {
style = new OutlineStyleATSC();
}
+ */
+ }
+
+ public OutlineATSC(ApplContext ac, CssExpression expression)
+ throws InvalidParamException {
+ this(ac, expression, false);
}
/**
@@ -134,13 +154,13 @@
return color.toString();
} else {
String ret ="";
- if (color.isByUser()) {
+ if (color != null) {
ret += " " + color;
}
- if (width.isByUser()) {
+ if (width != null) {
ret += " " + width;
}
- if (style.isByUser()) {
+ if (style != null) {
ret += " " + style;
}
return ret.substring(1);
@@ -153,9 +173,12 @@
*/
public void setImportant() {
super.setImportant();
- color.setImportant();
- width.setImportant();
- style.setImportant();
+ if(color != null)
+ color.setImportant();
+ if(width != null)
+ width.setImportant();
+ if(style != null)
+ style.setImportant();
}
/**
@@ -203,9 +226,12 @@
public void addToStyle(ApplContext ac, CssStyle style0) {
// outlineColor and outlineWidth can't be null ...
((Css2Style) style0).outline.same = same;
- color.addToStyle(ac, style0);
- width.addToStyle(ac, style0);
- style.addToStyle(ac, style0);
+ if(color != null)
+ color.addToStyle(ac, style0);
+ if(width != null)
+ width.addToStyle(ac, style0);
+ if(style != null)
+ style.addToStyle(ac, style0);
}
/**
@@ -217,10 +243,12 @@
*/
public void setInfo(int line, String source) {
super.setInfo(line, source);
- // color, style and width can't be null ...
- color.setInfo(line, source);
- width.setInfo(line, source);
- style.setInfo(line, source);
+ if(color != null)
+ color.setInfo(line, source);
+ if(width != null)
+ width.setInfo(line, source);
+ if(style != null)
+ style.setInfo(line, source);
}
/**
Index: OutlineStyleATSC.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/user/OutlineStyleATSC.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- OutlineStyleATSC.java 8 Apr 2002 21:18:33 -0000 1.2
+++ OutlineStyleATSC.java 8 Aug 2005 13:19:46 -0000 1.3
@@ -10,12 +10,12 @@
package org.w3c.css.user;
import org.w3c.css.parser.CssStyle;
-import org.w3c.css.values.CssExpression;
-import org.w3c.css.values.CssValue;
-import org.w3c.css.values.CssIdent;
import org.w3c.css.properties.CssProperty;
-import org.w3c.css.util.InvalidParamException;
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.CssValue;
/**
* @version $Revision$
@@ -43,8 +43,12 @@
* @param expression The expression for this face
* @exception InvalidParamException The expression is incorrect
*/
- public OutlineStyleATSC(ApplContext ac, CssExpression expression)
- throws InvalidParamException {
+ public OutlineStyleATSC(ApplContext ac, CssExpression expression,
+ boolean check) throws InvalidParamException {
+
+ if(check && expression.getCount() > 1) {
+ throw new InvalidParamException("unrecognize", ac);
+ }
CssValue val = expression.getValue();
setByUser();
@@ -66,6 +70,11 @@
getPropertyName(), ac);
}
+ public OutlineStyleATSC(ApplContext ac, CssExpression expression)
+ throws InvalidParamException {
+ this(ac, expression, false);
+ }
+
/**
* Returns the internal value
*/
Index: OutlineColorATSC.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/user/OutlineColorATSC.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- OutlineColorATSC.java 8 Apr 2002 21:18:33 -0000 1.2
+++ OutlineColorATSC.java 8 Aug 2005 13:19:46 -0000 1.3
@@ -10,13 +10,13 @@
package org.w3c.css.user;
import org.w3c.css.parser.CssStyle;
-import org.w3c.css.values.CssExpression;
-import org.w3c.css.values.CssValue;
-import org.w3c.css.values.CssIdent;
-import org.w3c.css.values.CssColor;
import org.w3c.css.properties.CssProperty;
-import org.w3c.css.util.InvalidParamException;
import org.w3c.css.util.ApplContext;
+import org.w3c.css.util.InvalidParamException;
+import org.w3c.css.values.CssColor;
+import org.w3c.css.values.CssExpression;
+import org.w3c.css.values.CssIdent;
+import org.w3c.css.values.CssValue;
/**
* @version $Revision$
@@ -39,8 +39,13 @@
* @param expression The expression for this property
* @exception InvalidParamException Values are incorrect
*/
- public OutlineColorATSC(ApplContext ac, CssExpression expression)
- throws InvalidParamException {
+ public OutlineColorATSC(ApplContext ac, CssExpression expression,
+ boolean check) throws InvalidParamException {
+
+ if(check && expression.getCount() > 1) {
+ throw new InvalidParamException("unrecognize", ac);
+ }
+
CssValue val = expression.getValue();
setByUser();
@@ -64,6 +69,11 @@
}
}
+ public OutlineColorATSC(ApplContext ac, CssExpression expression)
+ throws InvalidParamException {
+ this(ac, expression, false);
+ }
+
/**
* Returns the value of this property
*/
Index: OutlineStyle.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/user/OutlineStyle.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- OutlineStyle.java 20 Dec 2002 16:04:43 -0000 1.3
+++ OutlineStyle.java 8 Aug 2005 13:19:46 -0000 1.4
@@ -10,12 +10,12 @@
package org.w3c.css.user;
import org.w3c.css.parser.CssStyle;
-import org.w3c.css.values.CssExpression;
-import org.w3c.css.values.CssValue;
-import org.w3c.css.values.CssIdent;
import org.w3c.css.properties.CssProperty;
-import org.w3c.css.util.InvalidParamException;
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.CssValue;
/**
* @version $Revision$
@@ -43,8 +43,12 @@
* @param expression The expression for this face
* @exception InvalidParamException The expression is incorrect
*/
- public OutlineStyle(ApplContext ac, CssExpression expression)
- throws InvalidParamException {
+ public OutlineStyle(ApplContext ac, CssExpression expression,
+ boolean check) throws InvalidParamException {
+
+ if(check && expression.getCount() > 1) {
+ throw new InvalidParamException("unrecognize", ac);
+ }
CssValue val = expression.getValue();
setByUser();
@@ -64,6 +68,11 @@
getPropertyName(), ac);
}
+ public OutlineStyle(ApplContext ac, CssExpression expression)
+ throws InvalidParamException {
+ this(ac, expression, false);
+ }
+
/**
* Returns the internal value
*/
Index: OutlineWidth.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/user/OutlineWidth.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- OutlineWidth.java 8 Apr 2002 21:18:33 -0000 1.2
+++ OutlineWidth.java 8 Aug 2005 13:19:46 -0000 1.3
@@ -10,14 +10,14 @@
package org.w3c.css.user;
import org.w3c.css.parser.CssStyle;
+import org.w3c.css.properties.CssProperty;
+import org.w3c.css.util.ApplContext;
+import org.w3c.css.util.InvalidParamException;
import org.w3c.css.values.CssExpression;
-import org.w3c.css.values.CssValue;
+import org.w3c.css.values.CssIdent;
import org.w3c.css.values.CssLength;
import org.w3c.css.values.CssNumber;
-import org.w3c.css.values.CssIdent;
-import org.w3c.css.properties.CssProperty;
-import org.w3c.css.util.InvalidParamException;
-import org.w3c.css.util.ApplContext;
+import org.w3c.css.values.CssValue;
/**
* @version $Revision$
@@ -52,9 +52,13 @@
* @param expression The expression for this property
* @exception InvalidParamException Values are incorrect
*/
- public OutlineWidth(ApplContext ac, CssExpression expression)
+ public OutlineWidth(ApplContext ac, CssExpression expression, boolean check)
throws InvalidParamException {
+ if(check && expression.getCount() > 1) {
+ throw new InvalidParamException("unrecognize", ac);
+ }
+
CssValue val = expression.getValue();
setByUser();
@@ -84,6 +88,11 @@
expression.next();
}
+ public OutlineWidth(ApplContext ac, CssExpression expression)
+ throws InvalidParamException {
+ this(ac, expression, false);
+ }
+
/**
* Returns the internal value
*/
Index: Outline.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/user/Outline.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- Outline.java 8 Apr 2002 21:18:33 -0000 1.2
+++ Outline.java 8 Aug 2005 13:19:46 -0000 1.3
@@ -8,15 +8,15 @@
*/
package org.w3c.css.user;
-import org.w3c.css.parser.CssStyle;
-import org.w3c.css.parser.CssSelectors;
import org.w3c.css.parser.CssPrinterStyle;
+import org.w3c.css.parser.CssSelectors;
+import org.w3c.css.parser.CssStyle;
+import org.w3c.css.properties.CssProperty;
+import org.w3c.css.util.ApplContext;
+import org.w3c.css.util.InvalidParamException;
import org.w3c.css.values.CssExpression;
import org.w3c.css.values.CssOperator;
import org.w3c.css.values.CssValue;
-import org.w3c.css.properties.CssProperty;
-import org.w3c.css.util.InvalidParamException;
-import org.w3c.css.util.ApplContext;
/**
* @version $Revision$
@@ -41,19 +41,28 @@
* @param expression The expression for this property
* @exception InvalidParamException Values are incorrect
*/
- public Outline(ApplContext ac, CssExpression expression) throws InvalidParamException {
+ public Outline(ApplContext ac, CssExpression expression,
+ boolean check) throws InvalidParamException {
+
+ if(check && expression.getCount() > 3) {
+ throw new InvalidParamException("unrecognize", ac);
+ }
+
CssValue val = expression.getValue();
char op = SPACE;
boolean find = true;
int max_values = 3;
if (val.equals(inherit)) {
+ if(expression.getCount() > 1) {
+ throw new InvalidParamException("unrecognize", ac);
+ }
this.same = true;
color = new OutlineColor(ac, expression);
width = new OutlineWidth();
width.value = inherit;
style = new OutlineStyle();
- style.value = style.BORDERSTYLE.length - 1;
+ style.value = OutlineStyle.BORDERSTYLE.length - 1;
return;
}
@@ -62,6 +71,10 @@
val = expression.getValue();
op = expression.getOperator();
+ if(val != null && val.equals(inherit)) {
+ throw new InvalidParamException("unrecognize", ac);
+ }
+
if (val == null) {
break;
}
@@ -86,17 +99,18 @@
}
}
if (!find && width == null) {
- try {
- width = new OutlineWidth(ac, expression);
- find = true;
- } catch (InvalidParamException e) {
- }
+ width = new OutlineWidth(ac, expression);
+ find = true;
+ }
+ if(val != null && !find) {
+ throw new InvalidParamException("unrecognize", ac);
}
}
if (max_values >= 2) {
throw new InvalidParamException("few-value", getPropertyName(), ac);
}
+ /*
if (color == null) {
color = new OutlineColor();
}
@@ -105,7 +119,12 @@
}
if (style == null) {
style = new OutlineStyle();
- }
+ }*/
+ }
+
+ public Outline(ApplContext ac, CssExpression expression)
+ throws InvalidParamException {
+ this(ac, expression, false);
}
/**
@@ -132,13 +151,13 @@
return color.toString();
} else {
String ret ="";
- if (color.isByUser()) {
+ if (color != null) {
ret += " " + color;
}
- if (width.isByUser()) {
+ if (width != null) {
ret += " " + width;
}
- if (style.isByUser()) {
+ if (style != null) {
ret += " " + style;
}
return ret.substring(1);
@@ -151,9 +170,12 @@
*/
public void setImportant() {
super.setImportant();
- color.setImportant();
- width.setImportant();
- style.setImportant();
+ if(color != null)
+ color.setImportant();
+ if(width != null)
+ width.setImportant();
+ if(style != null)
+ style.setImportant();
}
/**
@@ -201,9 +223,12 @@
public void addToStyle(ApplContext ac, CssStyle style0) {
// outlineColor and outlineWidth can't be null ...
((Css2Style) style0).outline.same = same;
- color.addToStyle(ac, style0);
- width.addToStyle(ac, style0);
- style.addToStyle(ac, style0);
+ if(color != null)
+ color.addToStyle(ac, style0);
+ if(width != null)
+ width.addToStyle(ac, style0);
+ if(style != null)
+ style.addToStyle(ac, style0);
}
/**
@@ -215,10 +240,12 @@
*/
public void setInfo(int line, String source) {
super.setInfo(line, source);
- // color, style and width can't be null ...
- color.setInfo(line, source);
- width.setInfo(line, source);
- style.setInfo(line, source);
+ if(color != null)
+ color.setInfo(line, source);
+ if(width != null)
+ width.setInfo(line, source);
+ if(style != null)
+ style.setInfo(line, source);
}
/**
Index: Cursor.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/user/Cursor.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- Cursor.java 18 Dec 2002 09:21:01 -0000 1.3
+++ Cursor.java 8 Aug 2005 13:19:46 -0000 1.4
@@ -10,15 +10,15 @@
package org.w3c.css.user;
import java.util.Vector;
-import org.w3c.css.properties.CssProperty;
import org.w3c.css.parser.CssStyle;
+import org.w3c.css.properties.CssProperty;
+import org.w3c.css.util.ApplContext;
+import org.w3c.css.util.InvalidParamException;
import org.w3c.css.values.CssExpression;
-import org.w3c.css.values.CssValue;
import org.w3c.css.values.CssIdent;
-import org.w3c.css.values.CssURL;
import org.w3c.css.values.CssOperator;
-import org.w3c.css.util.InvalidParamException;
-import org.w3c.css.util.ApplContext;
+import org.w3c.css.values.CssURL;
+import org.w3c.css.values.CssValue;
/**
* @version $Revision$
@@ -54,21 +54,27 @@
* @param expression The expression for this property
* @exception InvalidParamException Values are incorrect
*/
- public Cursor(ApplContext ac, CssExpression expression)
- throws InvalidParamException {
+ public Cursor(ApplContext ac, CssExpression expression, boolean check)
+ throws InvalidParamException {
+
CssValue val = expression.getValue();
char op = expression.getOperator();
setByUser();
if (val.equals(inherit)) {
+ if(expression.getCount() > 1) {
+ throw new InvalidParamException("unrecognize", ac);
+ }
inheritedValue = true;
expression.next();
return;
}
- while ((op == COMMA)
- && (val instanceof CssURL)) {
+ while ((op == COMMA)&& (val instanceof CssURL)) {
+ if(val != null && val.equals(inherit)) {
+ throw new InvalidParamException("unrecognize", ac);
+ }
uris.addElement(val);
expression.next();
val = expression.getValue();
@@ -87,6 +93,9 @@
if (hash_values[i] == hash) {
value = i;
expression.next();
+ if(check && !expression.end()) {
+ throw new InvalidParamException("unrecognize", ac);
+ }
return;
}
}
@@ -96,6 +105,11 @@
val.toString(), getPropertyName(), ac);
}
+ public Cursor(ApplContext ac, CssExpression expression)
+ throws InvalidParamException {
+ this(ac, expression, false);
+ }
+
/**
* Returns the value of this property
*/
Index: OutlineWidthATSC.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/user/OutlineWidthATSC.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- OutlineWidthATSC.java 8 Apr 2002 21:18:33 -0000 1.2
+++ OutlineWidthATSC.java 8 Aug 2005 13:19:46 -0000 1.3
@@ -10,14 +10,14 @@
package org.w3c.css.user;
import org.w3c.css.parser.CssStyle;
+import org.w3c.css.properties.CssProperty;
+import org.w3c.css.util.ApplContext;
+import org.w3c.css.util.InvalidParamException;
import org.w3c.css.values.CssExpression;
-import org.w3c.css.values.CssValue;
+import org.w3c.css.values.CssIdent;
import org.w3c.css.values.CssLength;
import org.w3c.css.values.CssNumber;
-import org.w3c.css.values.CssIdent;
-import org.w3c.css.properties.CssProperty;
-import org.w3c.css.util.InvalidParamException;
-import org.w3c.css.util.ApplContext;
+import org.w3c.css.values.CssValue;
/**
* @version $Revision$
@@ -52,8 +52,12 @@
* @param expression The expression for this property
* @exception InvalidParamException Values are incorrect
*/
- public OutlineWidthATSC(ApplContext ac, CssExpression expression)
- throws InvalidParamException {
+ public OutlineWidthATSC(ApplContext ac, CssExpression expression,
+ boolean check) throws InvalidParamException {
+
+ if(check && expression.getCount() > 1) {
+ throw new InvalidParamException("unrecognize", ac);
+ }
CssValue val = expression.getValue();
setByUser();
@@ -86,6 +90,11 @@
expression.next();
}
+ public OutlineWidthATSC(ApplContext ac, CssExpression expression)
+ throws InvalidParamException {
+ this(ac, expression, false);
+ }
+
/**
* Returns the internal value
*/
Index: UserProperties.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/user/UserProperties.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- UserProperties.java 12 Jul 2005 14:47:55 -0000 1.3
+++ UserProperties.java 8 Aug 2005 13:19:46 -0000 1.4
@@ -15,26 +15,26 @@
* @version $Revision$
*/
public class UserProperties {
- public static Utf8Properties properties;
-
- public static String getString(CssProperty property, String prop) {
- return properties.getProperty(property.getPropertyName() + "." + prop);
- }
-
- public static boolean getInheritance(CssProperty property) {
- return getString(property, "inherited").equals("true");
- }
-
- static {
- properties = new Utf8Properties();
- try {
- URL url = UserProperties.class
- .getResource("UserDefault.properties");
- properties.load(url.openStream());
- } catch (Exception e) {
- System.err
- .println("org.w3c.css.user.UserProperties: couldn't load properties ");
- System.err.println(" " + e.toString());
+ public static Utf8Properties properties;
+
+ public static String getString(CssProperty property, String prop) {
+ return properties.getProperty(property.getPropertyName() + "." + prop);
+ }
+
+ public static boolean getInheritance(CssProperty property) {
+ return getString(property, "inherited").equals("true");
+ }
+
+ static {
+ properties = new Utf8Properties();
+ try {
+ URL url = UserProperties.class
+ .getResource("UserDefault.properties");
+ properties.load(url.openStream());
+ } catch (Exception e) {
+ System.err
+ .println("org.w3c.css.user.UserProperties: couldn't load properties ");
+ System.err.println(" " + e.toString());
+ }
}
- }
}
Received on Monday, 8 August 2005 13:19:59 UTC