Skip to content

Commit a6e6fa8

Browse files
committed
CSS2 is not allowing float values for RGB
1 parent 08f43ed commit a6e6fa8

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

org/w3c/css/values/RGB.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
package org.w3c.css.values;
88

99
import org.w3c.css.util.ApplContext;
10+
import org.w3c.css.util.CssVersion;
1011
import org.w3c.css.util.InvalidParamException;
1112
import org.w3c.css.util.Util;
1213

@@ -25,7 +26,14 @@ public static final CssValue filterValue(ApplContext ac, CssValue val)
2526
// might need to extend...
2627
} else {
2728
if (val.getType() == CssTypes.CSS_NUMBER) {
29+
boolean isCss3 = (ac.getCssVersion().compareTo(CssVersion.CSS3) >= 0);
2830
CssCheckableValue v = val.getCheckableValue();
31+
// in CSS2, numbers can only be integers
32+
if (!isCss3) {
33+
if (!v.isInteger()) {
34+
throw new InvalidParamException("rgb", val, ac);
35+
}
36+
}
2937
if (!v.warnPositiveness(ac, "RGB")) {
3038
CssNumber nb = new CssNumber();
3139
nb.setIntValue(0);

0 commit comments

Comments
 (0)