// // Author: Yves Lafon // // (c) COPYRIGHT MIT, ERCIM, Keio, Beihang, 2017. // Please first read the full copyright statement in file COPYRIGHT.html package org.w3c.css.properties.css3.counterstyle; import org.w3c.css.util.ApplContext; import org.w3c.css.util.InvalidParamException; import org.w3c.css.values.CssExpression; import org.w3c.css.values.CssIdent; import org.w3c.css.values.CssTypes; import org.w3c.css.values.CssValue; /** * @spec https://www.w3.org/TR/2015/CR-css-counter-styles-3-20150611/#descdef-counter-style-fallback */ public class CssFallback extends org.w3c.css.properties.css.counterstyle.CssFallback { /** * Create a new CssFallback */ public CssFallback() { value = initial; } /** * Creates a new CssFallback * * @param expression The expression for this property * @throws org.w3c.css.util.InvalidParamException * Expressions are incorrect */ public CssFallback(ApplContext ac, CssExpression expression, boolean check) throws InvalidParamException { if (check && expression.getCount() > 1) { throw new InvalidParamException("unrecognize", ac); } setByUser(); CssIdent ident; CssValue val; val = expression.getValue(); if (val.getType() == CssTypes.CSS_IDENT) { ident = (CssIdent) val; // unreserved ident only if (CssIdent.isCssWide(ident)) { throw new InvalidParamException("value", val.toString(), getPropertyName(), ac); } value = ident; } else { throw new InvalidParamException("value", val.toString(), getPropertyName(), ac); } expression.next(); } public CssFallback(ApplContext ac, CssExpression expression) throws InvalidParamException { this(ac, expression, false); } }