Skip to content

Commit afb76be

Browse files
committed
fix a few issues with HWB
1 parent bcec1cc commit afb76be

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

org/w3c/css/values/CssColor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ public void setHSLAColor(CssExpression exp, ApplContext ac)
631631
public void setHWBColor(CssExpression exp, ApplContext ac)
632632
throws InvalidParamException {
633633
// HWB defined in CSSColor Level 4 and onward, currently used in the CSS level
634-
if (ac.getCssVersion().compareTo(CssVersion.CSS) < 0) {
634+
if (ac.getCssVersion().compareTo(CssVersion.CSS3) < 0) {
635635
StringBuilder sb = new StringBuilder();
636636
sb.append("hwb(").append(exp.toStringFromStart()).append(')');
637637
throw new InvalidParamException("notversion", sb.toString(),
@@ -675,7 +675,7 @@ public void setHWBColor(CssExpression exp, ApplContext ac)
675675
exp.next();
676676
val = exp.getValue();
677677
op = exp.getOperator();
678-
if (val == null || op != COMMA) {
678+
if (val == null || (op != COMMA && exp.getRemainingCount() > 1)) {
679679
exp.starts();
680680
throw new InvalidParamException("invalid-color", ac);
681681
}

org/w3c/css/values/HWB.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public final void setAlpha(ApplContext ac, CssValue val)
7575
throws InvalidParamException {
7676
output = null;
7777
faSet = true;
78-
vb = RGBA.filterAlpha(ac, val);
78+
va = RGBA.filterAlpha(ac, val);
7979
}
8080

8181
public void normalize() {
@@ -110,7 +110,7 @@ public String toString() {
110110
sb.append(vh).append(", ");
111111
sb.append(vw).append(", ");
112112
sb.append(vb);
113-
if (faSet) {
113+
if (!faSet) {
114114
sb.append(")");
115115
} else {
116116
sb.append(", ").append(va).append(')');

0 commit comments

Comments
 (0)