Skip to content

Commit f1bbfb6

Browse files
committed
changes from css-writing-modes-3 REC to css-writing-modes-4 CR
1 parent 220a8f5 commit f1bbfb6

File tree

2 files changed

+42
-9
lines changed

2 files changed

+42
-9
lines changed

org/w3c/css/properties/css3/CssTextCombineUpright.java

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,24 @@
99
import org.w3c.css.util.InvalidParamException;
1010
import org.w3c.css.values.CssExpression;
1111
import org.w3c.css.values.CssIdent;
12+
import org.w3c.css.values.CssOperator;
1213
import org.w3c.css.values.CssTypes;
1314
import org.w3c.css.values.CssValue;
15+
import org.w3c.css.values.CssValueList;
16+
17+
import java.util.ArrayList;
1418

1519
/**
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
1721
*/
1822
public class CssTextCombineUpright extends org.w3c.css.properties.css.CssTextCombineUpright {
1923

2024
public static final CssIdent[] allowed_values;
25+
public static final CssIdent digits;
2126

2227
static {
23-
String[] _allowed_values = {"all", "none"};
28+
digits = CssIdent.getIdent("digits");
29+
String[] _allowed_values = {"all", "none", "digits"};
2430
allowed_values = new CssIdent[_allowed_values.length];
2531
int i = 0;
2632
for (String s : _allowed_values) {
@@ -54,13 +60,12 @@ public CssTextCombineUpright() {
5460
* Creates a new CssTextCombineUpright
5561
*
5662
* @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
5964
*/
6065
public CssTextCombineUpright(ApplContext ac, CssExpression expression, boolean check)
6166
throws InvalidParamException {
6267

63-
if (check && expression.getCount() > 1) {
68+
if (check && expression.getCount() > 2) {
6469
throw new InvalidParamException("unrecognize", ac);
6570
}
6671

@@ -79,6 +84,34 @@ public CssTextCombineUpright(ApplContext ac, CssExpression expression, boolean c
7984
throw new InvalidParamException("value", expression.getValue(),
8085
getPropertyName(), ac);
8186
}
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+
}
82115
}
83116
expression.next();
84117
}

org/w3c/css/properties/css3/CssWritingMode.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,15 @@
1313
import org.w3c.css.values.CssValue;
1414

1515
/**
16-
* @spec https://www.w3.org/TR/2019/REC-css-writing-modes-3-20191210/#propdef-writing-mode
16+
* @spec https://www.w3.org/TR/2019/CR-css-writing-modes-4-20190730/#propdef-writing-mode
1717
*/
1818
public class CssWritingMode extends org.w3c.css.properties.css.CssWritingMode {
1919

2020
public static final CssIdent[] allowed_values;
2121

2222
static {
23-
String[] _allowed_values = {"horizontal-tb", "vertical-rl", "vertical-lr"};
23+
String[] _allowed_values = {"horizontal-tb", "vertical-rl", "vertical-lr",
24+
"sideways-rl", "sideways-lr"};
2425
allowed_values = new CssIdent[_allowed_values.length];
2526
int i = 0;
2627
for (String s : _allowed_values) {
@@ -48,8 +49,7 @@ public CssWritingMode() {
4849
* Creates a new CssWritingMode
4950
*
5051
* @param expression The expression for this property
51-
* @throws org.w3c.css.util.InvalidParamException
52-
* Expressions are incorrect
52+
* @throws org.w3c.css.util.InvalidParamException Expressions are incorrect
5353
*/
5454
public CssWritingMode(ApplContext ac, CssExpression expression, boolean check)
5555
throws InvalidParamException {

0 commit comments

Comments
 (0)