mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-07 21:59:54 +00:00
LibWeb: Keep track of random function index within property value
Caching keys for 'auto' <random-value-sharing> rely on this value to distinguish between two random functions in a single property
This commit is contained in:
parent
bad9efac22
commit
86e6aa0291
Notes:
github-actions[bot]
2025-12-01 11:01:53 +00:00
Author: https://github.com/Calme1709
Commit: 86e6aa0291
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6707
Reviewed-by: https://github.com/AtkinsSJ ✅
Reviewed-by: https://github.com/gmta
2 changed files with 10 additions and 1 deletions
|
|
@ -588,10 +588,17 @@ private:
|
|||
TokenStream<Token> m_token_stream;
|
||||
|
||||
Vector<ValueParsingContext> m_value_context;
|
||||
size_t m_random_function_index = 0;
|
||||
auto push_temporary_value_parsing_context(ValueParsingContext&& context)
|
||||
{
|
||||
m_value_context.append(context);
|
||||
return ScopeGuard { [&] { m_value_context.take_last(); } };
|
||||
return ScopeGuard { [&] {
|
||||
auto removed_context = m_value_context.take_last();
|
||||
|
||||
// Reset the random function index when we leave the top-level property parsing context
|
||||
if (removed_context.has<PropertyID>() && !m_value_context.find_first_index_if([](ValueParsingContext context) { return context.has<PropertyID>(); }).has_value())
|
||||
m_random_function_index = 0;
|
||||
} };
|
||||
}
|
||||
bool context_allows_quirky_length() const;
|
||||
bool context_allows_tree_counting_functions() const;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue