9
9
import org .w3c .css .util .InvalidParamException ;
10
10
import org .w3c .css .values .CssExpression ;
11
11
import org .w3c .css .values .CssIdent ;
12
+ import org .w3c .css .values .CssOperator ;
12
13
import org .w3c .css .values .CssTypes ;
13
14
import org .w3c .css .values .CssValue ;
15
+ import org .w3c .css .values .CssValueList ;
16
+
17
+ import java .util .ArrayList ;
14
18
15
19
/**
16
- * @spec https://www.w3.org/TR/2019/REC -css-writing-modes-3-20191210 /#propdef-text-combine-upright
20
+ * @spec https://www.w3.org/TR/2019/CR -css-writing-modes-4-20190730 /#propdef-text-combine-upright
17
21
*/
18
22
public class CssTextCombineUpright extends org .w3c .css .properties .css .CssTextCombineUpright {
19
23
20
24
public static final CssIdent [] allowed_values ;
25
+ public static final CssIdent digits ;
21
26
22
27
static {
23
- String [] _allowed_values = {"all" , "none" };
28
+ digits = CssIdent .getIdent ("digits" );
29
+ String [] _allowed_values = {"all" , "none" , "digits" };
24
30
allowed_values = new CssIdent [_allowed_values .length ];
25
31
int i = 0 ;
26
32
for (String s : _allowed_values ) {
@@ -54,13 +60,12 @@ public CssTextCombineUpright() {
54
60
* Creates a new CssTextCombineUpright
55
61
*
56
62
* @param expression The expression for this property
57
- * @throws org.w3c.css.util.InvalidParamException
58
- * Expressions are incorrect
63
+ * @throws org.w3c.css.util.InvalidParamException Expressions are incorrect
59
64
*/
60
65
public CssTextCombineUpright (ApplContext ac , CssExpression expression , boolean check )
61
66
throws InvalidParamException {
62
67
63
- if (check && expression .getCount () > 1 ) {
68
+ if (check && expression .getCount () > 2 ) {
64
69
throw new InvalidParamException ("unrecognize" , ac );
65
70
}
66
71
@@ -79,6 +84,34 @@ public CssTextCombineUpright(ApplContext ac, CssExpression expression, boolean c
79
84
throw new InvalidParamException ("value" , expression .getValue (),
80
85
getPropertyName (), ac );
81
86
}
87
+ if ((digits != value ) && (expression .getCount () > 1 )) {
88
+ throw new InvalidParamException ("unrecognize" , ac );
89
+ }
90
+ if (digits == value ) {
91
+ if (expression .getCount () > 1 ) {
92
+ char op = expression .getOperator ();
93
+ if (op != CssOperator .SPACE ) {
94
+ throw new InvalidParamException ("operator" ,
95
+ Character .toString (op ), ac );
96
+ }
97
+ expression .next ();
98
+ val = expression .getValue ();
99
+ if (val .getType () != CssTypes .CSS_NUMBER ) {
100
+ throw new InvalidParamException ("value" , expression .getValue (),
101
+ getPropertyName (), ac );
102
+ }
103
+ // we got a number.
104
+ val .getCheckableValue ().checkInteger (ac , this );
105
+ val .getCheckableValue ().checkStrictPositiveness (ac , this );
106
+ // in fact the restricted set of values is smaller than that.
107
+ // TODO check the interval.
108
+ // now rewrite the value
109
+ ArrayList <CssValue > v = new ArrayList <>();
110
+ v .add (value );
111
+ v .add (val );
112
+ value = new CssValueList (v );
113
+ }
114
+ }
82
115
}
83
116
expression .next ();
84
117
}
0 commit comments