mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-08 06:09:58 +00:00
LibWeb: Support non-fixed <random-value-sharing>
This works by generating random values using XorShift128PlusRNG at compute time and then caching them on the document using the relevant random-caching-key
This commit is contained in:
parent
86e6aa0291
commit
12e8f503aa
Notes:
github-actions[bot]
2025-12-01 11:01:47 +00:00
Author: https://github.com/Calme1709
Commit: 12e8f503aa
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6707
Reviewed-by: https://github.com/AtkinsSJ ✅
Reviewed-by: https://github.com/gmta
15 changed files with 226 additions and 54 deletions
|
|
@ -1724,6 +1724,15 @@ bool Parser::context_allows_random_functions() const
|
|||
return m_value_context.find_first_index_if([](ValueParsingContext context) { return context.has<PropertyID>(); }).has_value();
|
||||
}
|
||||
|
||||
FlyString Parser::random_value_sharing_auto_name() const
|
||||
{
|
||||
auto top_level_property_context_index = m_value_context.find_first_index_if([](ValueParsingContext const& context) { return context.has<PropertyID>(); });
|
||||
|
||||
auto property_name = string_from_property_id(m_value_context[top_level_property_context_index.value()].get<PropertyID>());
|
||||
|
||||
return MUST(String::formatted("{} {}", property_name, m_random_function_index));
|
||||
}
|
||||
|
||||
Vector<ComponentValue> Parser::parse_as_list_of_component_values()
|
||||
{
|
||||
return parse_a_list_of_component_values(m_token_stream);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue