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

2002/css-validator/org/w3c/css/properties/css21 CssDisplay.java,NONE,1.1 Css21Style.java,1.2,1.3 CssDisplayCSS21.java,1.4,NONE

From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
Date: Wed, 31 Aug 2011 18:34:53 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1Qypcj-0003E0-A7@lionel-hutz.w3.org>
Update of /sources/public/2002/css-validator/org/w3c/css/properties/css21
In directory hutz:/tmp/cvs-serv12201/css/properties/css21

Modified Files:
	Css21Style.java 
Added Files:
	CssDisplay.java 
Removed Files:
	CssDisplayCSS21.java 
Log Message:
aligned 'display' to the latest CSS21 REC, started upgrading its definition for CSS3 (currently using idents from http://www.w3.org/TR/2007/WD-css3-box-20070809/#display )

--- CssDisplayCSS21.java DELETED ---

Index: Css21Style.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css21/Css21Style.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- Css21Style.java	14 Sep 2005 15:14:58 -0000	1.2
+++ Css21Style.java	31 Aug 2011 18:34:51 -0000	1.3
@@ -15,7 +15,7 @@
 public class Css21Style extends Css2Style {
 
     public void print(CssPrinterStyle printer) {
-	super.print(printer);
+        super.print(printer);
     }
 
 }

--- NEW FILE: CssDisplay.java ---
//
// $Id: CssDisplay.java,v 1.1 2011/08/31 18:34:51 ylafon Exp $
// From Philippe Le Hegaret (Philippe.Le_Hegaret@sophia.inria.fr)
//
// (c) COPYRIGHT MIT and INRIA, 1997.
// Please first read the full copyright statement in file COPYRIGHT.html
package org.w3c.css.properties.css21;

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

import java.util.HashMap;
/**
 *
 * http://www.w3.org/TR/2011/REC-CSS2-20110607/visuren.html#display-prop
 *
9.2.4 The 'display' property

'display'
    Value:  	inline | block | list-item | inline-block | table |
                inline-table | table-row-group | table-header-group |
                table-footer-group | table-row | table-column-group |
                table-column | table-cell | table-caption | none | inherit
    Initial:  	inline
    Applies to:  	all elements
    Inherited:  	no
    Percentages:  	N/A
    Media:  	all
    Computed value:  	see text

 * @version $Revision: 1.1 $
 */

public class CssDisplay extends org.w3c.css.properties.css.CssDisplay {

    public static HashMap<String, CssIdent> allowed_values;

    static {
        allowed_values = new HashMap<String, CssIdent>();
        String[] DISPLAY = {
                "inline", "block", "list-item", "inline-block",
                "table", "inline-table", "table-row-group",
                "table-header-group", "table-footer-group",
                "table-row", "table-column-group", "table-column",
                "table-cell", "table-caption", "none"};

        for (String aDISPLAY : DISPLAY) {
            allowed_values.put(aDISPLAY, CssIdent.getIdent(aDISPLAY));
        }
    }

    /**
     * Create a new CssDisplay
     */
    public CssDisplay() {
        // nothing to do
    }

    /**
     * Create a new CssDisplay
     *
     * @param ac         The context
     * @param expression The expression for this property
     * @param check      boolean, if check has to be enforced
     * @throws org.w3c.css.util.InvalidParamException Values are incorect
     */
    public CssDisplay(ApplContext ac, CssExpression expression,
                      boolean check) throws InvalidParamException {

        if (check && expression.getCount() > 1) {
            throw new InvalidParamException("unrecognize", ac);
        }

        CssValue val = expression.getValue();

        setByUser();

        if (val.getType() == CssTypes.CSS_IDENT) {
            CssIdent id_val = (CssIdent) val;
            String id_value = id_val.toString();
            if (inherit.equals(id_val)) {
                value = inherit;
            } else {
                value = allowed_values.get(id_value);
            }
            if (value != null) {
                expression.next();
                return;
            }
        }

        throw new InvalidParamException("value", expression.getValue(),
                getPropertyName(), ac);

    }

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


    /**
     * 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 (value == inline);
    }

}
Received on Wednesday, 31 August 2011 18:35:02 UTC

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