1/*
2 This file is part of the WebKit open source project.
3 This file has been generated by generate-bindings.pl. DO NOT MODIFY!
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/
20
21#pragma once
22
23#include "JSDOMConvertDictionary.h"
24#include "JSDOMWrapper.h"
25#include "JSEventTarget.h"
26#include "Node.h"
27#include <JavaScriptCore/DOMJITGetterSetter.h>
28#include <JavaScriptCore/Snippet.h>
29#include <wtf/NeverDestroyed.h>
30
31namespace WebCore {
32
33class WEBCORE_EXPORT JSNode : public JSEventTarget {
34public:
35 using Base = JSEventTarget;
36 using DOMWrapped = Node;
37 static JSNode* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref<Node>&& impl)
38 {
39 JSNode* ptr = new (NotNull, JSC::allocateCell<JSNode>(globalObject->vm().heap)) JSNode(structure, *globalObject, WTFMove(impl));
40 ptr->finishCreation(globalObject->vm());
41 return ptr;
42 }
43
44 static JSC::JSObject* createPrototype(JSC::VM&, JSDOMGlobalObject&);
45 static JSC::JSObject* prototype(JSC::VM&, JSDOMGlobalObject&);
46 static Node* toWrapped(JSC::VM&, JSC::JSValue);
47
48protected:
49 static const JSC::ClassInfo s_info;
50public:
51 static constexpr const JSC::ClassInfo* info() { return &s_info; }
52
53 static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
54 {
55 return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::JSType(JSNodeType), StructureFlags), info());
56 }
57
58 JSC::JSScope* pushEventHandlerScope(JSC::ExecState*, JSC::JSScope*) const;
59
60 static JSC::JSValue getConstructor(JSC::VM&, const JSC::JSGlobalObject*);
61 static void visitChildren(JSCell*, JSC::SlotVisitor&);
62 void visitAdditionalChildren(JSC::SlotVisitor&);
63
64 static void visitOutputConstraints(JSCell*, JSC::SlotVisitor&);
65 template<typename, JSC::SubspaceAccess> static JSC::CompleteSubspace* subspaceFor(JSC::VM& vm) { return outputConstraintSubspaceFor(vm); }
66 static void heapSnapshot(JSCell*, JSC::HeapSnapshotBuilder&);
67
68 // Custom attributes
69 JSC::JSValue nodeType(JSC::ExecState&) const;
70 Node& wrapped() const
71 {
72 return static_cast<Node&>(Base::wrapped());
73 }
74protected:
75 JSNode(JSC::Structure*, JSDOMGlobalObject&, Ref<Node>&&);
76
77 void finishCreation(JSC::VM&);
78};
79
80class JSNodeOwner : public JSC::WeakHandleOwner {
81public:
82 virtual bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::SlotVisitor&, const char**);
83 virtual void finalize(JSC::Handle<JSC::Unknown>, void* context);
84};
85
86inline JSC::WeakHandleOwner* wrapperOwner(DOMWrapperWorld&, Node*)
87{
88 static NeverDestroyed<JSNodeOwner> owner;
89 return &owner.get();
90}
91
92inline void* wrapperKey(Node* wrappableObject)
93{
94 return wrappableObject;
95}
96
97JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, Node&);
98inline JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, Node* impl) { return impl ? toJS(state, globalObject, *impl) : JSC::jsNull(); }
99JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject*, Ref<Node>&&);
100inline JSC::JSValue toJSNewlyCreated(JSC::ExecState* state, JSDOMGlobalObject* globalObject, RefPtr<Node>&& impl) { return impl ? toJSNewlyCreated(state, globalObject, impl.releaseNonNull()) : JSC::jsNull(); }
101
102#if ENABLE(JIT)
103Ref<JSC::Snippet> checkSubClassSnippetForJSNode();
104#endif
105// DOM JIT Attributes
106
107#if ENABLE(JIT)
108Ref<JSC::DOMJIT::CallDOMGetterSnippet> compileNodeNodeTypeAttribute();
109#endif
110
111#if ENABLE(JIT)
112Ref<JSC::DOMJIT::CallDOMGetterSnippet> compileNodeOwnerDocumentAttribute();
113#endif
114
115#if ENABLE(JIT)
116Ref<JSC::DOMJIT::CallDOMGetterSnippet> compileNodeParentNodeAttribute();
117#endif
118
119#if ENABLE(JIT)
120Ref<JSC::DOMJIT::CallDOMGetterSnippet> compileNodeFirstChildAttribute();
121#endif
122
123#if ENABLE(JIT)
124Ref<JSC::DOMJIT::CallDOMGetterSnippet> compileNodeLastChildAttribute();
125#endif
126
127#if ENABLE(JIT)
128Ref<JSC::DOMJIT::CallDOMGetterSnippet> compileNodePreviousSiblingAttribute();
129#endif
130
131#if ENABLE(JIT)
132Ref<JSC::DOMJIT::CallDOMGetterSnippet> compileNodeNextSiblingAttribute();
133#endif
134
135template<> struct JSDOMWrapperConverterTraits<Node> {
136 using WrapperClass = JSNode;
137 using ToWrappedReturnType = Node*;
138};
139template<> Node::GetRootNodeOptions convertDictionary<Node::GetRootNodeOptions>(JSC::ExecState&, JSC::JSValue);
140
141
142} // namespace WebCore
143#include "JSNodeCustom.h"
144