@@ -578,12 +578,19 @@ static bool parse_hsl(
578578
579579 /* saturation */
580580 token = parserutils_vector_iterate (vector , ctx );
581- if ((token == NULL ) || (token -> type != CSS_TOKEN_PERCENTAGE ))
581+ if (token == NULL )
582+ return false;
583+
584+ if ((token -> type != CSS_TOKEN_PERCENTAGE ) &&
585+ (token -> type != CSS_TOKEN_NUMBER || legacy )) {
582586 return false;
587+ }
583588
584589 sat = css__number_from_lwc_string (token -> idata , false, & consumed );
585- if (consumed != lwc_string_length (token -> idata ))
586- return false; /* failed to consume the whole string as a number */
590+ if (consumed != lwc_string_length (token -> idata )) {
591+ /* failed to consume the whole string as a number */
592+ return false;
593+ }
587594
588595 /* Normalise saturation to the range [0, 100] */
589596 if (sat < INTTOFIX (0 ))
@@ -604,12 +611,19 @@ static bool parse_hsl(
604611
605612 /* lightness */
606613 token = parserutils_vector_iterate (vector , ctx );
607- if ((token == NULL ) || (token -> type != CSS_TOKEN_PERCENTAGE ))
614+ if (token == NULL )
615+ return false;
616+
617+ if ((token -> type != CSS_TOKEN_PERCENTAGE ) &&
618+ (token -> type != CSS_TOKEN_NUMBER || legacy )) {
608619 return false;
620+ }
609621
610622 lit = css__number_from_lwc_string (token -> idata , false, & consumed );
611- if (consumed != lwc_string_length (token -> idata ))
612- return false; /* failed to consume the whole string as a number */
623+ if (consumed != lwc_string_length (token -> idata )) {
624+ /* failed to consume the whole string as a number */
625+ return false;
626+ }
613627
614628 /* Normalise lightness to the range [0, 100] */
615629 if (lit < INTTOFIX (0 ))
0 commit comments