csscolorvalue: Fix oklab() percentage range

This commit is contained in:
Alice Mikhaylenko 2024-06-05 23:10:52 +04:00
parent 6602ac5eae
commit dc1ff3c2e3
3 changed files with 21 additions and 1 deletions

View File

@ -1432,7 +1432,11 @@ parse_ok_ab_value (GtkCssParser *parser,
if (data->values[idx] == NULL)
return FALSE;
data->v[idx] = gtk_css_number_value_get_canonical (data->values[idx], 0.4);
data->v[idx] = gtk_css_number_value_get_canonical (data->values[idx], 0.8);
/* gtk_css_number_value_get_canonical() doesn't let us specify what 0% is */
if (gtk_css_number_value_has_percent (data->values[idx]))
data->v[idx] -= 0.4;
}
return TRUE;

View File

@ -123,3 +123,11 @@ ad {
ae {
color: hwb(200 10 90 / 0.5);
}
af {
color: oklab(0% 0% 0% / 0%);
}
ag {
color: oklab(100% 100% 100% / 100%);
}

View File

@ -123,3 +123,11 @@ ad {
ae {
color: rgba(26,26,26,0.5);
}
af {
color: oklab(0 -0.4 -0.4 / 0);
}
ag {
color: oklab(1 0.4 0.4);
}