diff --git a/org/w3c/css/properties/svg/CssAlignmentBaseline.java b/org/w3c/css/properties/svg/CssAlignmentBaseline.java index 2290adabb..e506a7113 100644 --- a/org/w3c/css/properties/svg/CssAlignmentBaseline.java +++ b/org/w3c/css/properties/svg/CssAlignmentBaseline.java @@ -51,8 +51,7 @@ public CssAlignmentBaseline() { * Creates a new CssAlignmentBaseline * * @param expression The expression for this property - * @throws org.w3c.css.util.InvalidParamException - * Expressions are incorrect + * @throws org.w3c.css.util.InvalidParamException Expressions are incorrect */ public CssAlignmentBaseline(ApplContext ac, CssExpression expression, boolean check) throws InvalidParamException { @@ -66,16 +65,19 @@ public CssAlignmentBaseline(ApplContext ac, CssExpression expression, boolean ch val = expression.getValue(); if (val.getType() == CssTypes.CSS_IDENT) { - CssIdent id = (CssIdent) val; - if (inherit.equals(id)) { - value = inherit; + CssIdent id = val.getIdent(); + if (CssIdent.isCssWide(id)) { + value = val; } else { - value = getAllowedIdent(id); - if (value == null) { + if (getAllowedIdent(id) == null) { // we also check if CSS version is CSS3 and onward. if (ac.getCssVersion().compareTo(CssVersion.CSS3) >= 0) { - value = org.w3c.css.properties.css3.CssAlignmentBaseline.getAllowedIdent(id); - } + if (org.w3c.css.properties.css3.CssAlignmentBaseline.getAllowedIdent(id) != null) { + value = val; + } + } + } else { + value = val; } if (value == null) { throw new InvalidParamException("value", diff --git a/org/w3c/css/properties/svg/CssBaselineShift.java b/org/w3c/css/properties/svg/CssBaselineShift.java index 7313c3770..1ebf8b370 100644 --- a/org/w3c/css/properties/svg/CssBaselineShift.java +++ b/org/w3c/css/properties/svg/CssBaselineShift.java @@ -44,8 +44,7 @@ public static final CssIdent getAllowedIdent(CssIdent ident) { * Creates a new CssBaselineShift * * @param expression The expression for this property - * @throws org.w3c.css.util.InvalidParamException - * Expressions are incorrect + * @throws org.w3c.css.util.InvalidParamException Expressions are incorrect */ public CssBaselineShift(ApplContext ac, CssExpression expression, boolean check) throws InvalidParamException { @@ -61,19 +60,19 @@ public CssBaselineShift(ApplContext ac, CssExpression expression, boolean check) switch (val.getType()) { case CssTypes.CSS_NUMBER: // zero is a valid length. otherwise it will fail. - val.getLength(); + val.getCheckableValue().checkEqualsZero(ac, getPropertyName()); case CssTypes.CSS_LENGTH: case CssTypes.CSS_PERCENTAGE: value = val; break; case CssTypes.CSS_IDENT: - CssIdent id = (CssIdent) val; - if (inherit.equals(id)) { - value = inherit; + CssIdent id = val.getIdent(); + if (CssIdent.isCssWide(id)) { + value = val; break; } - value = getAllowedIdent(id); - if (value != null) { + if (getAllowedIdent(id) != null) { + value = val; break; } // unrecognized ident -> fail. diff --git a/org/w3c/css/properties/svg/CssClipPath.java b/org/w3c/css/properties/svg/CssClipPath.java index e84ba6527..03ebef49d 100644 --- a/org/w3c/css/properties/svg/CssClipPath.java +++ b/org/w3c/css/properties/svg/CssClipPath.java @@ -89,8 +89,7 @@ public CssClipPath() { * Creates a new CssClipPath * * @param expression The expression for this property - * @throws org.w3c.css.util.InvalidParamException - * Expressions are incorrect + * @throws org.w3c.css.util.InvalidParamException Expressions are incorrect */ public CssClipPath(ApplContext ac, CssExpression expression, boolean check) throws InvalidParamException { @@ -110,7 +109,7 @@ public CssClipPath(ApplContext ac, CssExpression expression, boolean check) switch (val.getType()) { case CssTypes.CSS_FUNCTION: if (!gotBasicShape) { - CssFunction func = (CssFunction) val; + CssFunction func = val.getFunction(); String funcname = func.getName().toLowerCase(); switch (funcname) { case "inset": @@ -139,19 +138,19 @@ public CssClipPath(ApplContext ac, CssExpression expression, boolean check) value = val; break; case CssTypes.CSS_IDENT: - if (inherit.equals(val)) { - value = inherit; + CssIdent id = val.getIdent(); + if (CssIdent.isCssWide(id)) { + value = val; break; } - if (none.equals(val)) { - value = none; + if (none.equals(id)) { + value = val; break; } if (!gotGeometryBox) { - CssIdent ident = getGeometryBoxAllowedValue((CssIdent) val); - if (ident != null) { + if (getGeometryBoxAllowedValue(id) != null) { gotGeometryBox = true; - values.add(ident); + values.add(val); break; } } @@ -198,7 +197,7 @@ protected static void checkInsetFunction(ApplContext ac, CssExpression expressio } break; case CssTypes.CSS_IDENT: - if (inset_round.equals((CssIdent) val)) { + if (inset_round.equals(val.getIdent())) { // the remainder must be a border-radius CssExpression nex = new CssExpression(); expression.next(); @@ -253,9 +252,8 @@ protected static void checkCircleFunction(ApplContext ac, CssExpression expressi gotRadius = true; break; case CssTypes.CSS_IDENT: - CssIdent ident = (CssIdent) val; - CssIdent id = getShapeRadiusAllowedValue(ident); - if (id != null) { + CssIdent ident = val.getIdent(); + if (getShapeRadiusAllowedValue(ident) != null) { if (gotRadius) { throw new InvalidParamException("unrecognize", ac); } @@ -318,9 +316,8 @@ protected static void checkEllipseFunction(ApplContext ac, CssExpression express nbRadius++; break; case CssTypes.CSS_IDENT: - CssIdent ident = (CssIdent) val; - CssIdent id = getShapeRadiusAllowedValue(ident); - if (id != null) { + CssIdent ident = val.getIdent(); + if (getShapeRadiusAllowedValue(ident) != null) { if (nbRadius >= 2) { throw new InvalidParamException("unrecognize", ac); } @@ -385,9 +382,7 @@ protected static void checkPolygonFunction(ApplContext ac, CssExpression express case CssTypes.CSS_IDENT: // can only happen at the beginning. if (!gotFillRule && nbPoints == 0 && nbShapeArgs == 0) { - CssIdent ident = (CssIdent) val; - CssIdent id = CssFillRule.getAllowedIdent(ident); - if (id != null) { + if (CssFillRule.getAllowedIdent(val.getIdent()) != null) { gotFillRule = true; break; } diff --git a/org/w3c/css/properties/svg/CssClipRule.java b/org/w3c/css/properties/svg/CssClipRule.java index ab3cae031..43c6c7f3b 100644 --- a/org/w3c/css/properties/svg/CssClipRule.java +++ b/org/w3c/css/properties/svg/CssClipRule.java @@ -50,8 +50,7 @@ public CssClipRule() { * Creates a new CssClipRule * * @param expression The expression for this property - * @throws org.w3c.css.util.InvalidParamException - * Expressions are incorrect + * @throws org.w3c.css.util.InvalidParamException Expressions are incorrect */ public CssClipRule(ApplContext ac, CssExpression expression, boolean check) throws InvalidParamException { @@ -68,16 +67,13 @@ public CssClipRule(ApplContext ac, CssExpression expression, boolean check) getPropertyName(), ac); } // ident, so inherit, or allowed value - if (inherit.equals(val)) { - value = inherit; - } else { - val = getAllowedIdent((CssIdent) val); - if (val == null) { - throw new InvalidParamException("value", - expression.getValue(), - getPropertyName(), ac); - } + CssIdent id = val.getIdent(); + if (CssIdent.isCssWide(id) || getAllowedIdent(id) != null) { value = val; + } else { + throw new InvalidParamException("value", + expression.getValue(), + getPropertyName(), ac); } expression.next(); } diff --git a/org/w3c/css/properties/svg/CssColorInterpolation.java b/org/w3c/css/properties/svg/CssColorInterpolation.java index 16b21471f..5159ddffd 100644 --- a/org/w3c/css/properties/svg/CssColorInterpolation.java +++ b/org/w3c/css/properties/svg/CssColorInterpolation.java @@ -48,8 +48,7 @@ public CssColorInterpolation() { * Creates a new CssColorInterpolation * * @param expression The expression for this property - * @throws org.w3c.css.util.InvalidParamException - * Expressions are incorrect + * @throws org.w3c.css.util.InvalidParamException Expressions are incorrect */ public CssColorInterpolation(ApplContext ac, CssExpression expression, boolean check) throws InvalidParamException { @@ -64,18 +63,14 @@ public CssColorInterpolation(ApplContext ac, CssExpression expression, boolean c val = expression.getValue(); op = expression.getOperator(); - if (val.getType() == CssTypes.CSS_IDENT) { - CssIdent ident = (CssIdent) val; - if (inherit.equals(ident)) { - value = inherit; - } else { - value = getAllowedValue(ident); - if (value == null) { - throw new InvalidParamException("value", - val.toString(), - getPropertyName(), ac); - } - } + if (val.getType() != CssTypes.CSS_IDENT) { + throw new InvalidParamException("value", + expression.getValue(), + getPropertyName(), ac); + } + CssIdent ident = val.getIdent(); + if (CssIdent.isCssWide(ident) || (getAllowedValue(ident) != null)) { + value = val; } else { throw new InvalidParamException("value", val.toString(), diff --git a/org/w3c/css/properties/svg/CssColorProfile.java b/org/w3c/css/properties/svg/CssColorProfile.java index 59a1d5602..a817ed5fb 100644 --- a/org/w3c/css/properties/svg/CssColorProfile.java +++ b/org/w3c/css/properties/svg/CssColorProfile.java @@ -51,12 +51,13 @@ public CssColorProfile(ApplContext ac, CssExpression expression, boolean check) value = val; break; case CssTypes.CSS_IDENT: - if (inherit.equals(val)) { - value = inherit; + CssIdent id = val.getIdent(); + if (CssIdent.isCssWide(id)) { + value = val; break; } - if (sRBG.equals(val)) { - value = sRBG; + if (sRBG.equals(id)) { + value = val; break; } // or else it's a name diff --git a/org/w3c/css/properties/svg/CssColorRendering.java b/org/w3c/css/properties/svg/CssColorRendering.java index 69ab61c65..0bb8f2255 100644 --- a/org/w3c/css/properties/svg/CssColorRendering.java +++ b/org/w3c/css/properties/svg/CssColorRendering.java @@ -64,18 +64,14 @@ public CssColorRendering(ApplContext ac, CssExpression expression, boolean check val = expression.getValue(); op = expression.getOperator(); - if (val.getType() == CssTypes.CSS_IDENT) { - CssIdent ident = (CssIdent) val; - if (inherit.equals(ident)) { - value = inherit; - } else { - value = getAllowedValue(ident); - if (value == null) { - throw new InvalidParamException("value", - val.toString(), - getPropertyName(), ac); - } - } + if (val.getType() != CssTypes.CSS_IDENT) { + throw new InvalidParamException("value", + expression.getValue(), + getPropertyName(), ac); + } + CssIdent ident = val.getIdent(); + if (CssIdent.isCssWide(ident) || (getAllowedValue(ident) != null)) { + value = val; } else { throw new InvalidParamException("value", val.toString(), diff --git a/org/w3c/css/properties/svg/CssDominantBaseline.java b/org/w3c/css/properties/svg/CssDominantBaseline.java index f0c254440..d1100f201 100644 --- a/org/w3c/css/properties/svg/CssDominantBaseline.java +++ b/org/w3c/css/properties/svg/CssDominantBaseline.java @@ -65,16 +65,19 @@ public CssDominantBaseline(ApplContext ac, CssExpression expression, boolean che val = expression.getValue(); if (val.getType() == CssTypes.CSS_IDENT) { - CssIdent id = (CssIdent) val; - if (inherit.equals(id)) { - value = inherit; + CssIdent id = val.getIdent(); + if (CssIdent.isCssWide(id)) { + value = val; } else { - value = getAllowedIdent(id); - if (value == null) { + if (getAllowedIdent(id) == null) { // we also check if CSS version is CSS3 and onward. if (ac.getCssVersion().compareTo(CssVersion.CSS3) >= 0) { - value = org.w3c.css.properties.css3.CssDominantBaseline.getAllowedIdent(id); + if (org.w3c.css.properties.css3.CssDominantBaseline.getAllowedIdent(id) != null) { + value = val; + } } + } else { + value = val; } if (value == null) { throw new InvalidParamException("value", diff --git a/org/w3c/css/properties/svg/CssEnableBackground.java b/org/w3c/css/properties/svg/CssEnableBackground.java index f31fbb980..2260f3b73 100644 --- a/org/w3c/css/properties/svg/CssEnableBackground.java +++ b/org/w3c/css/properties/svg/CssEnableBackground.java @@ -67,26 +67,27 @@ public CssEnableBackground(ApplContext ac, CssExpression expression, boolean che values.add(val); break; case CssTypes.CSS_IDENT: - if (inherit.equals(val)) { + CssIdent id = val.getIdent(); + if (CssIdent.isCssWide(id)) { if (expression.getCount() > 1) { throw new InvalidParamException("value", val.toString(), getPropertyName(), ac); } - value = inherit; + value = val; break; } - if (accumulate.equals(val)) { + if (accumulate.equals(id)) { if (expression.getCount() > 1) { throw new InvalidParamException("value", val.toString(), getPropertyName(), ac); } - value = accumulate; + value = val; break; } - if (id_new.equals(val) && !got_new) { - values.add(id_new); + if (id_new.equals(id) && !got_new) { + values.add(val); got_new = true; break; } diff --git a/org/w3c/css/properties/svg/CssFill.java b/org/w3c/css/properties/svg/CssFill.java index 55c8c0575..d65faf785 100644 --- a/org/w3c/css/properties/svg/CssFill.java +++ b/org/w3c/css/properties/svg/CssFill.java @@ -43,8 +43,7 @@ public CssFill() { * Creates a new CssFill * * @param expression The expression for this property - * @throws org.w3c.css.util.InvalidParamException - * Expressions are incorrect + * @throws org.w3c.css.util.InvalidParamException Expressions are incorrect */ public CssFill(ApplContext ac, CssExpression expression, boolean check) throws InvalidParamException { @@ -168,7 +167,7 @@ static CssValue parsePaint(ApplContext ac, CssExpression expression, values.add(val); break; case CssTypes.CSS_FUNCTION: - CssFunction f = (CssFunction) val; + CssFunction f = val.getFunction(); if (gotColor || gotFuncIRI || gotIccColor) { throw new InvalidParamException("value", val.toString(), diff --git a/org/w3c/css/properties/svg/CssFillOpacity.java b/org/w3c/css/properties/svg/CssFillOpacity.java index 18b0c58ac..a8b952b65 100644 --- a/org/w3c/css/properties/svg/CssFillOpacity.java +++ b/org/w3c/css/properties/svg/CssFillOpacity.java @@ -9,6 +9,7 @@ import org.w3c.css.util.InvalidParamException; import org.w3c.css.util.Util; import org.w3c.css.values.CssExpression; +import org.w3c.css.values.CssIdent; import org.w3c.css.values.CssNumber; import org.w3c.css.values.CssTypes; import org.w3c.css.values.CssValue; @@ -72,8 +73,8 @@ public CssFillOpacity(ApplContext ac, CssExpression expression, boolean check) value = val; break; case CssTypes.CSS_IDENT: - if (inherit.equals(val)) { - value = inherit; + if (CssIdent.isCssWide(val.getIdent())) { + value = val; break; } default: diff --git a/org/w3c/css/properties/svg/CssFillRule.java b/org/w3c/css/properties/svg/CssFillRule.java index 834dce343..cbd5f4428 100644 --- a/org/w3c/css/properties/svg/CssFillRule.java +++ b/org/w3c/css/properties/svg/CssFillRule.java @@ -50,8 +50,7 @@ public CssFillRule() { * Creates a new CssFillRule * * @param expression The expression for this property - * @throws org.w3c.css.util.InvalidParamException - * Expressions are incorrect + * @throws org.w3c.css.util.InvalidParamException Expressions are incorrect */ public CssFillRule(ApplContext ac, CssExpression expression, boolean check) throws InvalidParamException { @@ -68,16 +67,13 @@ public CssFillRule(ApplContext ac, CssExpression expression, boolean check) getPropertyName(), ac); } // ident, so inherit, or allowed value - if (inherit.equals(val)) { - value = inherit; - } else { - val = getAllowedIdent((CssIdent) val); - if (val == null) { - throw new InvalidParamException("value", - expression.getValue(), - getPropertyName(), ac); - } + CssIdent id = val.getIdent(); + if (CssIdent.isCssWide(id) || getAllowedIdent(id) != null) { value = val; + } else { + throw new InvalidParamException("value", + expression.getValue(), + getPropertyName(), ac); } expression.next(); } diff --git a/org/w3c/css/properties/svg/CssGlyphOrientationHorizontal.java b/org/w3c/css/properties/svg/CssGlyphOrientationHorizontal.java index 8e85509d3..388ddb5d9 100644 --- a/org/w3c/css/properties/svg/CssGlyphOrientationHorizontal.java +++ b/org/w3c/css/properties/svg/CssGlyphOrientationHorizontal.java @@ -8,6 +8,7 @@ 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; @@ -52,8 +53,8 @@ public CssGlyphOrientationHorizontal(ApplContext ac, CssExpression expression, b value = val; break; case CssTypes.CSS_IDENT: - if (inherit.equals(val)) { - value = inherit; + if (CssIdent.isCssWide(val.getIdent())) { + value = val; break; } default: diff --git a/org/w3c/css/properties/svg/CssGlyphOrientationVertical.java b/org/w3c/css/properties/svg/CssGlyphOrientationVertical.java index d1cb84537..3c5413325 100644 --- a/org/w3c/css/properties/svg/CssGlyphOrientationVertical.java +++ b/org/w3c/css/properties/svg/CssGlyphOrientationVertical.java @@ -30,8 +30,7 @@ public CssGlyphOrientationVertical() { * Creates a new CssGlyphOrientationVertical * * @param expression The expression for this property - * @throws org.w3c.css.util.InvalidParamException - * Expressions are incorrect + * @throws org.w3c.css.util.InvalidParamException Expressions are incorrect */ public CssGlyphOrientationVertical(ApplContext ac, CssExpression expression, boolean check) throws InvalidParamException { @@ -55,12 +54,12 @@ public CssGlyphOrientationVertical(ApplContext ac, CssExpression expression, boo value = val; break; case CssTypes.CSS_IDENT: - if (inherit.equals(val)) { - value = inherit; + if (CssIdent.isCssWide(val.getIdent())) { + value = val; break; } - if (auto.equals(val)) { - value = auto; + if (auto.equals(val.getIdent())) { + value = val; break; } default: diff --git a/org/w3c/css/properties/svg/CssImageRendering.java b/org/w3c/css/properties/svg/CssImageRendering.java index cc91cf51f..6a7da3873 100644 --- a/org/w3c/css/properties/svg/CssImageRendering.java +++ b/org/w3c/css/properties/svg/CssImageRendering.java @@ -48,8 +48,7 @@ public CssImageRendering() { * Creates a new CssImageRendering * * @param expression The expression for this property - * @throws org.w3c.css.util.InvalidParamException - * Expressions are incorrect + * @throws org.w3c.css.util.InvalidParamException Expressions are incorrect */ public CssImageRendering(ApplContext ac, CssExpression expression, boolean check) throws InvalidParamException { @@ -64,18 +63,14 @@ public CssImageRendering(ApplContext ac, CssExpression expression, boolean check val = expression.getValue(); op = expression.getOperator(); - if (val.getType() == CssTypes.CSS_IDENT) { - CssIdent ident = (CssIdent) val; - if (inherit.equals(ident)) { - value = inherit; - } else { - value = getAllowedValue(ident); - if (value == null) { - throw new InvalidParamException("value", - val.toString(), - getPropertyName(), ac); - } - } + if (val.getType() != CssTypes.CSS_IDENT) { + throw new InvalidParamException("value", + expression.getValue(), + getPropertyName(), ac); + } + CssIdent ident = val.getIdent(); + if (CssIdent.isCssWide(ident) || (getAllowedValue(ident) != null)) { + value = val; } else { throw new InvalidParamException("value", val.toString(), diff --git a/org/w3c/css/properties/svg/CssKerning.java b/org/w3c/css/properties/svg/CssKerning.java index 4878b9de9..b80a61b72 100644 --- a/org/w3c/css/properties/svg/CssKerning.java +++ b/org/w3c/css/properties/svg/CssKerning.java @@ -54,12 +54,12 @@ public CssKerning(ApplContext ac, CssExpression expression, boolean check) value = val; break; case CssTypes.CSS_IDENT: - if (inherit.equals(val)) { - value = inherit; + if (CssIdent.isCssWide(val.getIdent())) { + value = val; break; } - if (auto.equals(val)) { - value = auto; + if (auto.equals(val.getIdent())) { + value = val; break; } default: diff --git a/org/w3c/css/properties/svg/CssMarker.java b/org/w3c/css/properties/svg/CssMarker.java index 20d9bb6ff..1b3b95804 100644 --- a/org/w3c/css/properties/svg/CssMarker.java +++ b/org/w3c/css/properties/svg/CssMarker.java @@ -9,6 +9,7 @@ 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; @@ -55,12 +56,10 @@ protected static CssValue checkMarkerValue(CssProperty property, ApplContext ac, case CssTypes.CSS_URL: break; case CssTypes.CSS_IDENT: - if (inherit.equals(val)) { - val = inherit; + if (CssIdent.isCssWide(val.getIdent())) { break; } - if (none.equals(val)) { - val = none; + if (none.equals(val.getIdent())) { break; } default: diff --git a/org/w3c/css/properties/svg/CssMask.java b/org/w3c/css/properties/svg/CssMask.java index b8acbe379..a4a1f7b78 100644 --- a/org/w3c/css/properties/svg/CssMask.java +++ b/org/w3c/css/properties/svg/CssMask.java @@ -8,6 +8,7 @@ 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; @@ -17,18 +18,17 @@ public class CssMask extends org.w3c.css.properties.css.CssMask { /** - * Create a new CssKerning + * Create a new CssMask */ public CssMask() { value = initial; } /** - * Creates a new CssKerning + * Creates a new CssMask * * @param expression The expression for this property - * @throws org.w3c.css.util.InvalidParamException - * Expressions are incorrect + * @throws org.w3c.css.util.InvalidParamException Expressions are incorrect */ public CssMask(ApplContext ac, CssExpression expression, boolean check) throws InvalidParamException { @@ -48,12 +48,12 @@ public CssMask(ApplContext ac, CssExpression expression, boolean check) value = val; break; case CssTypes.CSS_IDENT: - if (inherit.equals(val)) { - value = inherit; + if (CssIdent.isCssWide(val.getIdent())) { + value = val; break; } - if (none.equals(val)) { - value = none; + if (none.equals(val.getIdent())) { + value = val; break; } default: diff --git a/org/w3c/css/properties/svg/CssMaskBorderMode.java b/org/w3c/css/properties/svg/CssMaskBorderMode.java index 8df46b1d4..7c939029d 100644 --- a/org/w3c/css/properties/svg/CssMaskBorderMode.java +++ b/org/w3c/css/properties/svg/CssMaskBorderMode.java @@ -51,8 +51,7 @@ public CssMaskBorderMode() { * Creates a new CssMaskBorderMode * * @param expression The expression for this property - * @throws org.w3c.css.util.InvalidParamException - * Expressions are incorrect + * @throws org.w3c.css.util.InvalidParamException Expressions are incorrect */ public CssMaskBorderMode(ApplContext ac, CssExpression expression, boolean check) throws InvalidParamException { @@ -71,16 +70,12 @@ public CssMaskBorderMode(ApplContext ac, CssExpression expression, boolean check switch (val.getType()) { case CssTypes.CSS_IDENT: - if (inherit.equals(val)) { - if (expression.getCount() > 1) { - throw new InvalidParamException("unrecognize", ac); - } - value = inherit; + if (CssIdent.isCssWide(val.getIdent())) { + value = val; break; } - CssIdent id = getAllowedIdent((CssIdent) val); - if (id != null) { - value = id; + if (getAllowedIdent(val.getIdent()) != null) { + value = val; break; } default: diff --git a/org/w3c/css/properties/svg/CssMaskBorderOutset.java b/org/w3c/css/properties/svg/CssMaskBorderOutset.java index ccba91ef7..8922351e6 100644 --- a/org/w3c/css/properties/svg/CssMaskBorderOutset.java +++ b/org/w3c/css/properties/svg/CssMaskBorderOutset.java @@ -8,6 +8,7 @@ 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; import org.w3c.css.values.CssValueList; @@ -32,8 +33,7 @@ public CssMaskBorderOutset() { * Creates a new CssMaskBorderOutset * * @param expression The expression for this property - * @throws org.w3c.css.util.InvalidParamException - * Expressions are incorrect + * @throws org.w3c.css.util.InvalidParamException Expressions are incorrect */ public CssMaskBorderOutset(ApplContext ac, CssExpression expression, boolean check) throws InvalidParamException { @@ -59,11 +59,11 @@ public CssMaskBorderOutset(ApplContext ac, CssExpression expression, boolean che v.add(val); break; case CssTypes.CSS_IDENT: - if (inherit.equals(val)) { + if (CssIdent.isCssWide(val.getIdent())) { if (expression.getCount() > 1) { throw new InvalidParamException("unrecognize", ac); } - value = inherit; + value = val; break; } default: diff --git a/org/w3c/css/properties/svg/CssMaskBorderRepeat.java b/org/w3c/css/properties/svg/CssMaskBorderRepeat.java index c3c84bd9d..a44f6a56d 100644 --- a/org/w3c/css/properties/svg/CssMaskBorderRepeat.java +++ b/org/w3c/css/properties/svg/CssMaskBorderRepeat.java @@ -54,8 +54,7 @@ public CssMaskBorderRepeat() { * Creates a new CssMaskBorderRepeat * * @param expression The expression for this property - * @throws org.w3c.css.util.InvalidParamException - * Expressions are incorrect + * @throws org.w3c.css.util.InvalidParamException Expressions are incorrect */ public CssMaskBorderRepeat(ApplContext ac, CssExpression expression, boolean check) throws InvalidParamException { @@ -77,16 +76,16 @@ public CssMaskBorderRepeat(ApplContext ac, CssExpression expression, boolean che switch (val.getType()) { case CssTypes.CSS_IDENT: - if (inherit.equals(val)) { + CssIdent id = val.getIdent(); + if (CssIdent.isCssWide(id)) { if (expression.getCount() > 1) { throw new InvalidParamException("unrecognize", ac); } - value = inherit; + value = val; break; } - CssIdent id = getAllowedIdent((CssIdent) val); - if (id != null) { - v.add(id); + if (getAllowedIdent(id) != null) { + v.add(val); break; } default: diff --git a/org/w3c/css/properties/svg/CssMaskBorderSlice.java b/org/w3c/css/properties/svg/CssMaskBorderSlice.java index 0dc8392a8..097aa408d 100644 --- a/org/w3c/css/properties/svg/CssMaskBorderSlice.java +++ b/org/w3c/css/properties/svg/CssMaskBorderSlice.java @@ -35,8 +35,7 @@ public CssMaskBorderSlice() { * Creates a new CssMaskBorderSlice * * @param expression The expression for this property - * @throws org.w3c.css.util.InvalidParamException - * Expressions are incorrect + * @throws org.w3c.css.util.InvalidParamException Expressions are incorrect */ public CssMaskBorderSlice(ApplContext ac, CssExpression expression, boolean check) throws InvalidParamException { @@ -64,18 +63,19 @@ public CssMaskBorderSlice(ApplContext ac, CssExpression expression, boolean chec v.add(val); break; case CssTypes.CSS_IDENT: - if (inherit.equals(val)) { + CssIdent id = val.getIdent(); + if (CssIdent.isCssWide(id)) { if (expression.getCount() > 1) { throw new InvalidParamException("unrecognize", ac); } - value = inherit; + value = val; break; } - if (fill.equals(val)) { + if (fill.equals(id)) { if (nb_slice == 0 || expression.getRemainingCount() > 1) { throw new InvalidParamException("unrecognize", ac); } - v.add(fill); + v.add(val); break; } default: diff --git a/org/w3c/css/properties/svg/CssMaskBorderSource.java b/org/w3c/css/properties/svg/CssMaskBorderSource.java index ba83b7166..2d3bf175a 100644 --- a/org/w3c/css/properties/svg/CssMaskBorderSource.java +++ b/org/w3c/css/properties/svg/CssMaskBorderSource.java @@ -38,8 +38,7 @@ public CssMaskBorderSource() { * Creates a new CssMaskBorderSource * * @param expression The expression for this property - * @throws org.w3c.css.util.InvalidParamException - * Expressions are incorrect + * @throws org.w3c.css.util.InvalidParamException Expressions are incorrect */ public CssMaskBorderSource(ApplContext ac, CssExpression expression, boolean check) throws InvalidParamException { @@ -62,16 +61,16 @@ public CssMaskBorderSource(ApplContext ac, CssExpression expression, boolean che value = val; break; case CssTypes.CSS_IDENT: - if (inherit.equals(val)) { + CssIdent id = val.getIdent(); + if (CssIdent.isCssWide(id)) { if (expression.getCount() > 1) { throw new InvalidParamException("unrecognize", ac); } - value = inherit; + value = val; break; } - CssIdent id = getAllowedIdent((CssIdent) val); - if (id != null) { - value = id; + if (getAllowedIdent(id) != null) { + value = val; break; } default: diff --git a/org/w3c/css/properties/svg/CssMaskBorderWidth.java b/org/w3c/css/properties/svg/CssMaskBorderWidth.java index c03af5329..c84ce396c 100644 --- a/org/w3c/css/properties/svg/CssMaskBorderWidth.java +++ b/org/w3c/css/properties/svg/CssMaskBorderWidth.java @@ -35,8 +35,7 @@ public CssMaskBorderWidth() { * Creates a new CssMaskBorderWidth * * @param expression The expression for this property - * @throws org.w3c.css.util.InvalidParamException - * Expressions are incorrect + * @throws org.w3c.css.util.InvalidParamException Expressions are incorrect */ public CssMaskBorderWidth(ApplContext ac, CssExpression expression, boolean check) throws InvalidParamException { @@ -69,20 +68,21 @@ public CssMaskBorderWidth(ApplContext ac, CssExpression expression, boolean chec v.add(val); break; case CssTypes.CSS_IDENT: - if (inherit.equals(val)) { + CssIdent id = val.getIdent(); + if (CssIdent.isCssWide(id)) { if (expression.getCount() > 1) { throw new InvalidParamException("unrecognize", ac); } - value = inherit; + value = val; break; } - if (auto.equals(val)) { + if (auto.equals(id)) { if (nb_width >= 4) { throw new InvalidParamException("unrecognize", val.toString(), getPropertyName(), ac); } nb_width++; - v.add(auto); + v.add(val); break; } default: diff --git a/org/w3c/css/properties/svg/CssMaskClip.java b/org/w3c/css/properties/svg/CssMaskClip.java index 4e4a54ab0..18a16b3fd 100644 --- a/org/w3c/css/properties/svg/CssMaskClip.java +++ b/org/w3c/css/properties/svg/CssMaskClip.java @@ -47,8 +47,7 @@ public CssMaskClip() { * Creates a new CssMaskClip * * @param expression The expression for this property - * @throws org.w3c.css.util.InvalidParamException - * Expressions are incorrect + * @throws org.w3c.css.util.InvalidParamException Expressions are incorrect */ public CssMaskClip(ApplContext ac, CssExpression expression, boolean check) throws InvalidParamException { @@ -65,16 +64,16 @@ public CssMaskClip(ApplContext ac, CssExpression expression, boolean check) switch (val.getType()) { case CssTypes.CSS_IDENT: - if (inherit.equals(val)) { + CssIdent id = val.getIdent(); + if (CssIdent.isCssWide(id)) { if (expression.getCount() > 1) { throw new InvalidParamException("unrecognize", ac); } - value = inherit; + value = val; break; } - CssIdent id = getAllowedIdent((CssIdent) val); - if (id != null) { - v.add(id); + if (getAllowedIdent(id) != null) { + v.add(val); break; } default: diff --git a/org/w3c/css/properties/svg/CssMaskComposite.java b/org/w3c/css/properties/svg/CssMaskComposite.java index aff196513..77b68b469 100644 --- a/org/w3c/css/properties/svg/CssMaskComposite.java +++ b/org/w3c/css/properties/svg/CssMaskComposite.java @@ -54,8 +54,7 @@ public CssMaskComposite() { * Creates a new CssMaskComposite * * @param expression The expression for this property - * @throws org.w3c.css.util.InvalidParamException - * Expressions are incorrect + * @throws org.w3c.css.util.InvalidParamException Expressions are incorrect */ public CssMaskComposite(ApplContext ac, CssExpression expression, boolean check) throws InvalidParamException { @@ -72,16 +71,16 @@ public CssMaskComposite(ApplContext ac, CssExpression expression, boolean check) switch (val.getType()) { case CssTypes.CSS_IDENT: - if (inherit.equals(val)) { + CssIdent id = val.getIdent(); + if (CssIdent.isCssWide(id)) { if (expression.getCount() > 1) { throw new InvalidParamException("unrecognize", ac); } - value = inherit; + value = val; break; } - CssIdent id = getAllowedIdent((CssIdent) val); - if (id != null) { - v.add(id); + if (getAllowedIdent(id) != null) { + v.add(val); break; } default: diff --git a/org/w3c/css/properties/svg/CssMaskImage.java b/org/w3c/css/properties/svg/CssMaskImage.java index c9875d583..b6b1a632d 100644 --- a/org/w3c/css/properties/svg/CssMaskImage.java +++ b/org/w3c/css/properties/svg/CssMaskImage.java @@ -41,8 +41,7 @@ public CssMaskImage() { * Creates a new CssMaskImage * * @param expression The expression for this property - * @throws org.w3c.css.util.InvalidParamException - * Expressions are incorrect + * @throws org.w3c.css.util.InvalidParamException Expressions are incorrect */ public CssMaskImage(ApplContext ac, CssExpression expression, boolean check) throws InvalidParamException { @@ -63,16 +62,16 @@ public CssMaskImage(ApplContext ac, CssExpression expression, boolean check) v.add(val); break; case CssTypes.CSS_IDENT: - if (inherit.equals(val)) { + CssIdent id = val.getIdent(); + if (CssIdent.isCssWide(id)) { if (expression.getCount() > 1) { throw new InvalidParamException("unrecognize", ac); } - value = inherit; + value = val; break; } - CssIdent id = getAllowedIdent((CssIdent) val); - if (id != null) { - v.add(id); + if (getAllowedIdent(id) != null) { + v.add(val); break; } default: diff --git a/org/w3c/css/properties/svg/CssMaskMode.java b/org/w3c/css/properties/svg/CssMaskMode.java index 7a3a4b424..e4737bc5a 100644 --- a/org/w3c/css/properties/svg/CssMaskMode.java +++ b/org/w3c/css/properties/svg/CssMaskMode.java @@ -54,8 +54,7 @@ public CssMaskMode() { * Creates a new CssMaskMode * * @param expression The expression for this property - * @throws org.w3c.css.util.InvalidParamException - * Expressions are incorrect + * @throws org.w3c.css.util.InvalidParamException Expressions are incorrect */ public CssMaskMode(ApplContext ac, CssExpression expression, boolean check) throws InvalidParamException { @@ -72,16 +71,16 @@ public CssMaskMode(ApplContext ac, CssExpression expression, boolean check) switch (val.getType()) { case CssTypes.CSS_IDENT: - if (inherit.equals(val)) { + CssIdent id = val.getIdent(); + if (CssIdent.isCssWide(id)) { if (expression.getCount() > 1) { throw new InvalidParamException("unrecognize", ac); } - value = inherit; + value = val; break; } - CssIdent id = getAllowedIdent((CssIdent) val); - if (id != null) { - v.add(id); + if (getAllowedIdent(id) != null) { + v.add(val); break; } default: diff --git a/org/w3c/css/properties/svg/CssMaskOrigin.java b/org/w3c/css/properties/svg/CssMaskOrigin.java index cea2784f7..dfe362803 100644 --- a/org/w3c/css/properties/svg/CssMaskOrigin.java +++ b/org/w3c/css/properties/svg/CssMaskOrigin.java @@ -38,8 +38,7 @@ public CssMaskOrigin() { * Creates a new CssMaskOrigin * * @param expression The expression for this property - * @throws org.w3c.css.util.InvalidParamException - * Expressions are incorrect + * @throws org.w3c.css.util.InvalidParamException Expressions are incorrect */ public CssMaskOrigin(ApplContext ac, CssExpression expression, boolean check) throws InvalidParamException { @@ -56,15 +55,15 @@ public CssMaskOrigin(ApplContext ac, CssExpression expression, boolean check) switch (val.getType()) { case CssTypes.CSS_IDENT: - if (inherit.equals(val)) { + CssIdent id = val.getIdent(); + if (CssIdent.isCssWide(id)) { if (expression.getCount() > 1) { throw new InvalidParamException("unrecognize", ac); } - value = inherit; + value = val; break; } - CssIdent id = getAllowedIdent((CssIdent) val); - if (id != null) { + if (getAllowedIdent(id) != null) { v.add(id); break; } diff --git a/org/w3c/css/properties/svg/CssMaskType.java b/org/w3c/css/properties/svg/CssMaskType.java index 18ed154d3..fdd7310f5 100644 --- a/org/w3c/css/properties/svg/CssMaskType.java +++ b/org/w3c/css/properties/svg/CssMaskType.java @@ -49,8 +49,7 @@ public CssMaskType() { * Creates a new CssMaskType * * @param expression The expression for this property - * @throws org.w3c.css.util.InvalidParamException - * Expressions are incorrect + * @throws org.w3c.css.util.InvalidParamException Expressions are incorrect */ public CssMaskType(ApplContext ac, CssExpression expression, boolean check) throws InvalidParamException { @@ -63,13 +62,13 @@ public CssMaskType(ApplContext ac, CssExpression expression, boolean check) switch (val.getType()) { case CssTypes.CSS_IDENT: - if (inherit.equals(val)) { - value = inherit; + CssIdent id = val.getIdent(); + if (CssIdent.isCssWide(id)) { + value = val; break; } - CssIdent id = getAllowedIdent((CssIdent) val); - if (id != null) { - value = id; + if (getAllowedIdent(id) != null) { + value = val; break; } default: diff --git a/org/w3c/css/properties/svg/CssPointerEvents.java b/org/w3c/css/properties/svg/CssPointerEvents.java index ef6b03075..2392d34fd 100644 --- a/org/w3c/css/properties/svg/CssPointerEvents.java +++ b/org/w3c/css/properties/svg/CssPointerEvents.java @@ -51,8 +51,7 @@ public CssPointerEvents() { * Creates a new CssPointerEvents * * @param expression The expression for this property - * @throws org.w3c.css.util.InvalidParamException - * Expressions are incorrect + * @throws org.w3c.css.util.InvalidParamException Expressions are incorrect */ public CssPointerEvents(ApplContext ac, CssExpression expression, boolean check) throws InvalidParamException { @@ -68,20 +67,19 @@ public CssPointerEvents(ApplContext ac, CssExpression expression, boolean check) op = expression.getOperator(); if (val.getType() == CssTypes.CSS_IDENT) { - CssIdent ident = (CssIdent) val; - if (inherit.equals(ident)) { - value = inherit; + CssIdent ident = val.getIdent(); + if (CssIdent.isCssWide(ident)) { + value = val; } else if (auto.equals(ident)) { - value = auto; + value = val; ac.getFrame().addWarning("value-unofficial", // new String[]{"auto", "pointer-events"}); + } else if (getAllowedValue(ident) != null) { + value = val; } else { - value = getAllowedValue(ident); - if (value == null) { - throw new InvalidParamException("value", - val.toString(), - getPropertyName(), ac); - } + throw new InvalidParamException("value", + val.toString(), + getPropertyName(), ac); } } else { throw new InvalidParamException("value", diff --git a/org/w3c/css/properties/svg/CssShapeRendering.java b/org/w3c/css/properties/svg/CssShapeRendering.java index a34b32cbf..07f7af1bd 100644 --- a/org/w3c/css/properties/svg/CssShapeRendering.java +++ b/org/w3c/css/properties/svg/CssShapeRendering.java @@ -48,8 +48,7 @@ public CssShapeRendering() { * Creates a new CssShapeRendering * * @param expression The expression for this property - * @throws org.w3c.css.util.InvalidParamException - * Expressions are incorrect + * @throws org.w3c.css.util.InvalidParamException Expressions are incorrect */ public CssShapeRendering(ApplContext ac, CssExpression expression, boolean check) throws InvalidParamException { @@ -65,16 +64,13 @@ public CssShapeRendering(ApplContext ac, CssExpression expression, boolean check op = expression.getOperator(); if (val.getType() == CssTypes.CSS_IDENT) { - CssIdent ident = (CssIdent) val; - if (inherit.equals(ident)) { - value = inherit; + CssIdent ident = val.getIdent(); + if (CssIdent.isCssWide(ident) || getAllowedValue(ident) != null) { + value = val; } else { - value = getAllowedValue(ident); - if (value == null) { - throw new InvalidParamException("value", - val.toString(), - getPropertyName(), ac); - } + throw new InvalidParamException("value", + val.toString(), + getPropertyName(), ac); } } else { throw new InvalidParamException("value", diff --git a/org/w3c/css/properties/svg/CssStopColor.java b/org/w3c/css/properties/svg/CssStopColor.java index 3b1223c7e..e71711e54 100644 --- a/org/w3c/css/properties/svg/CssStopColor.java +++ b/org/w3c/css/properties/svg/CssStopColor.java @@ -74,21 +74,22 @@ static CssValue parseColor(ApplContext ac, CssExpression expression, switch (val.getType()) { case CssTypes.CSS_IDENT: - if (inherit.equals(val)) { - value = inherit; + CssIdent id = val.getIdent(); + if (CssIdent.isCssWide(id)) { + value = val; if (expression.getCount() > 1) { throw new InvalidParamException("value", val.toString(), property.getPropertyName(), ac); } } - if (currentColor.equals(val)) { + if (currentColor.equals(id)) { if (expression.getCount() > 1) { throw new InvalidParamException("value", val.toString(), property.getPropertyName(), ac); } - values.add(currentColor); + values.add(val); } if (expression.getCount() > 1) { throw new InvalidParamException("value", @@ -115,7 +116,7 @@ static CssValue parseColor(ApplContext ac, CssExpression expression, case CSS_2015: case CSS: default: - values.add((new org.w3c.css.properties.css3.CssColor(ac, nex, check)).getColor()); + values.add((new org.w3c.css.properties.css3.CssColor(ac, nex, check)).getValue()); break; } gotColor = true; @@ -127,9 +128,9 @@ static CssValue parseColor(ApplContext ac, CssExpression expression, property.getPropertyName(), ac); } CssColor c = new CssColor(); - c.setShortRGBColor(ac, val.toString()); + c.setShortRGBColor(ac, val.getHashIdent().toString()); gotColor = true; - values.add(c); + values.add(val); break; case CssTypes.CSS_COLOR: if (gotColor) { @@ -141,7 +142,7 @@ static CssValue parseColor(ApplContext ac, CssExpression expression, values.add(val); break; case CssTypes.CSS_FUNCTION: - CssFunction f = (CssFunction) val; + CssFunction f = val.getFunction(); if (gotColor || gotIccColor) { throw new InvalidParamException("value", val.toString(), diff --git a/org/w3c/css/properties/svg/CssStopOpacity.java b/org/w3c/css/properties/svg/CssStopOpacity.java index 060620b28..dd517f332 100644 --- a/org/w3c/css/properties/svg/CssStopOpacity.java +++ b/org/w3c/css/properties/svg/CssStopOpacity.java @@ -9,6 +9,7 @@ import org.w3c.css.util.InvalidParamException; import org.w3c.css.util.Util; import org.w3c.css.values.CssExpression; +import org.w3c.css.values.CssIdent; import org.w3c.css.values.CssNumber; import org.w3c.css.values.CssTypes; import org.w3c.css.values.CssValue; @@ -42,8 +43,7 @@ public CssStopOpacity() { * Creates a new CssStopOpacity * * @param expression The expression for this property - * @throws org.w3c.css.util.InvalidParamException - * Expressions are incorrect + * @throws org.w3c.css.util.InvalidParamException Expressions are incorrect */ public CssStopOpacity(ApplContext ac, CssExpression expression, boolean check) throws InvalidParamException { @@ -72,8 +72,8 @@ public CssStopOpacity(ApplContext ac, CssExpression expression, boolean check) value = val; break; case CssTypes.CSS_IDENT: - if (inherit.equals(val)) { - value = inherit; + if (CssIdent.isCssWide(val.getIdent())) { + value = val; break; } default: diff --git a/org/w3c/css/properties/svg/CssStrokeDasharray.java b/org/w3c/css/properties/svg/CssStrokeDasharray.java index 8316381bb..bd0ebde45 100644 --- a/org/w3c/css/properties/svg/CssStrokeDasharray.java +++ b/org/w3c/css/properties/svg/CssStrokeDasharray.java @@ -8,6 +8,7 @@ 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.CssOperator; import org.w3c.css.values.CssTypes; import org.w3c.css.values.CssValue; @@ -31,8 +32,7 @@ public CssStrokeDasharray() { * Creates a new CssStrokeDasharray * * @param expression The expression for this property - * @throws org.w3c.css.util.InvalidParamException - * Expressions are incorrect + * @throws org.w3c.css.util.InvalidParamException Expressions are incorrect */ public CssStrokeDasharray(ApplContext ac, CssExpression expression, boolean check) throws InvalidParamException { @@ -60,12 +60,13 @@ public CssStrokeDasharray(ApplContext ac, CssExpression expression, boolean chec val.toString(), getPropertyName(), ac); } - if (inherit.equals(val)) { - value = inherit; + CssIdent id = val.getIdent(); + if (CssIdent.isCssWide(id)) { + value = val; break; } - if (none.equals(val)) { - value = none; + if (none.equals(id)) { + value = val; break; } default: diff --git a/org/w3c/css/properties/svg/CssStrokeDashoffset.java b/org/w3c/css/properties/svg/CssStrokeDashoffset.java index 559698c3e..951213d13 100644 --- a/org/w3c/css/properties/svg/CssStrokeDashoffset.java +++ b/org/w3c/css/properties/svg/CssStrokeDashoffset.java @@ -8,6 +8,7 @@ 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; @@ -28,8 +29,7 @@ public CssStrokeDashoffset() { * Creates a new CssStrokeDashoffset * * @param expression The expression for this property - * @throws org.w3c.css.util.InvalidParamException - * Expressions are incorrect + * @throws org.w3c.css.util.InvalidParamException Expressions are incorrect */ public CssStrokeDashoffset(ApplContext ac, CssExpression expression, boolean check) throws InvalidParamException { @@ -51,8 +51,8 @@ public CssStrokeDashoffset(ApplContext ac, CssExpression expression, boolean che value = val; break; case CssTypes.CSS_IDENT: - if (inherit.equals(val)) { - value = inherit; + if (CssIdent.isCssWide(val.getIdent())) { + value = val; break; } default: diff --git a/org/w3c/css/properties/svg/CssStrokeLinecap.java b/org/w3c/css/properties/svg/CssStrokeLinecap.java index bec18fd95..d3dd7bea7 100644 --- a/org/w3c/css/properties/svg/CssStrokeLinecap.java +++ b/org/w3c/css/properties/svg/CssStrokeLinecap.java @@ -50,8 +50,7 @@ public CssStrokeLinecap() { * Creates a new CssStrokeLinecap * * @param expression The expression for this property - * @throws org.w3c.css.util.InvalidParamException - * Expressions are incorrect + * @throws org.w3c.css.util.InvalidParamException Expressions are incorrect */ public CssStrokeLinecap(ApplContext ac, CssExpression expression, boolean check) throws InvalidParamException { @@ -68,17 +67,13 @@ public CssStrokeLinecap(ApplContext ac, CssExpression expression, boolean check) getPropertyName(), ac); } // ident, so inherit, or allowed value - if (inherit.equals(val)) { - value = inherit; - } else { - val = getAllowedIdent((CssIdent) val); - if (val == null) { - throw new InvalidParamException("value", - expression.getValue(), - getPropertyName(), ac); - } - value = val; + CssIdent id = val.getIdent(); + if (!CssIdent.isCssWide(id) && getAllowedIdent(id) == null) { + throw new InvalidParamException("value", + expression.getValue(), + getPropertyName(), ac); } + value = val; expression.next(); } diff --git a/org/w3c/css/properties/svg/CssStrokeLinejoin.java b/org/w3c/css/properties/svg/CssStrokeLinejoin.java index bff6bbcee..f40fccfd5 100644 --- a/org/w3c/css/properties/svg/CssStrokeLinejoin.java +++ b/org/w3c/css/properties/svg/CssStrokeLinejoin.java @@ -68,17 +68,13 @@ public CssStrokeLinejoin(ApplContext ac, CssExpression expression, boolean check getPropertyName(), ac); } // ident, so inherit, or allowed value - if (inherit.equals(val)) { - value = inherit; - } else { - val = getAllowedIdent((CssIdent) val); - if (val == null) { - throw new InvalidParamException("value", - expression.getValue(), - getPropertyName(), ac); - } - value = val; + CssIdent id = val.getIdent(); + if (!CssIdent.isCssWide(id) && getAllowedIdent(id) == null) { + throw new InvalidParamException("value", + expression.getValue(), + getPropertyName(), ac); } + value = val; expression.next(); } diff --git a/org/w3c/css/properties/svg/CssStrokeMiterlimit.java b/org/w3c/css/properties/svg/CssStrokeMiterlimit.java index dcaed3992..d6c310742 100644 --- a/org/w3c/css/properties/svg/CssStrokeMiterlimit.java +++ b/org/w3c/css/properties/svg/CssStrokeMiterlimit.java @@ -8,6 +8,7 @@ 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; @@ -28,8 +29,7 @@ public CssStrokeMiterlimit() { * Creates a new CssStrokeMiterlimit * * @param expression The expression for this property - * @throws org.w3c.css.util.InvalidParamException - * Expressions are incorrect + * @throws org.w3c.css.util.InvalidParamException Expressions are incorrect */ public CssStrokeMiterlimit(ApplContext ac, CssExpression expression, boolean check) throws InvalidParamException { @@ -53,8 +53,8 @@ public CssStrokeMiterlimit(ApplContext ac, CssExpression expression, boolean che value = val; break; case CssTypes.CSS_IDENT: - if (inherit.equals(val)) { - value = inherit; + if (CssIdent.isCssWide(val.getIdent())) { + value = val; break; } default: diff --git a/org/w3c/css/properties/svg/CssStrokeOpacity.java b/org/w3c/css/properties/svg/CssStrokeOpacity.java index aa77c7f57..b71a5819e 100644 --- a/org/w3c/css/properties/svg/CssStrokeOpacity.java +++ b/org/w3c/css/properties/svg/CssStrokeOpacity.java @@ -9,6 +9,7 @@ import org.w3c.css.util.InvalidParamException; import org.w3c.css.util.Util; import org.w3c.css.values.CssExpression; +import org.w3c.css.values.CssIdent; import org.w3c.css.values.CssNumber; import org.w3c.css.values.CssTypes; import org.w3c.css.values.CssValue; @@ -42,8 +43,7 @@ public CssStrokeOpacity() { * Creates a new CssStrokeOpacity * * @param expression The expression for this property - * @throws org.w3c.css.util.InvalidParamException - * Expressions are incorrect + * @throws org.w3c.css.util.InvalidParamException Expressions are incorrect */ public CssStrokeOpacity(ApplContext ac, CssExpression expression, boolean check) throws InvalidParamException { @@ -72,8 +72,8 @@ public CssStrokeOpacity(ApplContext ac, CssExpression expression, boolean check) value = val; break; case CssTypes.CSS_IDENT: - if (inherit.equals(val)) { - value = inherit; + if (CssIdent.isCssWide(val.getIdent())) { + value = val; break; } default: diff --git a/org/w3c/css/properties/svg/CssStrokeWidth.java b/org/w3c/css/properties/svg/CssStrokeWidth.java index 9248def0c..c59fc7da5 100644 --- a/org/w3c/css/properties/svg/CssStrokeWidth.java +++ b/org/w3c/css/properties/svg/CssStrokeWidth.java @@ -8,6 +8,7 @@ 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; @@ -27,8 +28,7 @@ public CssStrokeWidth() { * Creates a new CssStrokeWidth * * @param expression The expression for this property - * @throws org.w3c.css.util.InvalidParamException - * Expressions are incorrect + * @throws org.w3c.css.util.InvalidParamException Expressions are incorrect */ public CssStrokeWidth(ApplContext ac, CssExpression expression, boolean check) throws InvalidParamException { @@ -51,8 +51,8 @@ public CssStrokeWidth(ApplContext ac, CssExpression expression, boolean check) value = val; break; case CssTypes.CSS_IDENT: - if (inherit.equals(val)) { - value = inherit; + if (CssIdent.isCssWide(val.getIdent())) { + value = val; break; } default: diff --git a/org/w3c/css/properties/svg/CssTextAnchor.java b/org/w3c/css/properties/svg/CssTextAnchor.java index 884206ff6..55dadb8da 100644 --- a/org/w3c/css/properties/svg/CssTextAnchor.java +++ b/org/w3c/css/properties/svg/CssTextAnchor.java @@ -28,7 +28,7 @@ public class CssTextAnchor extends org.w3c.css.properties.css.CssTextAnchor { } } - public static final CssIdent getAllowedValue(CssIdent ident) { + public static final CssIdent getAllowedIdent(CssIdent ident) { for (CssIdent id : allowed_values) { if (id.equals(ident)) { return id; @@ -48,8 +48,7 @@ public CssTextAnchor() { * Creates a new CssTextAnchor * * @param expression The expression for this property - * @throws org.w3c.css.util.InvalidParamException - * Expressions are incorrect + * @throws org.w3c.css.util.InvalidParamException Expressions are incorrect */ public CssTextAnchor(ApplContext ac, CssExpression expression, boolean check) throws InvalidParamException { @@ -64,23 +63,19 @@ public CssTextAnchor(ApplContext ac, CssExpression expression, boolean check) val = expression.getValue(); op = expression.getOperator(); - if (val.getType() == CssTypes.CSS_IDENT) { - CssIdent ident = (CssIdent) val; - if (inherit.equals(ident)) { - value = inherit; - } else { - value = getAllowedValue(ident); - if (value == null) { - throw new InvalidParamException("value", - val.toString(), - getPropertyName(), ac); - } - } - } else { + if (val.getType() != CssTypes.CSS_IDENT) { + throw new InvalidParamException("value", + expression.getValue(), + getPropertyName(), ac); + } + // ident, so inherit, or allowed value + CssIdent id = val.getIdent(); + if (!CssIdent.isCssWide(id) && getAllowedIdent(id) == null) { throw new InvalidParamException("value", - val.toString(), + expression.getValue(), getPropertyName(), ac); } + value = val; expression.next(); } diff --git a/org/w3c/css/properties/svg/CssTextRendering.java b/org/w3c/css/properties/svg/CssTextRendering.java index 849c53d39..295a62268 100644 --- a/org/w3c/css/properties/svg/CssTextRendering.java +++ b/org/w3c/css/properties/svg/CssTextRendering.java @@ -29,7 +29,7 @@ public class CssTextRendering extends org.w3c.css.properties.css.CssTextRenderin } } - public static final CssIdent getAllowedValue(CssIdent ident) { + public static final CssIdent getAllowedIdent(CssIdent ident) { for (CssIdent id : allowed_values) { if (id.equals(ident)) { return id; @@ -65,23 +65,19 @@ public CssTextRendering(ApplContext ac, CssExpression expression, boolean check) val = expression.getValue(); op = expression.getOperator(); - if (val.getType() == CssTypes.CSS_IDENT) { - CssIdent ident = (CssIdent) val; - if (inherit.equals(ident)) { - value = inherit; - } else { - value = getAllowedValue(ident); - if (value == null) { - throw new InvalidParamException("value", - val.toString(), - getPropertyName(), ac); - } - } - } else { + if (val.getType() != CssTypes.CSS_IDENT) { + throw new InvalidParamException("value", + expression.getValue(), + getPropertyName(), ac); + } + // ident, so inherit, or allowed value + CssIdent id = val.getIdent(); + if (!CssIdent.isCssWide(id) && getAllowedIdent(id) == null) { throw new InvalidParamException("value", - val.toString(), + expression.getValue(), getPropertyName(), ac); } + value = val; expression.next(); } diff --git a/org/w3c/css/properties/svg/CssWritingMode.java b/org/w3c/css/properties/svg/CssWritingMode.java index 50bd52db1..2dc81ca55 100644 --- a/org/w3c/css/properties/svg/CssWritingMode.java +++ b/org/w3c/css/properties/svg/CssWritingMode.java @@ -49,8 +49,7 @@ public CssWritingMode() { * Creates a new CssWritingMode * * @param expression The expression for this property - * @throws org.w3c.css.util.InvalidParamException - * Expressions are incorrect + * @throws org.w3c.css.util.InvalidParamException Expressions are incorrect */ public CssWritingMode(ApplContext ac, CssExpression expression, boolean check) throws InvalidParamException { @@ -67,23 +66,20 @@ public CssWritingMode(ApplContext ac, CssExpression expression, boolean check) if (val.getType() == CssTypes.CSS_IDENT) { boolean isCss3 = (ac.getCssVersion().compareTo(CssVersion.CSS3) >= 0); - CssIdent ident = (CssIdent) val; - if (inherit.equals(ident)) { - value = inherit; + CssIdent ident = val.getIdent(); + if (CssIdent.isCssWide(ident)) { + value = val; } else { - value = getAllowedIdent(ident); CssIdent css3ident = null; if (isCss3) { css3ident = org.w3c.css.properties.css3.CssWritingMode.getAllowedIdent(ident); } - if (value == null && css3ident == null) { + if (getAllowedIdent(ident) == null && css3ident == null) { throw new InvalidParamException("value", val.toString(), getPropertyName(), ac); } - if (value == null) { - value = css3ident; - } + value = val; if (css3ident == null && isCss3) { // Css3 and onward, the SVG values are deprecated, add a warning ac.getFrame().addWarning("deprecated", getPropertyName());