- From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
- Date: Thu, 23 Aug 2012 17:44:10 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/2002/css-validator/org/w3c/css/properties/css1 In directory hutz:/tmp/cvs-serv29896/css1 Modified Files: CssBackgroundAttachment.java Log Message: ident case sensitivity Index: CssBackgroundAttachment.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css1/CssBackgroundAttachment.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- CssBackgroundAttachment.java 4 May 2012 12:57:40 -0000 1.7 +++ CssBackgroundAttachment.java 23 Aug 2012 17:44:08 -0000 1.8 @@ -6,8 +6,6 @@ // Please first read the full copyright statement in file COPYRIGHT.html package org.w3c.css.properties.css1; -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; @@ -15,49 +13,29 @@ import org.w3c.css.values.CssTypes; import org.w3c.css.values.CssValue; -import java.util.ArrayList; - /** - * <H4> - * 'background-attachment' - * </H4> - * <p/> - * <EM>Value:</EM> scroll | fixed<BR> - * <EM>Initial:</EM> scroll<BR> - * <EM>Applies to:</EM> all elements<BR> - * <EM>Inherited:</EM> no<BR> - * <EM>Percentage values:</EM> N/A<BR> - * <p/> - * If a background image is specified, the value of 'background-attachment' - * determines if it is fixed with regard to the canvas or if it scrolls along - * with the content. - * <PRE> - * BODY { - * background: red url(pendant.gif); - * background-repeat: repeat-y; - * background-attachment: fixed; - * } - * </PRE> - * - * @version $Revision$ + * @spec http://www.w3.org/TR/2008/REC-CSS1-20080411/#background-attachment */ public class CssBackgroundAttachment extends org.w3c.css.properties.css.CssBackgroundAttachment { - private static ArrayList<CssIdent> allowed_values; - private static CssIdent scroll; - - static { - allowed_values = new ArrayList<CssIdent>(); - scroll = CssIdent.getIdent("scroll"); - allowed_values.add(scroll); - allowed_values.add(CssIdent.getIdent("fixed")); + public static boolean checkMatchingIdent(CssIdent ident) { + for (CssIdent id : allowed_values) { + if (id.equals(ident)) { + return true; + } + } + return false; } - protected static boolean checkMatchingIdent(CssIdent ident) { - return (null != getMatchingIdent(ident)); + private static CssIdent[] allowed_values; + + static { + allowed_values = new CssIdent[2]; + allowed_values[0] = CssIdent.getIdent("scroll"); + allowed_values[1] = CssIdent.getIdent("fixed"); } - protected static CssIdent getMatchingIdent(CssIdent ident) { + public static CssIdent getMatchingIdent(CssIdent ident) { for (CssIdent id : allowed_values) { if (id.equals(ident)) { return id; @@ -66,13 +44,10 @@ return null; } - CssIdent value; - /** * Create a new CssBackgroundAttachment */ public CssBackgroundAttachment() { - value = scroll; } /** @@ -109,69 +84,4 @@ this(ac, expression, false); } - /** - * 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 false; - } - - /** - * Returns a string representation of the object. - */ - public String toString() { - return value.toString(); - } - - /** - * Add this property to the CssStyle. - * - * @param style The CssStyle - */ - public void addToStyle(ApplContext ac, CssStyle style) { - org.w3c.css.properties.css.CssBackground cssBackground = ((Css1Style) style).cssBackground; - if (cssBackground.attachment != null) - style.addRedefinitionWarning(ac, this); - cssBackground.attachment = 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).getBackgroundAttachment(); - } else { - return ((Css1Style) style).cssBackground.attachment; - } - } - - /** - * Compares two properties for equality. - * - * @param property The other property. - */ - public boolean equals(CssProperty property) { - return (property instanceof CssBackgroundAttachment && - value == ((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> - */ - public boolean isDefault() { - return (scroll == value); - } }
Received on Thursday, 23 August 2012 17:44:16 UTC