@@ -771,31 +771,27 @@ css_error css__parse_colour_specifier(css_language *c,
771771 else
772772 goto invalid ;
773773 } else if (token -> type == CSS_TOKEN_FUNCTION ) {
774- int colour_channels = 0 ;
775-
776774 if ((lwc_string_caseless_isequal (
777775 token -> idata , c -> strings [RGB ],
778776 & match ) == lwc_error_ok && match )) {
779- colour_channels = 3 ;
777+ if (!parse_rgb (c , vector , ctx , result )) {
778+ goto invalid ;
779+ }
780780 } else if ((lwc_string_caseless_isequal (
781781 token -> idata , c -> strings [RGBA ],
782782 & match ) == lwc_error_ok && match )) {
783- colour_channels = 4 ;
784- } if ((lwc_string_caseless_isequal (
783+ if (!parse_rgb (c , vector , ctx , result )) {
784+ goto invalid ;
785+ }
786+ } else if ((lwc_string_caseless_isequal (
785787 token -> idata , c -> strings [HSL ],
786788 & match ) == lwc_error_ok && match )) {
787- colour_channels = 5 ;
789+ if (!parse_hsl (vector , ctx , result )) {
790+ goto invalid ;
791+ }
788792 } else if ((lwc_string_caseless_isequal (
789793 token -> idata , c -> strings [HSLA ],
790794 & match ) == lwc_error_ok && match )) {
791- colour_channels = 6 ;
792- }
793-
794- if (colour_channels == 3 || colour_channels == 4 ) {
795- if (!parse_rgb (c , vector , ctx , result )) {
796- goto invalid ;
797- }
798- } else if (colour_channels == 5 || colour_channels == 6 ) {
799795 if (!parse_hsl (vector , ctx , result )) {
800796 goto invalid ;
801797 }
0 commit comments