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 | #include "config.h" |
22 | #include "JSHTMLBRElement.h" |
23 | |
24 | #include "CustomElementReactionQueue.h" |
25 | #include "HTMLNames.h" |
26 | #include "JSDOMAttribute.h" |
27 | #include "JSDOMBinding.h" |
28 | #include "JSDOMConstructorNotConstructable.h" |
29 | #include "JSDOMConvertStrings.h" |
30 | #include "JSDOMExceptionHandling.h" |
31 | #include "JSDOMWrapperCache.h" |
32 | #include "ScriptExecutionContext.h" |
33 | #include <JavaScriptCore/HeapSnapshotBuilder.h> |
34 | #include <JavaScriptCore/JSCInlines.h> |
35 | #include <wtf/GetPtr.h> |
36 | #include <wtf/PointerPreparations.h> |
37 | #include <wtf/URL.h> |
38 | |
39 | |
40 | namespace WebCore { |
41 | using namespace JSC; |
42 | |
43 | // Attributes |
44 | |
45 | JSC::EncodedJSValue jsHTMLBRElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
46 | bool setJSHTMLBRElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
47 | JSC::EncodedJSValue jsHTMLBRElementClear(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
48 | bool setJSHTMLBRElementClear(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
49 | |
50 | class JSHTMLBRElementPrototype : public JSC::JSNonFinalObject { |
51 | public: |
52 | using Base = JSC::JSNonFinalObject; |
53 | static JSHTMLBRElementPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) |
54 | { |
55 | JSHTMLBRElementPrototype* ptr = new (NotNull, JSC::allocateCell<JSHTMLBRElementPrototype>(vm.heap)) JSHTMLBRElementPrototype(vm, globalObject, structure); |
56 | ptr->finishCreation(vm); |
57 | return ptr; |
58 | } |
59 | |
60 | DECLARE_INFO; |
61 | static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) |
62 | { |
63 | return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); |
64 | } |
65 | |
66 | private: |
67 | JSHTMLBRElementPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
68 | : JSC::JSNonFinalObject(vm, structure) |
69 | { |
70 | } |
71 | |
72 | void finishCreation(JSC::VM&); |
73 | }; |
74 | |
75 | using JSHTMLBRElementConstructor = JSDOMConstructorNotConstructable<JSHTMLBRElement>; |
76 | |
77 | template<> JSValue JSHTMLBRElementConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) |
78 | { |
79 | return JSHTMLElement::getConstructor(vm, &globalObject); |
80 | } |
81 | |
82 | template<> void JSHTMLBRElementConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) |
83 | { |
84 | putDirect(vm, vm.propertyNames->prototype, JSHTMLBRElement::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
85 | putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("HTMLBRElement"_s )), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
86 | putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
87 | } |
88 | |
89 | template<> const ClassInfo JSHTMLBRElementConstructor::s_info = { "HTMLBRElement" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSHTMLBRElementConstructor) }; |
90 | |
91 | /* Hash table for prototype */ |
92 | |
93 | static const HashTableValue JSHTMLBRElementPrototypeTableValues[] = |
94 | { |
95 | { "constructor" , static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLBRElementConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLBRElementConstructor) } }, |
96 | { "clear" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLBRElementClear), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLBRElementClear) } }, |
97 | }; |
98 | |
99 | const ClassInfo JSHTMLBRElementPrototype::s_info = { "HTMLBRElementPrototype" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSHTMLBRElementPrototype) }; |
100 | |
101 | void JSHTMLBRElementPrototype::finishCreation(VM& vm) |
102 | { |
103 | Base::finishCreation(vm); |
104 | reifyStaticProperties(vm, JSHTMLBRElement::info(), JSHTMLBRElementPrototypeTableValues, *this); |
105 | } |
106 | |
107 | const ClassInfo JSHTMLBRElement::s_info = { "HTMLBRElement" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSHTMLBRElement) }; |
108 | |
109 | JSHTMLBRElement::JSHTMLBRElement(Structure* structure, JSDOMGlobalObject& globalObject, Ref<HTMLBRElement>&& impl) |
110 | : JSHTMLElement(structure, globalObject, WTFMove(impl)) |
111 | { |
112 | } |
113 | |
114 | void JSHTMLBRElement::finishCreation(VM& vm) |
115 | { |
116 | Base::finishCreation(vm); |
117 | ASSERT(inherits(vm, info())); |
118 | |
119 | } |
120 | |
121 | JSObject* JSHTMLBRElement::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) |
122 | { |
123 | return JSHTMLBRElementPrototype::create(vm, &globalObject, JSHTMLBRElementPrototype::createStructure(vm, &globalObject, JSHTMLElement::prototype(vm, globalObject))); |
124 | } |
125 | |
126 | JSObject* JSHTMLBRElement::prototype(VM& vm, JSDOMGlobalObject& globalObject) |
127 | { |
128 | return getDOMPrototype<JSHTMLBRElement>(vm, globalObject); |
129 | } |
130 | |
131 | JSValue JSHTMLBRElement::getConstructor(VM& vm, const JSGlobalObject* globalObject) |
132 | { |
133 | return getDOMConstructor<JSHTMLBRElementConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); |
134 | } |
135 | |
136 | template<> inline JSHTMLBRElement* IDLAttribute<JSHTMLBRElement>::cast(ExecState& state, EncodedJSValue thisValue) |
137 | { |
138 | return jsDynamicCast<JSHTMLBRElement*>(state.vm(), JSValue::decode(thisValue)); |
139 | } |
140 | |
141 | EncodedJSValue jsHTMLBRElementConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
142 | { |
143 | VM& vm = state->vm(); |
144 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
145 | auto* prototype = jsDynamicCast<JSHTMLBRElementPrototype*>(vm, JSValue::decode(thisValue)); |
146 | if (UNLIKELY(!prototype)) |
147 | return throwVMTypeError(state, throwScope); |
148 | return JSValue::encode(JSHTMLBRElement::getConstructor(state->vm(), prototype->globalObject())); |
149 | } |
150 | |
151 | bool setJSHTMLBRElementConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
152 | { |
153 | VM& vm = state->vm(); |
154 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
155 | auto* prototype = jsDynamicCast<JSHTMLBRElementPrototype*>(vm, JSValue::decode(thisValue)); |
156 | if (UNLIKELY(!prototype)) { |
157 | throwVMTypeError(state, throwScope); |
158 | return false; |
159 | } |
160 | // Shadowing a built-in constructor |
161 | return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue)); |
162 | } |
163 | |
164 | static inline JSValue jsHTMLBRElementClearGetter(ExecState& state, JSHTMLBRElement& thisObject, ThrowScope& throwScope) |
165 | { |
166 | UNUSED_PARAM(throwScope); |
167 | UNUSED_PARAM(state); |
168 | auto& impl = thisObject.wrapped(); |
169 | JSValue result = toJS<IDLDOMString>(state, throwScope, impl.attributeWithoutSynchronization(WebCore::HTMLNames::clearAttr)); |
170 | return result; |
171 | } |
172 | |
173 | EncodedJSValue jsHTMLBRElementClear(ExecState* state, EncodedJSValue thisValue, PropertyName) |
174 | { |
175 | return IDLAttribute<JSHTMLBRElement>::get<jsHTMLBRElementClearGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "clear" ); |
176 | } |
177 | |
178 | static inline bool setJSHTMLBRElementClearSetter(ExecState& state, JSHTMLBRElement& thisObject, JSValue value, ThrowScope& throwScope) |
179 | { |
180 | UNUSED_PARAM(throwScope); |
181 | CustomElementReactionDisallowedScope customElementReactionDisallowedScope; |
182 | auto& impl = thisObject.wrapped(); |
183 | auto nativeValue = convert<IDLDOMString>(state, value); |
184 | RETURN_IF_EXCEPTION(throwScope, false); |
185 | AttributeSetter::call(state, throwScope, [&] { |
186 | return impl.setAttributeWithoutSynchronization(WebCore::HTMLNames::clearAttr, WTFMove(nativeValue)); |
187 | }); |
188 | return true; |
189 | } |
190 | |
191 | bool setJSHTMLBRElementClear(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
192 | { |
193 | return IDLAttribute<JSHTMLBRElement>::set<setJSHTMLBRElementClearSetter>(*state, thisValue, encodedValue, "clear" ); |
194 | } |
195 | |
196 | void JSHTMLBRElement::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder) |
197 | { |
198 | auto* thisObject = jsCast<JSHTMLBRElement*>(cell); |
199 | builder.setWrappedObjectForCell(cell, &thisObject->wrapped()); |
200 | if (thisObject->scriptExecutionContext()) |
201 | builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); |
202 | Base::heapSnapshot(cell, builder); |
203 | } |
204 | |
205 | |
206 | } |
207 | |