W3C home > Mailing lists > Public > www-validator-cvs@w3.org > October 2011

2002/css-validator/org/w3c/css/properties/css21 CssColor.java,NONE,1.1 CssBorderFaceColorCSS21.java,1.4,1.5 CssColorCSS21.java,1.6,NONE

From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
Date: Tue, 04 Oct 2011 13:05:27 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1RB4gZ-0004kh-8V@lionel-hutz.w3.org>
Update of /sources/public/2002/css-validator/org/w3c/css/properties/css21
In directory hutz:/tmp/cvs-serv17942/org/w3c/css/properties/css21

Modified Files:
	CssBorderFaceColorCSS21.java 
Added Files:
	CssColor.java 
Removed Files:
	CssColorCSS21.java 
Log Message:
some reordering to have only one background-color to check in checkConflicts (like what was done for CssColors

--- CssColorCSS21.java DELETED ---

--- NEW FILE: CssColor.java ---
// $Id: CssColor.java,v 1.1 2011/10/04 13:05:25 ylafon Exp $
//
// (c) COPYRIGHT MIT, ERCIM and Keio University
// Please first read the full copyright statement in file COPYRIGHT.html

package org.w3c.css.properties.css21;

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.CssTypes;
import org.w3c.css.values.CssValue;

/**
 * @version $Revision: 1.1 $
 * @spec http://www.w3.org/TR/2011/REC-CSS2-20110607/colors.html#propdef-color
 * Note that Color check against CSS levels is mostly done in CSS values.
 */
public class CssColor extends org.w3c.css.properties.css.CssColor {

    org.w3c.css.values.CssColor color;
    String attrvalue = null;
    boolean inherited;

    /**
     * Create a new CssColor
     */
    public CssColor() {
    }

    /**
     * Set the value of the property
     *
     * @param expression The expression for this property
     * @throws org.w3c.css.util.InvalidParamException
     *          Values are incorrect
     */
    public CssColor(ApplContext ac, CssExpression expression, boolean check)
            throws InvalidParamException {
        if (check && expression.getCount() > 1) {
            throw new InvalidParamException("unrecognize", ac);
        }

        CssValue val = expression.getValue();
        setByUser();
        switch (val.getType()) {
            case CssTypes.CSS_IDENT:
                if (inherit.equals(val)) {
                    inherited = true;
                } else {
                    color = new org.w3c.css.values.CssColor(ac, (String) val.get());
                }
                break;
            // in the parser, rgb func and hexval func generate a CssColor directly
            // so, no need for a CSS_FUNCTION case
            case CssTypes.CSS_COLOR:
                try {
                   color = (org.w3c.css.values.CssColor) val;
                } catch (ClassCastException ex) {
                    // as we checked the type, it can't happen
                    throw new InvalidParamException("value", expression.getValue(),
                        getPropertyName(), ac);
                }
                break;
            default:
                throw new InvalidParamException("value", expression.getValue(),
                        getPropertyName(), ac);
        }
        expression.next();
    }

    public CssColor(ApplContext ac, CssExpression expression)
            throws InvalidParamException {
        this(ac, expression, false);
    }

    /**
     * Returns the value of this property
     */
    public Object get() {
        return (inherited) ? inherit : color;
    }

    /**
     * Returns the color
     */
    public org.w3c.css.values.CssColor getColor() {
        return (inherited) ? null : color;
    }

    /**
     * Returns true if this property is "softly" inherited
     * e.g. his value equals inherit
     */
    public boolean isSoftlyInherited() {
        return inherited;
    }

    /**
     * Returns a string representation of the object.
     */
    public String toString() {
        if (attrvalue != null) {
            return attrvalue;
        } else {
            return (inherited) ? inherit.toString() : color.toString();
        }
    }

    /**
     * Compares two properties for equality.
     *
     * @param property The other property.
     */
    public boolean equals(CssProperty property) {
        CssColor other;
        try {
            other = (CssColor) property;
            return ((inherited && other.inherited) ||
                    (!inherited && !other.inherited) && (color.equals(other.color)));
        } catch (ClassCastException ex) {
            return false;
        }
    }
}

Index: CssBorderFaceColorCSS21.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css21/CssBorderFaceColorCSS21.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- CssBorderFaceColorCSS21.java	29 Sep 2011 09:08:59 -0000	1.4
+++ CssBorderFaceColorCSS21.java	4 Oct 2011 13:05:25 -0000	1.5
@@ -30,7 +30,7 @@
      *
      * @param color A color property
      */
-    public CssBorderFaceColorCSS21(org.w3c.css.properties.css1.CssColorCSS2 color) {
+    public CssBorderFaceColorCSS21(org.w3c.css.properties.css.CssColor color) {
 	super(color);
     }
 
Received on Tuesday, 4 October 2011 13:05:29 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:17:47 UTC