mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 06:17:34 +00:00
LibWeb+LibJS: Make the EventTarget hierarchy (incl. DOM) GC-allocated
This is a monster patch that turns all EventTargets into GC-allocated PlatformObjects. Their C++ wrapper classes are removed, and the LibJS garbage collector is now responsible for their lifetimes. There's a fair amount of hacks and band-aids in this patch, and we'll have a lot of cleanup to do after this.
This commit is contained in:
parent
bb547ce1c4
commit
6f433c8656
445 changed files with 4797 additions and 4268 deletions
|
@ -6,23 +6,24 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/NonnullRefPtrVector.h>
|
||||
#include <LibWeb/DOM/Node.h>
|
||||
|
||||
namespace Web::DOM {
|
||||
|
||||
class ParentNode : public Node {
|
||||
WEB_PLATFORM_OBJECT(ParentNode, Node);
|
||||
|
||||
public:
|
||||
template<typename F>
|
||||
void for_each_child(F) const;
|
||||
template<typename F>
|
||||
void for_each_child(F);
|
||||
|
||||
RefPtr<Element> first_element_child();
|
||||
RefPtr<Element> last_element_child();
|
||||
JS::GCPtr<Element> first_element_child();
|
||||
JS::GCPtr<Element> last_element_child();
|
||||
u32 child_element_count() const;
|
||||
|
||||
ExceptionOr<RefPtr<Element>> query_selector(StringView);
|
||||
ExceptionOr<JS::GCPtr<Element>> query_selector(StringView);
|
||||
ExceptionOr<NonnullRefPtr<NodeList>> query_selector_all(StringView);
|
||||
|
||||
NonnullRefPtr<HTMLCollection> children();
|
||||
|
@ -30,11 +31,16 @@ public:
|
|||
NonnullRefPtr<HTMLCollection> get_elements_by_tag_name(FlyString const&);
|
||||
NonnullRefPtr<HTMLCollection> get_elements_by_tag_name_ns(FlyString const&, FlyString const&);
|
||||
|
||||
ExceptionOr<void> prepend(Vector<Variant<NonnullRefPtr<Node>, String>> const& nodes);
|
||||
ExceptionOr<void> append(Vector<Variant<NonnullRefPtr<Node>, String>> const& nodes);
|
||||
ExceptionOr<void> replace_children(Vector<Variant<NonnullRefPtr<Node>, String>> const& nodes);
|
||||
ExceptionOr<void> prepend(Vector<Variant<JS::Handle<Node>, String>> const& nodes);
|
||||
ExceptionOr<void> append(Vector<Variant<JS::Handle<Node>, String>> const& nodes);
|
||||
ExceptionOr<void> replace_children(Vector<Variant<JS::Handle<Node>, String>> const& nodes);
|
||||
|
||||
protected:
|
||||
ParentNode(JS::Realm& realm, Document& document, NodeType type)
|
||||
: Node(realm, document, type)
|
||||
{
|
||||
}
|
||||
|
||||
ParentNode(Document& document, NodeType type)
|
||||
: Node(document, type)
|
||||
{
|
||||
|
@ -59,3 +65,5 @@ inline void ParentNode::for_each_child(Callback callback)
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
WRAPPER_HACK(ParentNode, Web::DOM)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue