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