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 "JSDeprecatedCSSOMValue.h"
23
24#include "JSDOMAttribute.h"
25#include "JSDOMBinding.h"
26#include "JSDOMConstructorNotConstructable.h"
27#include "JSDOMConvertNullable.h"
28#include "JSDOMConvertNumbers.h"
29#include "JSDOMConvertStrings.h"
30#include "JSDOMExceptionHandling.h"
31#include "JSDOMWrapperCache.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 jsDeprecatedCSSOMValueConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
47bool setJSDeprecatedCSSOMValueConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
48JSC::EncodedJSValue jsDeprecatedCSSOMValueCssText(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
49bool setJSDeprecatedCSSOMValueCssText(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
50JSC::EncodedJSValue jsDeprecatedCSSOMValueCssValueType(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
51
52class JSDeprecatedCSSOMValuePrototype : public JSC::JSNonFinalObject {
53public:
54 using Base = JSC::JSNonFinalObject;
55 static JSDeprecatedCSSOMValuePrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure)
56 {
57 JSDeprecatedCSSOMValuePrototype* ptr = new (NotNull, JSC::allocateCell<JSDeprecatedCSSOMValuePrototype>(vm.heap)) JSDeprecatedCSSOMValuePrototype(vm, globalObject, structure);
58 ptr->finishCreation(vm);
59 return ptr;
60 }
61
62 DECLARE_INFO;
63 static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
64 {
65 return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
66 }
67
68private:
69 JSDeprecatedCSSOMValuePrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
70 : JSC::JSNonFinalObject(vm, structure)
71 {
72 }
73
74 void finishCreation(JSC::VM&);
75};
76
77using JSDeprecatedCSSOMValueConstructor = JSDOMConstructorNotConstructable<JSDeprecatedCSSOMValue>;
78
79/* Hash table for constructor */
80
81static const HashTableValue JSDeprecatedCSSOMValueConstructorTableValues[] =
82{
83 { "CSS_INHERIT", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(0) } },
84 { "CSS_PRIMITIVE_VALUE", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(1) } },
85 { "CSS_VALUE_LIST", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(2) } },
86 { "CSS_CUSTOM", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(3) } },
87};
88
89static_assert(DeprecatedCSSOMValue::CSS_INHERIT == 0, "CSS_INHERIT in DeprecatedCSSOMValue does not match value from IDL");
90static_assert(DeprecatedCSSOMValue::CSS_PRIMITIVE_VALUE == 1, "CSS_PRIMITIVE_VALUE in DeprecatedCSSOMValue does not match value from IDL");
91static_assert(DeprecatedCSSOMValue::CSS_VALUE_LIST == 2, "CSS_VALUE_LIST in DeprecatedCSSOMValue does not match value from IDL");
92static_assert(DeprecatedCSSOMValue::CSS_CUSTOM == 3, "CSS_CUSTOM in DeprecatedCSSOMValue does not match value from IDL");
93
94template<> JSValue JSDeprecatedCSSOMValueConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
95{
96 UNUSED_PARAM(vm);
97 return globalObject.functionPrototype();
98}
99
100template<> void JSDeprecatedCSSOMValueConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
101{
102 putDirect(vm, vm.propertyNames->prototype, JSDeprecatedCSSOMValue::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
103 putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("CSSValue"_s)), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
104 putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
105 reifyStaticProperties(vm, JSDeprecatedCSSOMValue::info(), JSDeprecatedCSSOMValueConstructorTableValues, *this);
106}
107
108template<> const ClassInfo JSDeprecatedCSSOMValueConstructor::s_info = { "CSSValue", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSDeprecatedCSSOMValueConstructor) };
109
110/* Hash table for prototype */
111
112static const HashTableValue JSDeprecatedCSSOMValuePrototypeTableValues[] =
113{
114 { "constructor", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDeprecatedCSSOMValueConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSDeprecatedCSSOMValueConstructor) } },
115 { "cssText", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDeprecatedCSSOMValueCssText), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSDeprecatedCSSOMValueCssText) } },
116 { "cssValueType", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDeprecatedCSSOMValueCssValueType), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
117 { "CSS_INHERIT", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(0) } },
118 { "CSS_PRIMITIVE_VALUE", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(1) } },
119 { "CSS_VALUE_LIST", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(2) } },
120 { "CSS_CUSTOM", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(3) } },
121};
122
123const ClassInfo JSDeprecatedCSSOMValuePrototype::s_info = { "CSSValuePrototype", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSDeprecatedCSSOMValuePrototype) };
124
125void JSDeprecatedCSSOMValuePrototype::finishCreation(VM& vm)
126{
127 Base::finishCreation(vm);
128 reifyStaticProperties(vm, JSDeprecatedCSSOMValue::info(), JSDeprecatedCSSOMValuePrototypeTableValues, *this);
129}
130
131const ClassInfo JSDeprecatedCSSOMValue::s_info = { "CSSValue", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSDeprecatedCSSOMValue) };
132
133JSDeprecatedCSSOMValue::JSDeprecatedCSSOMValue(Structure* structure, JSDOMGlobalObject& globalObject, Ref<DeprecatedCSSOMValue>&& impl)
134 : JSDOMWrapper<DeprecatedCSSOMValue>(structure, globalObject, WTFMove(impl))
135{
136}
137
138void JSDeprecatedCSSOMValue::finishCreation(VM& vm)
139{
140 Base::finishCreation(vm);
141 ASSERT(inherits(vm, info()));
142
143}
144
145JSObject* JSDeprecatedCSSOMValue::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
146{
147 return JSDeprecatedCSSOMValuePrototype::create(vm, &globalObject, JSDeprecatedCSSOMValuePrototype::createStructure(vm, &globalObject, globalObject.objectPrototype()));
148}
149
150JSObject* JSDeprecatedCSSOMValue::prototype(VM& vm, JSDOMGlobalObject& globalObject)
151{
152 return getDOMPrototype<JSDeprecatedCSSOMValue>(vm, globalObject);
153}
154
155JSValue JSDeprecatedCSSOMValue::getConstructor(VM& vm, const JSGlobalObject* globalObject)
156{
157 return getDOMConstructor<JSDeprecatedCSSOMValueConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
158}
159
160void JSDeprecatedCSSOMValue::destroy(JSC::JSCell* cell)
161{
162 JSDeprecatedCSSOMValue* thisObject = static_cast<JSDeprecatedCSSOMValue*>(cell);
163 thisObject->JSDeprecatedCSSOMValue::~JSDeprecatedCSSOMValue();
164}
165
166template<> inline JSDeprecatedCSSOMValue* IDLAttribute<JSDeprecatedCSSOMValue>::cast(ExecState& state, EncodedJSValue thisValue)
167{
168 return jsDynamicCast<JSDeprecatedCSSOMValue*>(state.vm(), JSValue::decode(thisValue));
169}
170
171EncodedJSValue jsDeprecatedCSSOMValueConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
172{
173 VM& vm = state->vm();
174 auto throwScope = DECLARE_THROW_SCOPE(vm);
175 auto* prototype = jsDynamicCast<JSDeprecatedCSSOMValuePrototype*>(vm, JSValue::decode(thisValue));
176 if (UNLIKELY(!prototype))
177 return throwVMTypeError(state, throwScope);
178 return JSValue::encode(JSDeprecatedCSSOMValue::getConstructor(state->vm(), prototype->globalObject()));
179}
180
181bool setJSDeprecatedCSSOMValueConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
182{
183 VM& vm = state->vm();
184 auto throwScope = DECLARE_THROW_SCOPE(vm);
185 auto* prototype = jsDynamicCast<JSDeprecatedCSSOMValuePrototype*>(vm, JSValue::decode(thisValue));
186 if (UNLIKELY(!prototype)) {
187 throwVMTypeError(state, throwScope);
188 return false;
189 }
190 // Shadowing a built-in constructor
191 return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue));
192}
193
194static inline JSValue jsDeprecatedCSSOMValueCssTextGetter(ExecState& state, JSDeprecatedCSSOMValue& thisObject, ThrowScope& throwScope)
195{
196 UNUSED_PARAM(throwScope);
197 UNUSED_PARAM(state);
198 auto& impl = thisObject.wrapped();
199 JSValue result = toJS<IDLNullable<IDLDOMString>>(state, throwScope, impl.cssText());
200 return result;
201}
202
203EncodedJSValue jsDeprecatedCSSOMValueCssText(ExecState* state, EncodedJSValue thisValue, PropertyName)
204{
205 return IDLAttribute<JSDeprecatedCSSOMValue>::get<jsDeprecatedCSSOMValueCssTextGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "cssText");
206}
207
208static inline bool setJSDeprecatedCSSOMValueCssTextSetter(ExecState& state, JSDeprecatedCSSOMValue& thisObject, JSValue value, ThrowScope& throwScope)
209{
210 UNUSED_PARAM(throwScope);
211 auto& impl = thisObject.wrapped();
212 auto nativeValue = convert<IDLNullable<IDLDOMString>>(state, value);
213 RETURN_IF_EXCEPTION(throwScope, false);
214 AttributeSetter::call(state, throwScope, [&] {
215 return impl.setCssText(WTFMove(nativeValue));
216 });
217 return true;
218}
219
220bool setJSDeprecatedCSSOMValueCssText(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
221{
222 return IDLAttribute<JSDeprecatedCSSOMValue>::set<setJSDeprecatedCSSOMValueCssTextSetter>(*state, thisValue, encodedValue, "cssText");
223}
224
225static inline JSValue jsDeprecatedCSSOMValueCssValueTypeGetter(ExecState& state, JSDeprecatedCSSOMValue& thisObject, ThrowScope& throwScope)
226{
227 UNUSED_PARAM(throwScope);
228 UNUSED_PARAM(state);
229 auto& impl = thisObject.wrapped();
230 JSValue result = toJS<IDLUnsignedShort>(state, throwScope, impl.cssValueType());
231 return result;
232}
233
234EncodedJSValue jsDeprecatedCSSOMValueCssValueType(ExecState* state, EncodedJSValue thisValue, PropertyName)
235{
236 return IDLAttribute<JSDeprecatedCSSOMValue>::get<jsDeprecatedCSSOMValueCssValueTypeGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "cssValueType");
237}
238
239void JSDeprecatedCSSOMValue::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder)
240{
241 auto* thisObject = jsCast<JSDeprecatedCSSOMValue*>(cell);
242 builder.setWrappedObjectForCell(cell, &thisObject->wrapped());
243 if (thisObject->scriptExecutionContext())
244 builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string());
245 Base::heapSnapshot(cell, builder);
246}
247
248void JSDeprecatedCSSOMValueOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
249{
250 auto* jsDeprecatedCSSOMValue = static_cast<JSDeprecatedCSSOMValue*>(handle.slot()->asCell());
251 auto& world = *static_cast<DOMWrapperWorld*>(context);
252 uncacheWrapper(world, &jsDeprecatedCSSOMValue->wrapped(), jsDeprecatedCSSOMValue);
253}
254
255DeprecatedCSSOMValue* JSDeprecatedCSSOMValue::toWrapped(JSC::VM& vm, JSC::JSValue value)
256{
257 if (auto* wrapper = jsDynamicCast<JSDeprecatedCSSOMValue*>(vm, value))
258 return &wrapper->wrapped();
259 return nullptr;
260}
261
262}
263