- From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
- Date: Fri, 08 Jan 2010 21:38:03 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/2002/css-validator/org/w3c/css/properties/css
In directory hutz:/tmp/cvs-serv11348/properties/css
Modified Files:
CssBackground.java CssBackgroundAttachment.java
CssBackgroundClip.java CssBackgroundImage.java
CssBackgroundOrigin.java CssBackgroundPosition.java
CssBackgroundRepeat.java CssBackgroundSize.java
Log Message:
background css3 should be done... border next for completing css3 background and borders
Index: CssBackgroundRepeat.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css/CssBackgroundRepeat.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- CssBackgroundRepeat.java 5 Jan 2010 19:49:50 -0000 1.2
+++ CssBackgroundRepeat.java 8 Jan 2010 21:38:01 -0000 1.3
@@ -23,7 +23,7 @@
/**
* http://www.w3.org/TR/2009/CR-css3-background-20091217/#the-background-repeat
- *
+ * <p/>
* Name: background-repeat
* Value: <repeat-style> [ , <repeat-style> ]*
* Initial: repeat
@@ -32,18 +32,17 @@
* Percentages: N/A
* Media: visual
* Computed value: as specified
- *
+ * <p/>
* Specifies how background images are tiled after they have been sized and
* positioned. Where
- *
+ * <p/>
* <repeat-style> = repeat-x | repeat-y | [repeat | space |
- * round | no-repeat]{1,2}
- *
+ * round | no-repeat]{1,2}
*/
public class CssBackgroundRepeat extends CssProperty {
private static final String propertyName = "background-repeat";
- public static CssIdent repeat;
+ public final static CssIdent repeat;
private static HashMap<String, CssIdent> allowed_simple_values;
private static HashMap<String, CssIdent> allowed_double_values;
@@ -61,6 +60,13 @@
repeat = CssIdent.getIdent("repeat");
}
+ public static boolean isMatchingIdent(CssIdent ident) {
+ String id = ident.toString();
+
+ return (allowed_simple_values.containsKey(id) ||
+ allowed_double_values.containsKey(id));
+ }
+
public Object value;
/**
@@ -73,9 +79,9 @@
/**
* Set the value of the property
*
- * @param ac the context
+ * @param ac the context
* @param expression The expression for this property
- * @param check is length checking needed
+ * @param check is length checking needed
* @throws InvalidParamException The expression is incorrect
*/
public CssBackgroundRepeat(ApplContext ac, CssExpression expression,
Index: CssBackgroundAttachment.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css/CssBackgroundAttachment.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- CssBackgroundAttachment.java 5 Jan 2010 19:49:50 -0000 1.2
+++ CssBackgroundAttachment.java 8 Jan 2010 21:38:01 -0000 1.3
@@ -53,6 +53,10 @@
allowed_values.put("local", CssIdent.getIdent("local"));
}
+ public static boolean isMatchingIdent(CssIdent ident) {
+ return allowed_values.containsKey(ident.toString());
+ }
+
Object value;
/**
Index: CssBackground.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css/CssBackground.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- CssBackground.java 7 Jan 2010 20:21:37 -0000 1.4
+++ CssBackground.java 8 Jan 2010 21:38:01 -0000 1.5
@@ -14,6 +14,7 @@
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.CssTypes;
import org.w3c.css.values.CssValue;
import org.w3c.css.values.CssValueList;
@@ -142,10 +143,11 @@
if (!expression.end()) {
// incomplete value followed by a comma... it's complete!
if (op == COMMA) {
+ single_layer.setOperator(SPACE);
b_val = check(ac, single_layer, check, false);
values.add(b_val);
single_layer = null;
- } else if (op != SPACE) {
+ } else if ((op != SPACE) && (op != SLASH)) {
throw new InvalidParamException("operator",
((new Character(op)).toString()), ac);
}
@@ -163,10 +165,104 @@
}
}
+ private Object getCssBackgroundRepeatValue(ApplContext ac,
+ CssExpression expression,
+ boolean check)
+ throws InvalidParamException {
+ char op = expression.getOperator();
+ CssExpression exp = new CssExpression();
+
+ exp.addValue(expression.getValue());
+ CssBackgroundRepeat bg_size;
+ repeat = new CssBackgroundRepeat(ac, exp, check);
+ // now check if we can add a second value ;)
+ if ((op == SPACE) && !expression.end()) {
+ expression.next();
+ if (!expression.end()) {
+ CssValue val = expression.getValue();
+ if ((val.getType() == CssTypes.CSS_IDENT) &&
+ (CssBackgroundRepeat.isMatchingIdent((CssIdent) val))) {
+ exp.addValue(expression.getValue());
+ exp.starts();
+ try {
+ repeat = new CssBackgroundRepeat(ac, exp, check);
+ } catch (InvalidParamException ipe) {
+ expression.precedent();
+ }
+ } else {
+ expression.precedent();
+ }
+ }
+ }
+ return repeat.get();
+ }
+
+ private Object getCssBackgroundSizeValue(ApplContext ac,
+ CssExpression expression,
+ boolean check)
+ throws InvalidParamException {
+ char op = expression.getOperator();
+ CssExpression exp = new CssExpression();
+
+ exp.addValue(expression.getValue());
+ CssBackgroundSize bg_size;
+ bg_size = new CssBackgroundSize(ac, exp, check);
+ // now check if we can add a second value ;)
+ // TODO really dirty.. must check the use of 'check'
+ // here, and possibly adjust the parsing model in
+ // other classes :(
+ if ((op == SPACE) && !expression.end()) {
+ expression.next();
+ if (!expression.end()) {
+ exp.addValue(expression.getValue());
+ exp.starts();
+ try {
+ bg_size = new CssBackgroundSize(ac, exp, check);
+ } catch (InvalidParamException ipe) {
+ // roll back
+ expression.precedent();
+ }
+ }
+ }
+ return bg_size.get();
+ }
+
+
+ private Object getCssBackgroundPositionValue(ApplContext ac,
+ CssExpression expression,
+ boolean check)
+ throws InvalidParamException {
+ CssExpression exp = new CssExpression();
+ char op = expression.getOperator();
+ exp.addValue(expression.getValue());
+
+ CssBackgroundPosition bg_pos;
+ bg_pos = new CssBackgroundPosition(ac, exp, check);
+ // good we have a valid value, try something better..
+ try {
+ for (int i = 0; i < 3; i++) {
+ if ((op == SPACE) && !expression.end()) {
+ expression.next();
+ if (expression.end()) {
+ break;
+ }
+ exp.addValue(expression.getValue());
+ exp.starts();
+ bg_pos = new CssBackgroundPosition(ac, exp, check);
+
+ }
+ }
+ } catch (InvalidParamException ipe) {
+ // roll back
+ expression.precedent();
+ }
+ return bg_pos.get();
+ }
+
+
public CssBackgroundValue check(ApplContext ac, CssExpression expression,
boolean check, boolean is_final)
throws InvalidParamException {
- // TODO have fun here...
// <bg-layer> = <bg-image> || <bg-position> || / <bg-size> || <repeat-style> ||
// <attachment> || <bg-origin>
// bg_image is CSS_URL | IDENT
@@ -175,15 +271,17 @@
// repeat-style is IDENT
// attachment is IDENT
// bg-origin is IDENT
+ // + color as CSS_COLOR or IDENT on final-layer
CssValue val;
char op;
CssExpression exp;
CssBackgroundValue v = new CssBackgroundValue();
- boolean next_is_size;
+ boolean next_is_size, got_size;
Object res;
next_is_size = false;
+ got_size = false;
while (!expression.end()) {
val = expression.getValue();
op = expression.getOperator();
@@ -191,7 +289,7 @@
switch (val.getType()) {
case CssTypes.CSS_COLOR:
// we already got one, fail...
- if (v.color != null) {
+ if (v.color != null || next_is_size || !is_final) {
throw new InvalidParamException("value", val,
getPropertyName(), ac);
}
@@ -200,12 +298,12 @@
CssBackgroundColor bg_color;
bg_color = new CssBackgroundColor(ac, exp, check);
- v.color = v.color_value = (CssValue) bg_color.get();
+ v.color = (CssValue) bg_color.get();
break;
case CssTypes.CSS_URL:
// we already got one, fail...
- if (v.bg_image != null) {
+ if (v.bg_image != null || next_is_size) {
throw new InvalidParamException("value", val,
getPropertyName(), ac);
}
@@ -217,7 +315,7 @@
res = bg_image.get();
// we only have one vale so it should always be the case
if (res instanceof CssValue) {
- v.bg_image = v.bg_image_value = (CssValue) res;
+ v.bg_image = (CssValue) res;
} else {
throw new InvalidParamException("value", val,
getPropertyName(), ac);
@@ -236,68 +334,178 @@
throw new InvalidParamException("value", val,
getPropertyName(), ac);
}
- exp = new CssExpression();
- exp.addValue(val);
- CssBackgroundSize bg_size;
- bg_size = new CssBackgroundSize(ac, exp, check);
- // now check if we can add a second value ;)
- // TODO really dirty.. must check the use of 'check'
- // here, and possibly adjust the parsing model in
- // other classes :(
- if ((op == SPACE) && !expression.end()) {
- expression.next();
- exp.addValue(expression.getValue());
- try {
- bg_size = new CssBackgroundSize(ac, exp, check);
- } catch (InvalidParamException ipe) {
- // roll back
- expression.precedent();
- }
- }
- res = bg_size.get();
+ res = getCssBackgroundSizeValue(ac, expression, check);
+ op = expression.getOperator();
// we only have one vale so it should always be the case
if (res instanceof CssValue) {
- v.bg_size = v.bg_size_value = (CssValue) res;
+ v.bg_size = (CssValue) res;
} else {
throw new InvalidParamException("value", val,
getPropertyName(), ac);
}
+ got_size = true;
+ next_is_size = false;
} else {
// position with it's up to 4 values...
- if ((v.bg_size != null) || (v.bg_position != null)) {
+ if (got_size) {
+ throw new InvalidParamException("bg_order", val,
+ getPropertyName(), ac);
+ }
+ if (v.bg_position != null) {
+ throw new InvalidParamException("value", val,
+ getPropertyName(), ac);
+ }
+ res = getCssBackgroundPositionValue(ac, expression, check);
+ op = expression.getOperator();
+ // we only have one vale so it should always be the case
+ if (res instanceof CssValue) {
+ v.bg_position = (CssValue) res;
+ } else {
+ throw new InvalidParamException("value", val,
+ getPropertyName(), ac);
+ }
+
+ }
+ break;
+ case CssTypes.CSS_IDENT:
+ // inherit is already taken care of...
+ CssIdent ident_val = (CssIdent) val;
+ if (CssBackgroundAttachment.isMatchingIdent(ident_val)) {
+ if (v.attachment != null || next_is_size) {
throw new InvalidParamException("value", val,
getPropertyName(), ac);
}
exp = new CssExpression();
exp.addValue(val);
- CssBackgroundPosition bg_pos;
- bg_pos = new CssBackgroundPosition(ac, exp, check);
- // good we have a valid value, try something better..
- try {
- for (int i = 0; i < 3; i++) {
- if ((op == SPACE) && !expression.end()) {
- expression.next();
- exp.addValue(expression.getValue());
- bg_pos = new CssBackgroundPosition(ac, exp, check);
- }
- }
- } catch (InvalidParamException ipe) {
- // roll back
- expression.precedent();
+
+ CssBackgroundAttachment attachment;
+ attachment = new CssBackgroundAttachment(ac, exp, check);
+ res = attachment.get();
+ // we only have one vale so it should always be the case
+ if (res instanceof CssValue) {
+ v.attachment = (CssValue) res;
+ } else {
+ throw new InvalidParamException("value", val,
+ getPropertyName(), ac);
}
- res = bg_pos.get();
+ break;
+ }
+ if (CssBackgroundImage.isMatchingIdent(ident_val)) {
+ if (v.bg_image != null || next_is_size) {
+ throw new InvalidParamException("value", val,
+ getPropertyName(), ac);
+ }
+ // a bit of an overkill, as we know it can be only
+ // 'none'.. but it is more flexible if ever it changes
+ exp = new CssExpression();
+ exp.addValue(val);
+
+ bg_image = new CssBackgroundImage(ac, exp, check);
+ res = bg_image.get();
// we only have one vale so it should always be the case
if (res instanceof CssValue) {
- v.bg_position = v.bg_position_value = (CssValue) res;
+ v.bg_image = (CssValue) res;
} else {
throw new InvalidParamException("value", val,
getPropertyName(), ac);
}
+ break;
+ }
+ if (CssBackgroundOrigin.isMatchingIdent(ident_val)) {
+ if (v.origin != null || next_is_size) {
+ throw new InvalidParamException("value", val,
+ getPropertyName(), ac);
+ }
+ exp = new CssExpression();
+ exp.addValue(val);
+ CssBackgroundOrigin origin;
+ origin = new CssBackgroundOrigin(ac, exp, check);
+ res = origin.get();
+ // we only have one vale so it should always be the case
+ if (res instanceof CssValue) {
+ v.origin = (CssValue) res;
+ } else {
+ throw new InvalidParamException("value", val,
+ getPropertyName(), ac);
+ }
+ break;
}
- break;
- case CssTypes.CSS_IDENT:
- // TODO let's the fun begin :)
+ if (CssBackgroundRepeat.isMatchingIdent(ident_val)) {
+ if (v.repeat_style != null || next_is_size) {
+ throw new InvalidParamException("value", val,
+ getPropertyName(), ac);
+ }
+ res = getCssBackgroundRepeatValue(ac, expression, check);
+ op = expression.getOperator();
+
+ // we only have one vale so it should always be the case
+ if (res instanceof CssValue) {
+ v.repeat_style = (CssValue) res;
+ } else {
+ throw new InvalidParamException("value", val,
+ getPropertyName(), ac);
+ }
+ break;
+ }
+ if (next_is_size) {
+ if (CssBackgroundSize.isMatchingIdent(ident_val)) {
+ // size, we have up to two values
+ if (v.bg_size != null) {
+ throw new InvalidParamException("value", val,
+ getPropertyName(), ac);
+ }
+ res = getCssBackgroundSizeValue(ac, expression, check);
+ op = expression.getOperator();
+ // we only have one vale so it should always be the case
+ if (res instanceof CssValue) {
+ v.bg_size = (CssValue) res;
+ } else {
+ throw new InvalidParamException("value", val,
+ getPropertyName(), ac);
+ }
+ got_size = true;
+ next_is_size = false;
+ break;
+ }
+ } else {
+ if (CssBackgroundPosition.isMatchingIdent(ident_val)) {
+ // position with it's up to 4 values...
+ if (got_size) {
+ throw new InvalidParamException("bg_order",
+ val, getPropertyName(), ac);
+ }
+ if (v.bg_position != null) {
+ throw new InvalidParamException("value", val,
+ getPropertyName(), ac);
+ }
+ res = getCssBackgroundPositionValue(ac, expression, check);
+ op = expression.getOperator();
+ // we only have one vale so it should always be the case
+ if (res instanceof CssValue) {
+ v.bg_position = (CssValue) res;
+ } else {
+ throw new InvalidParamException("value", val,
+ getPropertyName(), ac);
+ }
+ break;
+ }
+ }
+ // last one remaining... color!
+ // or else, it will fail :)
+ if (is_final) {
+ if (v.color != null || next_is_size) {
+ throw new InvalidParamException("value", val,
+ getPropertyName(), ac);
+ }
+ exp = new CssExpression();
+ exp.addValue(val);
+ bg_color = new CssBackgroundColor(ac, exp, check);
+ v.color = (CssValue) bg_color.get();
+ break;
+ }
+ // unrecognized or unwanted ident
+ // let it fail now
default:
throw new InvalidParamException("value", val,
getPropertyName(), ac);
@@ -311,27 +519,81 @@
}
expression.next();
}
+ align_bg_values(v);
return v;
}
+ private void align_bg_values(CssBackgroundValue v) {
+ // <bg-layer> = <bg-image> || <bg-position> || / <bg-size> || <repeat-style> ||
+ // <attachment> || <bg-origin>
+ Object value;
+ if (v.bg_image == null) {
+ value = (new CssBackgroundImage()).get();
+ if (value instanceof CssValue) {
+ v.bg_image_value = (CssValue) value;
+ }
+ } else {
+ v.bg_image_value = v.bg_image;
+ }
- @SuppressWarnings("unchecked")
- public void transform_values
- () {
- ArrayList<CssBackgroundValue> v_array;
- if (value instanceof CssBackgroundValue) {
- v_array = new ArrayList<CssBackgroundValue>(1);
- v_array.add((CssBackgroundValue) value);
- } else if (value instanceof ArrayList) {
- v_array = (ArrayList<CssBackgroundValue>) value;
+ if (v.bg_position == null) {
+ value = (new CssBackgroundPosition()).get();
+ if (value instanceof CssValue) {
+ v.bg_position_value = (CssValue) value;
+ }
} else {
- return;
+ v.bg_position_value = v.bg_position;
}
- for (CssBackgroundValue v : v_array) {
- // TODO transform v
+ if (v.bg_size == null) {
+ value = (new CssBackgroundSize()).get();
+ if (value instanceof CssValue) {
+ v.bg_size_value = (CssValue) value;
+ }
+ } else {
+ v.bg_size_value = v.bg_size;
+ }
+
+ if (v.repeat_style == null) {
+ value = (new CssBackgroundRepeat()).get();
+ if (value instanceof CssValue) {
+ v.repeat_style_value = (CssValue) value;
+ }
+ } else {
+ v.repeat_style_value = v.repeat_style;
}
+ if (v.attachment == null) {
+ value = (new CssBackgroundAttachment()).get();
+ if (value instanceof CssValue) {
+ v.attachment_value = (CssValue) value;
+ }
+ } else {
+ v.attachment_value = v.attachment;
+ }
+
+ if (v.origin == null) {
+ value = (new CssBackgroundOrigin()).get();
+ if (value instanceof CssValue) {
+ CssValue css_val = (CssValue) value;
+ v.origin_value = (CssValue) value;
+ // If 'background-origin' is present and its value matches a
+ // possible value for 'background-clip' then it also sets
+ // 'background-clip' to that value.
+ if ((css_val.getType() == CssTypes.CSS_IDENT) &&
+ CssBackgroundClip.isMatchingIdent((CssIdent) css_val)) {
+ v.clip_value = v.origin_value;
+ }
+ }
+ } else {
+ v.origin_value = v.origin;
+ }
+
+ if (v.color == null) {
+ v.color_value = (new CssBackgroundColor()).getColor();
+ } else {
+ v.color_value = v.color;
+ }
}
/**
Index: CssBackgroundPosition.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css/CssBackgroundPosition.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- CssBackgroundPosition.java 7 Jan 2010 20:31:02 -0000 1.5
+++ CssBackgroundPosition.java 8 Jan 2010 21:38:01 -0000 1.6
@@ -61,9 +61,9 @@
private static final String propertyName = "background-position";
private static HashMap<String, CssIdent> allowed_values;
- private static CssIdent center, top, bottom, left, right;
- private static CssPercentage defaultPercent0, defaultPercent50;
- private static CssPercentage defaultPercent100;
+ private static final CssIdent center, top, bottom, left, right;
+ private static final CssPercentage defaultPercent0, defaultPercent50;
+ private static final CssPercentage defaultPercent100;
static {
top = CssIdent.getIdent("top");
@@ -83,6 +83,10 @@
defaultPercent100 = new CssPercentage(100);
}
+ public static boolean isMatchingIdent(CssIdent ident) {
+ return allowed_values.containsKey(ident.toString());
+ }
+
Object value;
/**
@@ -439,9 +443,7 @@
// should never happen
}
}
- // TODO add a check for 3 or 4 values that offset relative
- // to a direction is preceded by an explicit directionnal
- // //keyword
+
if (isVertical(id1) || isHorizontal(id2)) {
// if an offset is present and value is 'center'
if (((off1 != null) && !isVertical(id1)) ||
Index: CssBackgroundImage.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css/CssBackgroundImage.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- CssBackgroundImage.java 5 Jan 2010 13:49:37 -0000 1.1
+++ CssBackgroundImage.java 8 Jan 2010 21:38:01 -0000 1.2
@@ -11,6 +11,7 @@
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;
@@ -42,6 +43,9 @@
Object url = null;
+ public static boolean isMatchingIdent(CssIdent ident) {
+ return none.equals(ident);
+ }
/**
* Create a new CssBackgroundImage
*/
Index: CssBackgroundSize.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css/CssBackgroundSize.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- CssBackgroundSize.java 5 Jan 2010 19:49:50 -0000 1.2
+++ CssBackgroundSize.java 8 Jan 2010 21:38:01 -0000 1.3
@@ -25,7 +25,7 @@
/**
* http://www.w3.org/TR/2009/CR-css3-background-20091217/#the-background-size
- *
+ * <p/>
* <p/>
* Name: background-size
* Value: <bg-size> [ , <bg-size> ]*
@@ -57,6 +57,10 @@
allowed_values.put("contain", CssIdent.getIdent("contain"));
}
+ public static boolean isMatchingIdent(CssIdent ident) {
+ return allowed_values.containsKey(ident.toString());
+ }
+
Object value;
/**
Index: CssBackgroundOrigin.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css/CssBackgroundOrigin.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- CssBackgroundOrigin.java 7 Jan 2010 20:21:37 -0000 1.3
+++ CssBackgroundOrigin.java 8 Jan 2010 21:38:01 -0000 1.4
@@ -23,7 +23,7 @@
/**
* http://www.w3.org/TR/2009/CR-css3-background-20091217/#the-background-origin
- *
+ * <p/>
* Name: background-origin
* Value: <bg-origin> [ , <bg-origin> ]*
* Initial: padding-box
@@ -32,12 +32,12 @@
* Percentages: N/A
* Media: visual
* Computed value: same as specified value
- *
+ * <p/>
* For elements rendered as a single box, specifies the background positioning
* area. For elements rendered as multiple boxes (e.g., inline boxes on several
* lines, boxes on several pages) specifies which boxes 'box-decoration-break'
- * operates on to determine the background positioning area(s).
- *
+ * operates on to determine the background positioning area(s).
+ * <p/>
* <bg-origin> = border-box | padding-box | content-box
*/
@@ -51,11 +51,17 @@
Object value;
static {
- border_box = CssIdent.getIdent("border-box");
+ border_box = CssIdent.getIdent("border-box");
padding_box = CssIdent.getIdent("padding-box");
content_box = CssIdent.getIdent("content-box");
}
+ public static boolean isMatchingIdent(CssIdent ident) {
+ return (border_box.equals(ident) ||
+ padding_box.equals(ident) ||
+ content_box.equals(ident));
+ }
+
/**
* Create a new CssBackgroundClip
*/
@@ -67,10 +73,11 @@
* Create a new CssBackgroundClip
*
* @param expression The expression for this property
- * @throws org.w3c.css.util.InvalidParamException Incorrect value
+ * @throws org.w3c.css.util.InvalidParamException
+ * Incorrect value
*/
public CssBackgroundOrigin(ApplContext ac, CssExpression expression,
- boolean check) throws InvalidParamException {
+ boolean check) throws InvalidParamException {
ArrayList<CssValue> values = new ArrayList<CssValue>();
@@ -85,7 +92,7 @@
if (inherit.equals(val)) {
// if we got inherit after other values, fail
// if we got more than one value... fail
- if ((values.size() > 0)||(expression.getCount() > 1)) {
+ if ((values.size() > 0) || (expression.getCount() > 1)) {
throw new InvalidParamException("value", val,
getPropertyName(), ac);
}
Index: CssBackgroundClip.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css/CssBackgroundClip.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- CssBackgroundClip.java 5 Jan 2010 13:49:37 -0000 1.1
+++ CssBackgroundClip.java 8 Jan 2010 21:38:01 -0000 1.2
@@ -37,8 +37,8 @@
public class CssBackgroundClip extends CssProperty {
private static final String propertyName = "background-clip";
- public static CssIdent border_box;
- public static CssIdent padding_box;
+ public final static CssIdent border_box;
+ public final static CssIdent padding_box;
Object value;
@@ -47,6 +47,11 @@
padding_box = CssIdent.getIdent("padding-box");
}
+ public static boolean isMatchingIdent(CssIdent ident) {
+ return (border_box.equals(ident) ||
+ padding_box.equals(ident));
+ }
+
/**
* Create a new CssBackgroundClip
*/
@@ -65,7 +70,7 @@
ArrayList<CssValue> values = new ArrayList<CssValue>();
- CssValue val = expression.getValue();
+ CssValue val;
char op;
while (!expression.end()) {
@@ -76,7 +81,7 @@
if (inherit.equals(val)) {
// if we got inherit after other values, fail
// if we got more than one value... fail
- if ((values.size() > 0)||(expression.getCount() > 1)) {
+ if ((values.size() > 0) || (expression.getCount() > 1)) {
throw new InvalidParamException("value", val,
getPropertyName(), ac);
}
Received on Friday, 8 January 2010 21:38:04 UTC