|
13 | 13 | import org.w3c.css.values.CssValue; |
14 | 14 |
|
15 | 15 | /** |
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 |
17 | 17 | */ |
18 | 18 | public class CssTextAlign extends org.w3c.css.properties.css.CssTextAlign { |
19 | 19 |
|
@@ -60,19 +60,33 @@ public CssTextAlign(ApplContext ac, CssExpression expression, boolean check) |
60 | 60 | throw new InvalidParamException("unrecognize", ac); |
61 | 61 | } |
62 | 62 |
|
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); |
73 | 70 |
|
| 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); |
74 | 89 | } |
75 | | - value = val; |
76 | 90 | expression.next(); |
77 | 91 | } |
78 | 92 |
|
|
0 commit comments