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
23#if ENABLE(CSS_DEVICE_ADAPTATION)
24
25#include "JSWebKitCSSViewportRule.h"
26
27#include "JSCSSStyleDeclaration.h"
28#include "JSDOMAttribute.h"
29#include "JSDOMBinding.h"
30#include "JSDOMConstructorNotConstructable.h"
31#include "JSDOMConvertInterface.h"
32#include "JSDOMExceptionHandling.h"
33#include "JSDOMGlobalObject.h"
34#include "JSDOMWrapperCache.h"
35#include "ScriptExecutionContext.h"
36#include <JavaScriptCore/HeapSnapshotBuilder.h>
37#include <JavaScriptCore/JSCInlines.h>
38#include <wtf/GetPtr.h>
39#include <wtf/PointerPreparations.h>
40#include <wtf/URL.h>
41
42
43namespace WebCore {
44using namespace JSC;
45
46// Attributes
47
48JSC::EncodedJSValue jsWebKitCSSViewportRuleConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
49bool setJSWebKitCSSViewportRuleConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
50JSC::EncodedJSValue jsWebKitCSSViewportRuleStyle(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
51
52class JSWebKitCSSViewportRulePrototype : public JSC::JSNonFinalObject {
53public:
54 using Base = JSC::JSNonFinalObject;
55 static JSWebKitCSSViewportRulePrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure)
56 {
57 JSWebKitCSSViewportRulePrototype* ptr = new (NotNull, JSC::allocateCell<JSWebKitCSSViewportRulePrototype>(vm.heap)) JSWebKitCSSViewportRulePrototype(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 JSWebKitCSSViewportRulePrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
70 : JSC::JSNonFinalObject(vm, structure)
71 {
72 }
73
74 void finishCreation(JSC::VM&);
75};
76
77using JSWebKitCSSViewportRuleConstructor = JSDOMConstructorNotConstructable<JSWebKitCSSViewportRule>;
78
79template<> JSValue JSWebKitCSSViewportRuleConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
80{
81 return JSCSSRule::getConstructor(vm, &globalObject);
82}
83
84template<> void JSWebKitCSSViewportRuleConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
85{
86 putDirect(vm, vm.propertyNames->prototype, JSWebKitCSSViewportRule::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
87 putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("WebKitCSSViewportRule"_s)), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
88 putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
89}
90
91template<> const ClassInfo JSWebKitCSSViewportRuleConstructor::s_info = { "WebKitCSSViewportRule", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSWebKitCSSViewportRuleConstructor) };
92
93/* Hash table for prototype */
94
95static const HashTableValue JSWebKitCSSViewportRulePrototypeTableValues[] =
96{
97 { "constructor", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWebKitCSSViewportRuleConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSWebKitCSSViewportRuleConstructor) } },
98 { "style", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWebKitCSSViewportRuleStyle), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
99};
100
101const ClassInfo JSWebKitCSSViewportRulePrototype::s_info = { "WebKitCSSViewportRulePrototype", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSWebKitCSSViewportRulePrototype) };
102
103void JSWebKitCSSViewportRulePrototype::finishCreation(VM& vm)
104{
105 Base::finishCreation(vm);
106 reifyStaticProperties(vm, JSWebKitCSSViewportRule::info(), JSWebKitCSSViewportRulePrototypeTableValues, *this);
107}
108
109const ClassInfo JSWebKitCSSViewportRule::s_info = { "WebKitCSSViewportRule", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSWebKitCSSViewportRule) };
110
111JSWebKitCSSViewportRule::JSWebKitCSSViewportRule(Structure* structure, JSDOMGlobalObject& globalObject, Ref<WebKitCSSViewportRule>&& impl)
112 : JSCSSRule(structure, globalObject, WTFMove(impl))
113{
114}
115
116void JSWebKitCSSViewportRule::finishCreation(VM& vm)
117{
118 Base::finishCreation(vm);
119 ASSERT(inherits(vm, info()));
120
121}
122
123JSObject* JSWebKitCSSViewportRule::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
124{
125 return JSWebKitCSSViewportRulePrototype::create(vm, &globalObject, JSWebKitCSSViewportRulePrototype::createStructure(vm, &globalObject, JSCSSRule::prototype(vm, globalObject)));
126}
127
128JSObject* JSWebKitCSSViewportRule::prototype(VM& vm, JSDOMGlobalObject& globalObject)
129{
130 return getDOMPrototype<JSWebKitCSSViewportRule>(vm, globalObject);
131}
132
133JSValue JSWebKitCSSViewportRule::getConstructor(VM& vm, const JSGlobalObject* globalObject)
134{
135 return getDOMConstructor<JSWebKitCSSViewportRuleConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
136}
137
138template<> inline JSWebKitCSSViewportRule* IDLAttribute<JSWebKitCSSViewportRule>::cast(ExecState& state, EncodedJSValue thisValue)
139{
140 return jsDynamicCast<JSWebKitCSSViewportRule*>(state.vm(), JSValue::decode(thisValue));
141}
142
143EncodedJSValue jsWebKitCSSViewportRuleConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
144{
145 VM& vm = state->vm();
146 auto throwScope = DECLARE_THROW_SCOPE(vm);
147 auto* prototype = jsDynamicCast<JSWebKitCSSViewportRulePrototype*>(vm, JSValue::decode(thisValue));
148 if (UNLIKELY(!prototype))
149 return throwVMTypeError(state, throwScope);
150 return JSValue::encode(JSWebKitCSSViewportRule::getConstructor(state->vm(), prototype->globalObject()));
151}
152
153bool setJSWebKitCSSViewportRuleConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
154{
155 VM& vm = state->vm();
156 auto throwScope = DECLARE_THROW_SCOPE(vm);
157 auto* prototype = jsDynamicCast<JSWebKitCSSViewportRulePrototype*>(vm, JSValue::decode(thisValue));
158 if (UNLIKELY(!prototype)) {
159 throwVMTypeError(state, throwScope);
160 return false;
161 }
162 // Shadowing a built-in constructor
163 return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue));
164}
165
166static inline JSValue jsWebKitCSSViewportRuleStyleGetter(ExecState& state, JSWebKitCSSViewportRule& thisObject, ThrowScope& throwScope)
167{
168 UNUSED_PARAM(throwScope);
169 UNUSED_PARAM(state);
170 auto& impl = thisObject.wrapped();
171 JSValue result = toJS<IDLInterface<CSSStyleDeclaration>>(state, *thisObject.globalObject(), throwScope, impl.style());
172 return result;
173}
174
175EncodedJSValue jsWebKitCSSViewportRuleStyle(ExecState* state, EncodedJSValue thisValue, PropertyName)
176{
177 return IDLAttribute<JSWebKitCSSViewportRule>::get<jsWebKitCSSViewportRuleStyleGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "style");
178}
179
180void JSWebKitCSSViewportRule::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder)
181{
182 auto* thisObject = jsCast<JSWebKitCSSViewportRule*>(cell);
183 builder.setWrappedObjectForCell(cell, &thisObject->wrapped());
184 if (thisObject->scriptExecutionContext())
185 builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string());
186 Base::heapSnapshot(cell, builder);
187}
188
189
190}
191
192#endif // ENABLE(CSS_DEVICE_ADAPTATION)
193