Skip to content

Commit 98ee624

Browse files
committed
mark properly a copied expression as having a variable if what we add is indeed one, apply that to Color
1 parent bcf56ce commit 98ee624

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public CssColor(ApplContext ac, CssExpression expression, boolean check)
6969
color = val;
7070
break;
7171
case CssTypes.CSS_FUNCTION:
72-
CssFunction attr = val.getFunction();
72+
CssFunction attr = val.getFunction();
7373
CssExpression params = attr.getParameters();
7474
String fname = attr.getName();
7575

@@ -100,8 +100,10 @@ public CssColor(ApplContext ac, CssExpression expression, boolean check)
100100
}
101101
break;
102102
default:
103-
throw new InvalidParamException("value", expression.getValue(),
104-
getPropertyName(), ac);
103+
if (!expression.hasCssVariable()) {
104+
throw new InvalidParamException("value", expression.getValue(),
105+
getPropertyName(), ac);
106+
}
105107
}
106108
expression.next();
107109
}

org/w3c/css/values/CssExpression.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public boolean hasCssVariable() {
4747
public void markCssVariable() {
4848
css_variable = true;
4949
}
50-
50+
5151
/**
5252
* mark the current position, it can be set to this
5353
* position later by using reset
@@ -75,8 +75,13 @@ public void reset() {
7575
* @param value The value to append
7676
*/
7777
public void addValue(CssValue value) {
78-
items.add(new ValueOperator(value));
79-
count++;
78+
if (value != null) {
79+
if (value.getRawType() == CssTypes.CSS_VARIABLE) {
80+
markCssVariable();
81+
}
82+
items.add(new ValueOperator(value));
83+
count++;
84+
}
8085
}
8186

8287
/**
@@ -137,7 +142,7 @@ public CssValue getLastValue() {
137142
}
138143
}
139144

140-
/* Modified by Sijtsche de Jong */
145+
/* Modified by Sijtsche de Jong */
141146

142147
/**
143148
* Returns the operator <strong>after</strong> the current value

0 commit comments

Comments
 (0)