Skip to content

Commit dfa68e1

Browse files
committed
proper check for css-wide idents (cont.)
1 parent 90d4aff commit dfa68e1

22 files changed

+57
-77
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import org.w3c.css.util.InvalidParamException;
1010
import org.w3c.css.values.CssCheckableValue;
1111
import org.w3c.css.values.CssExpression;
12+
import org.w3c.css.values.CssIdent;
1213
import org.w3c.css.values.CssTypes;
1314
import org.w3c.css.values.CssValue;
1415

@@ -52,7 +53,7 @@ public CssTabSize(ApplContext ac, CssExpression expression, boolean check)
5253
value = val;
5354
break;
5455
case CssTypes.CSS_IDENT:
55-
if (inherit.equals(val.getIdent())) {
56+
if (CssIdent.isCssWide(val.getIdent())) {
5657
value = val;
5758
break;
5859
}

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

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ public CssTableLayout() {
4848
* Creates a new CssTableLayout
4949
*
5050
* @param expression The expression for this property
51-
* @throws org.w3c.css.util.InvalidParamException
52-
* Expressions are incorrect
51+
* @throws org.w3c.css.util.InvalidParamException Expressions are incorrect
5352
*/
5453
public CssTableLayout(ApplContext ac, CssExpression expression, boolean check)
5554
throws InvalidParamException {
@@ -64,23 +63,19 @@ public CssTableLayout(ApplContext ac, CssExpression expression, boolean check)
6463
val = expression.getValue();
6564
op = expression.getOperator();
6665

67-
if (val.getType() == CssTypes.CSS_IDENT) {
68-
CssIdent id = val.getIdent();
69-
if (inherit.equals(id)) {
70-
value = val;
71-
} else {
72-
if (getAllowedIdent(id) == null) {
73-
throw new InvalidParamException("value",
74-
val.toString(),
75-
getPropertyName(), ac);
76-
}
77-
value = val;
78-
}
79-
} else {
66+
if (val.getType() != CssTypes.CSS_IDENT) {
67+
throw new InvalidParamException("value",
68+
val.toString(),
69+
getPropertyName(), ac);
70+
}
71+
CssIdent id = val.getIdent();
72+
if (!CssIdent.isCssWide(id) && getAllowedIdent(id) == null) {
8073
throw new InvalidParamException("value",
8174
val.toString(),
8275
getPropertyName(), ac);
76+
8377
}
78+
value = val;
8479
expression.next();
8580
}
8681

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

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,14 @@ public CssTextAlign(ApplContext ac, CssExpression expression, boolean check)
6565
expression.getValue(),
6666
getPropertyName(), ac);
6767
}
68-
if (inherit.equals(val.getIdent())) {
69-
value = val;
70-
} else {
71-
if (getAllowedIdent(val.getIdent()) == null) {
72-
throw new InvalidParamException("value",
73-
expression.getValue(),
74-
getPropertyName(), ac);
75-
}
76-
value = val;
68+
CssIdent id = val.getIdent();
69+
if (!CssIdent.isCssWide(id) && getAllowedIdent(id) == null) {
70+
throw new InvalidParamException("value",
71+
expression.getValue(),
72+
getPropertyName(), ac);
73+
7774
}
75+
value = val;
7876
expression.next();
7977
}
8078

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

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ public CssTextAlignAll() {
4848
* Creates a new CssTextAlignAll
4949
*
5050
* @param expression The expression for this property
51-
* @throws org.w3c.css.util.InvalidParamException
52-
* Expressions are incorrect
51+
* @throws org.w3c.css.util.InvalidParamException Expressions are incorrect
5352
*/
5453
public CssTextAlignAll(ApplContext ac, CssExpression expression, boolean check)
5554
throws InvalidParamException {
@@ -65,16 +64,14 @@ public CssTextAlignAll(ApplContext ac, CssExpression expression, boolean check)
6564
expression.getValue(),
6665
getPropertyName(), ac);
6766
}
68-
if (inherit.equals(val.getIdent())) {
69-
value = val;
70-
} else {
71-
if (getAllowedIdent(val.getIdent()) == null) {
72-
throw new InvalidParamException("value",
73-
expression.getValue(),
74-
getPropertyName(), ac);
75-
}
76-
value = val;
67+
CssIdent id = val.getIdent();
68+
if (!CssIdent.isCssWide(id) && getAllowedIdent(id) == null) {
69+
throw new InvalidParamException("value",
70+
expression.getValue(),
71+
getPropertyName(), ac);
72+
7773
}
74+
value = val;
7875
expression.next();
7976
}
8077

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

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@ public CssTextAlignLast() {
5050
* Creates a new CssTextAlignLast
5151
*
5252
* @param expression The expression for this property
53-
* @throws org.w3c.css.util.InvalidParamException
54-
* Expressions are incorrect
53+
* @throws org.w3c.css.util.InvalidParamException Expressions are incorrect
5554
*/
5655
public CssTextAlignLast(ApplContext ac, CssExpression expression, boolean check)
5756
throws InvalidParamException {
@@ -68,16 +67,12 @@ public CssTextAlignLast(ApplContext ac, CssExpression expression, boolean check)
6867
getPropertyName(), ac);
6968
}
7069
// ident, so inherit, or allowed value
71-
if (inherit.equals(val.getIdent())) {
72-
value = val;
73-
} else {
74-
if (getMatchingIdent(val.getIdent()) == null) {
75-
throw new InvalidParamException("value",
76-
expression.getValue(),
77-
getPropertyName(), ac);
78-
}
79-
value = val;
70+
if (!CssIdent.isCssWide(val.getIdent()) && getMatchingIdent(val.getIdent()) == null) {
71+
throw new InvalidParamException("value",
72+
expression.getValue(),
73+
getPropertyName(), ac);
8074
}
75+
value = val;
8176
expression.next();
8277
}
8378

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public CssTextCombineUpright(ApplContext ac, CssExpression expression, boolean c
7676
throw new InvalidParamException("value", expression.getValue(),
7777
getPropertyName(), ac);
7878
}
79-
if (inherit.equals(val.getIdent())) {
79+
if (CssIdent.isCssWide(val.getIdent())) {
8080
value = val;
8181
} else {
8282
value = getAllowedIdent(val.getIdent());

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ public CssTextDecoration(ApplContext ac, CssExpression expression, boolean check
9999
} else {
100100
// so we have an ident...
101101
CssIdent ident = val.getIdent();
102-
if (inherit.equals(ident)) {
103-
value = inherit;
102+
if (CssIdent.isCssWide(ident)) {
103+
value = val;
104104
if (check && expression.getCount() != 1) {
105105
throw new InvalidParamException("value",
106106
val.toString(),

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public CssTextDecorationLine(ApplContext ac, CssExpression expression, boolean c
100100
getPropertyName(), ac);
101101
}
102102
id = val.getIdent();
103-
if (inherit.equals(id)) {
103+
if (CssIdent.isCssWide(id)) {
104104
if (expression.getCount() != 1) {
105105
throw new InvalidParamException("value",
106106
val.toString(),

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

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,7 @@ public CssTextDecorationSkip(ApplContext ac, CssExpression expression, boolean c
8585
}
8686

8787
CssIdent ident = val.getIdent();
88-
if (inherit.equals(ident)) {
89-
value = val;
90-
if (check && expression.getCount() != 1) {
91-
throw new InvalidParamException("value",
92-
val.toString(),
93-
getPropertyName(), ac);
94-
}
95-
} else if (none.equals(ident)) {
88+
if (CssIdent.isCssWide(ident) || none.equals(ident)) {
9689
value = val;
9790
if (check && expression.getCount() != 1) {
9891
throw new InvalidParamException("value",

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public CssTextDecorationSkipBox(ApplContext ac, CssExpression expression, boolea
6161

6262
switch (val.getType()) {
6363
case CssTypes.CSS_IDENT:
64-
if (inherit.equals(val.getIdent())) {
64+
if (CssIdent.isCssWide(val.getIdent())) {
6565
value = inherit;
6666
break;
6767
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public CssTextDecorationSkipInk(ApplContext ac, CssExpression expression, boolea
6161

6262
switch (val.getType()) {
6363
case CssTypes.CSS_IDENT:
64-
if (inherit.equals(val.getIdent())) {
64+
if (CssIdent.isCssWide(val.getIdent())) {
6565
value = val;
6666
break;
6767
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public CssTextDecorationSkipInset(ApplContext ac, CssExpression expression, bool
6161

6262
switch (val.getType()) {
6363
case CssTypes.CSS_IDENT:
64-
if (inherit.equals(val.getIdent())) {
64+
if (CssIdent.isCssWide(val.getIdent())) {
6565
value = val;
6666
break;
6767
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public CssTextDecorationSkipSelf(ApplContext ac, CssExpression expression, boole
6161

6262
switch (val.getType()) {
6363
case CssTypes.CSS_IDENT:
64-
if (inherit.equals(val.getIdent())) {
64+
if (CssIdent.isCssWide(val.getIdent())) {
6565
value = val;
6666
break;
6767
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public CssTextDecorationSkipSpaces(ApplContext ac, CssExpression expression, boo
101101
getPropertyName(), ac);
102102
}
103103
id = val.getIdent();
104-
if (inherit.equals(id)) {
104+
if (CssIdent.isCssWide(id)) {
105105
if (expression.getCount() != 1) {
106106
throw new InvalidParamException("value",
107107
val.toString(),

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public CssTextDecorationStyle(ApplContext ac, CssExpression expression, boolean
6666
}
6767
// ident, so inherit, or allowed value
6868
CssIdent ident = val.getIdent();
69-
if (!inherit.equals(ident) && (getMatchingIdent(ident) == null)) {
69+
if (!CssIdent.isCssWide(ident) && (getMatchingIdent(ident) == null)) {
7070
throw new InvalidParamException("value",
7171
expression.getValue(),
7272
getPropertyName(), ac);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public CssTextDecorationThickness(ApplContext ac, CssExpression expression, bool
6868
value = val;
6969
break;
7070
case CssTypes.CSS_IDENT:
71-
if (inherit.equals(val.getIdent())) {
71+
if (CssIdent.isCssWide(val.getIdent())) {
7272
value = val;
7373
break;
7474
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public CssTextEmphasis(ApplContext ac, CssExpression expression, boolean check)
6464
break;
6565
case CssTypes.CSS_IDENT:
6666
CssIdent ident = val.getIdent();
67-
if (inherit.equals(ident)) {
67+
if (CssIdent.isCssWide(ident)) {
6868
if (expression.getCount() > 1) {
6969
throw new InvalidParamException("value", val,
7070
getPropertyName(), ac);

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,7 @@ public CssTextEmphasisPosition() {
7777
* Creates a new CssTextEmphasisPosition
7878
*
7979
* @param expression The expression for this property
80-
* @throws org.w3c.css.util.InvalidParamException
81-
* Expressions are incorrect
80+
* @throws org.w3c.css.util.InvalidParamException Expressions are incorrect
8281
*/
8382
public CssTextEmphasisPosition(ApplContext ac, CssExpression expression, boolean check)
8483
throws InvalidParamException {
@@ -103,7 +102,7 @@ public CssTextEmphasisPosition(ApplContext ac, CssExpression expression, boolean
103102
}
104103

105104
CssIdent ident = val.getIdent();
106-
if (inherit.equals(ident)) {
105+
if (CssIdent.isCssWide(ident)) {
107106
value = val;
108107
if (check && expression.getCount() != 1) {
109108
throw new InvalidParamException("value",

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ public CssTextIndent(ApplContext ac, CssExpression expression, boolean check)
5454
CssValue hangVal = null;
5555
CssValue eachVal = null;
5656

57+
value = null;
58+
5759
while (!expression.end()) {
5860
val = expression.getValue();
5961
op = expression.getOperator();
@@ -77,8 +79,8 @@ public CssTextIndent(ApplContext ac, CssExpression expression, boolean check)
7779
break;
7880
case CssTypes.CSS_IDENT:
7981
CssIdent ident = val.getIdent();
80-
if (inherit.equals(ident)) {
81-
value = inherit;
82+
if (CssIdent.isCssWide(ident)) {
83+
value = val;
8284
if (check && expression.getCount() > 1) {
8385
throw new InvalidParamException("unrecognize", ac);
8486
}
@@ -100,7 +102,7 @@ public CssTextIndent(ApplContext ac, CssExpression expression, boolean check)
100102
expression.next();
101103
}
102104
// sanity check, we must have a length or percentage
103-
if (value != inherit) {
105+
if (value == null) {
104106
if (sizeVal == null) {
105107
throw new InvalidParamException("value",
106108
expression.toString(), getPropertyName(), ac);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public CssTransformBox(ApplContext ac, CssExpression expression,
8585
}
8686

8787
CssIdent ident = val.getIdent();
88-
if (!inherit.equals(ident) && (getAllowedValue(ident) == null)) {
88+
if (!CssIdent.isCssWide(ident) && (getAllowedValue(ident) == null)) {
8989
throw new InvalidParamException("value",
9090
val.toString(),
9191
getPropertyName(), ac);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public CssTransformStyle(ApplContext ac, CssExpression expression, boolean check
6666
}
6767
// ident, so inherit, or allowed value
6868
CssIdent id = val.getIdent();
69-
if (!inherit.equals(id) && (getMatchingIdent(id) == null)) {
69+
if (!CssIdent.isCssWide(id) && (getMatchingIdent(id) == null)) {
7070
throw new InvalidParamException("value",
7171
expression.getValue(),
7272
getPropertyName(), ac);

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,12 @@ public CssTransition(ApplContext ac, CssExpression expression, boolean check)
6464
val = expression.getValue();
6565
op = expression.getOperator();
6666

67-
if (inherit.equals(val)) {
67+
if ((val.getType() == CssTypes.CSS_IDENT) && CssIdent.isCssWide(val.getIdent())) {
6868
if (expression.getCount() > 1) {
6969
throw new InvalidParamException("value", val,
7070
getPropertyName(), ac);
7171
}
72-
value = inherit;
72+
value = val;
7373
expression.next();
7474
return;
7575
}

0 commit comments

Comments
 (0)