mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-26 14:28:49 +00:00
LibGC+Everywhere: Factor out a LibGC from LibJS
Resulting in a massive rename across almost everywhere! Alongside the namespace change, we now have the following names: * JS::NonnullGCPtr -> GC::Ref * JS::GCPtr -> GC::Ptr * JS::HeapFunction -> GC::Function * JS::CellImpl -> GC::Cell * JS::Handle -> GC::Root
This commit is contained in:
parent
ce23efc5f6
commit
f87041bf3a
Notes:
github-actions[bot]
2024-11-15 13:50:17 +00:00
Author: https://github.com/shannonbooth
Commit: f87041bf3a
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2345
1722 changed files with 9939 additions and 9906 deletions
|
@ -13,7 +13,7 @@
|
|||
|
||||
namespace Web::HTML {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(HTMLSlotElement);
|
||||
GC_DEFINE_ALLOCATOR(HTMLSlotElement);
|
||||
|
||||
HTMLSlotElement::HTMLSlotElement(DOM::Document& document, DOM::QualifiedName qualified_name)
|
||||
: HTMLElement(document, move(qualified_name))
|
||||
|
@ -38,11 +38,11 @@ void HTMLSlotElement::visit_edges(JS::Cell::Visitor& visitor)
|
|||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/scripting.html#dom-slot-assignednodes
|
||||
Vector<JS::Handle<DOM::Node>> HTMLSlotElement::assigned_nodes(AssignedNodesOptions options) const
|
||||
Vector<GC::Root<DOM::Node>> HTMLSlotElement::assigned_nodes(AssignedNodesOptions options) const
|
||||
{
|
||||
// 1. If options["flatten"] is false, then return this's assigned nodes.
|
||||
if (!options.flatten) {
|
||||
Vector<JS::Handle<DOM::Node>> assigned_nodes;
|
||||
Vector<GC::Root<DOM::Node>> assigned_nodes;
|
||||
assigned_nodes.ensure_capacity(assigned_nodes_internal().size());
|
||||
|
||||
for (auto const& node : assigned_nodes_internal()) {
|
||||
|
@ -59,14 +59,14 @@ Vector<JS::Handle<DOM::Node>> HTMLSlotElement::assigned_nodes(AssignedNodesOptio
|
|||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/scripting.html#dom-slot-assignedelements
|
||||
Vector<JS::Handle<DOM::Element>> HTMLSlotElement::assigned_elements(AssignedNodesOptions options) const
|
||||
Vector<GC::Root<DOM::Element>> HTMLSlotElement::assigned_elements(AssignedNodesOptions options) const
|
||||
{
|
||||
// 1. If options["flatten"] is false, then return this's assigned nodes, filtered to contain only Element nodes.
|
||||
if (!options.flatten) {
|
||||
Vector<JS::Handle<DOM::Element>> assigned_nodes;
|
||||
Vector<GC::Root<DOM::Element>> assigned_nodes;
|
||||
|
||||
for (auto const& node : assigned_nodes_internal()) {
|
||||
if (auto const* element = node.get_pointer<JS::NonnullGCPtr<DOM::Element>>())
|
||||
if (auto const* element = node.get_pointer<GC::Ref<DOM::Element>>())
|
||||
assigned_nodes.append(*element);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue