LibWeb: Unify WebIDL C++ type generation

Represent WebIDL C++ types with a single CppType model that tracks
nullability, optional presence, and contained storage.

GC-like values now use GC::Ref/GC::Ptr directly, while containers choose
"plain", "Root", or "Conservative" container types depending on what
they contain. For example, sequence<Element> becomes a RootVector of
GC::Ref values, while sequence<SomeDictionary> becomes a
ConservativeVector only when the dictionary contains GC-like values.
This moves the generated bindings away from wrapping GC values in
GC::Root by default.

This has broad fallout as the types passed to interfaces for GC
objects changes almost fully across the board.
This commit is contained in:
Shannon Booth 2026-05-20 20:58:46 +02:00 committed by Shannon Booth
parent aa0eb13a89
commit 637fd51595
Notes: github-actions[bot] 2026-05-23 16:27:03 +00:00
207 changed files with 1126 additions and 1255 deletions

View file

@ -272,12 +272,12 @@ void HTMLDetailsElement::update_shadow_tree_slots()
if (!shadow_root())
return;
Vector<HTMLSlotElement::SlottableHandle> summary_assignment;
Vector<HTMLSlotElement::SlottableHandle> descendants_assignment;
GC::ConservativeVector<HTMLSlotElement::SlottableHandle> summary_assignment;
GC::ConservativeVector<HTMLSlotElement::SlottableHandle> descendants_assignment;
auto* summary = first_child_of_type<HTMLSummaryElement>();
if (summary != nullptr)
summary_assignment.append(GC::make_root(static_cast<DOM::Element&>(*summary)));
summary_assignment.append(GC::Ref { static_cast<DOM::Element&>(*summary) });
for_each_in_subtree([&](auto& child) {
if (&child == summary)
@ -286,7 +286,7 @@ void HTMLDetailsElement::update_shadow_tree_slots()
return TraversalDecision::Continue;
child.as_slottable().visit([&](auto& node) {
descendants_assignment.append(GC::make_root(node));
descendants_assignment.append(node);
});
return TraversalDecision::Continue;