2020-11-13 06:08:06 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2020, the SerenityOS developers.
|
2024-10-04 13:19:50 +02:00
|
|
|
* Copyright (c) 2022, Andreas Kling <andreas@ladybird.org>
|
2020-11-13 06:08:06 +00:00
|
|
|
*
|
2021-04-22 01:24:48 -07:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-11-13 06:08:06 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2024-11-15 04:01:23 +13:00
|
|
|
#include <LibGC/Ptr.h>
|
2022-08-08 15:52:48 +02:00
|
|
|
#include <LibWeb/Bindings/PlatformObject.h>
|
2021-12-09 12:51:05 +01:00
|
|
|
#include <LibWeb/DOM/Document.h>
|
2020-11-13 06:08:06 +00:00
|
|
|
|
|
|
|
namespace Web::DOM {
|
|
|
|
|
2022-08-08 15:52:48 +02:00
|
|
|
class DOMImplementation final : public Bindings::PlatformObject {
|
2022-08-28 13:42:07 +02:00
|
|
|
WEB_PLATFORM_OBJECT(DOMImplementation, Bindings::PlatformObject);
|
2024-11-15 04:01:23 +13:00
|
|
|
GC_DECLARE_ALLOCATOR(DOMImplementation);
|
2022-08-08 15:52:48 +02:00
|
|
|
|
2020-11-13 06:08:06 +00:00
|
|
|
public:
|
2024-11-15 04:01:23 +13:00
|
|
|
[[nodiscard]] static GC::Ref<DOMImplementation> create(Document&);
|
2022-08-08 15:52:48 +02:00
|
|
|
virtual ~DOMImplementation();
|
2020-11-13 06:08:06 +00:00
|
|
|
|
2024-11-15 04:01:23 +13:00
|
|
|
WebIDL::ExceptionOr<GC::Ref<XMLDocument>> create_document(Optional<FlyString> const&, String const&, GC::Ptr<DocumentType>) const;
|
|
|
|
GC::Ref<Document> create_html_document(Optional<String> const& title) const;
|
2025-06-19 12:31:03 +01:00
|
|
|
WebIDL::ExceptionOr<GC::Ref<DocumentType>> create_document_type(String const& name, String const& public_id, String const& system_id);
|
2020-11-13 06:08:06 +00:00
|
|
|
|
|
|
|
// https://dom.spec.whatwg.org/#dom-domimplementation-hasfeature
|
2023-08-12 21:30:16 +12:00
|
|
|
bool has_feature() const
|
|
|
|
{
|
|
|
|
// The hasFeature() method steps are to return true.
|
|
|
|
return true;
|
|
|
|
}
|
2020-11-13 06:08:06 +00:00
|
|
|
|
|
|
|
private:
|
2022-08-28 13:42:07 +02:00
|
|
|
explicit DOMImplementation(Document&);
|
|
|
|
|
2023-08-07 08:41:28 +02:00
|
|
|
virtual void initialize(JS::Realm&) override;
|
2022-08-08 15:52:48 +02:00
|
|
|
virtual void visit_edges(Cell::Visitor&) override;
|
2020-11-13 06:08:06 +00:00
|
|
|
|
2022-08-08 15:52:48 +02:00
|
|
|
Document& document() { return m_document; }
|
|
|
|
Document const& document() const { return m_document; }
|
|
|
|
|
2024-11-15 04:01:23 +13:00
|
|
|
GC::Ref<Document> m_document;
|
2020-11-13 06:08:06 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|