Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions org/w3c/css/properties/svg/CssAlignmentBaseline.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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",
Expand Down
15 changes: 7 additions & 8 deletions org/w3c/css/properties/svg/CssBaselineShift.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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.
Expand Down
35 changes: 15 additions & 20 deletions org/w3c/css/properties/svg/CssClipPath.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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":
Expand Down Expand Up @@ -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;
}
}
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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;
}
Expand Down
18 changes: 7 additions & 11 deletions org/w3c/css/properties/svg/CssClipRule.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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();
}
Expand Down
23 changes: 9 additions & 14 deletions org/w3c/css/properties/svg/CssColorInterpolation.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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(),
Expand Down
9 changes: 5 additions & 4 deletions org/w3c/css/properties/svg/CssColorProfile.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 8 additions & 12 deletions org/w3c/css/properties/svg/CssColorRendering.java
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
15 changes: 9 additions & 6 deletions org/w3c/css/properties/svg/CssDominantBaseline.java
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
13 changes: 7 additions & 6 deletions org/w3c/css/properties/svg/CssEnableBackground.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
5 changes: 2 additions & 3 deletions org/w3c/css/properties/svg/CssFill.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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(),
Expand Down
5 changes: 3 additions & 2 deletions org/w3c/css/properties/svg/CssFillOpacity.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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:
Expand Down
Loading