Skip to content

Commit 13f8c0b

Browse files
committed
set proper function name for hsla()
1 parent c23001b commit 13f8c0b

File tree

4 files changed

+17
-6
lines changed

4 files changed

+17
-6
lines changed

org/w3c/css/parser/analyzer/CssParser.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8636,7 +8636,7 @@ final public boolean prio() throws ParseException {
86368636
color.setHSLColor(ac, exp);
86378637
{if ("" != null) return color;}
86388638
} else if (funcname.equals("hsla(")) {
8639-
color.setHSLColor(ac, exp);
8639+
color.setHSLAColor(ac, exp);
86408640
{if ("" != null) return color;}
86418641
} else if (funcname.equals("hwb(")) {
86428642
color.setHWBColor(ac, exp);

org/w3c/css/parser/analyzer/CssParser.jj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3708,7 +3708,7 @@ CssValue function() :
37083708
color.setHSLColor(ac, exp);
37093709
return color;
37103710
} else if (funcname.equals("hsla(")) {
3711-
color.setHSLColor(ac, exp);
3711+
color.setHSLAColor(ac, exp);
37123712
return color;
37133713
} else if (funcname.equals("hwb(")) {
37143714
color.setHWBColor(ac, exp);

org/w3c/css/values/CssColor.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -439,15 +439,22 @@ public void setModernRGBColor(ApplContext ac, CssExpression exp)
439439
}
440440

441441
/**
442-
* Parse a HSL color.
443-
* format hsl( <percentage>{3} [ / <alpha-value> ]? ) |
444-
* hsl( <number>{3} [ / <alpha-value> ]? )
442+
* Parse a HSL color
445443
*/
446444
public void setHSLColor(ApplContext ac, CssExpression exp)
447445
throws InvalidParamException {
448446
hsl = HSL.parseHSL(ac, exp, this);
449447
}
450448

449+
/**
450+
* Parse a HSLA color
451+
*/
452+
public void setHSLAColor(ApplContext ac, CssExpression exp)
453+
throws InvalidParamException {
454+
hsl = HSL.parseHSL(ac, exp, this);
455+
hsl.setFunctionName("hsla");
456+
}
457+
451458
/**
452459
* Parse a RGB color.
453460
* format #(3-6)<hexnum>

org/w3c/css/values/color/HSL.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public class HSL {
3232
boolean isRelative = false;
3333
CssColor fromValue;
3434

35-
static final String functionname = "hsl";
35+
String functionname = "hsl";
3636

3737
/**
3838
* Create a new HSL
@@ -384,6 +384,10 @@ public boolean equals(HSL other) {
384384
return false;
385385
}
386386

387+
public void setFunctionName(String name) {
388+
functionname = name;
389+
}
390+
387391
/**
388392
* Returns a string representation of the object.
389393
*/

0 commit comments

Comments
 (0)