- From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
- Date: Wed, 11 Feb 2009 22:43:17 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/2002/css-validator/org/w3c/css/properties/css1 In directory hutz:/tmp/cvs-serv8090/css1 Modified Files: CssBackgroundAttachment.java CssBackgroundAttachmentCSS1.java CssBackgroundAttachmentCSS2.java CssBackgroundColorCSS1.java CssBackgroundColorCSS2.java Log Message: small rewrites Index: CssBackgroundAttachment.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css1/CssBackgroundAttachment.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- CssBackgroundAttachment.java 14 Sep 2005 15:14:31 -0000 1.3 +++ CssBackgroundAttachment.java 11 Feb 2009 22:43:15 -0000 1.4 @@ -11,6 +11,7 @@ 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; /** @@ -67,7 +68,7 @@ CssValue val = expression.getValue(); - if (val instanceof CssIdent) { + if (val.getType() == CssTypes.CSS_IDENT) { int hash = val.hashCode(); for (int i =0; i < ATTACHMENT.length; i++) if (hash_values[i] == hash) { Index: CssBackgroundAttachmentCSS1.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css1/CssBackgroundAttachmentCSS1.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- CssBackgroundAttachmentCSS1.java 14 Sep 2005 15:14:31 -0000 1.3 +++ CssBackgroundAttachmentCSS1.java 11 Feb 2009 22:43:15 -0000 1.4 @@ -11,6 +11,7 @@ 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; /** @@ -67,7 +68,7 @@ CssValue val = expression.getValue(); - if (val instanceof CssIdent) { + if (val.getType() == CssTypes.CSS_IDENT) { int hash = val.hashCode(); for (int i =0; i < ATTACHMENT.length; i++) if (hash_values[i] == hash) { Index: CssBackgroundAttachmentCSS2.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css1/CssBackgroundAttachmentCSS2.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- CssBackgroundAttachmentCSS2.java 25 Mar 2008 18:43:30 -0000 1.4 +++ CssBackgroundAttachmentCSS2.java 11 Feb 2009 22:43:15 -0000 1.5 @@ -11,6 +11,7 @@ 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; /** @@ -67,7 +68,7 @@ CssValue val = expression.getValue(); - if (val instanceof CssIdent) { + if (val.getType() == CssTypes.CSS_IDENT) { int hash = val.hashCode(); for (int i =0; i < ATTACHMENT.length; i++) if (hash_values[i] == hash) { Index: CssBackgroundColorCSS2.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css1/CssBackgroundColorCSS2.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- CssBackgroundColorCSS2.java 14 Sep 2005 15:14:31 -0000 1.4 +++ CssBackgroundColorCSS2.java 11 Feb 2009 22:43:15 -0000 1.5 @@ -12,6 +12,7 @@ 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; /** @@ -60,24 +61,27 @@ setByUser(); CssValue val = expression.getValue(); - if (val instanceof org.w3c.css.values.CssColor) { - color = val; - expression.next(); - } else if (val instanceof CssIdent) { - if (val.equals(transparent)) { - color = transparent; - expression.next(); - } else if (val.equals(inherit)) { - color = inherit; - expression.next(); - } else { - color = new org.w3c.css.values.CssColorCSS2(ac, (String) val.get()); - expression.next(); - } - } else { + switch (val.getType()) { + case CssTypes.CSS_COLOR: + setColor(val); + break; + case CssTypes.CSS_IDENT: + if (transparent.equals(val)) { + setColor(transparent); + break; + } + if (inherit.equals(val)) { + setColor(inherit); + break; + } + setColor(new org.w3c.css.values.CssColorCSS2(ac, + (String) val.get())); + break; + default: throw new InvalidParamException("value", val.toString(), getPropertyName(), ac); } + expression.next(); } public CssBackgroundColorCSS2(ApplContext ac, CssExpression expression) @@ -121,11 +125,7 @@ if (color != null) { return color.toString(); } - else { - return ""; - } - - + return ""; } Index: CssBackgroundColorCSS1.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css1/CssBackgroundColorCSS1.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- CssBackgroundColorCSS1.java 14 Sep 2005 15:14:31 -0000 1.3 +++ CssBackgroundColorCSS1.java 11 Feb 2009 22:43:15 -0000 1.4 @@ -12,6 +12,7 @@ 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; /** @@ -60,24 +61,27 @@ setByUser(); CssValue val = expression.getValue(); - if (val instanceof org.w3c.css.values.CssColor) { - color = val; - expression.next(); - } else if (val instanceof CssIdent) { - if (val.equals(transparent)) { - color = transparent; - expression.next(); - } else if (val.equals(inherit)) { - color = inherit; - expression.next(); - } else { - color = new org.w3c.css.values.CssColorCSS1(ac, (String) val.get()); - expression.next(); - } - } else { + switch (val.getType()) { + case CssTypes.CSS_COLOR: + setColor(val); + break; + case CssTypes.CSS_IDENT: + if (transparent.equals(val)) { + setColor(transparent); + break; + } + if (inherit.equals(val)) { + setColor(inherit); + break; + } + setColor(new org.w3c.css.values.CssColorCSS1(ac, + (String) val.get())); + break; + default: throw new InvalidParamException("value", val.toString(), getPropertyName(), ac); } + expression.next(); } public CssBackgroundColorCSS1(ApplContext ac, CssExpression expression) @@ -86,6 +90,13 @@ } /** + * @param color The color to set. + */ + public void setColor(CssValue color) { + this.color = color; + } + + /** * Returns the value of this property */ public Object get() {
Received on Wednesday, 11 February 2009 22:43:28 UTC