2002/css-validator/org/w3c/css/properties/css3 CssBreakAfter.java,NONE,1.1 CssBreakBefore.java,NONE,1.1 CssBreakInside.java,NONE,1.1 Css3Style.java,1.5,1.6

Update of /sources/public/2002/css-validator/org/w3c/css/properties/css3
In directory hutz:/tmp/cvs-serv11951

Modified Files:
	Css3Style.java 
Added Files:
	CssBreakAfter.java CssBreakBefore.java CssBreakInside.java 
Log Message:
finished css3-multicol

--- NEW FILE: CssBreakBefore.java ---
//
// $Id: CssBreakBefore.java,v 1.1 2009/12/17 18:07:17 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 java.util.HashSet;

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

/**
 * http://www.w3.org/TR/css3-multicol/
 *  <P>
 *  <EM>Value:</EM> auto | always | avoid | left | right | page | column | 
 *                  avoid-page | avoid-column <BR>
 *  <EM>Initial:</EM>auto<BR>
 *  <EM>Applies to:</EM>block-level elements<BR>
 *  <EM>Inherited:</EM>no<BR>
 *  <EM>Percentages:</EM>N/A<BR>
 *  <EM>Media:</EM>:paged
 *  <P>
 * When content is laid out in multiple columns, the user agent must 
 * determine where column breaks are placed. The problem of breaking content
 * into columns is similar to breaking content into pages.
 * Three new properties are introduced to allow column breaks to be described 
 * in the same properties as page breaks: ‘break-before’, ‘break-after’, 
 * and ‘break-inside’. These properties take the same values as 
 * ‘page-break-before’, ‘page-break-after’, and ‘page-break-inside’ [CSS21]. 
 * In addition, some new keyword values are added.
 */

public class CssBreakBefore extends CssProperty {

    CssValue value;

    static CssValue default_value;
    public static HashSet<CssIdent> acceptable_values;
    static {
	default_value = CssIdent.getIdent("auto");
	acceptable_values = new HashSet<CssIdent>();
	acceptable_values.add((CssIdent)default_value);
	acceptable_values.add(CssIdent.getIdent("always"));
	acceptable_values.add(CssIdent.getIdent("avoid"));
	acceptable_values.add(CssIdent.getIdent("left"));
	acceptable_values.add(CssIdent.getIdent("right"));
	acceptable_values.add(CssIdent.getIdent("page"));
	acceptable_values.add(CssIdent.getIdent("column"));
	acceptable_values.add(CssIdent.getIdent("avoid-page"));
	acceptable_values.add(CssIdent.getIdent("avoid-column"));
    }

    /**
     * Create a new CssColumnWidth
     */
    public CssBreakBefore() {
	value = default_value;
    }

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

	setByUser();
	CssValue val = expression.getValue();

	if(check && expression.getCount() > 1) {
	    throw new InvalidParamException("unrecognize", ac);
	}
	
	if ((val.getType() != CssTypes.CSS_IDENT) ||
	    !(((CssIdent)val).equals(inherit) || 
	      acceptable_values.contains((CssIdent)val))) {
	    throw new InvalidParamException("value",
					    expression.getValue(),
					    getPropertyName(), ac);
	}
	value = CssIdent.getIdent(((CssIdent)val).toString());
	expression.next();
    }

    public CssBreakBefore(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).cssBreakBefore != null)
	    style.addRedefinitionWarning(ac, this);
	((Css3Style) style).cssBreakBefore = 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 ((Css3Style) style).getBreakBefore();
	}
	else {
	    return ((Css3Style) style).cssBreakBefore;
	}
    }

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

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

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

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

    /**
     * Returns a string representation of the object
     */
    public String toString() {
	return value.toString();
    }

    /**
     * Is the value of this property a default value
     * It is used by alle macro for the function <code>print</code>
     */
    public boolean isDefault() {
	return (value == default_value);
    }

}

Index: Css3Style.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css3/Css3Style.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- Css3Style.java	16 Dec 2009 13:18:24 -0000	1.5
+++ Css3Style.java	17 Dec 2009 18:07:17 -0000	1.6
@@ -94,9 +94,6 @@
     CssClearCSS3 cssClearCSS3;
     CssLineHeightPolicy cssLineHeightPolicy;
     CssLineBoxContain cssLineBoxContain;
-    CssColumnCount cssColumnCount;
-    CssColumnWidth cssColumnWidth;
-    CssColumnSpan cssColumnSpan;
     CssBackgroundClip cssBackgroundClip;
     CssBackgroundSize cssBackgroundSize;
     CssBackgroundOrigin cssBackgroundOrigin;
@@ -117,11 +114,19 @@
     CssTextOverflowMode cssTextOverflowMode;
     CssWhiteSpaceTreatment cssWhiteSpaceTreatment;
     CssWrapOption cssWrapOption;
+
     CssColumnGap cssColumnGap;
     CssColumnRuleColor cssColumnRuleColor;
     CssColumnRuleStyle cssColumnRuleStyle;
     CssColumnRuleWidth cssColumnRuleWidth;
     CssColumnRule cssColumnRule;
+    CssColumnCount cssColumnCount;
+    CssColumnWidth cssColumnWidth;
+    CssColumnSpan cssColumnSpan;
+    CssBreakBefore cssBreakBefore;
+    CssBreakAfter cssBreakAfter;
+    CssBreakInside cssBreakInside;
+
     CssDropInitialAfterAdjust cssDropInitialAfterAdjust;
     CssDropInitialAfterAlign cssDropInitialAfterAlign;
     CssDropInitialBeforeAdjust cssDropInitialBeforeAdjust;
@@ -1134,6 +1139,31 @@
 	return cssColumnGap;
     }
 
+   public CssBreakBefore getBreakBefore() {
+	if (cssBreakBefore == null) {
+	    cssBreakBefore =
+		(CssBreakBefore) style.CascadingOrder(
+						      new CssBreakBefore(), style, selector);
+	}
+	return cssBreakBefore;
+    }
+   public CssBreakAfter getBreakAfter() {
+	if (cssBreakAfter == null) {
+	    cssBreakAfter =
+		(CssBreakAfter) style.CascadingOrder(
+						      new CssBreakAfter(), style, selector);
+	}
+	return cssBreakAfter;
+    }
+   public CssBreakInside getBreakInside() {
+	if (cssBreakInside == null) {
+	    cssBreakInside =
+		(CssBreakInside) style.CascadingOrder(
+						      new CssBreakInside(), style, selector);
+	}
+	return cssBreakInside;
+    }
+
     public CssColumnRuleColor getColumnRuleColor() {
 	if (cssColumnRuleColor == null) {
 	    cssColumnRuleColor =

--- NEW FILE: CssBreakInside.java ---
//
// $Id: CssBreakInside.java,v 1.1 2009/12/17 18:07:17 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 java.util.HashSet;

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

/**
 * http://www.w3.org/TR/css3-multicol/
 *  <P>
 *  <EM>Value:</EM> auto | avoid | avoid-page | avoid-column<BR>
 *  <EM>Initial:</EM>auto<BR>
 *  <EM>Applies to:</EM>block-level elements<BR>
 *  <EM>Inherited:</EM>no<BR>
 *  <EM>Percentages:</EM>N/A<BR>
 *  <EM>Media:</EM>:paged
 *  <P>
 * When content is laid out in multiple columns, the user agent must 
 * determine where column breaks are placed. The problem of breaking content
 * into columns is similar to breaking content into pages.
 * Three new properties are introduced to allow column breaks to be described 
 * in the same properties as page breaks: ‘break-before’, ‘break-after’, 
 * and ‘break-inside’. These properties take the same values as 
 * ‘page-break-before’, ‘page-break-after’, and ‘page-break-inside’ [CSS21]. 
 * In addition, some new keyword values are added.
 */

public class CssBreakInside extends CssProperty {

    CssValue value;

    static CssValue default_value;
    public static HashSet<CssIdent> acceptable_values;
    static {
	default_value = CssIdent.getIdent("auto");
	acceptable_values = new HashSet<CssIdent>();
	acceptable_values.add((CssIdent)default_value);
	acceptable_values.add(CssIdent.getIdent("avoid"));
	acceptable_values.add(CssIdent.getIdent("avoid-page"));
	acceptable_values.add(CssIdent.getIdent("avoid-column"));
    }

    /**
     * Create a new CssColumnWidth
     */
    public CssBreakInside() {
	value = default_value;
    }

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

	setByUser();
	CssValue val = expression.getValue();

	if(check && expression.getCount() > 1) {
	    throw new InvalidParamException("unrecognize", ac);
	}
	
	if ((val.getType() != CssTypes.CSS_IDENT) ||
	    !(((CssIdent)val).equals(inherit) || 
	      acceptable_values.contains((CssIdent)val))) {
	    throw new InvalidParamException("value",
					    expression.getValue(),
					    getPropertyName(), ac);
	}
	value = CssIdent.getIdent(((CssIdent)val).toString());
	expression.next();
    }

    public CssBreakInside(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).cssBreakInside != null)
	    style.addRedefinitionWarning(ac, this);
	((Css3Style) style).cssBreakInside = 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 ((Css3Style) style).getBreakInside();
	}
	else {
	    return ((Css3Style) style).cssBreakInside;
	}
    }

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

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

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

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

    /**
     * Returns a string representation of the object
     */
    public String toString() {
	return value.toString();
    }

    /**
     * Is the value of this property a default value
     * It is used by alle macro for the function <code>print</code>
     */
    public boolean isDefault() {
	return (value == default_value);
    }

}

--- NEW FILE: CssBreakAfter.java ---
//
// $Id: CssBreakAfter.java,v 1.1 2009/12/17 18:07:17 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.CssIdent;
import org.w3c.css.values.CssLength;
import org.w3c.css.values.CssNumber;
import org.w3c.css.values.CssTypes;
import org.w3c.css.values.CssValue;

/**
 * http://www.w3.org/TR/css3-multicol/
 *  <P>
 *  <EM>Value:</EM> auto | always | avoid | left | right | page | column | 
 *                  avoid-page | avoid-column <BR>
 *  <EM>Initial:</EM>auto<BR>
 *  <EM>Applies to:</EM>block-level elements<BR>
 *  <EM>Inherited:</EM>no<BR>
 *  <EM>Percentages:</EM>N/A<BR>
 *  <EM>Media:</EM>:paged
 *  <P>
 * When content is laid out in multiple columns, the user agent must 
 * determine where column breaks are placed. The problem of breaking content
 * into columns is similar to breaking content into pages.
 * Three new properties are introduced to allow column breaks to be described 
 * in the same properties as page breaks: ‘break-before’, ‘break-after’, 
 * and ‘break-inside’. These properties take the same values as 
 * ‘page-break-before’, ‘page-break-after’, and ‘page-break-inside’ [CSS21]. 
 * In addition, some new keyword values are added.
 */

public class CssBreakAfter extends CssProperty {

    CssValue value;

    /**
     * Create a new CssColumnWidth
     */
    public CssBreakAfter() {
	value = CssBreakBefore.default_value;
    }

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

	setByUser();
	CssValue val = expression.getValue();

	if(check && expression.getCount() > 1) {
	    throw new InvalidParamException("unrecognize", ac);
	}
	
	if ((val.getType() != CssTypes.CSS_IDENT) ||
	    !(((CssIdent)val).equals(inherit) || 
	      CssBreakBefore.acceptable_values.contains((CssIdent)val))) {
	    throw new InvalidParamException("value",
					    expression.getValue(),
					    getPropertyName(), ac);
	}
	value = CssIdent.getIdent(((CssIdent)val).toString());
	expression.next();
    }

    public CssBreakAfter(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).cssBreakAfter != null)
	    style.addRedefinitionWarning(ac, this);
	((Css3Style) style).cssBreakAfter = 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 ((Css3Style) style).getBreakAfter();
	}
	else {
	    return ((Css3Style) style).cssBreakAfter;
	}
    }

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

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

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

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

    /**
     * Returns a string representation of the object
     */
    public String toString() {
	return value.toString();
    }

    /**
     * Is the value of this property a default value
     * It is used by alle macro for the function <code>print</code>
     */
    public boolean isDefault() {
	return (value == CssBreakBefore.default_value);
    }

}

Received on Thursday, 17 December 2009 18:07:21 UTC