mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-27 21:42:53 +00:00
LibWeb/CSS: Reject non-grouping-rules as descendants of style rules
For example, `@font-face` is not only invalid inside a style rule, it's also invalid inside a child of a style rule. This fixes a test regression that we previously passed by accident.
This commit is contained in:
parent
9cce791424
commit
e43bb1410c
Notes:
github-actions[bot]
2025-04-04 09:41:27 +00:00
Author: https://github.com/AtkinsSJ
Commit: e43bb1410c
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4206
2 changed files with 9 additions and 4 deletions
|
@ -1427,14 +1427,18 @@ bool Parser::is_valid_in_the_current_context(AtRule const& at_rule) const
|
|||
if (m_rule_context.is_empty())
|
||||
return true;
|
||||
|
||||
// Only grouping rules can be nested within style rules
|
||||
if (m_rule_context.contains_slow(ContextType::Style))
|
||||
return first_is_one_of(at_rule.name, "layer", "media", "supports");
|
||||
|
||||
switch (m_rule_context.last()) {
|
||||
case ContextType::Unknown:
|
||||
// If the context is an unknown type, we don't accept anything.
|
||||
return false;
|
||||
|
||||
case ContextType::Style:
|
||||
// Style rules can contain grouping rules
|
||||
return first_is_one_of(at_rule.name, "layer", "media", "supports");
|
||||
// Already handled above
|
||||
VERIFY_NOT_REACHED();
|
||||
|
||||
case ContextType::AtLayer:
|
||||
case ContextType::AtMedia:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue