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 "JSHTMLImageElement.h"
23
24#include "CustomElementReactionQueue.h"
25#include "Document.h"
26#include "HTMLNames.h"
27#include "JSDOMAttribute.h"
28#include "JSDOMBinding.h"
29#include "JSDOMConstructorNotConstructable.h"
30#include "JSDOMConvertBoolean.h"
31#include "JSDOMConvertInterface.h"
32#include "JSDOMConvertNullable.h"
33#include "JSDOMConvertNumbers.h"
34#include "JSDOMConvertStrings.h"
35#include "JSDOMExceptionHandling.h"
36#include "JSDOMNamedConstructor.h"
37#include "JSDOMOperation.h"
38#include "JSDOMOperationReturningPromise.h"
39#include "JSDOMWrapperCache.h"
40#include "RuntimeEnabledFeatures.h"
41#include "ScriptExecutionContext.h"
42#include <JavaScriptCore/FunctionPrototype.h>
43#include <JavaScriptCore/HeapSnapshotBuilder.h>
44#include <JavaScriptCore/JSCInlines.h>
45#include <wtf/GetPtr.h>
46#include <wtf/PointerPreparations.h>
47#include <wtf/URL.h>
48
49
50namespace WebCore {
51using namespace JSC;
52
53// Functions
54
55JSC::EncodedJSValue JSC_HOST_CALL jsHTMLImageElementPrototypeFunctionDecode(JSC::ExecState*);
56
57// Attributes
58
59JSC::EncodedJSValue jsHTMLImageElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
60bool setJSHTMLImageElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
61JSC::EncodedJSValue jsHTMLImageElementName(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
62bool setJSHTMLImageElementName(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
63JSC::EncodedJSValue jsHTMLImageElementAlign(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
64bool setJSHTMLImageElementAlign(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
65JSC::EncodedJSValue jsHTMLImageElementAlt(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
66bool setJSHTMLImageElementAlt(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
67JSC::EncodedJSValue jsHTMLImageElementBorder(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
68bool setJSHTMLImageElementBorder(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
69JSC::EncodedJSValue jsHTMLImageElementCrossOrigin(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
70bool setJSHTMLImageElementCrossOrigin(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
71JSC::EncodedJSValue jsHTMLImageElementHeight(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
72bool setJSHTMLImageElementHeight(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
73JSC::EncodedJSValue jsHTMLImageElementHspace(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
74bool setJSHTMLImageElementHspace(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
75JSC::EncodedJSValue jsHTMLImageElementIsMap(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
76bool setJSHTMLImageElementIsMap(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
77JSC::EncodedJSValue jsHTMLImageElementLongDesc(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
78bool setJSHTMLImageElementLongDesc(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
79JSC::EncodedJSValue jsHTMLImageElementSrc(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
80bool setJSHTMLImageElementSrc(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
81JSC::EncodedJSValue jsHTMLImageElementSrcset(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
82bool setJSHTMLImageElementSrcset(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
83JSC::EncodedJSValue jsHTMLImageElementSizes(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
84bool setJSHTMLImageElementSizes(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
85JSC::EncodedJSValue jsHTMLImageElementCurrentSrc(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
86JSC::EncodedJSValue jsHTMLImageElementUseMap(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
87bool setJSHTMLImageElementUseMap(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
88JSC::EncodedJSValue jsHTMLImageElementVspace(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
89bool setJSHTMLImageElementVspace(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
90JSC::EncodedJSValue jsHTMLImageElementWidth(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
91bool setJSHTMLImageElementWidth(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
92JSC::EncodedJSValue jsHTMLImageElementDecoding(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
93bool setJSHTMLImageElementDecoding(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
94#if ENABLE(ATTACHMENT_ELEMENT)
95JSC::EncodedJSValue jsHTMLImageElementAttachmentIdentifier(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
96#endif
97JSC::EncodedJSValue jsHTMLImageElementComplete(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
98JSC::EncodedJSValue jsHTMLImageElementLowsrc(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
99bool setJSHTMLImageElementLowsrc(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
100JSC::EncodedJSValue jsHTMLImageElementNaturalHeight(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
101JSC::EncodedJSValue jsHTMLImageElementNaturalWidth(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
102JSC::EncodedJSValue jsHTMLImageElementX(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
103JSC::EncodedJSValue jsHTMLImageElementY(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
104
105class JSHTMLImageElementPrototype : public JSC::JSNonFinalObject {
106public:
107 using Base = JSC::JSNonFinalObject;
108 static JSHTMLImageElementPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure)
109 {
110 JSHTMLImageElementPrototype* ptr = new (NotNull, JSC::allocateCell<JSHTMLImageElementPrototype>(vm.heap)) JSHTMLImageElementPrototype(vm, globalObject, structure);
111 ptr->finishCreation(vm);
112 return ptr;
113 }
114
115 DECLARE_INFO;
116 static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
117 {
118 return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
119 }
120
121private:
122 JSHTMLImageElementPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
123 : JSC::JSNonFinalObject(vm, structure)
124 {
125 }
126
127 void finishCreation(JSC::VM&);
128};
129
130using JSHTMLImageElementConstructor = JSDOMConstructorNotConstructable<JSHTMLImageElement>;
131using JSHTMLImageElementNamedConstructor = JSDOMNamedConstructor<JSHTMLImageElement>;
132
133template<> JSValue JSHTMLImageElementConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
134{
135 return JSHTMLElement::getConstructor(vm, &globalObject);
136}
137
138template<> void JSHTMLImageElementConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
139{
140 putDirect(vm, vm.propertyNames->prototype, JSHTMLImageElement::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
141 putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("HTMLImageElement"_s)), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
142 putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
143}
144
145template<> const ClassInfo JSHTMLImageElementConstructor::s_info = { "HTMLImageElement", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSHTMLImageElementConstructor) };
146
147template<> EncodedJSValue JSC_HOST_CALL JSHTMLImageElementNamedConstructor::construct(ExecState* state)
148{
149 VM& vm = state->vm();
150 auto throwScope = DECLARE_THROW_SCOPE(vm);
151 UNUSED_PARAM(throwScope);
152 auto* castedThis = jsCast<JSHTMLImageElementNamedConstructor*>(state->jsCallee());
153 ASSERT(castedThis);
154 auto* context = castedThis->scriptExecutionContext();
155 if (UNLIKELY(!context))
156 return throwConstructorScriptExecutionContextUnavailableError(*state, throwScope, "HTMLImageElement");
157 ASSERT(context->isDocument());
158 auto& document = downcast<Document>(*context);
159 auto width = state->argument(0).isUndefined() ? Optional<Converter<IDLUnsignedLong>::ReturnType>() : Optional<Converter<IDLUnsignedLong>::ReturnType>(convert<IDLUnsignedLong>(*state, state->uncheckedArgument(0)));
160 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
161 auto height = state->argument(1).isUndefined() ? Optional<Converter<IDLUnsignedLong>::ReturnType>() : Optional<Converter<IDLUnsignedLong>::ReturnType>(convert<IDLUnsignedLong>(*state, state->uncheckedArgument(1)));
162 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
163 auto object = HTMLImageElement::createForJSConstructor(document, WTFMove(width), WTFMove(height));
164 return JSValue::encode(toJSNewlyCreated<IDLInterface<HTMLImageElement>>(*state, *castedThis->globalObject(), WTFMove(object)));
165}
166
167template<> JSValue JSHTMLImageElementNamedConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
168{
169 UNUSED_PARAM(vm);
170 return globalObject.functionPrototype();
171}
172
173template<> void JSHTMLImageElementNamedConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
174{
175 putDirect(vm, vm.propertyNames->prototype, JSHTMLImageElement::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
176 putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("Image"_s)), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
177 putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
178}
179
180template<> const ClassInfo JSHTMLImageElementNamedConstructor::s_info = { "Image", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSHTMLImageElementNamedConstructor) };
181
182/* Hash table for prototype */
183
184static const HashTableValue JSHTMLImageElementPrototypeTableValues[] =
185{
186 { "constructor", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLImageElementConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLImageElementConstructor) } },
187 { "name", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLImageElementName), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLImageElementName) } },
188 { "align", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLImageElementAlign), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLImageElementAlign) } },
189 { "alt", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLImageElementAlt), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLImageElementAlt) } },
190 { "border", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLImageElementBorder), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLImageElementBorder) } },
191 { "crossOrigin", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLImageElementCrossOrigin), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLImageElementCrossOrigin) } },
192 { "height", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLImageElementHeight), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLImageElementHeight) } },
193 { "hspace", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLImageElementHspace), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLImageElementHspace) } },
194 { "isMap", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLImageElementIsMap), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLImageElementIsMap) } },
195 { "longDesc", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLImageElementLongDesc), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLImageElementLongDesc) } },
196 { "src", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLImageElementSrc), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLImageElementSrc) } },
197 { "srcset", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLImageElementSrcset), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLImageElementSrcset) } },
198 { "sizes", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLImageElementSizes), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLImageElementSizes) } },
199 { "currentSrc", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLImageElementCurrentSrc), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
200 { "useMap", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLImageElementUseMap), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLImageElementUseMap) } },
201 { "vspace", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLImageElementVspace), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLImageElementVspace) } },
202 { "width", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLImageElementWidth), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLImageElementWidth) } },
203 { "decoding", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLImageElementDecoding), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLImageElementDecoding) } },
204#if ENABLE(ATTACHMENT_ELEMENT)
205 { "attachmentIdentifier", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLImageElementAttachmentIdentifier), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
206#else
207 { 0, 0, NoIntrinsic, { 0, 0 } },
208#endif
209 { "complete", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLImageElementComplete), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
210 { "lowsrc", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLImageElementLowsrc), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLImageElementLowsrc) } },
211 { "naturalHeight", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLImageElementNaturalHeight), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
212 { "naturalWidth", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLImageElementNaturalWidth), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
213 { "x", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLImageElementX), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
214 { "y", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLImageElementY), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
215 { "decode", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsHTMLImageElementPrototypeFunctionDecode), (intptr_t) (0) } },
216};
217
218const ClassInfo JSHTMLImageElementPrototype::s_info = { "HTMLImageElementPrototype", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSHTMLImageElementPrototype) };
219
220void JSHTMLImageElementPrototype::finishCreation(VM& vm)
221{
222 Base::finishCreation(vm);
223 reifyStaticProperties(vm, JSHTMLImageElement::info(), JSHTMLImageElementPrototypeTableValues, *this);
224 bool hasDisabledRuntimeProperties = false;
225#if ENABLE(ATTACHMENT_ELEMENT)
226 if (!RuntimeEnabledFeatures::sharedFeatures().attachmentElementEnabled()) {
227 hasDisabledRuntimeProperties = true;
228 auto propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>("attachmentIdentifier"), strlen("attachmentIdentifier"));
229 VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable);
230 JSObject::deleteProperty(this, globalObject()->globalExec(), propertyName);
231 }
232#endif
233 if (hasDisabledRuntimeProperties && structure()->isDictionary())
234 flattenDictionaryObject(vm);
235}
236
237const ClassInfo JSHTMLImageElement::s_info = { "HTMLImageElement", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSHTMLImageElement) };
238
239JSHTMLImageElement::JSHTMLImageElement(Structure* structure, JSDOMGlobalObject& globalObject, Ref<HTMLImageElement>&& impl)
240 : JSHTMLElement(structure, globalObject, WTFMove(impl))
241{
242}
243
244void JSHTMLImageElement::finishCreation(VM& vm)
245{
246 Base::finishCreation(vm);
247 ASSERT(inherits(vm, info()));
248
249}
250
251JSObject* JSHTMLImageElement::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
252{
253 return JSHTMLImageElementPrototype::create(vm, &globalObject, JSHTMLImageElementPrototype::createStructure(vm, &globalObject, JSHTMLElement::prototype(vm, globalObject)));
254}
255
256JSObject* JSHTMLImageElement::prototype(VM& vm, JSDOMGlobalObject& globalObject)
257{
258 return getDOMPrototype<JSHTMLImageElement>(vm, globalObject);
259}
260
261JSValue JSHTMLImageElement::getConstructor(VM& vm, const JSGlobalObject* globalObject)
262{
263 return getDOMConstructor<JSHTMLImageElementConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
264}
265
266JSValue JSHTMLImageElement::getNamedConstructor(VM& vm, JSGlobalObject* globalObject)
267{
268 return getDOMConstructor<JSHTMLImageElementNamedConstructor>(vm, *jsCast<JSDOMGlobalObject*>(globalObject));
269}
270
271template<> inline JSHTMLImageElement* IDLAttribute<JSHTMLImageElement>::cast(ExecState& state, EncodedJSValue thisValue)
272{
273 return jsDynamicCast<JSHTMLImageElement*>(state.vm(), JSValue::decode(thisValue));
274}
275
276template<> inline JSHTMLImageElement* IDLOperation<JSHTMLImageElement>::cast(ExecState& state)
277{
278 return jsDynamicCast<JSHTMLImageElement*>(state.vm(), state.thisValue());
279}
280
281EncodedJSValue jsHTMLImageElementConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
282{
283 VM& vm = state->vm();
284 auto throwScope = DECLARE_THROW_SCOPE(vm);
285 auto* prototype = jsDynamicCast<JSHTMLImageElementPrototype*>(vm, JSValue::decode(thisValue));
286 if (UNLIKELY(!prototype))
287 return throwVMTypeError(state, throwScope);
288 return JSValue::encode(JSHTMLImageElement::getConstructor(state->vm(), prototype->globalObject()));
289}
290
291bool setJSHTMLImageElementConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
292{
293 VM& vm = state->vm();
294 auto throwScope = DECLARE_THROW_SCOPE(vm);
295 auto* prototype = jsDynamicCast<JSHTMLImageElementPrototype*>(vm, JSValue::decode(thisValue));
296 if (UNLIKELY(!prototype)) {
297 throwVMTypeError(state, throwScope);
298 return false;
299 }
300 // Shadowing a built-in constructor
301 return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue));
302}
303
304static inline JSValue jsHTMLImageElementNameGetter(ExecState& state, JSHTMLImageElement& thisObject, ThrowScope& throwScope)
305{
306 UNUSED_PARAM(throwScope);
307 UNUSED_PARAM(state);
308 auto& impl = thisObject.wrapped();
309 JSValue result = toJS<IDLDOMString>(state, throwScope, impl.getNameAttribute());
310 return result;
311}
312
313EncodedJSValue jsHTMLImageElementName(ExecState* state, EncodedJSValue thisValue, PropertyName)
314{
315 return IDLAttribute<JSHTMLImageElement>::get<jsHTMLImageElementNameGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "name");
316}
317
318static inline bool setJSHTMLImageElementNameSetter(ExecState& state, JSHTMLImageElement& thisObject, JSValue value, ThrowScope& throwScope)
319{
320 UNUSED_PARAM(throwScope);
321 CustomElementReactionDisallowedScope customElementReactionDisallowedScope;
322 auto& impl = thisObject.wrapped();
323 auto nativeValue = convert<IDLDOMString>(state, value);
324 RETURN_IF_EXCEPTION(throwScope, false);
325 AttributeSetter::call(state, throwScope, [&] {
326 return impl.setAttributeWithoutSynchronization(WebCore::HTMLNames::nameAttr, WTFMove(nativeValue));
327 });
328 return true;
329}
330
331bool setJSHTMLImageElementName(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
332{
333 return IDLAttribute<JSHTMLImageElement>::set<setJSHTMLImageElementNameSetter>(*state, thisValue, encodedValue, "name");
334}
335
336static inline JSValue jsHTMLImageElementAlignGetter(ExecState& state, JSHTMLImageElement& thisObject, ThrowScope& throwScope)
337{
338 UNUSED_PARAM(throwScope);
339 UNUSED_PARAM(state);
340 auto& impl = thisObject.wrapped();
341 JSValue result = toJS<IDLDOMString>(state, throwScope, impl.attributeWithoutSynchronization(WebCore::HTMLNames::alignAttr));
342 return result;
343}
344
345EncodedJSValue jsHTMLImageElementAlign(ExecState* state, EncodedJSValue thisValue, PropertyName)
346{
347 return IDLAttribute<JSHTMLImageElement>::get<jsHTMLImageElementAlignGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "align");
348}
349
350static inline bool setJSHTMLImageElementAlignSetter(ExecState& state, JSHTMLImageElement& thisObject, JSValue value, ThrowScope& throwScope)
351{
352 UNUSED_PARAM(throwScope);
353 CustomElementReactionDisallowedScope customElementReactionDisallowedScope;
354 auto& impl = thisObject.wrapped();
355 auto nativeValue = convert<IDLDOMString>(state, value);
356 RETURN_IF_EXCEPTION(throwScope, false);
357 AttributeSetter::call(state, throwScope, [&] {
358 return impl.setAttributeWithoutSynchronization(WebCore::HTMLNames::alignAttr, WTFMove(nativeValue));
359 });
360 return true;
361}
362
363bool setJSHTMLImageElementAlign(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
364{
365 return IDLAttribute<JSHTMLImageElement>::set<setJSHTMLImageElementAlignSetter>(*state, thisValue, encodedValue, "align");
366}
367
368static inline JSValue jsHTMLImageElementAltGetter(ExecState& state, JSHTMLImageElement& thisObject, ThrowScope& throwScope)
369{
370 UNUSED_PARAM(throwScope);
371 UNUSED_PARAM(state);
372 auto& impl = thisObject.wrapped();
373 JSValue result = toJS<IDLDOMString>(state, throwScope, impl.attributeWithoutSynchronization(WebCore::HTMLNames::altAttr));
374 return result;
375}
376
377EncodedJSValue jsHTMLImageElementAlt(ExecState* state, EncodedJSValue thisValue, PropertyName)
378{
379 return IDLAttribute<JSHTMLImageElement>::get<jsHTMLImageElementAltGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "alt");
380}
381
382static inline bool setJSHTMLImageElementAltSetter(ExecState& state, JSHTMLImageElement& thisObject, JSValue value, ThrowScope& throwScope)
383{
384 UNUSED_PARAM(throwScope);
385 CustomElementReactionDisallowedScope customElementReactionDisallowedScope;
386 auto& impl = thisObject.wrapped();
387 auto nativeValue = convert<IDLDOMString>(state, value);
388 RETURN_IF_EXCEPTION(throwScope, false);
389 AttributeSetter::call(state, throwScope, [&] {
390 return impl.setAttributeWithoutSynchronization(WebCore::HTMLNames::altAttr, WTFMove(nativeValue));
391 });
392 return true;
393}
394
395bool setJSHTMLImageElementAlt(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
396{
397 return IDLAttribute<JSHTMLImageElement>::set<setJSHTMLImageElementAltSetter>(*state, thisValue, encodedValue, "alt");
398}
399
400static inline JSValue jsHTMLImageElementBorderGetter(ExecState& state, JSHTMLImageElement& thisObject, ThrowScope& throwScope)
401{
402 UNUSED_PARAM(throwScope);
403 UNUSED_PARAM(state);
404 auto& impl = thisObject.wrapped();
405 JSValue result = toJS<IDLTreatNullAsEmptyAdaptor<IDLDOMString>>(state, throwScope, impl.attributeWithoutSynchronization(WebCore::HTMLNames::borderAttr));
406 return result;
407}
408
409EncodedJSValue jsHTMLImageElementBorder(ExecState* state, EncodedJSValue thisValue, PropertyName)
410{
411 return IDLAttribute<JSHTMLImageElement>::get<jsHTMLImageElementBorderGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "border");
412}
413
414static inline bool setJSHTMLImageElementBorderSetter(ExecState& state, JSHTMLImageElement& thisObject, JSValue value, ThrowScope& throwScope)
415{
416 UNUSED_PARAM(throwScope);
417 CustomElementReactionDisallowedScope customElementReactionDisallowedScope;
418 auto& impl = thisObject.wrapped();
419 auto nativeValue = convert<IDLTreatNullAsEmptyAdaptor<IDLDOMString>>(state, value);
420 RETURN_IF_EXCEPTION(throwScope, false);
421 AttributeSetter::call(state, throwScope, [&] {
422 return impl.setAttributeWithoutSynchronization(WebCore::HTMLNames::borderAttr, WTFMove(nativeValue));
423 });
424 return true;
425}
426
427bool setJSHTMLImageElementBorder(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
428{
429 return IDLAttribute<JSHTMLImageElement>::set<setJSHTMLImageElementBorderSetter>(*state, thisValue, encodedValue, "border");
430}
431
432static inline JSValue jsHTMLImageElementCrossOriginGetter(ExecState& state, JSHTMLImageElement& thisObject, ThrowScope& throwScope)
433{
434 UNUSED_PARAM(throwScope);
435 UNUSED_PARAM(state);
436 auto& impl = thisObject.wrapped();
437 JSValue result = toJS<IDLNullable<IDLDOMString>>(state, throwScope, impl.crossOrigin());
438 return result;
439}
440
441EncodedJSValue jsHTMLImageElementCrossOrigin(ExecState* state, EncodedJSValue thisValue, PropertyName)
442{
443 return IDLAttribute<JSHTMLImageElement>::get<jsHTMLImageElementCrossOriginGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "crossOrigin");
444}
445
446static inline bool setJSHTMLImageElementCrossOriginSetter(ExecState& state, JSHTMLImageElement& thisObject, JSValue value, ThrowScope& throwScope)
447{
448 UNUSED_PARAM(throwScope);
449 CustomElementReactionDisallowedScope customElementReactionDisallowedScope;
450 auto& impl = thisObject.wrapped();
451 auto nativeValue = convert<IDLNullable<IDLDOMString>>(state, value);
452 RETURN_IF_EXCEPTION(throwScope, false);
453 AttributeSetter::call(state, throwScope, [&] {
454 return impl.setCrossOrigin(WTFMove(nativeValue));
455 });
456 return true;
457}
458
459bool setJSHTMLImageElementCrossOrigin(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
460{
461 return IDLAttribute<JSHTMLImageElement>::set<setJSHTMLImageElementCrossOriginSetter>(*state, thisValue, encodedValue, "crossOrigin");
462}
463
464static inline JSValue jsHTMLImageElementHeightGetter(ExecState& state, JSHTMLImageElement& thisObject, ThrowScope& throwScope)
465{
466 UNUSED_PARAM(throwScope);
467 UNUSED_PARAM(state);
468 auto& impl = thisObject.wrapped();
469 JSValue result = toJS<IDLUnsignedLong>(state, throwScope, impl.height());
470 return result;
471}
472
473EncodedJSValue jsHTMLImageElementHeight(ExecState* state, EncodedJSValue thisValue, PropertyName)
474{
475 return IDLAttribute<JSHTMLImageElement>::get<jsHTMLImageElementHeightGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "height");
476}
477
478static inline bool setJSHTMLImageElementHeightSetter(ExecState& state, JSHTMLImageElement& thisObject, JSValue value, ThrowScope& throwScope)
479{
480 UNUSED_PARAM(throwScope);
481 CustomElementReactionDisallowedScope customElementReactionDisallowedScope;
482 auto& impl = thisObject.wrapped();
483 auto nativeValue = convert<IDLUnsignedLong>(state, value);
484 RETURN_IF_EXCEPTION(throwScope, false);
485 AttributeSetter::call(state, throwScope, [&] {
486 return impl.setHeight(WTFMove(nativeValue));
487 });
488 return true;
489}
490
491bool setJSHTMLImageElementHeight(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
492{
493 return IDLAttribute<JSHTMLImageElement>::set<setJSHTMLImageElementHeightSetter>(*state, thisValue, encodedValue, "height");
494}
495
496static inline JSValue jsHTMLImageElementHspaceGetter(ExecState& state, JSHTMLImageElement& thisObject, ThrowScope& throwScope)
497{
498 UNUSED_PARAM(throwScope);
499 UNUSED_PARAM(state);
500 auto& impl = thisObject.wrapped();
501 JSValue result = toJS<IDLUnsignedLong>(state, throwScope, std::max(0, impl.getIntegralAttribute(WebCore::HTMLNames::hspaceAttr)));
502 return result;
503}
504
505EncodedJSValue jsHTMLImageElementHspace(ExecState* state, EncodedJSValue thisValue, PropertyName)
506{
507 return IDLAttribute<JSHTMLImageElement>::get<jsHTMLImageElementHspaceGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "hspace");
508}
509
510static inline bool setJSHTMLImageElementHspaceSetter(ExecState& state, JSHTMLImageElement& thisObject, JSValue value, ThrowScope& throwScope)
511{
512 UNUSED_PARAM(throwScope);
513 CustomElementReactionDisallowedScope customElementReactionDisallowedScope;
514 auto& impl = thisObject.wrapped();
515 auto nativeValue = convert<IDLUnsignedLong>(state, value);
516 RETURN_IF_EXCEPTION(throwScope, false);
517 AttributeSetter::call(state, throwScope, [&] {
518 return impl.setUnsignedIntegralAttribute(WebCore::HTMLNames::hspaceAttr, WTFMove(nativeValue));
519 });
520 return true;
521}
522
523bool setJSHTMLImageElementHspace(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
524{
525 return IDLAttribute<JSHTMLImageElement>::set<setJSHTMLImageElementHspaceSetter>(*state, thisValue, encodedValue, "hspace");
526}
527
528static inline JSValue jsHTMLImageElementIsMapGetter(ExecState& state, JSHTMLImageElement& thisObject, ThrowScope& throwScope)
529{
530 UNUSED_PARAM(throwScope);
531 UNUSED_PARAM(state);
532 auto& impl = thisObject.wrapped();
533 JSValue result = toJS<IDLBoolean>(state, throwScope, impl.hasAttributeWithoutSynchronization(WebCore::HTMLNames::ismapAttr));
534 return result;
535}
536
537EncodedJSValue jsHTMLImageElementIsMap(ExecState* state, EncodedJSValue thisValue, PropertyName)
538{
539 return IDLAttribute<JSHTMLImageElement>::get<jsHTMLImageElementIsMapGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "isMap");
540}
541
542static inline bool setJSHTMLImageElementIsMapSetter(ExecState& state, JSHTMLImageElement& thisObject, JSValue value, ThrowScope& throwScope)
543{
544 UNUSED_PARAM(throwScope);
545 CustomElementReactionDisallowedScope customElementReactionDisallowedScope;
546 auto& impl = thisObject.wrapped();
547 auto nativeValue = convert<IDLBoolean>(state, value);
548 RETURN_IF_EXCEPTION(throwScope, false);
549 AttributeSetter::call(state, throwScope, [&] {
550 return impl.setBooleanAttribute(WebCore::HTMLNames::ismapAttr, WTFMove(nativeValue));
551 });
552 return true;
553}
554
555bool setJSHTMLImageElementIsMap(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
556{
557 return IDLAttribute<JSHTMLImageElement>::set<setJSHTMLImageElementIsMapSetter>(*state, thisValue, encodedValue, "isMap");
558}
559
560static inline JSValue jsHTMLImageElementLongDescGetter(ExecState& state, JSHTMLImageElement& thisObject, ThrowScope& throwScope)
561{
562 UNUSED_PARAM(throwScope);
563 UNUSED_PARAM(state);
564 auto& impl = thisObject.wrapped();
565 JSValue result = toJS<IDLUSVString>(state, throwScope, impl.getURLAttribute(WebCore::HTMLNames::longdescAttr));
566 return result;
567}
568
569EncodedJSValue jsHTMLImageElementLongDesc(ExecState* state, EncodedJSValue thisValue, PropertyName)
570{
571 return IDLAttribute<JSHTMLImageElement>::get<jsHTMLImageElementLongDescGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "longDesc");
572}
573
574static inline bool setJSHTMLImageElementLongDescSetter(ExecState& state, JSHTMLImageElement& thisObject, JSValue value, ThrowScope& throwScope)
575{
576 UNUSED_PARAM(throwScope);
577 CustomElementReactionDisallowedScope customElementReactionDisallowedScope;
578 auto& impl = thisObject.wrapped();
579 auto nativeValue = convert<IDLUSVString>(state, value);
580 RETURN_IF_EXCEPTION(throwScope, false);
581 AttributeSetter::call(state, throwScope, [&] {
582 return impl.setAttributeWithoutSynchronization(WebCore::HTMLNames::longdescAttr, WTFMove(nativeValue));
583 });
584 return true;
585}
586
587bool setJSHTMLImageElementLongDesc(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
588{
589 return IDLAttribute<JSHTMLImageElement>::set<setJSHTMLImageElementLongDescSetter>(*state, thisValue, encodedValue, "longDesc");
590}
591
592static inline JSValue jsHTMLImageElementSrcGetter(ExecState& state, JSHTMLImageElement& thisObject, ThrowScope& throwScope)
593{
594 UNUSED_PARAM(throwScope);
595 UNUSED_PARAM(state);
596 auto& impl = thisObject.wrapped();
597 JSValue result = toJS<IDLUSVString>(state, throwScope, impl.getURLAttribute(WebCore::HTMLNames::srcAttr));
598 return result;
599}
600
601EncodedJSValue jsHTMLImageElementSrc(ExecState* state, EncodedJSValue thisValue, PropertyName)
602{
603 return IDLAttribute<JSHTMLImageElement>::get<jsHTMLImageElementSrcGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "src");
604}
605
606static inline bool setJSHTMLImageElementSrcSetter(ExecState& state, JSHTMLImageElement& thisObject, JSValue value, ThrowScope& throwScope)
607{
608 UNUSED_PARAM(throwScope);
609 CustomElementReactionDisallowedScope customElementReactionDisallowedScope;
610 auto& impl = thisObject.wrapped();
611 auto nativeValue = convert<IDLUSVString>(state, value);
612 RETURN_IF_EXCEPTION(throwScope, false);
613 AttributeSetter::call(state, throwScope, [&] {
614 return impl.setAttributeWithoutSynchronization(WebCore::HTMLNames::srcAttr, WTFMove(nativeValue));
615 });
616 return true;
617}
618
619bool setJSHTMLImageElementSrc(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
620{
621 return IDLAttribute<JSHTMLImageElement>::set<setJSHTMLImageElementSrcSetter>(*state, thisValue, encodedValue, "src");
622}
623
624static inline JSValue jsHTMLImageElementSrcsetGetter(ExecState& state, JSHTMLImageElement& thisObject, ThrowScope& throwScope)
625{
626 UNUSED_PARAM(throwScope);
627 UNUSED_PARAM(state);
628 auto& impl = thisObject.wrapped();
629 JSValue result = toJS<IDLUSVString>(state, throwScope, impl.attributeWithoutSynchronization(WebCore::HTMLNames::srcsetAttr));
630 return result;
631}
632
633EncodedJSValue jsHTMLImageElementSrcset(ExecState* state, EncodedJSValue thisValue, PropertyName)
634{
635 return IDLAttribute<JSHTMLImageElement>::get<jsHTMLImageElementSrcsetGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "srcset");
636}
637
638static inline bool setJSHTMLImageElementSrcsetSetter(ExecState& state, JSHTMLImageElement& thisObject, JSValue value, ThrowScope& throwScope)
639{
640 UNUSED_PARAM(throwScope);
641 CustomElementReactionDisallowedScope customElementReactionDisallowedScope;
642 auto& impl = thisObject.wrapped();
643 auto nativeValue = convert<IDLUSVString>(state, value);
644 RETURN_IF_EXCEPTION(throwScope, false);
645 AttributeSetter::call(state, throwScope, [&] {
646 return impl.setAttributeWithoutSynchronization(WebCore::HTMLNames::srcsetAttr, WTFMove(nativeValue));
647 });
648 return true;
649}
650
651bool setJSHTMLImageElementSrcset(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
652{
653 return IDLAttribute<JSHTMLImageElement>::set<setJSHTMLImageElementSrcsetSetter>(*state, thisValue, encodedValue, "srcset");
654}
655
656static inline JSValue jsHTMLImageElementSizesGetter(ExecState& state, JSHTMLImageElement& thisObject, ThrowScope& throwScope)
657{
658 UNUSED_PARAM(throwScope);
659 UNUSED_PARAM(state);
660 auto& impl = thisObject.wrapped();
661 JSValue result = toJS<IDLDOMString>(state, throwScope, impl.attributeWithoutSynchronization(WebCore::HTMLNames::sizesAttr));
662 return result;
663}
664
665EncodedJSValue jsHTMLImageElementSizes(ExecState* state, EncodedJSValue thisValue, PropertyName)
666{
667 return IDLAttribute<JSHTMLImageElement>::get<jsHTMLImageElementSizesGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "sizes");
668}
669
670static inline bool setJSHTMLImageElementSizesSetter(ExecState& state, JSHTMLImageElement& thisObject, JSValue value, ThrowScope& throwScope)
671{
672 UNUSED_PARAM(throwScope);
673 CustomElementReactionDisallowedScope customElementReactionDisallowedScope;
674 auto& impl = thisObject.wrapped();
675 auto nativeValue = convert<IDLDOMString>(state, value);
676 RETURN_IF_EXCEPTION(throwScope, false);
677 AttributeSetter::call(state, throwScope, [&] {
678 return impl.setAttributeWithoutSynchronization(WebCore::HTMLNames::sizesAttr, WTFMove(nativeValue));
679 });
680 return true;
681}
682
683bool setJSHTMLImageElementSizes(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
684{
685 return IDLAttribute<JSHTMLImageElement>::set<setJSHTMLImageElementSizesSetter>(*state, thisValue, encodedValue, "sizes");
686}
687
688static inline JSValue jsHTMLImageElementCurrentSrcGetter(ExecState& state, JSHTMLImageElement& thisObject, ThrowScope& throwScope)
689{
690 UNUSED_PARAM(throwScope);
691 UNUSED_PARAM(state);
692 auto& impl = thisObject.wrapped();
693 JSValue result = toJS<IDLUSVString>(state, throwScope, impl.currentSrc());
694 return result;
695}
696
697EncodedJSValue jsHTMLImageElementCurrentSrc(ExecState* state, EncodedJSValue thisValue, PropertyName)
698{
699 return IDLAttribute<JSHTMLImageElement>::get<jsHTMLImageElementCurrentSrcGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "currentSrc");
700}
701
702static inline JSValue jsHTMLImageElementUseMapGetter(ExecState& state, JSHTMLImageElement& thisObject, ThrowScope& throwScope)
703{
704 UNUSED_PARAM(throwScope);
705 UNUSED_PARAM(state);
706 auto& impl = thisObject.wrapped();
707 JSValue result = toJS<IDLDOMString>(state, throwScope, impl.attributeWithoutSynchronization(WebCore::HTMLNames::usemapAttr));
708 return result;
709}
710
711EncodedJSValue jsHTMLImageElementUseMap(ExecState* state, EncodedJSValue thisValue, PropertyName)
712{
713 return IDLAttribute<JSHTMLImageElement>::get<jsHTMLImageElementUseMapGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "useMap");
714}
715
716static inline bool setJSHTMLImageElementUseMapSetter(ExecState& state, JSHTMLImageElement& thisObject, JSValue value, ThrowScope& throwScope)
717{
718 UNUSED_PARAM(throwScope);
719 CustomElementReactionDisallowedScope customElementReactionDisallowedScope;
720 auto& impl = thisObject.wrapped();
721 auto nativeValue = convert<IDLDOMString>(state, value);
722 RETURN_IF_EXCEPTION(throwScope, false);
723 AttributeSetter::call(state, throwScope, [&] {
724 return impl.setAttributeWithoutSynchronization(WebCore::HTMLNames::usemapAttr, WTFMove(nativeValue));
725 });
726 return true;
727}
728
729bool setJSHTMLImageElementUseMap(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
730{
731 return IDLAttribute<JSHTMLImageElement>::set<setJSHTMLImageElementUseMapSetter>(*state, thisValue, encodedValue, "useMap");
732}
733
734static inline JSValue jsHTMLImageElementVspaceGetter(ExecState& state, JSHTMLImageElement& thisObject, ThrowScope& throwScope)
735{
736 UNUSED_PARAM(throwScope);
737 UNUSED_PARAM(state);
738 auto& impl = thisObject.wrapped();
739 JSValue result = toJS<IDLUnsignedLong>(state, throwScope, std::max(0, impl.getIntegralAttribute(WebCore::HTMLNames::vspaceAttr)));
740 return result;
741}
742
743EncodedJSValue jsHTMLImageElementVspace(ExecState* state, EncodedJSValue thisValue, PropertyName)
744{
745 return IDLAttribute<JSHTMLImageElement>::get<jsHTMLImageElementVspaceGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "vspace");
746}
747
748static inline bool setJSHTMLImageElementVspaceSetter(ExecState& state, JSHTMLImageElement& thisObject, JSValue value, ThrowScope& throwScope)
749{
750 UNUSED_PARAM(throwScope);
751 CustomElementReactionDisallowedScope customElementReactionDisallowedScope;
752 auto& impl = thisObject.wrapped();
753 auto nativeValue = convert<IDLUnsignedLong>(state, value);
754 RETURN_IF_EXCEPTION(throwScope, false);
755 AttributeSetter::call(state, throwScope, [&] {
756 return impl.setUnsignedIntegralAttribute(WebCore::HTMLNames::vspaceAttr, WTFMove(nativeValue));
757 });
758 return true;
759}
760
761bool setJSHTMLImageElementVspace(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
762{
763 return IDLAttribute<JSHTMLImageElement>::set<setJSHTMLImageElementVspaceSetter>(*state, thisValue, encodedValue, "vspace");
764}
765
766static inline JSValue jsHTMLImageElementWidthGetter(ExecState& state, JSHTMLImageElement& thisObject, ThrowScope& throwScope)
767{
768 UNUSED_PARAM(throwScope);
769 UNUSED_PARAM(state);
770 auto& impl = thisObject.wrapped();
771 JSValue result = toJS<IDLUnsignedLong>(state, throwScope, impl.width());
772 return result;
773}
774
775EncodedJSValue jsHTMLImageElementWidth(ExecState* state, EncodedJSValue thisValue, PropertyName)
776{
777 return IDLAttribute<JSHTMLImageElement>::get<jsHTMLImageElementWidthGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "width");
778}
779
780static inline bool setJSHTMLImageElementWidthSetter(ExecState& state, JSHTMLImageElement& thisObject, JSValue value, ThrowScope& throwScope)
781{
782 UNUSED_PARAM(throwScope);
783 CustomElementReactionDisallowedScope customElementReactionDisallowedScope;
784 auto& impl = thisObject.wrapped();
785 auto nativeValue = convert<IDLUnsignedLong>(state, value);
786 RETURN_IF_EXCEPTION(throwScope, false);
787 AttributeSetter::call(state, throwScope, [&] {
788 return impl.setWidth(WTFMove(nativeValue));
789 });
790 return true;
791}
792
793bool setJSHTMLImageElementWidth(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
794{
795 return IDLAttribute<JSHTMLImageElement>::set<setJSHTMLImageElementWidthSetter>(*state, thisValue, encodedValue, "width");
796}
797
798static inline JSValue jsHTMLImageElementDecodingGetter(ExecState& state, JSHTMLImageElement& thisObject, ThrowScope& throwScope)
799{
800 UNUSED_PARAM(throwScope);
801 UNUSED_PARAM(state);
802 auto& impl = thisObject.wrapped();
803 JSValue result = toJS<IDLDOMString>(state, throwScope, impl.attributeWithoutSynchronization(WebCore::HTMLNames::decodingAttr));
804 return result;
805}
806
807EncodedJSValue jsHTMLImageElementDecoding(ExecState* state, EncodedJSValue thisValue, PropertyName)
808{
809 return IDLAttribute<JSHTMLImageElement>::get<jsHTMLImageElementDecodingGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "decoding");
810}
811
812static inline bool setJSHTMLImageElementDecodingSetter(ExecState& state, JSHTMLImageElement& thisObject, JSValue value, ThrowScope& throwScope)
813{
814 UNUSED_PARAM(throwScope);
815 CustomElementReactionDisallowedScope customElementReactionDisallowedScope;
816 auto& impl = thisObject.wrapped();
817 auto nativeValue = convert<IDLDOMString>(state, value);
818 RETURN_IF_EXCEPTION(throwScope, false);
819 AttributeSetter::call(state, throwScope, [&] {
820 return impl.setAttributeWithoutSynchronization(WebCore::HTMLNames::decodingAttr, WTFMove(nativeValue));
821 });
822 return true;
823}
824
825bool setJSHTMLImageElementDecoding(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
826{
827 return IDLAttribute<JSHTMLImageElement>::set<setJSHTMLImageElementDecodingSetter>(*state, thisValue, encodedValue, "decoding");
828}
829
830#if ENABLE(ATTACHMENT_ELEMENT)
831static inline JSValue jsHTMLImageElementAttachmentIdentifierGetter(ExecState& state, JSHTMLImageElement& thisObject, ThrowScope& throwScope)
832{
833 UNUSED_PARAM(throwScope);
834 UNUSED_PARAM(state);
835 auto& impl = thisObject.wrapped();
836 JSValue result = toJS<IDLDOMString>(state, throwScope, impl.attachmentIdentifier());
837 return result;
838}
839
840EncodedJSValue jsHTMLImageElementAttachmentIdentifier(ExecState* state, EncodedJSValue thisValue, PropertyName)
841{
842 return IDLAttribute<JSHTMLImageElement>::get<jsHTMLImageElementAttachmentIdentifierGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "attachmentIdentifier");
843}
844
845#endif
846
847static inline JSValue jsHTMLImageElementCompleteGetter(ExecState& state, JSHTMLImageElement& thisObject, ThrowScope& throwScope)
848{
849 UNUSED_PARAM(throwScope);
850 UNUSED_PARAM(state);
851 auto& impl = thisObject.wrapped();
852 JSValue result = toJS<IDLBoolean>(state, throwScope, impl.complete());
853 return result;
854}
855
856EncodedJSValue jsHTMLImageElementComplete(ExecState* state, EncodedJSValue thisValue, PropertyName)
857{
858 return IDLAttribute<JSHTMLImageElement>::get<jsHTMLImageElementCompleteGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "complete");
859}
860
861static inline JSValue jsHTMLImageElementLowsrcGetter(ExecState& state, JSHTMLImageElement& thisObject, ThrowScope& throwScope)
862{
863 UNUSED_PARAM(throwScope);
864 UNUSED_PARAM(state);
865 auto& impl = thisObject.wrapped();
866 JSValue result = toJS<IDLUSVString>(state, throwScope, impl.getURLAttribute(WebCore::HTMLNames::lowsrcAttr));
867 return result;
868}
869
870EncodedJSValue jsHTMLImageElementLowsrc(ExecState* state, EncodedJSValue thisValue, PropertyName)
871{
872 return IDLAttribute<JSHTMLImageElement>::get<jsHTMLImageElementLowsrcGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "lowsrc");
873}
874
875static inline bool setJSHTMLImageElementLowsrcSetter(ExecState& state, JSHTMLImageElement& thisObject, JSValue value, ThrowScope& throwScope)
876{
877 UNUSED_PARAM(throwScope);
878 CustomElementReactionDisallowedScope customElementReactionDisallowedScope;
879 auto& impl = thisObject.wrapped();
880 auto nativeValue = convert<IDLUSVString>(state, value);
881 RETURN_IF_EXCEPTION(throwScope, false);
882 AttributeSetter::call(state, throwScope, [&] {
883 return impl.setAttributeWithoutSynchronization(WebCore::HTMLNames::lowsrcAttr, WTFMove(nativeValue));
884 });
885 return true;
886}
887
888bool setJSHTMLImageElementLowsrc(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
889{
890 return IDLAttribute<JSHTMLImageElement>::set<setJSHTMLImageElementLowsrcSetter>(*state, thisValue, encodedValue, "lowsrc");
891}
892
893static inline JSValue jsHTMLImageElementNaturalHeightGetter(ExecState& state, JSHTMLImageElement& thisObject, ThrowScope& throwScope)
894{
895 UNUSED_PARAM(throwScope);
896 UNUSED_PARAM(state);
897 auto& impl = thisObject.wrapped();
898 JSValue result = toJS<IDLLong>(state, throwScope, impl.naturalHeight());
899 return result;
900}
901
902EncodedJSValue jsHTMLImageElementNaturalHeight(ExecState* state, EncodedJSValue thisValue, PropertyName)
903{
904 return IDLAttribute<JSHTMLImageElement>::get<jsHTMLImageElementNaturalHeightGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "naturalHeight");
905}
906
907static inline JSValue jsHTMLImageElementNaturalWidthGetter(ExecState& state, JSHTMLImageElement& thisObject, ThrowScope& throwScope)
908{
909 UNUSED_PARAM(throwScope);
910 UNUSED_PARAM(state);
911 auto& impl = thisObject.wrapped();
912 JSValue result = toJS<IDLLong>(state, throwScope, impl.naturalWidth());
913 return result;
914}
915
916EncodedJSValue jsHTMLImageElementNaturalWidth(ExecState* state, EncodedJSValue thisValue, PropertyName)
917{
918 return IDLAttribute<JSHTMLImageElement>::get<jsHTMLImageElementNaturalWidthGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "naturalWidth");
919}
920
921static inline JSValue jsHTMLImageElementXGetter(ExecState& state, JSHTMLImageElement& thisObject, ThrowScope& throwScope)
922{
923 UNUSED_PARAM(throwScope);
924 UNUSED_PARAM(state);
925 auto& impl = thisObject.wrapped();
926 JSValue result = toJS<IDLLong>(state, throwScope, impl.x());
927 return result;
928}
929
930EncodedJSValue jsHTMLImageElementX(ExecState* state, EncodedJSValue thisValue, PropertyName)
931{
932 return IDLAttribute<JSHTMLImageElement>::get<jsHTMLImageElementXGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "x");
933}
934
935static inline JSValue jsHTMLImageElementYGetter(ExecState& state, JSHTMLImageElement& thisObject, ThrowScope& throwScope)
936{
937 UNUSED_PARAM(throwScope);
938 UNUSED_PARAM(state);
939 auto& impl = thisObject.wrapped();
940 JSValue result = toJS<IDLLong>(state, throwScope, impl.y());
941 return result;
942}
943
944EncodedJSValue jsHTMLImageElementY(ExecState* state, EncodedJSValue thisValue, PropertyName)
945{
946 return IDLAttribute<JSHTMLImageElement>::get<jsHTMLImageElementYGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "y");
947}
948
949static inline JSC::EncodedJSValue jsHTMLImageElementPrototypeFunctionDecodeBody(JSC::ExecState* state, typename IDLOperationReturningPromise<JSHTMLImageElement>::ClassParameter castedThis, Ref<DeferredPromise>&& promise, JSC::ThrowScope& throwScope)
950{
951 UNUSED_PARAM(state);
952 UNUSED_PARAM(throwScope);
953 auto& impl = castedThis->wrapped();
954 impl.decode(WTFMove(promise));
955 return JSValue::encode(jsUndefined());
956}
957
958EncodedJSValue JSC_HOST_CALL jsHTMLImageElementPrototypeFunctionDecode(ExecState* state)
959{
960 return IDLOperationReturningPromise<JSHTMLImageElement>::call<jsHTMLImageElementPrototypeFunctionDecodeBody, PromiseExecutionScope::WindowOnly>(*state, "decode");
961}
962
963void JSHTMLImageElement::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder)
964{
965 auto* thisObject = jsCast<JSHTMLImageElement*>(cell);
966 builder.setWrappedObjectForCell(cell, &thisObject->wrapped());
967 if (thisObject->scriptExecutionContext())
968 builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string());
969 Base::heapSnapshot(cell, builder);
970}
971
972#if ENABLE(BINDING_INTEGRITY)
973#if PLATFORM(WIN)
974#pragma warning(disable: 4483)
975extern "C" { extern void (*const __identifier("??_7HTMLImageElement@WebCore@@6B@")[])(); }
976#else
977extern "C" { extern void* _ZTVN7WebCore16HTMLImageElementE[]; }
978#endif
979#endif
980
981JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<HTMLImageElement>&& impl)
982{
983
984#if ENABLE(BINDING_INTEGRITY)
985 void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr()));
986#if PLATFORM(WIN)
987 void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(__identifier("??_7HTMLImageElement@WebCore@@6B@"));
988#else
989 void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(&_ZTVN7WebCore16HTMLImageElementE[2]);
990#endif
991
992 // If this fails HTMLImageElement does not have a vtable, so you need to add the
993 // ImplementationLacksVTable attribute to the interface definition
994 static_assert(std::is_polymorphic<HTMLImageElement>::value, "HTMLImageElement is not polymorphic");
995
996 // If you hit this assertion you either have a use after free bug, or
997 // HTMLImageElement has subclasses. If HTMLImageElement has subclasses that get passed
998 // to toJS() we currently require HTMLImageElement you to opt out of binding hardening
999 // by adding the SkipVTableValidation attribute to the interface IDL definition
1000 RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
1001#endif
1002 return createWrapper<HTMLImageElement>(globalObject, WTFMove(impl));
1003}
1004
1005JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, HTMLImageElement& impl)
1006{
1007 return wrap(state, globalObject, impl);
1008}
1009
1010HTMLImageElement* JSHTMLImageElement::toWrapped(JSC::VM& vm, JSC::JSValue value)
1011{
1012 if (auto* wrapper = jsDynamicCast<JSHTMLImageElement*>(vm, value))
1013 return &wrapper->wrapped();
1014 return nullptr;
1015}
1016
1017}
1018