1212import org .w3c .css .values .CssOperator ;
1313import org .w3c .css .values .CssTypes ;
1414import org .w3c .css .values .CssValue ;
15- import org .w3c .css .values .CssValueList ;
1615
1716import java .util .ArrayList ;
1817
1918/**
20- * @spec https://www.w3.org/TR/2017 /WD-css-text-3-20170822/# word-spacing-property
19+ * @spec https://www.w3.org/TR/2018 /WD-css-text-3-20181212/#propdef- word-spacing
2120 */
2221public class CssWordSpacing extends org .w3c .css .properties .css .CssWordSpacing {
2322
@@ -40,7 +39,7 @@ public CssWordSpacing() {
4039 public CssWordSpacing (ApplContext ac , CssExpression expression ,
4140 boolean check ) throws InvalidParamException {
4241
43- if (check && expression .getCount () > 3 ) {
42+ if (check && expression .getCount () > 1 ) {
4443 throw new InvalidParamException ("unrecognize" , ac );
4544 }
4645 setByUser ();
@@ -49,45 +48,32 @@ public CssWordSpacing(ApplContext ac, CssExpression expression,
4948 CssValue val ;
5049 char op ;
5150
52- while (!expression .end ()) {
53- val = expression .getValue ();
54- op = expression .getOperator ();
51+ val = expression .getValue ();
52+ op = expression .getOperator ();
5553
56- switch (val .getType ()) {
57- case CssTypes .CSS_NUMBER :
58- val .getCheckableValue ().checkEqualsZero (ac , this );
59- case CssTypes .CSS_LENGTH :
60- v .add (val );
54+ switch (val .getType ()) {
55+ case CssTypes .CSS_NUMBER :
56+ val .getCheckableValue ().checkEqualsZero (ac , this );
57+ case CssTypes .CSS_LENGTH :
58+ value = val ;
59+ break ;
60+ case CssTypes .CSS_IDENT :
61+ if (inherit .equals (val )) {
62+ value = inherit ;
6163 break ;
62- case CssTypes . CSS_PERCENTAGE :
63- v . add ( val ) ;
64+ } else if ( normal . equals ( val )) {
65+ value = normal ;
6466 break ;
65- case CssTypes .CSS_IDENT :
66- if (inherit .equals (val )) {
67- // inherit can only be alone
68- if (expression .getCount () > 1 ) {
69- throw new InvalidParamException ("value" , expression .getValue (),
70- getPropertyName (), ac );
71- }
72- value = inherit ;
73- break ;
74- } else if (normal .equals (val )) {
75- v .add (normal );
76- break ;
77- }
78- default :
79- throw new InvalidParamException ("value" , expression .getValue (),
80- getPropertyName (), ac );
81- }
82- if (op != CssOperator .SPACE ) {
83- throw new InvalidParamException ("operator" ,
84- ((new Character (op )).toString ()), ac );
85- }
86- expression .next ();
67+ }
68+ default :
69+ throw new InvalidParamException ("value" , expression .getValue (),
70+ getPropertyName (), ac );
8771 }
88- if (value != inherit ) {
89- value = (v .size () == 1 ) ? v .get (0 ) : new CssValueList (v );
72+ if (op != CssOperator .SPACE ) {
73+ throw new InvalidParamException ("operator" ,
74+ ((new Character (op )).toString ()), ac );
9075 }
76+ expression .next ();
9177 }
9278
9379 public CssWordSpacing (ApplContext ac , CssExpression expression )
0 commit comments