Skip to content

Commit 71be88e

Browse files
committed
check the 'normal' value, this fixes #224
1 parent a1d36c2 commit 71be88e

File tree

1 file changed

+23
-15
lines changed

1 file changed

+23
-15
lines changed

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

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
// $Id$
1+
//
22
// Author: Yves Lafon <ylafon@w3.org>
33
//
4-
// (c) COPYRIGHT MIT, ERCIM and Keio University, 2012.
4+
// (c) COPYRIGHT MIT, ERCIM, Keio, Beihang, 2012.
55
// Please first read the full copyright statement in file COPYRIGHT.html
66
package org.w3c.css.properties.css3;
77

@@ -21,16 +21,16 @@
2121
import static org.w3c.css.values.CssOperator.SPACE;
2222

2323
/**
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
2525
*/
2626
public class CssFontFeatureSettings extends org.w3c.css.properties.css.CssFontFeatureSettings {
2727

28-
public static final CssIdent on, off;
28+
public static final CssIdent on, off, normal;
2929

3030
static {
3131
on = CssIdent.getIdent("on");
3232
off = CssIdent.getIdent("off");
33-
33+
normal = CssIdent.getIdent("normal");
3434
}
3535

3636
/**
@@ -117,17 +117,25 @@ public CssValue check(ApplContext ac, CssExpression exp)
117117
throw new InvalidParamException("unrecognize", ac);
118118
}
119119
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:
124136
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);
131139
}
132140
if (exp.getCount() == 1) {
133141
return val;

0 commit comments

Comments
 (0)