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 "JSHTMLFontElement.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
40namespace WebCore {
41using namespace JSC;
42
43// Attributes
44
45JSC::EncodedJSValue jsHTMLFontElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
46bool setJSHTMLFontElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
47JSC::EncodedJSValue jsHTMLFontElementColor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
48bool setJSHTMLFontElementColor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
49JSC::EncodedJSValue jsHTMLFontElementFace(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
50bool setJSHTMLFontElementFace(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
51JSC::EncodedJSValue jsHTMLFontElementSize(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
52bool setJSHTMLFontElementSize(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
53
54class JSHTMLFontElementPrototype : public JSC::JSNonFinalObject {
55public:
56 using Base = JSC::JSNonFinalObject;
57 static JSHTMLFontElementPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure)
58 {
59 JSHTMLFontElementPrototype* ptr = new (NotNull, JSC::allocateCell<JSHTMLFontElementPrototype>(vm.heap)) JSHTMLFontElementPrototype(vm, globalObject, structure);
60 ptr->finishCreation(vm);
61 return ptr;
62 }
63
64 DECLARE_INFO;
65 static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
66 {
67 return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
68 }
69
70private:
71 JSHTMLFontElementPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
72 : JSC::JSNonFinalObject(vm, structure)
73 {
74 }
75
76 void finishCreation(JSC::VM&);
77};
78
79using JSHTMLFontElementConstructor = JSDOMConstructorNotConstructable<JSHTMLFontElement>;
80
81template<> JSValue JSHTMLFontElementConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
82{
83 return JSHTMLElement::getConstructor(vm, &globalObject);
84}
85
86template<> void JSHTMLFontElementConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
87{
88 putDirect(vm, vm.propertyNames->prototype, JSHTMLFontElement::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
89 putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("HTMLFontElement"_s)), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
90 putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
91}
92
93template<> const ClassInfo JSHTMLFontElementConstructor::s_info = { "HTMLFontElement", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSHTMLFontElementConstructor) };
94
95/* Hash table for prototype */
96
97static const HashTableValue JSHTMLFontElementPrototypeTableValues[] =
98{
99 { "constructor", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLFontElementConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLFontElementConstructor) } },
100 { "color", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLFontElementColor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLFontElementColor) } },
101 { "face", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLFontElementFace), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLFontElementFace) } },
102 { "size", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLFontElementSize), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLFontElementSize) } },
103};
104
105const ClassInfo JSHTMLFontElementPrototype::s_info = { "HTMLFontElementPrototype", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSHTMLFontElementPrototype) };
106
107void JSHTMLFontElementPrototype::finishCreation(VM& vm)
108{
109 Base::finishCreation(vm);
110 reifyStaticProperties(vm, JSHTMLFontElement::info(), JSHTMLFontElementPrototypeTableValues, *this);
111}
112
113const ClassInfo JSHTMLFontElement::s_info = { "HTMLFontElement", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSHTMLFontElement) };
114
115JSHTMLFontElement::JSHTMLFontElement(Structure* structure, JSDOMGlobalObject& globalObject, Ref<HTMLFontElement>&& impl)
116 : JSHTMLElement(structure, globalObject, WTFMove(impl))
117{
118}
119
120void JSHTMLFontElement::finishCreation(VM& vm)
121{
122 Base::finishCreation(vm);
123 ASSERT(inherits(vm, info()));
124
125}
126
127JSObject* JSHTMLFontElement::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
128{
129 return JSHTMLFontElementPrototype::create(vm, &globalObject, JSHTMLFontElementPrototype::createStructure(vm, &globalObject, JSHTMLElement::prototype(vm, globalObject)));
130}
131
132JSObject* JSHTMLFontElement::prototype(VM& vm, JSDOMGlobalObject& globalObject)
133{
134 return getDOMPrototype<JSHTMLFontElement>(vm, globalObject);
135}
136
137JSValue JSHTMLFontElement::getConstructor(VM& vm, const JSGlobalObject* globalObject)
138{
139 return getDOMConstructor<JSHTMLFontElementConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
140}
141
142template<> inline JSHTMLFontElement* IDLAttribute<JSHTMLFontElement>::cast(ExecState& state, EncodedJSValue thisValue)
143{
144 return jsDynamicCast<JSHTMLFontElement*>(state.vm(), JSValue::decode(thisValue));
145}
146
147EncodedJSValue jsHTMLFontElementConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
148{
149 VM& vm = state->vm();
150 auto throwScope = DECLARE_THROW_SCOPE(vm);
151 auto* prototype = jsDynamicCast<JSHTMLFontElementPrototype*>(vm, JSValue::decode(thisValue));
152 if (UNLIKELY(!prototype))
153 return throwVMTypeError(state, throwScope);
154 return JSValue::encode(JSHTMLFontElement::getConstructor(state->vm(), prototype->globalObject()));
155}
156
157bool setJSHTMLFontElementConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
158{
159 VM& vm = state->vm();
160 auto throwScope = DECLARE_THROW_SCOPE(vm);
161 auto* prototype = jsDynamicCast<JSHTMLFontElementPrototype*>(vm, JSValue::decode(thisValue));
162 if (UNLIKELY(!prototype)) {
163 throwVMTypeError(state, throwScope);
164 return false;
165 }
166 // Shadowing a built-in constructor
167 return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue));
168}
169
170static inline JSValue jsHTMLFontElementColorGetter(ExecState& state, JSHTMLFontElement& thisObject, ThrowScope& throwScope)
171{
172 UNUSED_PARAM(throwScope);
173 UNUSED_PARAM(state);
174 auto& impl = thisObject.wrapped();
175 JSValue result = toJS<IDLTreatNullAsEmptyAdaptor<IDLDOMString>>(state, throwScope, impl.attributeWithoutSynchronization(WebCore::HTMLNames::colorAttr));
176 return result;
177}
178
179EncodedJSValue jsHTMLFontElementColor(ExecState* state, EncodedJSValue thisValue, PropertyName)
180{
181 return IDLAttribute<JSHTMLFontElement>::get<jsHTMLFontElementColorGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "color");
182}
183
184static inline bool setJSHTMLFontElementColorSetter(ExecState& state, JSHTMLFontElement& thisObject, JSValue value, ThrowScope& throwScope)
185{
186 UNUSED_PARAM(throwScope);
187 CustomElementReactionDisallowedScope customElementReactionDisallowedScope;
188 auto& impl = thisObject.wrapped();
189 auto nativeValue = convert<IDLTreatNullAsEmptyAdaptor<IDLDOMString>>(state, value);
190 RETURN_IF_EXCEPTION(throwScope, false);
191 AttributeSetter::call(state, throwScope, [&] {
192 return impl.setAttributeWithoutSynchronization(WebCore::HTMLNames::colorAttr, WTFMove(nativeValue));
193 });
194 return true;
195}
196
197bool setJSHTMLFontElementColor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
198{
199 return IDLAttribute<JSHTMLFontElement>::set<setJSHTMLFontElementColorSetter>(*state, thisValue, encodedValue, "color");
200}
201
202static inline JSValue jsHTMLFontElementFaceGetter(ExecState& state, JSHTMLFontElement& thisObject, ThrowScope& throwScope)
203{
204 UNUSED_PARAM(throwScope);
205 UNUSED_PARAM(state);
206 auto& impl = thisObject.wrapped();
207 JSValue result = toJS<IDLDOMString>(state, throwScope, impl.attributeWithoutSynchronization(WebCore::HTMLNames::faceAttr));
208 return result;
209}
210
211EncodedJSValue jsHTMLFontElementFace(ExecState* state, EncodedJSValue thisValue, PropertyName)
212{
213 return IDLAttribute<JSHTMLFontElement>::get<jsHTMLFontElementFaceGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "face");
214}
215
216static inline bool setJSHTMLFontElementFaceSetter(ExecState& state, JSHTMLFontElement& thisObject, JSValue value, ThrowScope& throwScope)
217{
218 UNUSED_PARAM(throwScope);
219 CustomElementReactionDisallowedScope customElementReactionDisallowedScope;
220 auto& impl = thisObject.wrapped();
221 auto nativeValue = convert<IDLDOMString>(state, value);
222 RETURN_IF_EXCEPTION(throwScope, false);
223 AttributeSetter::call(state, throwScope, [&] {
224 return impl.setAttributeWithoutSynchronization(WebCore::HTMLNames::faceAttr, WTFMove(nativeValue));
225 });
226 return true;
227}
228
229bool setJSHTMLFontElementFace(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
230{
231 return IDLAttribute<JSHTMLFontElement>::set<setJSHTMLFontElementFaceSetter>(*state, thisValue, encodedValue, "face");
232}
233
234static inline JSValue jsHTMLFontElementSizeGetter(ExecState& state, JSHTMLFontElement& thisObject, ThrowScope& throwScope)
235{
236 UNUSED_PARAM(throwScope);
237 UNUSED_PARAM(state);
238 auto& impl = thisObject.wrapped();
239 JSValue result = toJS<IDLDOMString>(state, throwScope, impl.attributeWithoutSynchronization(WebCore::HTMLNames::sizeAttr));
240 return result;
241}
242
243EncodedJSValue jsHTMLFontElementSize(ExecState* state, EncodedJSValue thisValue, PropertyName)
244{
245 return IDLAttribute<JSHTMLFontElement>::get<jsHTMLFontElementSizeGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "size");
246}
247
248static inline bool setJSHTMLFontElementSizeSetter(ExecState& state, JSHTMLFontElement& thisObject, JSValue value, ThrowScope& throwScope)
249{
250 UNUSED_PARAM(throwScope);
251 CustomElementReactionDisallowedScope customElementReactionDisallowedScope;
252 auto& impl = thisObject.wrapped();
253 auto nativeValue = convert<IDLDOMString>(state, value);
254 RETURN_IF_EXCEPTION(throwScope, false);
255 AttributeSetter::call(state, throwScope, [&] {
256 return impl.setAttributeWithoutSynchronization(WebCore::HTMLNames::sizeAttr, WTFMove(nativeValue));
257 });
258 return true;
259}
260
261bool setJSHTMLFontElementSize(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
262{
263 return IDLAttribute<JSHTMLFontElement>::set<setJSHTMLFontElementSizeSetter>(*state, thisValue, encodedValue, "size");
264}
265
266void JSHTMLFontElement::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder)
267{
268 auto* thisObject = jsCast<JSHTMLFontElement*>(cell);
269 builder.setWrappedObjectForCell(cell, &thisObject->wrapped());
270 if (thisObject->scriptExecutionContext())
271 builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string());
272 Base::heapSnapshot(cell, builder);
273}
274
275
276}
277