|
21 | 21 | import org.w3c.css.util.WarningParamException; |
22 | 22 | import org.w3c.css.values.CssExpression; |
23 | 23 | import org.w3c.css.values.CssIdent; |
| 24 | +import org.w3c.css.values.CssTypes; |
24 | 25 |
|
25 | 26 | import java.lang.reflect.Constructor; |
26 | 27 | import java.lang.reflect.InvocationTargetException; |
@@ -261,18 +262,22 @@ public synchronized CssProperty createProperty(ApplContext ac, AtRule atRule, St |
261 | 262 | throw new WarningParamException("css-hack", expression.toStringFromStart()); |
262 | 263 | } |
263 | 264 |
|
264 | | - CssIdent initial = CssIdent.getIdent("initial"); |
265 | | - CssIdent unset = CssIdent.getIdent("unset"); |
266 | | - |
267 | 265 | try { |
268 | | - if ((ac.getCssVersion().compareTo(CssVersion.CSS3) >= 0) && (expression.getCount() == 1) |
269 | | - && (expression.getValue().equals(initial) || expression.getValue().equals(unset))) { |
| 266 | + boolean isCssWide = false; |
| 267 | + CssIdent cssIdent = null; |
| 268 | + if ((expression.getCount() == 1) && (expression.getValue().getRawType() == CssTypes.CSS_IDENT)) { |
| 269 | + cssIdent = expression.getValue().getIdent(); |
| 270 | + isCssWide = CssIdent.isCssWide(cssIdent); |
| 271 | + } |
| 272 | + if ((ac.getCssVersion().compareTo(CssVersion.CSS3) >= 0) && isCssWide) { |
270 | 273 | // create an instance of your property class |
271 | 274 | Class[] parametersType = {}; |
272 | 275 | Constructor constructor = Class.forName(classname).getConstructor(parametersType); |
273 | 276 | Object[] parameters = {}; |
274 | 277 | // invoke the constructor |
275 | | - return (CssProperty) constructor.newInstance(parameters); |
| 278 | + CssProperty p = (CssProperty) constructor.newInstance(parameters); |
| 279 | + p.value = cssIdent; |
| 280 | + return p; |
276 | 281 | } else { |
277 | 282 | // create an instance of your property class |
278 | 283 | Class[] parametersType = {ac.getClass(), expression.getClass(), boolean.class}; |
|
0 commit comments