- From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
- Date: Tue, 28 Aug 2012 20:31:19 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/2002/css-validator/org/w3c/css/properties/css3 In directory hutz:/tmp/cvs-serv24407 Modified Files: CssBackground.java CssBackgroundAttachment.java CssBackgroundClip.java CssBackgroundColor.java CssBackgroundImage.java CssBackgroundOrigin.java CssBackgroundPosition.java CssBackgroundRepeat.java CssBackgroundSize.java Log Message: use of CssLayerList Index: CssBackgroundRepeat.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css3/CssBackgroundRepeat.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- CssBackgroundRepeat.java 24 Aug 2012 06:04:28 -0000 1.2 +++ CssBackgroundRepeat.java 28 Aug 2012 20:31:17 -0000 1.3 @@ -5,11 +5,11 @@ // Please first read the full copyright statement in file COPYRIGHT.html package org.w3c.css.properties.css3; -import org.w3c.css.properties.css.CssProperty; 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.CssLayerList; import org.w3c.css.values.CssTypes; import org.w3c.css.values.CssValue; import org.w3c.css.values.CssValueList; @@ -81,8 +81,6 @@ return null; } - public Object value; - /** * Create a new CssBackgroundRepeat */ @@ -182,7 +180,7 @@ if (values.size() == 1) { value = values.get(0); } else { - value = values; + value = new CssLayerList(values); } } @@ -193,52 +191,6 @@ } /** - * Returns the value of this property - */ - - public Object get() { - return value; - } - - public void set(Object val) { - value = val; - } - - /** - * Returns true if this property is "softly" inherited - * e.g. his value equals inherit - */ - public boolean isSoftlyInherited() { - return (inherit == value); - } - - /** - * Returns a string representation of the object. - */ - public String toString() { - if (value instanceof ArrayList) { - ArrayList values = (ArrayList) value; - StringBuilder sb = new StringBuilder(); - for (Object aValue : values) { - sb.append(aValue.toString()).append(", "); - } - sb.setLength(sb.length() - 2); - return sb.toString(); - } - return value.toString(); - } - - /** - * Compares two properties for equality. - * - * @param property The other property. - */ - public boolean equals(CssProperty property) { - return (property instanceof CssBackgroundRepeat && - value == ((CssBackgroundRepeat) property).value); - } - - /** * Is the value of this property is a default value. * It is used by all macro for the function <code>print</code> */ Index: CssBackgroundColor.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css3/CssBackgroundColor.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- CssBackgroundColor.java 24 Aug 2012 07:07:50 -0000 1.3 +++ CssBackgroundColor.java 28 Aug 2012 20:31:17 -0000 1.4 @@ -7,7 +7,6 @@ package org.w3c.css.properties.css3; -import org.w3c.css.properties.css.CssProperty; import org.w3c.css.util.ApplContext; import org.w3c.css.util.InvalidParamException; import org.w3c.css.values.CssExpression; @@ -18,13 +17,11 @@ */ public class CssBackgroundColor extends org.w3c.css.properties.css.CssBackgroundColor { - CssValue color; - /** * Create a new CssBackgroundColor */ public CssBackgroundColor() { - color = initial; + value = initial; } /** @@ -45,7 +42,7 @@ } if (inherit.equals(val)) { - color = inherit; + value = inherit; expression.next(); } else { try { @@ -54,7 +51,7 @@ CssColor tcolor = new CssColor(ac, expression, check); // instead of using getColor, we get the value directly // as we can have idents - color = tcolor.color; + value = tcolor.color; } catch (InvalidParamException e) { throw new InvalidParamException("value", expression.getValue(), @@ -69,56 +66,10 @@ } /** - * Returns the value of this property - */ - public Object get() { - return color; - } - - - public void set(CssValue col) { - color = col; - } - - /** - * Returns the color - */ - public CssValue getColor() { - return color; - } - - /** - * Returns true if this property is "softly" inherited - * e.g. his value equals inherit - */ - public boolean isSoftlyInherited() { - return color.equals(inherit); - } - - /** - * Returns a string representation of the object. - */ - public String toString() { - return color.toString(); - } - - - /** - * Compares two properties for equality. - * - * @param property The other property. - */ - public boolean equals(CssProperty property) { - return (property instanceof CssBackgroundColor && - color.equals(((CssBackgroundColor) property).color)); - } - - /** * Is the value of this property is a default value. * It is used by all macro for the function <code>print</code> */ public boolean isDefault() { - return (color == transparent); + return (value == transparent); } - } Index: CssBackgroundAttachment.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css3/CssBackgroundAttachment.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- CssBackgroundAttachment.java 23 Aug 2012 17:03:41 -0000 1.2 +++ CssBackgroundAttachment.java 28 Aug 2012 20:31:17 -0000 1.3 @@ -6,11 +6,11 @@ package org.w3c.css.properties.css3; -import org.w3c.css.properties.css.CssProperty; 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.CssLayerList; import org.w3c.css.values.CssTypes; import org.w3c.css.values.CssValue; @@ -50,8 +50,6 @@ return null; } - Object value; - /** * Create a new CssBackgroundAttachment */ @@ -59,10 +57,6 @@ value = initial; } - public void set(Object val) { - value = val; - } - /** * Creates a new CssBackgroundAttachment * @@ -116,7 +110,7 @@ if (values.size() == 1) { value = values.get(0); } else { - value = values; + value = new CssLayerList(values); } } @@ -126,52 +120,6 @@ } /** - * Returns the value of this property - */ - public Object get() { - return value; - } - - /** - * Returns true if this property is "softly" inherited - * e.g. his value equals inherit - */ - public boolean isSoftlyInherited() { - return (inherit == value); - } - - /** - * Returns a string representation of the object. - */ - public String toString() { - if (value instanceof ArrayList) { - ArrayList values = (ArrayList) value; - StringBuilder sb = new StringBuilder(); - boolean addComma = false; - for (Object aValue : values) { - if (addComma) { - sb.append(", "); - } else { - addComma = true; - } - sb.append(aValue); - } - return sb.toString(); - } - return value.toString(); - } - - /** - * Compares two properties for equality. - * - * @param property The other property. - */ - public boolean equals(CssProperty property) { - return (property instanceof CssBackgroundAttachment && - value.equals(((CssBackgroundAttachment) property).value)); - } - - /** * Is the value of this property is a default value. * It is used by all macro for the function <code>print</code> */ Index: CssBackground.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css3/CssBackground.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- CssBackground.java 4 Apr 2012 14:36:25 -0000 1.4 +++ CssBackground.java 28 Aug 2012 20:31:06 -0000 1.5 @@ -6,14 +6,14 @@ // Please first read the full copyright statement in file COPYRIGHT.html package org.w3c.css.properties.css3; -import org.w3c.css.parser.CssSelectors; -import org.w3c.css.parser.CssStyle; -import org.w3c.css.properties.css.CssProperty; -import org.w3c.css.properties.css1.Css1Style; import org.w3c.css.util.ApplContext; import org.w3c.css.util.InvalidParamException; -import org.w3c.css.values.CssColor; -import org.w3c.css.values.*; [...1707 lines suppressed...] + sb.append(attachment).append(' '); + } + if (origin != null) { + sb.append(origin).append(' '); + } + if (clip != null) { + sb.append(clip).append(' '); + } + if (color != null) { + sb.append(color); + } else { + int sb_length = sb.length(); + if (sb_length > 0) { + sb.setLength(sb_length - 1); + } + } + return sb.toString(); + } + } } Index: CssBackgroundPosition.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css3/CssBackgroundPosition.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- CssBackgroundPosition.java 23 Aug 2012 20:49:27 -0000 1.3 +++ CssBackgroundPosition.java 28 Aug 2012 20:31:17 -0000 1.4 @@ -7,14 +7,11 @@ package org.w3c.css.properties.css3; -import org.w3c.css.parser.CssStyle; -import org.w3c.css.properties.css.CssBackground; -import org.w3c.css.properties.css.CssProperty; -import org.w3c.css.properties.css1.Css1Style; 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.CssLayerList; import org.w3c.css.values.CssNumber; import org.w3c.css.values.CssPercentage; import org.w3c.css.values.CssTypes; @@ -72,8 +69,6 @@ return null; } - Object value; - /** * Create a new CssBackgroundPosition */ @@ -91,11 +86,11 @@ boolean check) throws InvalidParamException { setByUser(); CssValue val; - ArrayList<CssBackgroundPositionValue> values; + ArrayList<CssValue> values; CssBackgroundPositionValue b_val = null; char op; - values = new ArrayList<CssBackgroundPositionValue>(); + values = new ArrayList<CssValue>(); // we just accumulate values and check at validation while (!expression.end()) { val = expression.getValue(); @@ -137,7 +132,7 @@ if (values.size() == 1) { value = values.get(0); } else { - value = values; + value = new CssLayerList(values); } } @@ -148,84 +143,6 @@ /** - * Returns the value of this property - */ - public Object get() { - return value; - } - - public void set(Object val) { - value = val; - } - - /** - * Returns true if this property is "softly" inherited - * e.g. his value equals inherit - */ - public boolean isSoftlyInherited() { - return (inherit == value); - } - - /** - * Returns a string representation of the object. - */ - public String toString() { - if (value instanceof ArrayList) { - ArrayList v_list; - v_list = (ArrayList) value; - StringBuilder sb = new StringBuilder(); - boolean isFirst = true; - for (Object val : v_list) { - if (isFirst) { - isFirst = false; - } else { - sb.append(", "); - } - sb.append(val); - } - return sb.toString(); - } - return value.toString(); - } - - /** - * Add this property to the CssStyle. - * - * @param style The CssStyle - */ - public void addToStyle(ApplContext ac, CssStyle style) { - CssBackground cssBackground = ((Css1Style) style).cssBackground; - if (cssBackground.position != null) - style.addRedefinitionWarning(ac, this); - cssBackground.position = this; - } - - /** - * Get this property in the style. - * - * @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 ((Css1Style) style).getBackgroundPosition(); - } else { - return ((Css1Style) style).cssBackground.position; - } - } - - /** - * Compares two properties for equality. - * - * @param property The other property. - */ - public boolean equals(CssProperty property) { - return ((property != null) && - (property instanceof CssBackgroundPosition) && - (value.equals(((CssBackgroundPosition) property).value))); - } - - /** * Is the value of this property is a default value. * It is used by all macro for the function <code>print</code> */ Index: CssBackgroundImage.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css3/CssBackgroundImage.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- CssBackgroundImage.java 24 Aug 2012 07:08:53 -0000 1.2 +++ CssBackgroundImage.java 28 Aug 2012 20:31:17 -0000 1.3 @@ -6,11 +6,11 @@ package org.w3c.css.properties.css3; -import org.w3c.css.properties.css.CssProperty; 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.CssLayerList; import org.w3c.css.values.CssTypes; import org.w3c.css.values.CssValue; @@ -24,8 +24,6 @@ public class CssBackgroundImage extends org.w3c.css.properties.css.CssBackgroundImage { - Object url = null; - public static boolean isMatchingIdent(CssIdent ident) { return none.equals(ident); } @@ -85,9 +83,9 @@ } } if (values.size() == 1) { - url = values.get(0); + value = values.get(0); } else { - url = values; + value = new CssLayerList(values); } } @@ -97,57 +95,11 @@ } /** - * Returns the value of this property - */ - - public Object get() { - return url; - } - - public void set(Object val) { - url = val; - } - - /** - * Returns true if this property is "softly" inherited - * e.g. his value equals inherit - */ - public boolean isSoftlyInherited() { - return (inherit == url); - } - - /** - * Returns a string representation of the object. - */ - public String toString() { - if (url instanceof ArrayList) { - ArrayList values = (ArrayList) url; - StringBuilder sb = new StringBuilder(); - for (Object aValue : values) { - sb.append(aValue.toString()).append(", "); - } - sb.setLength(sb.length() - 2); - return sb.toString(); - } - return url.toString(); - } - - /** - * Compares two properties for equality. - * - * @param property The other property. - */ - public boolean equals(CssProperty property) { - return (property instanceof CssBackgroundImage && url != null && - url.equals(((CssBackgroundImage) property).url)); - } - - /** * Is the value of this property is a default value. * It is used by all macro for the function <code>print</code> */ public boolean isDefault() { - return (url == none); + return (value == none); } } Index: CssBackgroundSize.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css3/CssBackgroundSize.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- CssBackgroundSize.java 24 Aug 2012 07:07:05 -0000 1.5 +++ CssBackgroundSize.java 28 Aug 2012 20:31:17 -0000 1.6 @@ -6,11 +6,11 @@ package org.w3c.css.properties.css3; -import org.w3c.css.properties.css.CssProperty; 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.CssLayerList; import org.w3c.css.values.CssNumber; import org.w3c.css.values.CssTypes; import org.w3c.css.values.CssValue; @@ -22,23 +22,7 @@ import static org.w3c.css.values.CssOperator.SPACE; /** - * http://www.w3.org/TR/2009/CR-css3-background-20091217/#the-background-size - * <p/> - * <p/> - * Name: background-size - * Value: <bg-size> [ , <bg-size> ]* - * Initial: auto - * Applies to: all elements - * Inherited: no - * Percentages: see text - * Media: visual - * Computed value: for <length> the absolute value, otherwise as - * specified - * <p/> - * Specifies the size of the background images. Where - * <p/> - * <bg-size> = [ <length> | <percentage> | auto ]{1,2} | - * cover | contain + * @spec http://www.w3.org/TR/2009/CR-css3-background-20091217/#the-background-size */ public class CssBackgroundSize extends org.w3c.css.properties.css.CssBackgroundSize { @@ -66,8 +50,6 @@ return null; } - Object value; - /** * Create a new CssBackgroundSize */ @@ -173,7 +155,7 @@ if (values.size() == 1) { value = values.get(0); } else { - value = values; + value = new CssLayerList(values); } } @@ -184,50 +166,6 @@ } /** - * Compares two properties for equality. - * - * @param property The other property. - */ - public boolean equals(CssProperty property) { - return (property instanceof CssBackgroundSize && - value.equals(((CssBackgroundSize) property).value)); - } - - /** - * Returns the value of this property - */ - public Object get() { - return value; - } - - public void set(Object val) { - value = val; - } - - /** - * Returns true if this property is "softly" inherited - */ - public boolean isSoftlyInherited() { - return (inherit == value); - } - - /** - * Returns a string representation of the object - */ - public String toString() { - if (value instanceof ArrayList) { - ArrayList values = (ArrayList) value; - StringBuilder sb = new StringBuilder(); - for (Object aValue : values) { - sb.append(aValue.toString()).append(", "); - } - sb.setLength(sb.length() - 2); - return sb.toString(); - } - return value.toString(); - } - - /** * Is the value of this property a default value * It is used by all macro for the function <code>print</code> */ Index: CssBackgroundOrigin.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css3/CssBackgroundOrigin.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- CssBackgroundOrigin.java 24 Aug 2012 07:08:53 -0000 1.5 +++ CssBackgroundOrigin.java 28 Aug 2012 20:31:17 -0000 1.6 @@ -8,12 +8,11 @@ package org.w3c.css.properties.css3; -import org.w3c.css.parser.CssStyle; -import org.w3c.css.properties.css.CssProperty; 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.CssLayerList; import org.w3c.css.values.CssTypes; import org.w3c.css.values.CssValue; @@ -31,8 +30,6 @@ private static CssIdent padding_box; private static CssIdent content_box; - Object value; - static { border_box = CssIdent.getIdent("border-box"); padding_box = CssIdent.getIdent("padding-box"); @@ -104,7 +101,7 @@ if (values.size() == 1) { value = values.get(0); } else { - value = values; + value = new CssLayerList(values); } } @@ -114,75 +111,6 @@ } /** - * Add this property to the CssStyle - * - * @param style The CssStyle - */ - public void addToStyle(ApplContext ac, CssStyle style) { - if (((Css3Style) style).cssBackgroundOrigin != null) - style.addRedefinitionWarning(ac, this); - ((Css3Style) style).cssBackgroundOrigin = this; - } - - /** - * Get this property in the style. - * - * @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).getCssBackgroundOrigin(); - } else { - return ((Css3Style) style).cssBackgroundOrigin; - } - } - - /** - * Compares two properties for equality. - * - * @param property The other property. - */ - public boolean equals(CssProperty property) { - return (property instanceof CssBackgroundOrigin && - value.equals(((CssBackgroundOrigin) property).value)); - } - - /** - * Returns the value of this property - */ - public Object get() { - return value; - } - - public void set(Object val) { - value = val; - } - - /** - * Returns true if this property is "softly" inherited - */ - public boolean isSoftlyInherited() { - return inherit.equals(value); - } - - /** - * Returns a string representation of the object - */ - public String toString() { - if (value instanceof ArrayList) { - ArrayList values = (ArrayList) value; - StringBuilder sb = new StringBuilder(); - for (Object aValue : values) { - sb.append(aValue.toString()).append(", "); - } - sb.setLength(sb.length() - 2); - return sb.toString(); - } - return value.toString(); - } - - /** * Is the value of this property a default value * It is used by all macro for the function <code>print</code> */ Index: CssBackgroundClip.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css3/CssBackgroundClip.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- CssBackgroundClip.java 24 Aug 2012 07:07:05 -0000 1.8 +++ CssBackgroundClip.java 28 Aug 2012 20:31:17 -0000 1.9 @@ -7,12 +7,11 @@ package org.w3c.css.properties.css3; -import org.w3c.css.parser.CssStyle; -import org.w3c.css.properties.css.CssProperty; 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.CssLayerList; import org.w3c.css.values.CssTypes; import org.w3c.css.values.CssValue; @@ -29,7 +28,6 @@ public final static CssIdent border_box; public static CssIdent[] allowed_values; public final static String val[] = {"border-box", "padding-box", "content-box"}; - Object value; static { border_box = CssIdent.getIdent("border-box"); @@ -110,7 +108,7 @@ if (values.size() == 1) { value = values.get(0); } else { - value = values; + value = new CssLayerList(values); } } @@ -119,69 +117,6 @@ this(ac, expression, false); } - public void set(Object val) { - value = val; - } - - /** - * Returns the value of this property - */ - public Object get() { - return value; - } - - /** - * Add this property to the CssStyle - * - * @param style The CssStyle - */ - public void addToStyle(ApplContext ac, CssStyle style) { - // TODO FIXME -> in CssStyle - if (((Css3Style) style).cssBackgroundClip != null) - style.addRedefinitionWarning(ac, this); - ((Css3Style) style).cssBackgroundClip = this; - } - - /** - * Get this property in the style. - * - * @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).getCssBackgroundClip(); - } else { - return ((Css3Style) style).cssBackgroundClip; - } - } - - /** - * Compares two properties for equality. - * - * @param property The other property. - */ - public boolean equals(CssProperty property) { - return (property instanceof CssBackgroundClip && - value.equals(((CssBackgroundClip) property).value)); - } - - /** - * Returns a string representation of the object - */ - public String toString() { - if (value instanceof ArrayList) { - ArrayList values = (ArrayList) value; - StringBuilder sb = new StringBuilder(); - for (Object aValue : values) { - sb.append(aValue.toString()).append(", "); - } - sb.setLength(sb.length() - 2); - return sb.toString(); - } - return value.toString(); - } - /** * Is the value of this property a default value * It is used by all macro for the function <code>print</code>
Received on Tuesday, 28 August 2012 20:31:22 UTC