2 This file is part of the WebKit open source project.
3 This file has been generated by generate-bindings.pl. DO NOT MODIFY!
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.
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.
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.
22 #include "JSStyleSheet.h"
24 #include "JSMediaList.h"
26 #include "JSStyleSheet.h"
28 #include "MediaList.h"
30 #include "StyleSheet.h"
31 #include <wtf/GetPtr.h>
37 ASSERT_CLASS_FITS_IN_CELL(JSStyleSheet);
41 #define THUNK_GENERATOR(generator) , generator
43 #define THUNK_GENERATOR(generator)
46 #define INTRINSIC(intrinsic) , intrinsic
48 #define INTRINSIC(intrinsic)
51 static const HashTableValue JSStyleSheetTableValues[] =
53 { "type", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsStyleSheetType), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
54 { "disabled", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsStyleSheetDisabled), (intptr_t)setJSStyleSheetDisabled THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
55 { "ownerNode", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsStyleSheetOwnerNode), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
56 { "parentStyleSheet", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsStyleSheetParentStyleSheet), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
57 { "href", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsStyleSheetHref), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
58 { "title", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsStyleSheetTitle), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
59 { "media", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsStyleSheetMedia), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
60 { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsStyleSheetConstructor), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
61 { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
64 #undef THUNK_GENERATOR
65 static const HashTable JSStyleSheetTable = { 17, 15, JSStyleSheetTableValues, 0 };
66 /* Hash table for constructor */
68 #define THUNK_GENERATOR(generator) , generator
70 #define THUNK_GENERATOR(generator)
73 #define INTRINSIC(intrinsic) , intrinsic
75 #define INTRINSIC(intrinsic)
78 static const HashTableValue JSStyleSheetConstructorTableValues[] =
80 { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
83 #undef THUNK_GENERATOR
84 static const HashTable JSStyleSheetConstructorTable = { 1, 0, JSStyleSheetConstructorTableValues, 0 };
85 const ClassInfo JSStyleSheetConstructor::s_info = { "StyleSheetConstructor", &DOMConstructorObject::s_info, &JSStyleSheetConstructorTable, 0, CREATE_METHOD_TABLE(JSStyleSheetConstructor) };
87 JSStyleSheetConstructor::JSStyleSheetConstructor(Structure* structure, JSDOMGlobalObject* globalObject)
88 : DOMConstructorObject(structure, globalObject)
92 void JSStyleSheetConstructor::finishCreation(ExecState* exec, JSDOMGlobalObject* globalObject)
94 Base::finishCreation(exec->globalData());
95 ASSERT(inherits(&s_info));
96 putDirect(exec->globalData(), exec->propertyNames().prototype, JSStyleSheetPrototype::self(exec, globalObject), DontDelete | ReadOnly);
99 bool JSStyleSheetConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
101 return getStaticValueSlot<JSStyleSheetConstructor, JSDOMWrapper>(exec, &JSStyleSheetConstructorTable, static_cast<JSStyleSheetConstructor*>(cell), propertyName, slot);
104 bool JSStyleSheetConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
106 return getStaticValueDescriptor<JSStyleSheetConstructor, JSDOMWrapper>(exec, &JSStyleSheetConstructorTable, static_cast<JSStyleSheetConstructor*>(object), propertyName, descriptor);
109 /* Hash table for prototype */
111 #define THUNK_GENERATOR(generator) , generator
113 #define THUNK_GENERATOR(generator)
116 #define INTRINSIC(intrinsic) , intrinsic
118 #define INTRINSIC(intrinsic)
121 static const HashTableValue JSStyleSheetPrototypeTableValues[] =
123 { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
126 #undef THUNK_GENERATOR
127 static const HashTable JSStyleSheetPrototypeTable = { 1, 0, JSStyleSheetPrototypeTableValues, 0 };
128 const ClassInfo JSStyleSheetPrototype::s_info = { "StyleSheetPrototype", &JSC::JSNonFinalObject::s_info, &JSStyleSheetPrototypeTable, 0, CREATE_METHOD_TABLE(JSStyleSheetPrototype) };
130 JSObject* JSStyleSheetPrototype::self(ExecState* exec, JSGlobalObject* globalObject)
132 return getDOMPrototype<JSStyleSheet>(exec, globalObject);
135 const ClassInfo JSStyleSheet::s_info = { "StyleSheet", &JSDOMWrapper::s_info, &JSStyleSheetTable, 0 , CREATE_METHOD_TABLE(JSStyleSheet) };
137 JSStyleSheet::JSStyleSheet(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<StyleSheet> impl)
138 : JSDOMWrapper(structure, globalObject)
139 , m_impl(impl.leakRef())
143 void JSStyleSheet::finishCreation(JSGlobalData& globalData)
145 Base::finishCreation(globalData);
146 ASSERT(inherits(&s_info));
149 JSObject* JSStyleSheet::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
151 return JSStyleSheetPrototype::create(exec->globalData(), globalObject, JSStyleSheetPrototype::createStructure(globalObject->globalData(), globalObject, globalObject->objectPrototype()));
154 bool JSStyleSheet::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
156 JSStyleSheet* thisObject = jsCast<JSStyleSheet*>(cell);
157 ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
158 return getStaticValueSlot<JSStyleSheet, Base>(exec, &JSStyleSheetTable, thisObject, propertyName, slot);
161 bool JSStyleSheet::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
163 JSStyleSheet* thisObject = jsCast<JSStyleSheet*>(object);
164 ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
165 return getStaticValueDescriptor<JSStyleSheet, Base>(exec, &JSStyleSheetTable, thisObject, propertyName, descriptor);
168 JSValue jsStyleSheetType(ExecState* exec, JSValue slotBase, const Identifier&)
170 JSStyleSheet* castedThis = static_cast<JSStyleSheet*>(asObject(slotBase));
172 StyleSheet* imp = static_cast<StyleSheet*>(castedThis->impl());
173 JSValue result = jsStringOrNull(exec, imp->type());
178 JSValue jsStyleSheetDisabled(ExecState* exec, JSValue slotBase, const Identifier&)
180 JSStyleSheet* castedThis = static_cast<JSStyleSheet*>(asObject(slotBase));
182 StyleSheet* imp = static_cast<StyleSheet*>(castedThis->impl());
183 JSValue result = jsBoolean(imp->disabled());
188 JSValue jsStyleSheetOwnerNode(ExecState* exec, JSValue slotBase, const Identifier&)
190 JSStyleSheet* castedThis = static_cast<JSStyleSheet*>(asObject(slotBase));
192 StyleSheet* imp = static_cast<StyleSheet*>(castedThis->impl());
193 JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->ownerNode()));
198 JSValue jsStyleSheetParentStyleSheet(ExecState* exec, JSValue slotBase, const Identifier&)
200 JSStyleSheet* castedThis = static_cast<JSStyleSheet*>(asObject(slotBase));
202 StyleSheet* imp = static_cast<StyleSheet*>(castedThis->impl());
203 JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->parentStyleSheet()));
208 JSValue jsStyleSheetHref(ExecState* exec, JSValue slotBase, const Identifier&)
210 JSStyleSheet* castedThis = static_cast<JSStyleSheet*>(asObject(slotBase));
212 StyleSheet* imp = static_cast<StyleSheet*>(castedThis->impl());
213 JSValue result = jsStringOrNull(exec, imp->href());
218 JSValue jsStyleSheetTitle(ExecState* exec, JSValue slotBase, const Identifier&)
220 JSStyleSheet* castedThis = static_cast<JSStyleSheet*>(asObject(slotBase));
222 StyleSheet* imp = static_cast<StyleSheet*>(castedThis->impl());
223 JSValue result = jsStringOrNull(exec, imp->title());
228 JSValue jsStyleSheetMedia(ExecState* exec, JSValue slotBase, const Identifier&)
230 JSStyleSheet* castedThis = static_cast<JSStyleSheet*>(asObject(slotBase));
232 StyleSheet* imp = static_cast<StyleSheet*>(castedThis->impl());
233 JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->media()));
238 JSValue jsStyleSheetConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
240 JSStyleSheet* domObject = static_cast<JSStyleSheet*>(asObject(slotBase));
241 return JSStyleSheet::getConstructor(exec, domObject->globalObject());
244 void JSStyleSheet::put(JSCell* cell, ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
246 JSStyleSheet* thisObject = jsCast<JSStyleSheet*>(cell);
247 ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
248 lookupPut<JSStyleSheet, Base>(exec, propertyName, value, &JSStyleSheetTable, thisObject, slot);
251 void setJSStyleSheetDisabled(ExecState* exec, JSObject* thisObject, JSValue value)
253 JSStyleSheet* castedThis = static_cast<JSStyleSheet*>(thisObject);
254 StyleSheet* imp = static_cast<StyleSheet*>(castedThis->impl());
255 imp->setDisabled(value.toBoolean(exec));
259 JSValue JSStyleSheet::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
261 return getDOMConstructor<JSStyleSheetConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));
264 static inline bool isObservable(JSStyleSheet* jsStyleSheet)
266 if (jsStyleSheet->hasCustomProperties())
271 bool JSStyleSheetOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
273 JSStyleSheet* jsStyleSheet = static_cast<JSStyleSheet*>(handle.get().asCell());
274 if (!isObservable(jsStyleSheet))
276 void* root = WebCore::root(jsStyleSheet->impl());
277 return visitor.containsOpaqueRoot(root);
280 void JSStyleSheetOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
282 JSStyleSheet* jsStyleSheet = static_cast<JSStyleSheet*>(handle.get().asCell());
283 DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context);
284 uncacheWrapper(world, jsStyleSheet->impl(), jsStyleSheet);
285 jsStyleSheet->releaseImpl();
288 StyleSheet* toStyleSheet(JSC::JSValue value)
290 return value.inherits(&JSStyleSheet::s_info) ? static_cast<JSStyleSheet*>(asObject(value))->impl() : 0;