mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 12:07:45 +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
|
@ -11,9 +11,9 @@
|
|||
namespace Web::DOM {
|
||||
|
||||
class ShadowRoot final : public DocumentFragment {
|
||||
public:
|
||||
ShadowRoot(Document&, Element&);
|
||||
WEB_PLATFORM_OBJECT(ShadowRoot, DocumentFragment);
|
||||
|
||||
public:
|
||||
bool closed() const { return m_closed; }
|
||||
|
||||
bool delegates_focus() const { return m_delegates_focus; }
|
||||
|
@ -32,6 +32,8 @@ public:
|
|||
ExceptionOr<void> set_inner_html(String const&);
|
||||
|
||||
private:
|
||||
ShadowRoot(Document&, Element&);
|
||||
|
||||
// ^Node
|
||||
virtual FlyString node_name() const override { return "#shadow-root"; }
|
||||
virtual bool is_shadow_root() const final { return true; }
|
||||
|
@ -52,7 +54,7 @@ inline IterationDecision Node::for_each_shadow_including_descendant(Callback cal
|
|||
return IterationDecision::Break;
|
||||
for (auto* child = first_child(); child; child = child->next_sibling()) {
|
||||
if (child->is_element()) {
|
||||
if (RefPtr<ShadowRoot> shadow_root = static_cast<Element*>(child)->shadow_root()) {
|
||||
if (JS::GCPtr<ShadowRoot> shadow_root = static_cast<Element*>(child)->shadow_root()) {
|
||||
if (shadow_root->for_each_shadow_including_descendant(callback) == IterationDecision::Break)
|
||||
return IterationDecision::Break;
|
||||
}
|
||||
|
@ -64,3 +66,5 @@ inline IterationDecision Node::for_each_shadow_including_descendant(Callback cal
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
WRAPPER_HACK(ShadowRoot, Web::DOM)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue