W3C home > Mailing lists > Public > www-validator-cvs@w3.org > December 2009

2002/css-validator/org/w3c/css/properties/css3 CssColumns.java,NONE,1.1 Css3Style.java,1.7,1.8 CssColumnCount.java,1.3,1.4 CssColumnRule.java,1.3,1.4 CssColumnWidth.java,1.4,1.5

From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
Date: Thu, 17 Dec 2009 22:51:25 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1NLPBt-0002C2-5M@lionel-hutz.w3.org>
Update of /sources/public/2002/css-validator/org/w3c/css/properties/css3
In directory hutz:/tmp/cvs-serv8395/org/w3c/css/properties/css3

Modified Files:
	Css3Style.java CssColumnCount.java CssColumnRule.java 
	CssColumnWidth.java 
Added Files:
	CssColumns.java 
Log Message:
added columns shorthand property

Index: CssColumnCount.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css3/CssColumnCount.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- CssColumnCount.java	15 Dec 2009 16:59:43 -0000	1.3
+++ CssColumnCount.java	17 Dec 2009 22:51:22 -0000	1.4
@@ -41,7 +41,7 @@
      * Create a new CssColumnCount
      */
     public CssColumnCount() {
-	// nothing to do
+	count = auto;
     }
 
     /**

Index: CssColumnWidth.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css3/CssColumnWidth.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- CssColumnWidth.java	15 Dec 2009 17:23:49 -0000	1.4
+++ CssColumnWidth.java	17 Dec 2009 22:51:23 -0000	1.5
@@ -40,14 +40,14 @@
     static CssIdent auto;
 
     static {
-	auto = new CssIdent("auto");
+	auto = CssIdent.getIdent("auto");
     }
 
     /**
      * Create a new CssColumnWidth
      */
     public CssColumnWidth() {
-	// nothing to do
+	width = auto;
     }
 
     /**
@@ -83,7 +83,7 @@
 	    if (inherit.equals(val)) {
 		width = inherit;
 		break;
-	    } else if ( auto.equals(val)) {
+	    } else if (auto.equals(val)) {
 		width = auto;
 		break;
 	    } 

--- NEW FILE: CssColumns.java ---
//
// $Id: CssColumns.java,v 1.1 2009/12/17 22:51:23 ylafon Exp $
// From Sijtsche de Jong (sy.de.jong@let.rug.nl)
//
// (c) COPYRIGHT 1995-2000  World Wide Web Consortium (MIT, INRIA, Keio University)
// Please first read the full copyright statement at
// http://www.w3.org/Consortium/Legal/copyright-software-19980720

package org.w3c.css.properties.css3;

import org.w3c.css.parser.CssStyle;
import org.w3c.css.properties.css1.CssProperty;
import org.w3c.css.util.ApplContext;
import org.w3c.css.util.InvalidParamException;
import org.w3c.css.values.CssExpression;
import org.w3c.css.values.CssOperator;
import org.w3c.css.values.CssIdent;
import org.w3c.css.values.CssTypes;
import org.w3c.css.values.CssValue;

/**
 * multicol
 *  <P>
 *  <EM>Value:</EM> &lt;column-width&gt; || &lt;column-counte&gt; 
 *  <EM>Initial:</EM>See individual properties<BR>
 *  <EM>Applies to:</EM>non-replaced block-level elements 
 *                      (except table elements), table cells, 
 *                      and inline-block elementsmulticol elements<BR>
 *  <EM>Inherited:</EM>no<BR>
 *  <EM>Percentages:</EM>N/A<BR>
 *  <EM>Media:</EM>:visual
 */

public class CssColumns extends CssProperty implements CssOperator {
    CssIdent value = null;
    CssColumnWidth width = null;
    CssColumnCount count = null;

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

    /**
     * Create a new CssColumns
     *
     * @param expression The expression for this property
     * @exception InvalidParamException Incorrect values
     */
    public CssColumns(ApplContext ac, CssExpression expression,
	    boolean check) throws InvalidParamException {

	CssValue val = expression.getValue();
	char op = SPACE;
	int nb_val = expression.getCount();
	int nb_auto = 0;

	if (check && nb_val > 2) {
	    throw new InvalidParamException("unrecognize", ac);
	}
	setByUser();
	
	while (!expression.end()) {
	    boolean ok = true;
	    val = expression.getValue();
	    op = expression.getOperator();
	    if (op != SPACE) {
		throw new InvalidParamException("operator",
					      ((new Character(op)).toString()),
						ac);
	    }
	    switch (val.getType()) {
	    case CssTypes.CSS_NUMBER:
		if (count != null) {
		    throw new InvalidParamException("unrecognize", ac);
		}
		count = new CssColumnCount(ac, expression);
		break;
	    case CssTypes.CSS_LENGTH:
		if (width != null) {
		    throw new InvalidParamException("unrecognize", ac);
		}
		width = new CssColumnWidth(ac, expression);
		break;
	    case CssTypes.CSS_IDENT:
		if (inherit.equals((CssIdent)val)) {
		    if (nb_val > 1) {
			throw new InvalidParamException("unrecognize", ac);
		    }
		    value = inherit;
		    expression.next();
		    break;
		}
		if (CssColumnCount.auto.equals((CssIdent)val)) {
		    nb_auto++;
		    expression.next();
		    break;
		}
	    default:
		throw new InvalidParamException("value",
						expression.getValue(),
						getPropertyName(), ac);
	    }
	}
	if (nb_val == 1) {
	    if (nb_auto == 1) {
		value = CssIdent.getIdent("auto");
	    }
	} else {
	    if (nb_auto == 2) {
		count = new CssColumnCount();
		width = new CssColumnWidth();
	    } else if (nb_auto == 1) {
		if (count != null) {
		    width = new CssColumnWidth();
		} else {
		    count = new CssColumnCount();
		}
	    }
	}
    }

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

    /**
     * Add this property to the CssStyle
     *
     * @param style The CssStyle
     */
    public void addToStyle(ApplContext ac, CssStyle style) {
	if (((Css3Style) style).cssColumns != null)
	    style.addRedefinitionWarning(ac, this);
	((Css3Style) style).cssColumns = this;
	if (count != null) {
	    count.addToStyle(ac, style);
	}
	if (width != null) {
	    width.addToStyle(ac, style);
	}
    }

    /**
     * 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).getColumns();
	}
	else {
	    return ((Css3Style) style).cssColumns;
	}
    }

    /**
     * Compares two properties for equality.
     *
     * @param value The other property.
     */
    public boolean equals(CssProperty property) {
	return false;
    }

    /**
     * Returns the name of this property
     */
    public String getPropertyName() {
	return "columns";
    }

    /**
     * Returns the value of this property
     */
    public Object get() {
	return null;
    }

    /**
     * Returns a string representation of the object
     */
    public String toString() {
	StringBuilder sb = new StringBuilder();
	boolean first = true;
	if (value != null) {
	    return value.toString();
	}
	if (count != null) {
	    sb.append(count);
	    first = false;
	}
	if (width != null) {
	    if (!first) {
		sb.append(' ');
	    }
	    sb.append(width);
	}
	return sb.toString();
    }
}

Index: Css3Style.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css3/Css3Style.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- Css3Style.java	17 Dec 2009 21:02:42 -0000	1.7
+++ Css3Style.java	17 Dec 2009 22:51:22 -0000	1.8
@@ -115,18 +115,19 @@
     CssWhiteSpaceTreatment cssWhiteSpaceTreatment;
     CssWrapOption cssWrapOption;
 
-    CssColumnCount cssColumnCount;
-    CssColumnFill cssColumnFill;
-    CssColumnGap cssColumnGap;
-    CssColumnRule cssColumnRule;
+    CssColumns         cssColumns;
+    CssColumnCount     cssColumnCount;
+    CssColumnFill      cssColumnFill;
+    CssColumnGap       cssColumnGap;
+    CssColumnRule      cssColumnRule;
     CssColumnRuleColor cssColumnRuleColor;
     CssColumnRuleStyle cssColumnRuleStyle;
     CssColumnRuleWidth cssColumnRuleWidth;
-    CssColumnSpan cssColumnSpan;
-    CssColumnWidth cssColumnWidth;
-    CssBreakAfter cssBreakAfter;
-    CssBreakBefore cssBreakBefore;
-    CssBreakInside cssBreakInside;
+    CssColumnSpan      cssColumnSpan;
+    CssColumnWidth     cssColumnWidth;
+    CssBreakAfter      cssBreakAfter;
+    CssBreakBefore     cssBreakBefore;
+    CssBreakInside     cssBreakInside;
 
     CssDropInitialAfterAdjust cssDropInitialAfterAdjust;
     CssDropInitialAfterAlign cssDropInitialAfterAlign;
@@ -933,6 +934,15 @@
 	return cssLineBoxContain;
     }
 
+    public CssColumns getColumns() {
+	if (cssColumns == null) {
+	    cssColumns =
+		(CssColumns) style.CascadingOrder(
+						  new CssColumns(), style, selector);
+	}
+	return cssColumns;
+    }
+
     public CssColumnCount getColumnCount() {
 	if (cssColumnCount == null) {
 	    cssColumnCount =

Index: CssColumnRule.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css3/CssColumnRule.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- CssColumnRule.java	17 Dec 2009 22:08:30 -0000	1.3
+++ CssColumnRule.java	17 Dec 2009 22:51:22 -0000	1.4
@@ -90,6 +90,7 @@
 			throw new InvalidParamException("unrecognize", ac);
 		    }
 		    value = inherit;
+		    expression.next();
 		    break;
 		}
 		if (rule_color == null) {
@@ -135,6 +136,15 @@
 	if (((Css3Style) style).cssColumnRule != null)
 	    style.addRedefinitionWarning(ac, this);
 	((Css3Style) style).cssColumnRule = this;
+	if (rule_style != null) {
+	    rule_style.addToStyle(ac, style);
+	}
+	if (rule_color != null) {
+	    rule_color.addToStyle(ac, style);
+	}
+	if (rule_width != null) {
+	    rule_width.addToStyle(ac, style);
+	}
     }
 
     /**
Received on Thursday, 17 December 2009 22:51:32 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 26 April 2012 12:55:16 GMT