- From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
- Date: Fri, 22 Jan 2010 10:51: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-serv25772 Modified Files: CssBackground.java CssBackgroundAttachment.java CssBackgroundClip.java CssBackgroundColor.java CssBackgroundImage.java CssBackgroundOrigin.java CssBackgroundPosition.java CssBackgroundRepeat.java CssBackgroundSize.java Log Message: transformed background values into individual ones for conflict check Index: CssBackgroundRepeat.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css/CssBackgroundRepeat.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- CssBackgroundRepeat.java 8 Jan 2010 21:38:01 -0000 1.3 +++ CssBackgroundRepeat.java 22 Jan 2010 10:51:17 -0000 1.4 @@ -186,6 +186,10 @@ return value; } + public void set(Object val) { + value = val; + } + /** * Returns true if this property is "softly" inherited * e.g. his value equals inherit Index: CssBackgroundColor.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css/CssBackgroundColor.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- CssBackgroundColor.java 5 Jan 2010 19:49:50 -0000 1.2 +++ CssBackgroundColor.java 22 Jan 2010 10:51:16 -0000 1.3 @@ -88,6 +88,10 @@ return color; } + + public void set(CssValue col) { + color = col; + } /** * Returns the color */ Index: CssBackgroundAttachment.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css/CssBackgroundAttachment.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- CssBackgroundAttachment.java 8 Jan 2010 21:38:01 -0000 1.3 +++ CssBackgroundAttachment.java 22 Jan 2010 10:51:16 -0000 1.4 @@ -66,6 +66,10 @@ value = scroll; } + public void set(Object val) { + value = val; + } + /** * Creates a new CssBackgroundAttachment * Index: CssBackground.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css/CssBackground.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- CssBackground.java 9 Jan 2010 10:36:47 -0000 1.6 +++ CssBackground.java 22 Jan 2010 10:51:16 -0000 1.7 @@ -163,6 +163,7 @@ } else { value = values; } + transform_into_individual_values(); } private Object getCssBackgroundRepeatValue(ApplContext ac, @@ -607,6 +608,85 @@ } /** + * Transform the compound value into the equivalent individual + * values (used for conflict check, like color and background-color + * Note that the value verification already took place, so no need + * for extra check + */ + private void transform_into_individual_values() { + if (value instanceof CssBackgroundValue) { + CssBackgroundValue v = (CssBackgroundValue) value; + if (v.color != null) { + color = new CssBackgroundColor(); + color.set(v.color_value); + } + if (v.bg_image != null) { + image = new CssBackgroundImage(); + image.set(v.bg_image_value); + } + if (v.repeat_style != null) { + repeat = new CssBackgroundRepeat(); + repeat.set(v.repeat_style_value); + } + if (v.attachment != null) { + attachment = new CssBackgroundAttachment(); + attachment.set(v.attachment_value); + } + if (v.bg_position != null) { + position = new CssBackgroundPosition(); + position.set(v.bg_position_value); + } + if (v.bg_size != null) { + size = new CssBackgroundSize(); + size.set(v.bg_size_value); + } + } else if (value instanceof ArrayList) { + ArrayList vlist = (ArrayList) value; + int len = vlist.size(); + ArrayList<CssValue> images = new ArrayList<CssValue>(len); + ArrayList<CssValue> repeats = new ArrayList<CssValue>(len); + ArrayList<CssValue> positions = new ArrayList<CssValue>(len); + ArrayList<CssValue> attachments = new ArrayList<CssValue>(len); + ArrayList<CssValue> sizes = new ArrayList<CssValue>(len); + + for (int i = 0; i < len; i++) { + CssBackgroundValue v = (CssBackgroundValue) vlist.get(i); + images.add(v.bg_image_value); + repeats.add(v.repeat_style_value); + positions.add(v.bg_position_value); + attachments.add(v.attachment_value); + sizes.add(v.bg_size_value); + if (v.color != null) { + color = new CssBackgroundColor(); + color.set(v.color_value); + } + } + image = new CssBackgroundImage(); + image.set(images); + + repeat = new CssBackgroundRepeat(); + repeat.set(repeats); + + attachment = new CssBackgroundAttachment(); + attachment.set(attachments); + + position = new CssBackgroundPosition(); + position.set(sizes); + + size = new CssBackgroundSize(); + size.set(sizes); + } else { + // FIXME TODO use inherit? + image = null; + repeat = null; + attachment = null; + color = null; + size = null; + position = null; + } + } + + /** * @return Returns the image. */ Index: CssBackgroundPosition.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css/CssBackgroundPosition.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- CssBackgroundPosition.java 8 Jan 2010 21:38:01 -0000 1.6 +++ CssBackgroundPosition.java 22 Jan 2010 10:51:17 -0000 1.7 @@ -169,6 +169,10 @@ return value; } + public void set(Object val) { + value = val; + } + /** * Returns the name of this property */ Index: CssBackgroundImage.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css/CssBackgroundImage.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- CssBackgroundImage.java 8 Jan 2010 21:38:01 -0000 1.2 +++ CssBackgroundImage.java 22 Jan 2010 10:51:16 -0000 1.3 @@ -21,7 +21,7 @@ /** * http://www.w3.org/TR/2009/CR-css3-background-20091217/#the-background-image - * + * <p/> * Name: background-image * Value: <bg-image> [ , <bg-image> ]* * Initial: none @@ -30,11 +30,11 @@ * Percentages: N/A * Media: visual * Computed value: as specified, but with URIs made absolute - * + * <p/> * This property sets the background image(s) of an element. Images are drawn * with the first specified one on top (closest to the user) and each * subsequent image behind the previous one. Where - * + * <p/> * <bg-image> = <image> | none */ public class CssBackgroundImage extends CssProperty { @@ -46,6 +46,7 @@ public static boolean isMatchingIdent(CssIdent ident) { return none.equals(ident); } + /** * Create a new CssBackgroundImage */ @@ -56,15 +57,15 @@ /** * Creates a new CssBackgroundImage * - * @param ac the context + * @param ac the context * @param expression The expression for this property - * @param check boolean + * @param check boolean * @throws InvalidParamException Values are incorrect */ public CssBackgroundImage(ApplContext ac, CssExpression expression, boolean check) throws InvalidParamException { - ArrayList<CssValue> values = new ArrayList <CssValue>(); + ArrayList<CssValue> values = new ArrayList<CssValue>(); setByUser(); CssValue val; @@ -81,7 +82,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); } @@ -121,6 +122,10 @@ return url; } + public void set(Object val) { + url = val; + } + /** * Returns true if this property is "softly" inherited * e.g. his value equals inherit Index: CssBackgroundSize.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css/CssBackgroundSize.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- CssBackgroundSize.java 8 Jan 2010 21:38:01 -0000 1.3 +++ CssBackgroundSize.java 22 Jan 2010 10:51:17 -0000 1.4 @@ -226,6 +226,9 @@ return value; } + public void set(Object val) { + value = val; + } /** * Returns true if this property is "softly" inherited */ Index: CssBackgroundOrigin.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css/CssBackgroundOrigin.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- CssBackgroundOrigin.java 8 Jan 2010 21:38:01 -0000 1.4 +++ CssBackgroundOrigin.java 22 Jan 2010 10:51:16 -0000 1.5 @@ -180,6 +180,10 @@ return value; } + public void set(Object val) { + value = val; + } + /** * Returns true if this property is "softly" inherited */ Index: CssBackgroundClip.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css/CssBackgroundClip.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- CssBackgroundClip.java 8 Jan 2010 21:38:01 -0000 1.2 +++ CssBackgroundClip.java 22 Jan 2010 10:51:16 -0000 1.3 @@ -116,6 +116,10 @@ this(ac, expression, false); } + public void set(Object val) { + value = val; + } + /** * Add this property to the CssStyle *
Received on Friday, 22 January 2010 10:51:21 UTC