tizen beta release
[profile/ivi/webkit-efl.git] / DerivedSources / WebCore / JSSVGColor.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(SVG)
24
25 #include "JSSVGColor.h"
26
27 #include "ExceptionCode.h"
28 #include "JSDOMBinding.h"
29 #include "JSRGBColor.h"
30 #include "RGBColor.h"
31 #include "SVGColor.h"
32 #include <runtime/Error.h>
33 #include <wtf/GetPtr.h>
34
35 using namespace JSC;
36
37 namespace WebCore {
38
39 ASSERT_CLASS_FITS_IN_CELL(JSSVGColor);
40
41 /* Hash table */
42 #if ENABLE(JIT)
43 #define THUNK_GENERATOR(generator) , generator
44 #else
45 #define THUNK_GENERATOR(generator)
46 #endif
47 #if ENABLE(DFG_JIT)
48 #define INTRINSIC(intrinsic) , intrinsic
49 #else
50 #define INTRINSIC(intrinsic)
51 #endif
52
53 static const HashTableValue JSSVGColorTableValues[] =
54 {
55     { "colorType", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGColorColorType), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
56     { "rgbColor", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGColorRgbColor), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
57     { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGColorConstructor), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
58     { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
59 };
60
61 #undef THUNK_GENERATOR
62 static const HashTable JSSVGColorTable = { 8, 7, JSSVGColorTableValues, 0 };
63 /* Hash table for constructor */
64 #if ENABLE(JIT)
65 #define THUNK_GENERATOR(generator) , generator
66 #else
67 #define THUNK_GENERATOR(generator)
68 #endif
69 #if ENABLE(DFG_JIT)
70 #define INTRINSIC(intrinsic) , intrinsic
71 #else
72 #define INTRINSIC(intrinsic)
73 #endif
74
75 static const HashTableValue JSSVGColorConstructorTableValues[] =
76 {
77     { "SVG_COLORTYPE_UNKNOWN", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGColorSVG_COLORTYPE_UNKNOWN), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
78     { "SVG_COLORTYPE_RGBCOLOR", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGColorSVG_COLORTYPE_RGBCOLOR), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
79     { "SVG_COLORTYPE_RGBCOLOR_ICCCOLOR", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGColorSVG_COLORTYPE_RGBCOLOR_ICCCOLOR), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
80     { "SVG_COLORTYPE_CURRENTCOLOR", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGColorSVG_COLORTYPE_CURRENTCOLOR), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
81     { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
82 };
83
84 #undef THUNK_GENERATOR
85 static const HashTable JSSVGColorConstructorTable = { 8, 7, JSSVGColorConstructorTableValues, 0 };
86
87 COMPILE_ASSERT(0 == SVGColor::SVG_COLORTYPE_UNKNOWN, SVGColorEnumSVG_COLORTYPE_UNKNOWNIsWrongUseDontCheckEnums);
88 COMPILE_ASSERT(1 == SVGColor::SVG_COLORTYPE_RGBCOLOR, SVGColorEnumSVG_COLORTYPE_RGBCOLORIsWrongUseDontCheckEnums);
89 COMPILE_ASSERT(2 == SVGColor::SVG_COLORTYPE_RGBCOLOR_ICCCOLOR, SVGColorEnumSVG_COLORTYPE_RGBCOLOR_ICCCOLORIsWrongUseDontCheckEnums);
90 COMPILE_ASSERT(3 == SVGColor::SVG_COLORTYPE_CURRENTCOLOR, SVGColorEnumSVG_COLORTYPE_CURRENTCOLORIsWrongUseDontCheckEnums);
91
92 const ClassInfo JSSVGColorConstructor::s_info = { "SVGColorConstructor", &DOMConstructorObject::s_info, &JSSVGColorConstructorTable, 0, CREATE_METHOD_TABLE(JSSVGColorConstructor) };
93
94 JSSVGColorConstructor::JSSVGColorConstructor(Structure* structure, JSDOMGlobalObject* globalObject)
95     : DOMConstructorObject(structure, globalObject)
96 {
97 }
98
99 void JSSVGColorConstructor::finishCreation(ExecState* exec, JSDOMGlobalObject* globalObject)
100 {
101     Base::finishCreation(exec->globalData());
102     ASSERT(inherits(&s_info));
103     putDirect(exec->globalData(), exec->propertyNames().prototype, JSSVGColorPrototype::self(exec, globalObject), DontDelete | ReadOnly);
104 }
105
106 bool JSSVGColorConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
107 {
108     return getStaticValueSlot<JSSVGColorConstructor, JSDOMWrapper>(exec, &JSSVGColorConstructorTable, static_cast<JSSVGColorConstructor*>(cell), propertyName, slot);
109 }
110
111 bool JSSVGColorConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
112 {
113     return getStaticValueDescriptor<JSSVGColorConstructor, JSDOMWrapper>(exec, &JSSVGColorConstructorTable, static_cast<JSSVGColorConstructor*>(object), propertyName, descriptor);
114 }
115
116 /* Hash table for prototype */
117 #if ENABLE(JIT)
118 #define THUNK_GENERATOR(generator) , generator
119 #else
120 #define THUNK_GENERATOR(generator)
121 #endif
122 #if ENABLE(DFG_JIT)
123 #define INTRINSIC(intrinsic) , intrinsic
124 #else
125 #define INTRINSIC(intrinsic)
126 #endif
127
128 static const HashTableValue JSSVGColorPrototypeTableValues[] =
129 {
130     { "SVG_COLORTYPE_UNKNOWN", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGColorSVG_COLORTYPE_UNKNOWN), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
131     { "SVG_COLORTYPE_RGBCOLOR", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGColorSVG_COLORTYPE_RGBCOLOR), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
132     { "SVG_COLORTYPE_RGBCOLOR_ICCCOLOR", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGColorSVG_COLORTYPE_RGBCOLOR_ICCCOLOR), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
133     { "SVG_COLORTYPE_CURRENTCOLOR", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGColorSVG_COLORTYPE_CURRENTCOLOR), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
134     { "setRGBColor", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsSVGColorPrototypeFunctionSetRGBColor), (intptr_t)1 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
135     { "setRGBColorICCColor", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsSVGColorPrototypeFunctionSetRGBColorICCColor), (intptr_t)2 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
136     { "setColor", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsSVGColorPrototypeFunctionSetColor), (intptr_t)3 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
137     { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
138 };
139
140 #undef THUNK_GENERATOR
141 static const HashTable JSSVGColorPrototypeTable = { 17, 15, JSSVGColorPrototypeTableValues, 0 };
142 const ClassInfo JSSVGColorPrototype::s_info = { "SVGColorPrototype", &JSC::JSNonFinalObject::s_info, &JSSVGColorPrototypeTable, 0, CREATE_METHOD_TABLE(JSSVGColorPrototype) };
143
144 JSObject* JSSVGColorPrototype::self(ExecState* exec, JSGlobalObject* globalObject)
145 {
146     return getDOMPrototype<JSSVGColor>(exec, globalObject);
147 }
148
149 bool JSSVGColorPrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
150 {
151     JSSVGColorPrototype* thisObject = jsCast<JSSVGColorPrototype*>(cell);
152     return getStaticPropertySlot<JSSVGColorPrototype, JSObject>(exec, &JSSVGColorPrototypeTable, thisObject, propertyName, slot);
153 }
154
155 bool JSSVGColorPrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
156 {
157     JSSVGColorPrototype* thisObject = jsCast<JSSVGColorPrototype*>(object);
158     return getStaticPropertyDescriptor<JSSVGColorPrototype, JSObject>(exec, &JSSVGColorPrototypeTable, thisObject, propertyName, descriptor);
159 }
160
161 const ClassInfo JSSVGColor::s_info = { "SVGColor", &JSCSSValue::s_info, &JSSVGColorTable, 0 , CREATE_METHOD_TABLE(JSSVGColor) };
162
163 JSSVGColor::JSSVGColor(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<SVGColor> impl)
164     : JSCSSValue(structure, globalObject, impl)
165 {
166 }
167
168 void JSSVGColor::finishCreation(JSGlobalData& globalData)
169 {
170     Base::finishCreation(globalData);
171     ASSERT(inherits(&s_info));
172 }
173
174 JSObject* JSSVGColor::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
175 {
176     return JSSVGColorPrototype::create(exec->globalData(), globalObject, JSSVGColorPrototype::createStructure(exec->globalData(), globalObject, JSCSSValuePrototype::self(exec, globalObject)));
177 }
178
179 bool JSSVGColor::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
180 {
181     JSSVGColor* thisObject = jsCast<JSSVGColor*>(cell);
182     ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
183     return getStaticValueSlot<JSSVGColor, Base>(exec, &JSSVGColorTable, thisObject, propertyName, slot);
184 }
185
186 bool JSSVGColor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
187 {
188     JSSVGColor* thisObject = jsCast<JSSVGColor*>(object);
189     ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
190     return getStaticValueDescriptor<JSSVGColor, Base>(exec, &JSSVGColorTable, thisObject, propertyName, descriptor);
191 }
192
193 JSValue jsSVGColorColorType(ExecState* exec, JSValue slotBase, const Identifier&)
194 {
195     JSSVGColor* castedThis = static_cast<JSSVGColor*>(asObject(slotBase));
196     UNUSED_PARAM(exec);
197     SVGColor* imp = static_cast<SVGColor*>(castedThis->impl());
198     JSValue result = jsNumber(imp->colorType());
199     return result;
200 }
201
202
203 JSValue jsSVGColorRgbColor(ExecState* exec, JSValue slotBase, const Identifier&)
204 {
205     JSSVGColor* castedThis = static_cast<JSSVGColor*>(asObject(slotBase));
206     UNUSED_PARAM(exec);
207     SVGColor* imp = static_cast<SVGColor*>(castedThis->impl());
208     JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->rgbColor()));
209     return result;
210 }
211
212
213 JSValue jsSVGColorConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
214 {
215     JSSVGColor* domObject = static_cast<JSSVGColor*>(asObject(slotBase));
216     return JSSVGColor::getConstructor(exec, domObject->globalObject());
217 }
218
219 JSValue JSSVGColor::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
220 {
221     return getDOMConstructor<JSSVGColorConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));
222 }
223
224 EncodedJSValue JSC_HOST_CALL jsSVGColorPrototypeFunctionSetRGBColor(ExecState* exec)
225 {
226     JSValue thisValue = exec->hostThisValue();
227     if (!thisValue.inherits(&JSSVGColor::s_info))
228         return throwVMTypeError(exec);
229     JSSVGColor* castedThis = static_cast<JSSVGColor*>(asObject(thisValue));
230     ASSERT_GC_OBJECT_INHERITS(castedThis, &JSSVGColor::s_info);
231     SVGColor* imp = static_cast<SVGColor*>(castedThis->impl());
232     if (exec->argumentCount() < 1)
233         return throwVMError(exec, createTypeError(exec, "Not enough arguments"));
234     ExceptionCode ec = 0;
235     const String& rgbColor(ustringToString(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).isEmpty() ? UString() : MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).toString(exec)));
236     if (exec->hadException())
237         return JSValue::encode(jsUndefined());
238     imp->setRGBColor(rgbColor, ec);
239     setDOMException(exec, ec);
240     return JSValue::encode(jsUndefined());
241 }
242
243 EncodedJSValue JSC_HOST_CALL jsSVGColorPrototypeFunctionSetRGBColorICCColor(ExecState* exec)
244 {
245     JSValue thisValue = exec->hostThisValue();
246     if (!thisValue.inherits(&JSSVGColor::s_info))
247         return throwVMTypeError(exec);
248     JSSVGColor* castedThis = static_cast<JSSVGColor*>(asObject(thisValue));
249     ASSERT_GC_OBJECT_INHERITS(castedThis, &JSSVGColor::s_info);
250     SVGColor* imp = static_cast<SVGColor*>(castedThis->impl());
251     if (exec->argumentCount() < 2)
252         return throwVMError(exec, createTypeError(exec, "Not enough arguments"));
253     ExceptionCode ec = 0;
254     const String& rgbColor(ustringToString(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).isEmpty() ? UString() : MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).toString(exec)));
255     if (exec->hadException())
256         return JSValue::encode(jsUndefined());
257     const String& iccColor(ustringToString(MAYBE_MISSING_PARAMETER(exec, 1, MissingIsUndefined).isEmpty() ? UString() : MAYBE_MISSING_PARAMETER(exec, 1, MissingIsUndefined).toString(exec)));
258     if (exec->hadException())
259         return JSValue::encode(jsUndefined());
260     imp->setRGBColorICCColor(rgbColor, iccColor, ec);
261     setDOMException(exec, ec);
262     return JSValue::encode(jsUndefined());
263 }
264
265 EncodedJSValue JSC_HOST_CALL jsSVGColorPrototypeFunctionSetColor(ExecState* exec)
266 {
267     JSValue thisValue = exec->hostThisValue();
268     if (!thisValue.inherits(&JSSVGColor::s_info))
269         return throwVMTypeError(exec);
270     JSSVGColor* castedThis = static_cast<JSSVGColor*>(asObject(thisValue));
271     ASSERT_GC_OBJECT_INHERITS(castedThis, &JSSVGColor::s_info);
272     SVGColor* imp = static_cast<SVGColor*>(castedThis->impl());
273     if (exec->argumentCount() < 3)
274         return throwVMError(exec, createTypeError(exec, "Not enough arguments"));
275     ExceptionCode ec = 0;
276     unsigned short colorType(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).toUInt32(exec));
277     if (exec->hadException())
278         return JSValue::encode(jsUndefined());
279     const String& rgbColor(ustringToString(MAYBE_MISSING_PARAMETER(exec, 1, MissingIsUndefined).isEmpty() ? UString() : MAYBE_MISSING_PARAMETER(exec, 1, MissingIsUndefined).toString(exec)));
280     if (exec->hadException())
281         return JSValue::encode(jsUndefined());
282     const String& iccColor(ustringToString(MAYBE_MISSING_PARAMETER(exec, 2, MissingIsUndefined).isEmpty() ? UString() : MAYBE_MISSING_PARAMETER(exec, 2, MissingIsUndefined).toString(exec)));
283     if (exec->hadException())
284         return JSValue::encode(jsUndefined());
285     imp->setColor(colorType, rgbColor, iccColor, ec);
286     setDOMException(exec, ec);
287     return JSValue::encode(jsUndefined());
288 }
289
290 // Constant getters
291
292 JSValue jsSVGColorSVG_COLORTYPE_UNKNOWN(ExecState* exec, JSValue, const Identifier&)
293 {
294     UNUSED_PARAM(exec);
295     return jsNumber(static_cast<int>(0));
296 }
297
298 JSValue jsSVGColorSVG_COLORTYPE_RGBCOLOR(ExecState* exec, JSValue, const Identifier&)
299 {
300     UNUSED_PARAM(exec);
301     return jsNumber(static_cast<int>(1));
302 }
303
304 JSValue jsSVGColorSVG_COLORTYPE_RGBCOLOR_ICCCOLOR(ExecState* exec, JSValue, const Identifier&)
305 {
306     UNUSED_PARAM(exec);
307     return jsNumber(static_cast<int>(2));
308 }
309
310 JSValue jsSVGColorSVG_COLORTYPE_CURRENTCOLOR(ExecState* exec, JSValue, const Identifier&)
311 {
312     UNUSED_PARAM(exec);
313     return jsNumber(static_cast<int>(3));
314 }
315
316
317 }
318
319 #endif // ENABLE(SVG)