tizen beta release
[profile/ivi/webkit-efl.git] / DerivedSources / WebCore / JSMutationRecord.cpp
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(MUTATION_OBSERVERS)
24
25 #include "JSMutationRecord.h"
26
27 #include "JSNode.h"
28 #include "JSNodeList.h"
29 #include "KURL.h"
30 #include "MutationRecord.h"
31 #include "NameNodeList.h"
32 #include "Node.h"
33 #include "NodeList.h"
34 #include <runtime/JSString.h>
35 #include <wtf/GetPtr.h>
36
37 using namespace JSC;
38
39 namespace WebCore {
40
41 ASSERT_CLASS_FITS_IN_CELL(JSMutationRecord);
42
43 /* Hash table */
44 #if ENABLE(JIT)
45 #define THUNK_GENERATOR(generator) , generator
46 #else
47 #define THUNK_GENERATOR(generator)
48 #endif
49 #if ENABLE(DFG_JIT)
50 #define INTRINSIC(intrinsic) , intrinsic
51 #else
52 #define INTRINSIC(intrinsic)
53 #endif
54
55 static const HashTableValue JSMutationRecordTableValues[] =
56 {
57     { "type", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsMutationRecordType), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
58     { "target", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsMutationRecordTarget), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
59     { "addedNodes", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsMutationRecordAddedNodes), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
60     { "removedNodes", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsMutationRecordRemovedNodes), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
61     { "previousSibling", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsMutationRecordPreviousSibling), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
62     { "nextSibling", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsMutationRecordNextSibling), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
63     { "attributeName", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsMutationRecordAttributeName), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
64     { "attributeNamespace", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsMutationRecordAttributeNamespace), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
65     { "oldValue", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsMutationRecordOldValue), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
66     { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsMutationRecordConstructor), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
67     { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
68 };
69
70 #undef THUNK_GENERATOR
71 static const HashTable JSMutationRecordTable = { 33, 31, JSMutationRecordTableValues, 0 };
72 /* Hash table for constructor */
73 #if ENABLE(JIT)
74 #define THUNK_GENERATOR(generator) , generator
75 #else
76 #define THUNK_GENERATOR(generator)
77 #endif
78 #if ENABLE(DFG_JIT)
79 #define INTRINSIC(intrinsic) , intrinsic
80 #else
81 #define INTRINSIC(intrinsic)
82 #endif
83
84 static const HashTableValue JSMutationRecordConstructorTableValues[] =
85 {
86     { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
87 };
88
89 #undef THUNK_GENERATOR
90 static const HashTable JSMutationRecordConstructorTable = { 1, 0, JSMutationRecordConstructorTableValues, 0 };
91 const ClassInfo JSMutationRecordConstructor::s_info = { "MutationRecordConstructor", &DOMConstructorObject::s_info, &JSMutationRecordConstructorTable, 0, CREATE_METHOD_TABLE(JSMutationRecordConstructor) };
92
93 JSMutationRecordConstructor::JSMutationRecordConstructor(Structure* structure, JSDOMGlobalObject* globalObject)
94     : DOMConstructorObject(structure, globalObject)
95 {
96 }
97
98 void JSMutationRecordConstructor::finishCreation(ExecState* exec, JSDOMGlobalObject* globalObject)
99 {
100     Base::finishCreation(exec->globalData());
101     ASSERT(inherits(&s_info));
102     putDirect(exec->globalData(), exec->propertyNames().prototype, JSMutationRecordPrototype::self(exec, globalObject), DontDelete | ReadOnly);
103 }
104
105 bool JSMutationRecordConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
106 {
107     return getStaticValueSlot<JSMutationRecordConstructor, JSDOMWrapper>(exec, &JSMutationRecordConstructorTable, static_cast<JSMutationRecordConstructor*>(cell), propertyName, slot);
108 }
109
110 bool JSMutationRecordConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
111 {
112     return getStaticValueDescriptor<JSMutationRecordConstructor, JSDOMWrapper>(exec, &JSMutationRecordConstructorTable, static_cast<JSMutationRecordConstructor*>(object), propertyName, descriptor);
113 }
114
115 /* Hash table for prototype */
116 #if ENABLE(JIT)
117 #define THUNK_GENERATOR(generator) , generator
118 #else
119 #define THUNK_GENERATOR(generator)
120 #endif
121 #if ENABLE(DFG_JIT)
122 #define INTRINSIC(intrinsic) , intrinsic
123 #else
124 #define INTRINSIC(intrinsic)
125 #endif
126
127 static const HashTableValue JSMutationRecordPrototypeTableValues[] =
128 {
129     { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
130 };
131
132 #undef THUNK_GENERATOR
133 static const HashTable JSMutationRecordPrototypeTable = { 1, 0, JSMutationRecordPrototypeTableValues, 0 };
134 const ClassInfo JSMutationRecordPrototype::s_info = { "MutationRecordPrototype", &JSC::JSNonFinalObject::s_info, &JSMutationRecordPrototypeTable, 0, CREATE_METHOD_TABLE(JSMutationRecordPrototype) };
135
136 JSObject* JSMutationRecordPrototype::self(ExecState* exec, JSGlobalObject* globalObject)
137 {
138     return getDOMPrototype<JSMutationRecord>(exec, globalObject);
139 }
140
141 const ClassInfo JSMutationRecord::s_info = { "MutationRecord", &JSDOMWrapper::s_info, &JSMutationRecordTable, 0 , CREATE_METHOD_TABLE(JSMutationRecord) };
142
143 JSMutationRecord::JSMutationRecord(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<MutationRecord> impl)
144     : JSDOMWrapper(structure, globalObject)
145     , m_impl(impl.leakRef())
146 {
147 }
148
149 void JSMutationRecord::finishCreation(JSGlobalData& globalData)
150 {
151     Base::finishCreation(globalData);
152     ASSERT(inherits(&s_info));
153 }
154
155 JSObject* JSMutationRecord::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
156 {
157     return JSMutationRecordPrototype::create(exec->globalData(), globalObject, JSMutationRecordPrototype::createStructure(globalObject->globalData(), globalObject, globalObject->objectPrototype()));
158 }
159
160 bool JSMutationRecord::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
161 {
162     JSMutationRecord* thisObject = jsCast<JSMutationRecord*>(cell);
163     ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
164     return getStaticValueSlot<JSMutationRecord, Base>(exec, &JSMutationRecordTable, thisObject, propertyName, slot);
165 }
166
167 bool JSMutationRecord::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
168 {
169     JSMutationRecord* thisObject = jsCast<JSMutationRecord*>(object);
170     ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
171     return getStaticValueDescriptor<JSMutationRecord, Base>(exec, &JSMutationRecordTable, thisObject, propertyName, descriptor);
172 }
173
174 JSValue jsMutationRecordType(ExecState* exec, JSValue slotBase, const Identifier&)
175 {
176     JSMutationRecord* castedThis = static_cast<JSMutationRecord*>(asObject(slotBase));
177     UNUSED_PARAM(exec);
178     MutationRecord* imp = static_cast<MutationRecord*>(castedThis->impl());
179     JSValue result = jsString(exec, imp->type());
180     return result;
181 }
182
183
184 JSValue jsMutationRecordTarget(ExecState* exec, JSValue slotBase, const Identifier&)
185 {
186     JSMutationRecord* castedThis = static_cast<JSMutationRecord*>(asObject(slotBase));
187     UNUSED_PARAM(exec);
188     MutationRecord* imp = static_cast<MutationRecord*>(castedThis->impl());
189     JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->target()));
190     return result;
191 }
192
193
194 JSValue jsMutationRecordAddedNodes(ExecState* exec, JSValue slotBase, const Identifier&)
195 {
196     JSMutationRecord* castedThis = static_cast<JSMutationRecord*>(asObject(slotBase));
197     UNUSED_PARAM(exec);
198     MutationRecord* imp = static_cast<MutationRecord*>(castedThis->impl());
199     JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->addedNodes()));
200     return result;
201 }
202
203
204 JSValue jsMutationRecordRemovedNodes(ExecState* exec, JSValue slotBase, const Identifier&)
205 {
206     JSMutationRecord* castedThis = static_cast<JSMutationRecord*>(asObject(slotBase));
207     UNUSED_PARAM(exec);
208     MutationRecord* imp = static_cast<MutationRecord*>(castedThis->impl());
209     JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->removedNodes()));
210     return result;
211 }
212
213
214 JSValue jsMutationRecordPreviousSibling(ExecState* exec, JSValue slotBase, const Identifier&)
215 {
216     JSMutationRecord* castedThis = static_cast<JSMutationRecord*>(asObject(slotBase));
217     UNUSED_PARAM(exec);
218     MutationRecord* imp = static_cast<MutationRecord*>(castedThis->impl());
219     JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->previousSibling()));
220     return result;
221 }
222
223
224 JSValue jsMutationRecordNextSibling(ExecState* exec, JSValue slotBase, const Identifier&)
225 {
226     JSMutationRecord* castedThis = static_cast<JSMutationRecord*>(asObject(slotBase));
227     UNUSED_PARAM(exec);
228     MutationRecord* imp = static_cast<MutationRecord*>(castedThis->impl());
229     JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->nextSibling()));
230     return result;
231 }
232
233
234 JSValue jsMutationRecordAttributeName(ExecState* exec, JSValue slotBase, const Identifier&)
235 {
236     JSMutationRecord* castedThis = static_cast<JSMutationRecord*>(asObject(slotBase));
237     UNUSED_PARAM(exec);
238     MutationRecord* imp = static_cast<MutationRecord*>(castedThis->impl());
239     JSValue result = jsString(exec, imp->attributeName());
240     return result;
241 }
242
243
244 JSValue jsMutationRecordAttributeNamespace(ExecState* exec, JSValue slotBase, const Identifier&)
245 {
246     JSMutationRecord* castedThis = static_cast<JSMutationRecord*>(asObject(slotBase));
247     UNUSED_PARAM(exec);
248     MutationRecord* imp = static_cast<MutationRecord*>(castedThis->impl());
249     JSValue result = jsStringOrNull(exec, imp->attributeNamespace());
250     return result;
251 }
252
253
254 JSValue jsMutationRecordOldValue(ExecState* exec, JSValue slotBase, const Identifier&)
255 {
256     JSMutationRecord* castedThis = static_cast<JSMutationRecord*>(asObject(slotBase));
257     UNUSED_PARAM(exec);
258     MutationRecord* imp = static_cast<MutationRecord*>(castedThis->impl());
259     JSValue result = jsStringOrNull(exec, imp->oldValue());
260     return result;
261 }
262
263
264 JSValue jsMutationRecordConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
265 {
266     JSMutationRecord* domObject = static_cast<JSMutationRecord*>(asObject(slotBase));
267     return JSMutationRecord::getConstructor(exec, domObject->globalObject());
268 }
269
270 JSValue JSMutationRecord::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
271 {
272     return getDOMConstructor<JSMutationRecordConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));
273 }
274
275 static inline bool isObservable(JSMutationRecord* jsMutationRecord)
276 {
277     if (jsMutationRecord->hasCustomProperties())
278         return true;
279     return false;
280 }
281
282 bool JSMutationRecordOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
283 {
284     JSMutationRecord* jsMutationRecord = static_cast<JSMutationRecord*>(handle.get().asCell());
285     if (!isObservable(jsMutationRecord))
286         return false;
287     UNUSED_PARAM(visitor);
288     return false;
289 }
290
291 void JSMutationRecordOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
292 {
293     JSMutationRecord* jsMutationRecord = static_cast<JSMutationRecord*>(handle.get().asCell());
294     DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context);
295     uncacheWrapper(world, jsMutationRecord->impl(), jsMutationRecord);
296     jsMutationRecord->releaseImpl();
297 }
298
299 JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, MutationRecord* impl)
300 {
301     return wrap<JSMutationRecord>(exec, globalObject, impl);
302 }
303
304 MutationRecord* toMutationRecord(JSC::JSValue value)
305 {
306     return value.inherits(&JSMutationRecord::s_info) ? static_cast<JSMutationRecord*>(asObject(value))->impl() : 0;
307 }
308
309 }
310
311 #endif // ENABLE(MUTATION_OBSERVERS)