@@ -577,12 +577,19 @@ static bool parse_hsl(
577577
578578 /* saturation */
579579 token = parserutils_vector_iterate (vector , ctx );
580- if ((token == NULL ) || (token -> type != CSS_TOKEN_PERCENTAGE ))
580+ if (token == NULL )
581+ return false;
582+
583+ if ((token -> type != CSS_TOKEN_PERCENTAGE ) &&
584+ (token -> type != CSS_TOKEN_NUMBER || legacy )) {
581585 return false;
586+ }
582587
583588 sat = css__number_from_lwc_string (token -> idata , false, & consumed );
584- if (consumed != lwc_string_length (token -> idata ))
585- return false; /* failed to consume the whole string as a number */
589+ if (consumed != lwc_string_length (token -> idata )) {
590+ /* failed to consume the whole string as a number */
591+ return false;
592+ }
586593
587594 /* Normalise saturation to the range [0, 100] */
588595 if (sat < INTTOFIX (0 ))
@@ -603,12 +610,19 @@ static bool parse_hsl(
603610
604611 /* lightness */
605612 token = parserutils_vector_iterate (vector , ctx );
606- if ((token == NULL ) || (token -> type != CSS_TOKEN_PERCENTAGE ))
613+ if (token == NULL )
614+ return false;
615+
616+ if ((token -> type != CSS_TOKEN_PERCENTAGE ) &&
617+ (token -> type != CSS_TOKEN_NUMBER || legacy )) {
607618 return false;
619+ }
608620
609621 lit = css__number_from_lwc_string (token -> idata , false, & consumed );
610- if (consumed != lwc_string_length (token -> idata ))
611- return false; /* failed to consume the whole string as a number */
622+ if (consumed != lwc_string_length (token -> idata )) {
623+ /* failed to consume the whole string as a number */
624+ return false;
625+ }
612626
613627 /* Normalise lightness to the range [0, 100] */
614628 if (lit < INTTOFIX (0 ))
0 commit comments