Skip to content

Commit 1433c43

Browse files
committed
1 parent 3b01237 commit 1433c43

File tree

1 file changed

+26
-12
lines changed

1 file changed

+26
-12
lines changed

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

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

1515
/**
16-
* @spec https://www.w3.org/TR/2021/CRD-css-text-3-20210422/#propdef-text-align
16+
* @spec https://www.w3.org/TR/2024/WD-css-text-4-20240219/#propdef-text-align
1717
*/
1818
public class CssTextAlign extends org.w3c.css.properties.css.CssTextAlign {
1919

@@ -60,19 +60,33 @@ public CssTextAlign(ApplContext ac, CssExpression expression, boolean check)
6060
throw new InvalidParamException("unrecognize", ac);
6161
}
6262

63-
if (val.getType() != CssTypes.CSS_IDENT) {
64-
throw new InvalidParamException("value",
65-
expression.getValue(),
66-
getPropertyName(), ac);
67-
}
68-
CssIdent id = val.getIdent();
69-
if (!CssIdent.isCssWide(id) && getAllowedIdent(id) == null) {
70-
throw new InvalidParamException("value",
71-
expression.getValue(),
72-
getPropertyName(), ac);
63+
switch (val.getType()) {
64+
case CssTypes.CSS_IDENT:
65+
CssIdent id = val.getIdent();
66+
if (!CssIdent.isCssWide(id) && getAllowedIdent(id) == null) {
67+
throw new InvalidParamException("value",
68+
expression.getValue(),
69+
getPropertyName(), ac);
7370

71+
}
72+
value = val;
73+
break;
74+
case CssTypes.CSS_STRING:
75+
if (val.getRawType() == CssTypes.CSS_STRING) {
76+
// string length must be 1, so 3 including delimiters
77+
if (val.toString().length() > 3) {
78+
throw new InvalidParamException("value",
79+
expression.getValue(),
80+
getPropertyName(), ac);
81+
}
82+
}
83+
value = val;
84+
break;
85+
default:
86+
throw new InvalidParamException("value",
87+
expression.getValue(),
88+
getPropertyName(), ac);
7489
}
75-
value = val;
7690
expression.next();
7791
}
7892

0 commit comments

Comments
 (0)