tizen beta release
[profile/ivi/webkit-efl.git] / DerivedSources / WebCore / JSScreen.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 #include "JSScreen.h"
23
24 #include "Screen.h"
25 #include <wtf/GetPtr.h>
26
27 using namespace JSC;
28
29 namespace WebCore {
30
31 ASSERT_CLASS_FITS_IN_CELL(JSScreen);
32
33 /* Hash table */
34 #if ENABLE(JIT)
35 #define THUNK_GENERATOR(generator) , generator
36 #else
37 #define THUNK_GENERATOR(generator)
38 #endif
39 #if ENABLE(DFG_JIT)
40 #define INTRINSIC(intrinsic) , intrinsic
41 #else
42 #define INTRINSIC(intrinsic)
43 #endif
44
45 static const HashTableValue JSScreenTableValues[] =
46 {
47     { "height", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsScreenHeight), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
48     { "width", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsScreenWidth), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
49     { "colorDepth", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsScreenColorDepth), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
50     { "pixelDepth", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsScreenPixelDepth), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
51     { "availLeft", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsScreenAvailLeft), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
52     { "availTop", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsScreenAvailTop), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
53     { "availHeight", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsScreenAvailHeight), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
54     { "availWidth", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsScreenAvailWidth), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
55     { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
56 };
57
58 #undef THUNK_GENERATOR
59 static const HashTable JSScreenTable = { 18, 15, JSScreenTableValues, 0 };
60 /* Hash table for prototype */
61 #if ENABLE(JIT)
62 #define THUNK_GENERATOR(generator) , generator
63 #else
64 #define THUNK_GENERATOR(generator)
65 #endif
66 #if ENABLE(DFG_JIT)
67 #define INTRINSIC(intrinsic) , intrinsic
68 #else
69 #define INTRINSIC(intrinsic)
70 #endif
71
72 static const HashTableValue JSScreenPrototypeTableValues[] =
73 {
74     { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
75 };
76
77 #undef THUNK_GENERATOR
78 static const HashTable JSScreenPrototypeTable = { 1, 0, JSScreenPrototypeTableValues, 0 };
79 const ClassInfo JSScreenPrototype::s_info = { "ScreenPrototype", &JSC::JSNonFinalObject::s_info, &JSScreenPrototypeTable, 0, CREATE_METHOD_TABLE(JSScreenPrototype) };
80
81 JSObject* JSScreenPrototype::self(ExecState* exec, JSGlobalObject* globalObject)
82 {
83     return getDOMPrototype<JSScreen>(exec, globalObject);
84 }
85
86 const ClassInfo JSScreen::s_info = { "Screen", &JSDOMWrapper::s_info, &JSScreenTable, 0 , CREATE_METHOD_TABLE(JSScreen) };
87
88 JSScreen::JSScreen(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<Screen> impl)
89     : JSDOMWrapper(structure, globalObject)
90     , m_impl(impl.leakRef())
91 {
92 }
93
94 void JSScreen::finishCreation(JSGlobalData& globalData)
95 {
96     Base::finishCreation(globalData);
97     ASSERT(inherits(&s_info));
98 }
99
100 JSObject* JSScreen::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
101 {
102     return JSScreenPrototype::create(exec->globalData(), globalObject, JSScreenPrototype::createStructure(globalObject->globalData(), globalObject, globalObject->objectPrototype()));
103 }
104
105 bool JSScreen::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
106 {
107     JSScreen* thisObject = jsCast<JSScreen*>(cell);
108     ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
109     return getStaticValueSlot<JSScreen, Base>(exec, &JSScreenTable, thisObject, propertyName, slot);
110 }
111
112 bool JSScreen::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
113 {
114     JSScreen* thisObject = jsCast<JSScreen*>(object);
115     ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
116     return getStaticValueDescriptor<JSScreen, Base>(exec, &JSScreenTable, thisObject, propertyName, descriptor);
117 }
118
119 JSValue jsScreenHeight(ExecState* exec, JSValue slotBase, const Identifier&)
120 {
121     JSScreen* castedThis = static_cast<JSScreen*>(asObject(slotBase));
122     UNUSED_PARAM(exec);
123     Screen* imp = static_cast<Screen*>(castedThis->impl());
124     JSValue result = jsNumber(imp->height());
125     return result;
126 }
127
128
129 JSValue jsScreenWidth(ExecState* exec, JSValue slotBase, const Identifier&)
130 {
131     JSScreen* castedThis = static_cast<JSScreen*>(asObject(slotBase));
132     UNUSED_PARAM(exec);
133     Screen* imp = static_cast<Screen*>(castedThis->impl());
134     JSValue result = jsNumber(imp->width());
135     return result;
136 }
137
138
139 JSValue jsScreenColorDepth(ExecState* exec, JSValue slotBase, const Identifier&)
140 {
141     JSScreen* castedThis = static_cast<JSScreen*>(asObject(slotBase));
142     UNUSED_PARAM(exec);
143     Screen* imp = static_cast<Screen*>(castedThis->impl());
144     JSValue result = jsNumber(imp->colorDepth());
145     return result;
146 }
147
148
149 JSValue jsScreenPixelDepth(ExecState* exec, JSValue slotBase, const Identifier&)
150 {
151     JSScreen* castedThis = static_cast<JSScreen*>(asObject(slotBase));
152     UNUSED_PARAM(exec);
153     Screen* imp = static_cast<Screen*>(castedThis->impl());
154     JSValue result = jsNumber(imp->pixelDepth());
155     return result;
156 }
157
158
159 JSValue jsScreenAvailLeft(ExecState* exec, JSValue slotBase, const Identifier&)
160 {
161     JSScreen* castedThis = static_cast<JSScreen*>(asObject(slotBase));
162     UNUSED_PARAM(exec);
163     Screen* imp = static_cast<Screen*>(castedThis->impl());
164     JSValue result = jsNumber(imp->availLeft());
165     return result;
166 }
167
168
169 JSValue jsScreenAvailTop(ExecState* exec, JSValue slotBase, const Identifier&)
170 {
171     JSScreen* castedThis = static_cast<JSScreen*>(asObject(slotBase));
172     UNUSED_PARAM(exec);
173     Screen* imp = static_cast<Screen*>(castedThis->impl());
174     JSValue result = jsNumber(imp->availTop());
175     return result;
176 }
177
178
179 JSValue jsScreenAvailHeight(ExecState* exec, JSValue slotBase, const Identifier&)
180 {
181     JSScreen* castedThis = static_cast<JSScreen*>(asObject(slotBase));
182     UNUSED_PARAM(exec);
183     Screen* imp = static_cast<Screen*>(castedThis->impl());
184     JSValue result = jsNumber(imp->availHeight());
185     return result;
186 }
187
188
189 JSValue jsScreenAvailWidth(ExecState* exec, JSValue slotBase, const Identifier&)
190 {
191     JSScreen* castedThis = static_cast<JSScreen*>(asObject(slotBase));
192     UNUSED_PARAM(exec);
193     Screen* imp = static_cast<Screen*>(castedThis->impl());
194     JSValue result = jsNumber(imp->availWidth());
195     return result;
196 }
197
198
199 static inline bool isObservable(JSScreen* jsScreen)
200 {
201     if (jsScreen->hasCustomProperties())
202         return true;
203     return false;
204 }
205
206 bool JSScreenOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
207 {
208     JSScreen* jsScreen = static_cast<JSScreen*>(handle.get().asCell());
209     if (!isObservable(jsScreen))
210         return false;
211     Frame* root = jsScreen->impl()->frame();
212     if (!root)
213         return false;
214     return visitor.containsOpaqueRoot(root);
215 }
216
217 void JSScreenOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
218 {
219     JSScreen* jsScreen = static_cast<JSScreen*>(handle.get().asCell());
220     DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context);
221     uncacheWrapper(world, jsScreen->impl(), jsScreen);
222     jsScreen->releaseImpl();
223 }
224
225 JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, Screen* impl)
226 {
227     return wrap<JSScreen>(exec, globalObject, impl);
228 }
229
230 Screen* toScreen(JSC::JSValue value)
231 {
232     return value.inherits(&JSScreen::s_info) ? static_cast<JSScreen*>(asObject(value))->impl() : 0;
233 }
234
235 }