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 "JSDeprecatedCSSOMRGBColor.h"
23
24#include "JSDOMAttribute.h"
25#include "JSDOMBinding.h"
26#include "JSDOMConstructorNotConstructable.h"
27#include "JSDOMConvertInterface.h"
28#include "JSDOMExceptionHandling.h"
29#include "JSDOMGlobalObject.h"
30#include "JSDOMWrapperCache.h"
31#include "JSDeprecatedCSSOMPrimitiveValue.h"
32#include "ScriptExecutionContext.h"
33#include <JavaScriptCore/FunctionPrototype.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
41namespace WebCore {
42using namespace JSC;
43
44// Attributes
45
46JSC::EncodedJSValue jsDeprecatedCSSOMRGBColorConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
47bool setJSDeprecatedCSSOMRGBColorConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
48JSC::EncodedJSValue jsDeprecatedCSSOMRGBColorRed(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
49JSC::EncodedJSValue jsDeprecatedCSSOMRGBColorGreen(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
50JSC::EncodedJSValue jsDeprecatedCSSOMRGBColorBlue(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
51JSC::EncodedJSValue jsDeprecatedCSSOMRGBColorAlpha(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
52
53class JSDeprecatedCSSOMRGBColorPrototype : public JSC::JSNonFinalObject {
54public:
55 using Base = JSC::JSNonFinalObject;
56 static JSDeprecatedCSSOMRGBColorPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure)
57 {
58 JSDeprecatedCSSOMRGBColorPrototype* ptr = new (NotNull, JSC::allocateCell<JSDeprecatedCSSOMRGBColorPrototype>(vm.heap)) JSDeprecatedCSSOMRGBColorPrototype(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
69private:
70 JSDeprecatedCSSOMRGBColorPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
71 : JSC::JSNonFinalObject(vm, structure)
72 {
73 }
74
75 void finishCreation(JSC::VM&);
76};
77
78using JSDeprecatedCSSOMRGBColorConstructor = JSDOMConstructorNotConstructable<JSDeprecatedCSSOMRGBColor>;
79
80template<> JSValue JSDeprecatedCSSOMRGBColorConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
81{
82 UNUSED_PARAM(vm);
83 return globalObject.functionPrototype();
84}
85
86template<> void JSDeprecatedCSSOMRGBColorConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
87{
88 putDirect(vm, vm.propertyNames->prototype, JSDeprecatedCSSOMRGBColor::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
89 putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("RGBColor"_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 JSDeprecatedCSSOMRGBColorConstructor::s_info = { "RGBColor", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSDeprecatedCSSOMRGBColorConstructor) };
94
95/* Hash table for prototype */
96
97static const HashTableValue JSDeprecatedCSSOMRGBColorPrototypeTableValues[] =
98{
99 { "constructor", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDeprecatedCSSOMRGBColorConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSDeprecatedCSSOMRGBColorConstructor) } },
100 { "red", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDeprecatedCSSOMRGBColorRed), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
101 { "green", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDeprecatedCSSOMRGBColorGreen), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
102 { "blue", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDeprecatedCSSOMRGBColorBlue), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
103 { "alpha", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDeprecatedCSSOMRGBColorAlpha), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
104};
105
106const ClassInfo JSDeprecatedCSSOMRGBColorPrototype::s_info = { "RGBColorPrototype", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSDeprecatedCSSOMRGBColorPrototype) };
107
108void JSDeprecatedCSSOMRGBColorPrototype::finishCreation(VM& vm)
109{
110 Base::finishCreation(vm);
111 reifyStaticProperties(vm, JSDeprecatedCSSOMRGBColor::info(), JSDeprecatedCSSOMRGBColorPrototypeTableValues, *this);
112}
113
114const ClassInfo JSDeprecatedCSSOMRGBColor::s_info = { "RGBColor", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSDeprecatedCSSOMRGBColor) };
115
116JSDeprecatedCSSOMRGBColor::JSDeprecatedCSSOMRGBColor(Structure* structure, JSDOMGlobalObject& globalObject, Ref<DeprecatedCSSOMRGBColor>&& impl)
117 : JSDOMWrapper<DeprecatedCSSOMRGBColor>(structure, globalObject, WTFMove(impl))
118{
119}
120
121void JSDeprecatedCSSOMRGBColor::finishCreation(VM& vm)
122{
123 Base::finishCreation(vm);
124 ASSERT(inherits(vm, info()));
125
126}
127
128JSObject* JSDeprecatedCSSOMRGBColor::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
129{
130 return JSDeprecatedCSSOMRGBColorPrototype::create(vm, &globalObject, JSDeprecatedCSSOMRGBColorPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype()));
131}
132
133JSObject* JSDeprecatedCSSOMRGBColor::prototype(VM& vm, JSDOMGlobalObject& globalObject)
134{
135 return getDOMPrototype<JSDeprecatedCSSOMRGBColor>(vm, globalObject);
136}
137
138JSValue JSDeprecatedCSSOMRGBColor::getConstructor(VM& vm, const JSGlobalObject* globalObject)
139{
140 return getDOMConstructor<JSDeprecatedCSSOMRGBColorConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
141}
142
143void JSDeprecatedCSSOMRGBColor::destroy(JSC::JSCell* cell)
144{
145 JSDeprecatedCSSOMRGBColor* thisObject = static_cast<JSDeprecatedCSSOMRGBColor*>(cell);
146 thisObject->JSDeprecatedCSSOMRGBColor::~JSDeprecatedCSSOMRGBColor();
147}
148
149template<> inline JSDeprecatedCSSOMRGBColor* IDLAttribute<JSDeprecatedCSSOMRGBColor>::cast(ExecState& state, EncodedJSValue thisValue)
150{
151 return jsDynamicCast<JSDeprecatedCSSOMRGBColor*>(state.vm(), JSValue::decode(thisValue));
152}
153
154EncodedJSValue jsDeprecatedCSSOMRGBColorConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
155{
156 VM& vm = state->vm();
157 auto throwScope = DECLARE_THROW_SCOPE(vm);
158 auto* prototype = jsDynamicCast<JSDeprecatedCSSOMRGBColorPrototype*>(vm, JSValue::decode(thisValue));
159 if (UNLIKELY(!prototype))
160 return throwVMTypeError(state, throwScope);
161 return JSValue::encode(JSDeprecatedCSSOMRGBColor::getConstructor(state->vm(), prototype->globalObject()));
162}
163
164bool setJSDeprecatedCSSOMRGBColorConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
165{
166 VM& vm = state->vm();
167 auto throwScope = DECLARE_THROW_SCOPE(vm);
168 auto* prototype = jsDynamicCast<JSDeprecatedCSSOMRGBColorPrototype*>(vm, JSValue::decode(thisValue));
169 if (UNLIKELY(!prototype)) {
170 throwVMTypeError(state, throwScope);
171 return false;
172 }
173 // Shadowing a built-in constructor
174 return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue));
175}
176
177static inline JSValue jsDeprecatedCSSOMRGBColorRedGetter(ExecState& state, JSDeprecatedCSSOMRGBColor& thisObject, ThrowScope& throwScope)
178{
179 UNUSED_PARAM(throwScope);
180 UNUSED_PARAM(state);
181 auto& impl = thisObject.wrapped();
182 JSValue result = toJS<IDLInterface<DeprecatedCSSOMPrimitiveValue>>(state, *thisObject.globalObject(), throwScope, impl.red());
183 return result;
184}
185
186EncodedJSValue jsDeprecatedCSSOMRGBColorRed(ExecState* state, EncodedJSValue thisValue, PropertyName)
187{
188 return IDLAttribute<JSDeprecatedCSSOMRGBColor>::get<jsDeprecatedCSSOMRGBColorRedGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "red");
189}
190
191static inline JSValue jsDeprecatedCSSOMRGBColorGreenGetter(ExecState& state, JSDeprecatedCSSOMRGBColor& thisObject, ThrowScope& throwScope)
192{
193 UNUSED_PARAM(throwScope);
194 UNUSED_PARAM(state);
195 auto& impl = thisObject.wrapped();
196 JSValue result = toJS<IDLInterface<DeprecatedCSSOMPrimitiveValue>>(state, *thisObject.globalObject(), throwScope, impl.green());
197 return result;
198}
199
200EncodedJSValue jsDeprecatedCSSOMRGBColorGreen(ExecState* state, EncodedJSValue thisValue, PropertyName)
201{
202 return IDLAttribute<JSDeprecatedCSSOMRGBColor>::get<jsDeprecatedCSSOMRGBColorGreenGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "green");
203}
204
205static inline JSValue jsDeprecatedCSSOMRGBColorBlueGetter(ExecState& state, JSDeprecatedCSSOMRGBColor& thisObject, ThrowScope& throwScope)
206{
207 UNUSED_PARAM(throwScope);
208 UNUSED_PARAM(state);
209 auto& impl = thisObject.wrapped();
210 JSValue result = toJS<IDLInterface<DeprecatedCSSOMPrimitiveValue>>(state, *thisObject.globalObject(), throwScope, impl.blue());
211 return result;
212}
213
214EncodedJSValue jsDeprecatedCSSOMRGBColorBlue(ExecState* state, EncodedJSValue thisValue, PropertyName)
215{
216 return IDLAttribute<JSDeprecatedCSSOMRGBColor>::get<jsDeprecatedCSSOMRGBColorBlueGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "blue");
217}
218
219static inline JSValue jsDeprecatedCSSOMRGBColorAlphaGetter(ExecState& state, JSDeprecatedCSSOMRGBColor& thisObject, ThrowScope& throwScope)
220{
221 UNUSED_PARAM(throwScope);
222 UNUSED_PARAM(state);
223 auto& impl = thisObject.wrapped();
224 JSValue result = toJS<IDLInterface<DeprecatedCSSOMPrimitiveValue>>(state, *thisObject.globalObject(), throwScope, impl.alpha());
225 return result;
226}
227
228EncodedJSValue jsDeprecatedCSSOMRGBColorAlpha(ExecState* state, EncodedJSValue thisValue, PropertyName)
229{
230 return IDLAttribute<JSDeprecatedCSSOMRGBColor>::get<jsDeprecatedCSSOMRGBColorAlphaGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "alpha");
231}
232
233void JSDeprecatedCSSOMRGBColor::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder)
234{
235 auto* thisObject = jsCast<JSDeprecatedCSSOMRGBColor*>(cell);
236 builder.setWrappedObjectForCell(cell, &thisObject->wrapped());
237 if (thisObject->scriptExecutionContext())
238 builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string());
239 Base::heapSnapshot(cell, builder);
240}
241
242bool JSDeprecatedCSSOMRGBColorOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor, const char** reason)
243{
244 UNUSED_PARAM(handle);
245 UNUSED_PARAM(visitor);
246 UNUSED_PARAM(reason);
247 return false;
248}
249
250void JSDeprecatedCSSOMRGBColorOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
251{
252 auto* jsDeprecatedCSSOMRGBColor = static_cast<JSDeprecatedCSSOMRGBColor*>(handle.slot()->asCell());
253 auto& world = *static_cast<DOMWrapperWorld*>(context);
254 uncacheWrapper(world, &jsDeprecatedCSSOMRGBColor->wrapped(), jsDeprecatedCSSOMRGBColor);
255}
256
257JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<DeprecatedCSSOMRGBColor>&& impl)
258{
259 // If you hit this failure the interface definition has the ImplementationLacksVTable
260 // attribute. You should remove that attribute. If the class has subclasses
261 // that may be passed through this toJS() function you should use the SkipVTableValidation
262 // attribute to DeprecatedCSSOMRGBColor.
263 static_assert(!std::is_polymorphic<DeprecatedCSSOMRGBColor>::value, "DeprecatedCSSOMRGBColor is polymorphic but the IDL claims it is not");
264 return createWrapper<DeprecatedCSSOMRGBColor>(globalObject, WTFMove(impl));
265}
266
267JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, DeprecatedCSSOMRGBColor& impl)
268{
269 return wrap(state, globalObject, impl);
270}
271
272DeprecatedCSSOMRGBColor* JSDeprecatedCSSOMRGBColor::toWrapped(JSC::VM& vm, JSC::JSValue value)
273{
274 if (auto* wrapper = jsDynamicCast<JSDeprecatedCSSOMRGBColor*>(vm, value))
275 return &wrapper->wrapped();
276 return nullptr;
277}
278
279}
280