|
1 | | -// $Id$ |
| 1 | +// |
2 | 2 | // Author: Yves Lafon <ylafon@w3.org> |
3 | 3 | // |
4 | | -// (c) COPYRIGHT MIT, ERCIM and Keio University, 2012. |
| 4 | +// (c) COPYRIGHT MIT, ERCIM, Keio, Beihang, 2012. |
5 | 5 | // Please first read the full copyright statement in file COPYRIGHT.html |
6 | 6 | package org.w3c.css.properties.css3; |
7 | 7 |
|
|
21 | 21 | import static org.w3c.css.values.CssOperator.SPACE; |
22 | 22 |
|
23 | 23 | /** |
24 | | - * @spec http://www.w3.org/TR/2012/WD-css3-fonts-20120823/#propdef-font-feature-settings |
| 24 | + * @spec https://www.w3.org/TR/2018/REC-css-fonts-3-20180920/#propdef-font-feature-settings |
25 | 25 | */ |
26 | 26 | public class CssFontFeatureSettings extends org.w3c.css.properties.css.CssFontFeatureSettings { |
27 | 27 |
|
28 | | - public static final CssIdent on, off; |
| 28 | + public static final CssIdent on, off, normal; |
29 | 29 |
|
30 | 30 | static { |
31 | 31 | on = CssIdent.getIdent("on"); |
32 | 32 | off = CssIdent.getIdent("off"); |
33 | | - |
| 33 | + normal = CssIdent.getIdent("normal"); |
34 | 34 | } |
35 | 35 |
|
36 | 36 | /** |
@@ -117,17 +117,25 @@ public CssValue check(ApplContext ac, CssExpression exp) |
117 | 117 | throw new InvalidParamException("unrecognize", ac); |
118 | 118 | } |
119 | 119 | val = exp.getValue(); |
120 | | - if (val.getType() == CssTypes.CSS_STRING) { |
121 | | - String s = val.toString(); |
122 | | - // limit of 4 characters + two surrounding quotes |
123 | | - if (s.length() != 6) { |
| 120 | + switch (val.getType()) { |
| 121 | + |
| 122 | + case CssTypes.CSS_STRING: |
| 123 | + String s = val.toString(); |
| 124 | + // limit of 4 characters + two surrounding quotes |
| 125 | + if (s.length() != 6) { |
| 126 | + throw new InvalidParamException("value", |
| 127 | + s, getPropertyName(), ac); |
| 128 | + } |
| 129 | + break; |
| 130 | + case CssTypes.CSS_IDENT: |
| 131 | + if (normal.equals(val) && exp.getCount() == 1) { |
| 132 | + return normal; |
| 133 | + } |
| 134 | + //else we throw |
| 135 | + default: |
124 | 136 | throw new InvalidParamException("value", |
125 | | - s, getPropertyName(), ac); |
126 | | - } |
127 | | - } else { |
128 | | - throw new InvalidParamException("value", |
129 | | - val.toString(), |
130 | | - getPropertyName(), ac); |
| 137 | + val.toString(), |
| 138 | + getPropertyName(), ac); |
131 | 139 | } |
132 | 140 | if (exp.getCount() == 1) { |
133 | 141 | return val; |
|
0 commit comments