mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-23 16:40:03 +00:00
LibWeb: Add method for whether tree-counting function is allowed
Some contexts (e.g. descriptors, media conditions) don't allow tree counting functions, this commit adds an easy way to check if the current value context is one of those.
This commit is contained in:
parent
fbc6a4c96f
commit
fd31fbd84b
Notes:
github-actions[bot]
2025-10-20 15:13:55 +00:00
Author: https://github.com/Calme1709
Commit: fd31fbd84b
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6426
Reviewed-by: https://github.com/AtkinsSJ ✅
5 changed files with 27 additions and 1 deletions
|
@ -1694,6 +1694,21 @@ bool Parser::context_allows_quirky_length() const
|
|||
return unitless_length_allowed;
|
||||
}
|
||||
|
||||
bool Parser::context_allows_tree_counting_functions() const
|
||||
{
|
||||
for (auto context : m_value_context) {
|
||||
if (context.has<DescriptorContext>())
|
||||
return false;
|
||||
|
||||
if (auto const* special_context = context.get_pointer<SpecialContext>(); special_context && first_is_one_of(*special_context, SpecialContext::DOMMatrixInitString, SpecialContext::MediaCondition))
|
||||
return false;
|
||||
|
||||
// TODO: Handle other contexts where tree counting functions are not allowed
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
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