ladybird/Userland/Libraries/LibWeb/DOM/DOMImplementation.h
Andreas Kling 6f433c8656 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.
2022-09-06 00:27:09 +02:00

44 lines
1.3 KiB
C++

/*
* Copyright (c) 2020, the SerenityOS developers.
* Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibJS/Heap/GCPtr.h>
#include <LibWeb/Bindings/PlatformObject.h>
#include <LibWeb/DOM/Document.h>
namespace Web::DOM {
class DOMImplementation final : public Bindings::PlatformObject {
WEB_PLATFORM_OBJECT(DOMImplementation, Bindings::PlatformObject);
public:
static JS::NonnullGCPtr<DOMImplementation> create(Document&);
virtual ~DOMImplementation();
ExceptionOr<JS::NonnullGCPtr<Document>> create_document(String const&, String const&, JS::GCPtr<DocumentType>) const;
JS::NonnullGCPtr<Document> create_html_document(String const& title) const;
ExceptionOr<JS::NonnullGCPtr<DocumentType>> create_document_type(String const& qualified_name, String const& public_id, String const& system_id);
// https://dom.spec.whatwg.org/#dom-domimplementation-hasfeature
bool has_feature() const { return true; }
private:
explicit DOMImplementation(Document&);
virtual void visit_edges(Cell::Visitor&) override;
Document& document() { return m_document; }
Document const& document() const { return m_document; }
Document& m_document;
};
}
WRAPPER_HACK(DOMImplementation, Web::DOM)