mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 23:07:35 +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
|
@ -18,15 +18,12 @@ namespace Web::DOM {
|
|||
|
||||
// https://dom.spec.whatwg.org/#interface-namednodemap
|
||||
class NamedNodeMap : public Bindings::LegacyPlatformObject {
|
||||
JS_OBJECT(NamedNodeMap, Bindings::LegacyPlatformObject);
|
||||
WEB_PLATFORM_OBJECT(NamedNodeMap, Bindings::LegacyPlatformObject);
|
||||
|
||||
public:
|
||||
static NamedNodeMap* create(Element&);
|
||||
explicit NamedNodeMap(Element&);
|
||||
static JS::NonnullGCPtr<NamedNodeMap> create(Element&);
|
||||
~NamedNodeMap() = default;
|
||||
|
||||
NamedNodeMap& impl() { return *this; }
|
||||
|
||||
virtual bool is_supported_property_index(u32 index) const override;
|
||||
virtual Vector<String> supported_property_names() const override;
|
||||
virtual JS::Value item_value(size_t index) const override;
|
||||
|
@ -50,18 +47,19 @@ public:
|
|||
Attribute const* remove_attribute(StringView qualified_name);
|
||||
|
||||
private:
|
||||
Element& associated_element() { return m_element; }
|
||||
Element const& associated_element() const { return m_element; }
|
||||
explicit NamedNodeMap(Element&);
|
||||
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
|
||||
Element& associated_element() { return *m_element; }
|
||||
Element const& associated_element() const { return *m_element; }
|
||||
|
||||
void remove_attribute_at_index(size_t attribute_index);
|
||||
|
||||
DOM::Element& m_element;
|
||||
NonnullRefPtrVector<Attribute> m_attributes;
|
||||
JS::NonnullGCPtr<DOM::Element> m_element;
|
||||
Vector<JS::NonnullGCPtr<Attribute>> m_attributes;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
namespace Web::Bindings {
|
||||
inline JS::Object* wrap(JS::Realm&, Web::DOM::NamedNodeMap& object) { return &object; }
|
||||
using NamedNodeMapWrapper = Web::DOM::NamedNodeMap;
|
||||
}
|
||||
WRAPPER_HACK(NamedNodeMap, Web::DOM)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue