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 "JSSVGRenderingIntent.h"
23
24#include "JSDOMBinding.h"
25#include "JSDOMConstructorNotConstructable.h"
26#include "JSDOMExceptionHandling.h"
27#include "JSDOMWrapperCache.h"
28#include "ScriptExecutionContext.h"
29#include <JavaScriptCore/FunctionPrototype.h>
30#include <JavaScriptCore/HeapSnapshotBuilder.h>
31#include <JavaScriptCore/JSCInlines.h>
32#include <wtf/GetPtr.h>
33#include <wtf/PointerPreparations.h>
34#include <wtf/URL.h>
35
36
37namespace WebCore {
38using namespace JSC;
39
40// Attributes
41
42JSC::EncodedJSValue jsSVGRenderingIntentConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
43bool setJSSVGRenderingIntentConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
44
45class JSSVGRenderingIntentPrototype : public JSC::JSNonFinalObject {
46public:
47 using Base = JSC::JSNonFinalObject;
48 static JSSVGRenderingIntentPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure)
49 {
50 JSSVGRenderingIntentPrototype* ptr = new (NotNull, JSC::allocateCell<JSSVGRenderingIntentPrototype>(vm.heap)) JSSVGRenderingIntentPrototype(vm, globalObject, structure);
51 ptr->finishCreation(vm);
52 return ptr;
53 }
54
55 DECLARE_INFO;
56 static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
57 {
58 return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
59 }
60
61private:
62 JSSVGRenderingIntentPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
63 : JSC::JSNonFinalObject(vm, structure)
64 {
65 }
66
67 void finishCreation(JSC::VM&);
68};
69
70using JSSVGRenderingIntentConstructor = JSDOMConstructorNotConstructable<JSSVGRenderingIntent>;
71
72/* Hash table for constructor */
73
74static const HashTableValue JSSVGRenderingIntentConstructorTableValues[] =
75{
76 { "RENDERING_INTENT_UNKNOWN", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(0) } },
77 { "RENDERING_INTENT_AUTO", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(1) } },
78 { "RENDERING_INTENT_PERCEPTUAL", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(2) } },
79 { "RENDERING_INTENT_RELATIVE_COLORIMETRIC", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(3) } },
80 { "RENDERING_INTENT_SATURATION", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(4) } },
81 { "RENDERING_INTENT_ABSOLUTE_COLORIMETRIC", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(5) } },
82};
83
84static_assert(SVGRenderingIntent::RENDERING_INTENT_UNKNOWN == 0, "RENDERING_INTENT_UNKNOWN in SVGRenderingIntent does not match value from IDL");
85static_assert(SVGRenderingIntent::RENDERING_INTENT_AUTO == 1, "RENDERING_INTENT_AUTO in SVGRenderingIntent does not match value from IDL");
86static_assert(SVGRenderingIntent::RENDERING_INTENT_PERCEPTUAL == 2, "RENDERING_INTENT_PERCEPTUAL in SVGRenderingIntent does not match value from IDL");
87static_assert(SVGRenderingIntent::RENDERING_INTENT_RELATIVE_COLORIMETRIC == 3, "RENDERING_INTENT_RELATIVE_COLORIMETRIC in SVGRenderingIntent does not match value from IDL");
88static_assert(SVGRenderingIntent::RENDERING_INTENT_SATURATION == 4, "RENDERING_INTENT_SATURATION in SVGRenderingIntent does not match value from IDL");
89static_assert(SVGRenderingIntent::RENDERING_INTENT_ABSOLUTE_COLORIMETRIC == 5, "RENDERING_INTENT_ABSOLUTE_COLORIMETRIC in SVGRenderingIntent does not match value from IDL");
90
91template<> JSValue JSSVGRenderingIntentConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
92{
93 UNUSED_PARAM(vm);
94 return globalObject.functionPrototype();
95}
96
97template<> void JSSVGRenderingIntentConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
98{
99 putDirect(vm, vm.propertyNames->prototype, JSSVGRenderingIntent::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
100 putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("SVGRenderingIntent"_s)), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
101 putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
102 reifyStaticProperties(vm, JSSVGRenderingIntent::info(), JSSVGRenderingIntentConstructorTableValues, *this);
103}
104
105template<> const ClassInfo JSSVGRenderingIntentConstructor::s_info = { "SVGRenderingIntent", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGRenderingIntentConstructor) };
106
107/* Hash table for prototype */
108
109static const HashTableValue JSSVGRenderingIntentPrototypeTableValues[] =
110{
111 { "constructor", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGRenderingIntentConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSSVGRenderingIntentConstructor) } },
112 { "RENDERING_INTENT_UNKNOWN", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(0) } },
113 { "RENDERING_INTENT_AUTO", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(1) } },
114 { "RENDERING_INTENT_PERCEPTUAL", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(2) } },
115 { "RENDERING_INTENT_RELATIVE_COLORIMETRIC", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(3) } },
116 { "RENDERING_INTENT_SATURATION", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(4) } },
117 { "RENDERING_INTENT_ABSOLUTE_COLORIMETRIC", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(5) } },
118};
119
120const ClassInfo JSSVGRenderingIntentPrototype::s_info = { "SVGRenderingIntentPrototype", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGRenderingIntentPrototype) };
121
122void JSSVGRenderingIntentPrototype::finishCreation(VM& vm)
123{
124 Base::finishCreation(vm);
125 reifyStaticProperties(vm, JSSVGRenderingIntent::info(), JSSVGRenderingIntentPrototypeTableValues, *this);
126}
127
128const ClassInfo JSSVGRenderingIntent::s_info = { "SVGRenderingIntent", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSVGRenderingIntent) };
129
130JSSVGRenderingIntent::JSSVGRenderingIntent(Structure* structure, JSDOMGlobalObject& globalObject, Ref<SVGRenderingIntent>&& impl)
131 : JSDOMWrapper<SVGRenderingIntent>(structure, globalObject, WTFMove(impl))
132{
133}
134
135void JSSVGRenderingIntent::finishCreation(VM& vm)
136{
137 Base::finishCreation(vm);
138 ASSERT(inherits(vm, info()));
139
140}
141
142JSObject* JSSVGRenderingIntent::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
143{
144 return JSSVGRenderingIntentPrototype::create(vm, &globalObject, JSSVGRenderingIntentPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype()));
145}
146
147JSObject* JSSVGRenderingIntent::prototype(VM& vm, JSDOMGlobalObject& globalObject)
148{
149 return getDOMPrototype<JSSVGRenderingIntent>(vm, globalObject);
150}
151
152JSValue JSSVGRenderingIntent::getConstructor(VM& vm, const JSGlobalObject* globalObject)
153{
154 return getDOMConstructor<JSSVGRenderingIntentConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
155}
156
157void JSSVGRenderingIntent::destroy(JSC::JSCell* cell)
158{
159 JSSVGRenderingIntent* thisObject = static_cast<JSSVGRenderingIntent*>(cell);
160 thisObject->JSSVGRenderingIntent::~JSSVGRenderingIntent();
161}
162
163EncodedJSValue jsSVGRenderingIntentConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
164{
165 VM& vm = state->vm();
166 auto throwScope = DECLARE_THROW_SCOPE(vm);
167 auto* prototype = jsDynamicCast<JSSVGRenderingIntentPrototype*>(vm, JSValue::decode(thisValue));
168 if (UNLIKELY(!prototype))
169 return throwVMTypeError(state, throwScope);
170 return JSValue::encode(JSSVGRenderingIntent::getConstructor(state->vm(), prototype->globalObject()));
171}
172
173bool setJSSVGRenderingIntentConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
174{
175 VM& vm = state->vm();
176 auto throwScope = DECLARE_THROW_SCOPE(vm);
177 auto* prototype = jsDynamicCast<JSSVGRenderingIntentPrototype*>(vm, JSValue::decode(thisValue));
178 if (UNLIKELY(!prototype)) {
179 throwVMTypeError(state, throwScope);
180 return false;
181 }
182 // Shadowing a built-in constructor
183 return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue));
184}
185
186void JSSVGRenderingIntent::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder)
187{
188 auto* thisObject = jsCast<JSSVGRenderingIntent*>(cell);
189 builder.setWrappedObjectForCell(cell, &thisObject->wrapped());
190 if (thisObject->scriptExecutionContext())
191 builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string());
192 Base::heapSnapshot(cell, builder);
193}
194
195bool JSSVGRenderingIntentOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor, const char** reason)
196{
197 UNUSED_PARAM(handle);
198 UNUSED_PARAM(visitor);
199 UNUSED_PARAM(reason);
200 return false;
201}
202
203void JSSVGRenderingIntentOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
204{
205 auto* jsSVGRenderingIntent = static_cast<JSSVGRenderingIntent*>(handle.slot()->asCell());
206 auto& world = *static_cast<DOMWrapperWorld*>(context);
207 uncacheWrapper(world, &jsSVGRenderingIntent->wrapped(), jsSVGRenderingIntent);
208}
209
210SVGRenderingIntent* JSSVGRenderingIntent::toWrapped(JSC::VM& vm, JSC::JSValue value)
211{
212 if (auto* wrapper = jsDynamicCast<JSSVGRenderingIntent*>(vm, value))
213 return &wrapper->wrapped();
214 return nullptr;
215}
216
217}
218