LibWeb: Implement basic CSS random() function

At the moment this is limited to only fixed value sharing and does not
support step values
This commit is contained in:
Callum Law 2025-11-04 13:35:17 +13:00 committed by Sam Atkins
parent 8944130fde
commit 2a5e389f63
Notes: github-actions[bot] 2025-12-01 11:02:05 +00:00
17 changed files with 380 additions and 31 deletions

View file

@ -1718,6 +1718,12 @@ bool Parser::context_allows_tree_counting_functions() const
return true;
}
bool Parser::context_allows_random_functions() const
{
// For now we only allow random functions within property contexts, see https://drafts.csswg.org/css-values-5/#issue-cd071f29
return m_value_context.find_first_index_if([](ValueParsingContext context) { return context.has<PropertyID>(); }).has_value();
}
Vector<ComponentValue> Parser::parse_as_list_of_component_values()
{
return parse_a_list_of_component_values(m_token_stream);