blob: e35ae20eadbc5ed751055723d961c321f5c238e4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
/*
* Copyright (c) 2020, the SerenityOS developers.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/NonnullRefPtr.h>
#include <AK/RefCountForwarder.h>
#include <AK/RefCounted.h>
#include <AK/Weakable.h>
#include <LibWeb/Bindings/Wrappable.h>
#include <LibWeb/DOM/Document.h>
namespace Web::DOM {
class DOMImplementation final
: public RefCountForwarder<Document>
, public Weakable<DOMImplementation>
, public Bindings::Wrappable {
public:
using WrapperType = Bindings::DOMImplementationWrapper;
static NonnullOwnPtr<DOMImplementation> create(Badge<Document>, Document& document)
{
return adopt_own(*new DOMImplementation(document));
}
// FIXME: Add optional DocumentType once supported by IDL
NonnullRefPtr<Document> create_document(const String&, const String&) const;
NonnullRefPtr<Document> create_html_document(const String& title) const;
NonnullRefPtr<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&);
Document& document() { return ref_count_target(); }
Document const& document() const { return ref_count_target(); }
};
}
|