2002/css-validator/org/w3c/css/properties/css3 Css3Style.java,1.45,1.46 CssWordBreak.java,1.3,1.4

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

Modified Files:
	Css3Style.java CssWordBreak.java 
Log Message:
word-break per http://www.w3.org/TR/2012/WD-css3-text-20120814/#word-break0

Index: CssWordBreak.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css3/CssWordBreak.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- CssWordBreak.java	5 Jan 2010 13:49:56 -0000	1.3
+++ CssWordBreak.java	30 Aug 2012 12:51:56 -0000	1.4
@@ -1,178 +1,93 @@
-//
 // $Id$
-// From Sijtsche de Jong (sy.de.jong@let.rug.nl)
+// Author: Yves Lafon <ylafon@w3.org>
 //
-// (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
-
+// (c) COPYRIGHT MIT, ERCIM and Keio University, 2012.
+// Please first read the full copyright statement in file COPYRIGHT.html
 package org.w3c.css.properties.css3;
 
-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;
-import org.w3c.css.values.CssOperator;
+import org.w3c.css.values.CssIdent;
+import org.w3c.css.values.CssTypes;
 import org.w3c.css.values.CssValue;
 
 /**
- *  <P>
- *  <EM>Value:</EM> normal || &lt;word-break-CJK&gt; || &lt;word-break-wrap&gt; ||
- *  word-break-inside || inherit<BR>
- *  <EM>Initial:</EM>normal<BR>
- *  <EM>Applies to:</EM>block-level elements<BR>
- *  <EM>Inherited:</EM>yes<BR>
- *  <EM>Percentages:</EM>no<BR>
- *  <EM>Media:</EM>:visual
- *  <P>
- *  The 'word-break' property is a shorthand property for setting
- *  'word-break-CJK', 'word-break-wrap' and 'word-break-inside', at the same
- *  place in the style sheet.
+ * @spec http://www.w3.org/TR/2012/WD-css3-text-20120814/#word-break0
  */
+public class CssWordBreak extends org.w3c.css.properties.css.CssOverflowWrap {
 
-public class CssWordBreak extends CssProperty
-implements CssOperator {
-
-    CssWordBreakCJK wbc;
-    CssWordBreakInside wbi;
-    CssValue wordbreak;
-
-    /**
-     * Create a new CssWordBreak
-     */
-    public CssWordBreak() {
-    }
-
-    /**
-     * Create a new CssWordBreak
-     *
-     * @param expression The expression for this property
-     * @exception InvalidParamException Incorrect value
-     */
-    public CssWordBreak(ApplContext ac, CssExpression expression,
-	    boolean check) throws InvalidParamException {
-
-	CssValue val = expression.getValue();
-	int maxvalues = 3;
-	boolean correct = true;
-	char op = SPACE;
-
-	while (correct && (val != null) && (maxvalues-- > 0)) {
-
-	    correct = false;
+	public static final CssIdent[] allowed_values;
 
-	    if (wbc == null) {
-		try {
-		    wbc = new CssWordBreakCJK(ac, expression);
-		    correct = true;
-		}
-		catch (InvalidParamException e) {
-		}
-	    }
-	    if (!correct && wbi == null) {
-		try {
-		    wbi = new CssWordBreakInside(ac, expression);
-		    correct = true;
-		}
-		catch (InvalidParamException e) {
+	static {
+		String[] _allowed_values = {"normal", "keep-all", "break-all"};
+		allowed_values = new CssIdent[_allowed_values.length];
+		int i = 0;
+		for (String s : _allowed_values) {
+			allowed_values[i++] = CssIdent.getIdent(s);
 		}
-	    }
-	    if (!correct) {
-		throw new InvalidParamException("value", expression.getValue(),
-						getPropertyName(), ac);
-	    }
-
-	    val = expression.getValue();
-	    op = expression.getOperator();
-
 	}
 
-	if (wbc == null) {
-	    wbc = new CssWordBreakCJK();
-	}
-	if (wbi == null) {
-	    wbi = new CssWordBreakInside();
+	public static final CssIdent getAllowedValue(CssIdent ident) {
+		for (CssIdent id : allowed_values) {
+			if (id.equals(ident)) {
+				return id;
+			}
+		}
+		return null;
 	}
 
-    }
-
-    public CssWordBreak(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).cssWordBreak != null)
-	    style.addRedefinitionWarning(ac, this);
-	((Css3Style) style).cssWordBreak = 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).getWordBreak();
-	}
-	else {
-	    return ((Css3Style) style).cssWordBreak;
+	/**
+	 * Create a new CssOverflowWrap
+	 */
+	public CssWordBreak() {
+		value = initial;
 	}
-    }
 
-    /**
-     * 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 "word-break";
-    }
+	/**
+	 * Creates a new CssOverflowWrap
+	 *
+	 * @param expression The expression for this property
+	 * @throws org.w3c.css.util.InvalidParamException
+	 *          Expressions are incorrect
+	 */
+	public CssWordBreak(ApplContext ac, CssExpression expression, boolean check)
+			throws InvalidParamException {
+		if (check && expression.getCount() > 1) {
+			throw new InvalidParamException("unrecognize", ac);
+		}
+		setByUser();
 
-    /**
-     * Returns the value of this property
-     */
-    public Object get() {
-	return null;
-    }
+		CssValue val;
+		char op;
 
-    /**
-     * Returns a string representation of the object
-     */
-    public String toString() {
+		val = expression.getValue();
+		op = expression.getOperator();
 
-	String ret = "";
-	if (wbc.isByUser()) {
-	    ret += " " + wbc;
-	}
-	if (wbi.isByUser()) {
-	    ret += " " + wbi;
+		if (val.getType() == CssTypes.CSS_IDENT) {
+			CssIdent ident = (CssIdent) val;
+			if (inherit.equals(ident)) {
+				value = inherit;
+			} else {
+				value = getAllowedValue(ident);
+				if (value == null) {
+					throw new InvalidParamException("value",
+							val.toString(),
+							getPropertyName(), ac);
+				}
+			}
+		} else {
+			throw new InvalidParamException("value",
+					val.toString(),
+					getPropertyName(), ac);
+		}
+		expression.next();
 	}
-	return ret.substring(1);
 
-    }
-
-    //    /**
-    // * 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 wordbreak == normal;
-    //}
+	public CssWordBreak(ApplContext ac, CssExpression expression)
+			throws InvalidParamException {
+		this(ac, expression, false);
+	}
 
 }
+

Index: Css3Style.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css3/Css3Style.java,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -d -r1.45 -r1.46
--- Css3Style.java	30 Aug 2012 12:26:45 -0000	1.45
+++ Css3Style.java	30 Aug 2012 12:51:56 -0000	1.46
@@ -40,6 +40,7 @@
 import org.w3c.css.properties.css.CssFontVariantPosition;
 import org.w3c.css.properties.css.CssOpacity;
 import org.w3c.css.properties.css.CssOverflowWrap;
+import org.w3c.css.properties.css.CssWordBreak;
 import org.w3c.css.util.ApplContext;
 import org.w3c.css.util.Util;
 import org.w3c.css.util.Warning;
@@ -65,9 +66,6 @@
 	CssAlignmentAdjust cssAlignmentAdjust;
 	CssBaselineShift cssBaselineShift;
 	CssLineBreak cssLineBreak;
-	CssWordBreakCJK cssWordBreakCJK;
-	CssWordBreakInside cssWordBreakInside;
-	CssWordBreak cssWordBreak;
 	CssTextSpace cssTextSpace;
 	CssTextEndOverflow cssTextEndOverflow;
 	CssTextAfterOverflow cssTextAfterOverflow;
@@ -137,6 +135,7 @@
 	public CssFontVariantAlternates cssFontVariantAlternates;
 
 	public CssOverflowWrap cssOverflowWrap;
+	public CssWordBreak cssWordBreak;
 
 	CssDropInitialAfterAdjust cssDropInitialAfterAdjust;
 	CssDropInitialAfterAlign cssDropInitialAfterAlign;
@@ -367,24 +366,6 @@
 		return cssLineBreak;
 	}
 
-	public CssWordBreakCJK getWordBreakCJK() {
-		if (cssWordBreakCJK == null) {
-			cssWordBreakCJK =
-					(CssWordBreakCJK) style.CascadingOrder(
-							new CssWordBreakCJK(), style, selector);
-		}
-		return cssWordBreakCJK;
-	}
-
-	public CssWordBreakInside getWordBreakInside() {
-		if (cssWordBreakInside == null) {
-			cssWordBreakInside =
-					(CssWordBreakInside) style.CascadingOrder(
-							new CssWordBreakInside(), style, selector);
-		}
-		return cssWordBreakInside;
-	}
-
 	public CssWordBreak getWordBreak() {
 		if (cssWordBreak == null) {
 			cssWordBreak =
@@ -1393,7 +1374,7 @@
 		return cssFontVariantAlternates;
 	}
 
-	public CssOverflowWrap getOverflowWrap() {
+	public org.w3c.css.properties.css.CssOverflowWrap getOverflowWrap() {
 		if (cssOverflowWrap == null) {
 			cssOverflowWrap =
 					(CssOverflowWrap) style.CascadingOrder(

Received on Thursday, 30 August 2012 12:52:00 UTC