LibWeb: Allow specifying type of nested declarations rule

When parsing declarations within a nested grouping rule, we don't store
these directly, but within a "nested declarations rule", in most cases
this is `CSSNestedDeclarations`, but this isn't always the case e.g.
`@function` rules and others (e.g. @media) within them should instead
use `CSSFunctionDeclarations`
This commit is contained in:
Callum Law
2026-03-05 16:00:11 +13:00
committed by Sam Atkins
parent e7243f0090
commit cd05e1d039
Notes: github-actions[bot] 2026-03-27 11:21:09 +00:00
6 changed files with 43 additions and 15 deletions

View File

@@ -8,12 +8,18 @@
#include <LibWeb/Bindings/CSSNestedDeclarationsPrototype.h>
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/CSS/CSSStyleRule.h>
#include <LibWeb/CSS/Parser/Parser.h>
#include <LibWeb/Dump.h>
namespace Web::CSS {
GC_DEFINE_ALLOCATOR(CSSNestedDeclarations);
GC::Ref<CSSNestedDeclarations> CSSNestedDeclarations::create(JS::Realm& realm, Parser::Parser& parser, Vector<Parser::Declaration> const& declarations)
{
return realm.create<CSSNestedDeclarations>(realm, parser.convert_to_style_declaration(declarations));
}
GC::Ref<CSSNestedDeclarations> CSSNestedDeclarations::create(JS::Realm& realm, CSSStyleProperties& declaration)
{
return realm.create<CSSNestedDeclarations>(realm, declaration);