mirror of
https://github.com/RGBCube/serenity
synced 2025-05-16 19:35:08 +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,27 +6,33 @@
|
|||
|
||||
#include <AK/CharacterTypes.h>
|
||||
#include <LibWeb/Bindings/DOMStringMapPrototype.h>
|
||||
#include <LibWeb/Bindings/WindowObject.h>
|
||||
#include <LibWeb/DOM/Document.h>
|
||||
#include <LibWeb/DOM/Element.h>
|
||||
#include <LibWeb/HTML/DOMStringMap.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
|
||||
namespace Web::HTML {
|
||||
|
||||
DOMStringMap* DOMStringMap::create(DOM::Element& element)
|
||||
JS::NonnullGCPtr<DOMStringMap> DOMStringMap::create(DOM::Element& element)
|
||||
{
|
||||
auto& realm = element.document().preferred_window_object().realm();
|
||||
return realm.heap().allocate<DOMStringMap>(realm, element);
|
||||
auto& realm = element.document().window().realm();
|
||||
return *realm.heap().allocate<DOMStringMap>(realm, element);
|
||||
}
|
||||
|
||||
DOMStringMap::DOMStringMap(DOM::Element& element)
|
||||
: PlatformObject(element.document().preferred_window_object().ensure_web_prototype<Bindings::DOMStringMapPrototype>("DOMStringMap"))
|
||||
: PlatformObject(element.document().window().ensure_web_prototype<Bindings::DOMStringMapPrototype>("DOMStringMap"))
|
||||
, m_associated_element(element)
|
||||
{
|
||||
}
|
||||
|
||||
DOMStringMap::~DOMStringMap() = default;
|
||||
|
||||
void DOMStringMap::visit_edges(Cell::Visitor& visitor)
|
||||
{
|
||||
Base::visit_edges(visitor);
|
||||
visitor.visit(m_associated_element.ptr());
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/dom.html#concept-domstringmap-pairs
|
||||
Vector<DOMStringMap::NameValuePair> DOMStringMap::get_name_value_pairs() const
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue