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:
Shannon Booth 2024-11-15 04:01:23 +13:00 committed by Andreas Kling
parent ce23efc5f6
commit f87041bf3a
Notes: github-actions[bot] 2024-11-15 13:50:17 +00:00
1722 changed files with 9939 additions and 9906 deletions

View file

@ -7,8 +7,8 @@
#pragma once
#include <AK/Function.h>
#include <LibGC/Ptr.h>
#include <LibJS/Forward.h>
#include <LibJS/Heap/GCPtr.h>
#include <LibWeb/Bindings/PlatformObject.h>
#include <LibWeb/DOM/HTMLCollection.h>
#include <LibWeb/Forward.h>
@ -17,22 +17,22 @@ namespace Web::HTML {
class HTMLAllCollection : public Bindings::PlatformObject {
WEB_PLATFORM_OBJECT(HTMLAllCollection, Bindings::PlatformObject);
JS_DECLARE_ALLOCATOR(HTMLAllCollection);
GC_DECLARE_ALLOCATOR(HTMLAllCollection);
public:
enum class Scope {
Children,
Descendants,
};
[[nodiscard]] static JS::NonnullGCPtr<HTMLAllCollection> create(DOM::ParentNode& root, Scope, ESCAPING Function<bool(DOM::Element const&)> filter);
[[nodiscard]] static GC::Ref<HTMLAllCollection> create(DOM::ParentNode& root, Scope, ESCAPING Function<bool(DOM::Element const&)> filter);
virtual ~HTMLAllCollection() override;
size_t length() const;
Variant<JS::NonnullGCPtr<DOM::HTMLCollection>, JS::NonnullGCPtr<DOM::Element>, Empty> item(Optional<FlyString> const& name_or_index) const;
Variant<JS::NonnullGCPtr<DOM::HTMLCollection>, JS::NonnullGCPtr<DOM::Element>, Empty> named_item(FlyString const& name) const;
Variant<GC::Ref<DOM::HTMLCollection>, GC::Ref<DOM::Element>, Empty> item(Optional<FlyString> const& name_or_index) const;
Variant<GC::Ref<DOM::HTMLCollection>, GC::Ref<DOM::Element>, Empty> named_item(FlyString const& name) const;
JS::MarkedVector<JS::NonnullGCPtr<DOM::Element>> collect_matching_elements() const;
GC::MarkedVector<GC::Ref<DOM::Element>> collect_matching_elements() const;
virtual Optional<JS::Value> item_value(size_t index) const override;
virtual JS::Value named_item_value(FlyString const& name) const override;
@ -46,13 +46,13 @@ protected:
virtual bool is_htmldda() const override { return true; }
private:
Variant<JS::NonnullGCPtr<DOM::HTMLCollection>, JS::NonnullGCPtr<DOM::Element>, Empty> get_the_all_named_elements(FlyString const& name) const;
JS::GCPtr<DOM::Element> get_the_all_indexed_element(u32 index) const;
Variant<JS::NonnullGCPtr<DOM::HTMLCollection>, JS::NonnullGCPtr<DOM::Element>, Empty> get_the_all_indexed_or_named_elements(JS::PropertyKey const& name_or_index) const;
Variant<GC::Ref<DOM::HTMLCollection>, GC::Ref<DOM::Element>, Empty> get_the_all_named_elements(FlyString const& name) const;
GC::Ptr<DOM::Element> get_the_all_indexed_element(u32 index) const;
Variant<GC::Ref<DOM::HTMLCollection>, GC::Ref<DOM::Element>, Empty> get_the_all_indexed_or_named_elements(JS::PropertyKey const& name_or_index) const;
virtual void visit_edges(Cell::Visitor&) override;
JS::NonnullGCPtr<DOM::ParentNode> m_root;
GC::Ref<DOM::ParentNode> m_root;
Function<bool(DOM::Element const&)> m_filter;
Scope m_scope { Scope::Descendants };
};