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