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.
25 #include "JSSVGColor.h"
27 #include "ExceptionCode.h"
28 #include "JSDOMBinding.h"
29 #include "JSRGBColor.h"
32 #include <runtime/Error.h>
33 #include <wtf/GetPtr.h>
39 ASSERT_CLASS_FITS_IN_CELL(JSSVGColor);
43 #define THUNK_GENERATOR(generator) , generator
45 #define THUNK_GENERATOR(generator)
48 #define INTRINSIC(intrinsic) , intrinsic
50 #define INTRINSIC(intrinsic)
53 static const HashTableValue JSSVGColorTableValues[] =
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) }
61 #undef THUNK_GENERATOR
62 static const HashTable JSSVGColorTable = { 8, 7, JSSVGColorTableValues, 0 };
63 /* Hash table for constructor */
65 #define THUNK_GENERATOR(generator) , generator
67 #define THUNK_GENERATOR(generator)
70 #define INTRINSIC(intrinsic) , intrinsic
72 #define INTRINSIC(intrinsic)
75 static const HashTableValue JSSVGColorConstructorTableValues[] =
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) }
84 #undef THUNK_GENERATOR
85 static const HashTable JSSVGColorConstructorTable = { 8, 7, JSSVGColorConstructorTableValues, 0 };
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);
92 const ClassInfo JSSVGColorConstructor::s_info = { "SVGColorConstructor", &DOMConstructorObject::s_info, &JSSVGColorConstructorTable, 0, CREATE_METHOD_TABLE(JSSVGColorConstructor) };
94 JSSVGColorConstructor::JSSVGColorConstructor(Structure* structure, JSDOMGlobalObject* globalObject)
95 : DOMConstructorObject(structure, globalObject)
99 void JSSVGColorConstructor::finishCreation(ExecState* exec, JSDOMGlobalObject* globalObject)
101 Base::finishCreation(exec->globalData());
102 ASSERT(inherits(&s_info));
103 putDirect(exec->globalData(), exec->propertyNames().prototype, JSSVGColorPrototype::self(exec, globalObject), DontDelete | ReadOnly);
106 bool JSSVGColorConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
108 return getStaticValueSlot<JSSVGColorConstructor, JSDOMWrapper>(exec, &JSSVGColorConstructorTable, static_cast<JSSVGColorConstructor*>(cell), propertyName, slot);
111 bool JSSVGColorConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
113 return getStaticValueDescriptor<JSSVGColorConstructor, JSDOMWrapper>(exec, &JSSVGColorConstructorTable, static_cast<JSSVGColorConstructor*>(object), propertyName, descriptor);
116 /* Hash table for prototype */
118 #define THUNK_GENERATOR(generator) , generator
120 #define THUNK_GENERATOR(generator)
123 #define INTRINSIC(intrinsic) , intrinsic
125 #define INTRINSIC(intrinsic)
128 static const HashTableValue JSSVGColorPrototypeTableValues[] =
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) }
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) };
144 JSObject* JSSVGColorPrototype::self(ExecState* exec, JSGlobalObject* globalObject)
146 return getDOMPrototype<JSSVGColor>(exec, globalObject);
149 bool JSSVGColorPrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
151 JSSVGColorPrototype* thisObject = jsCast<JSSVGColorPrototype*>(cell);
152 return getStaticPropertySlot<JSSVGColorPrototype, JSObject>(exec, &JSSVGColorPrototypeTable, thisObject, propertyName, slot);
155 bool JSSVGColorPrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
157 JSSVGColorPrototype* thisObject = jsCast<JSSVGColorPrototype*>(object);
158 return getStaticPropertyDescriptor<JSSVGColorPrototype, JSObject>(exec, &JSSVGColorPrototypeTable, thisObject, propertyName, descriptor);
161 const ClassInfo JSSVGColor::s_info = { "SVGColor", &JSCSSValue::s_info, &JSSVGColorTable, 0 , CREATE_METHOD_TABLE(JSSVGColor) };
163 JSSVGColor::JSSVGColor(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<SVGColor> impl)
164 : JSCSSValue(structure, globalObject, impl)
168 void JSSVGColor::finishCreation(JSGlobalData& globalData)
170 Base::finishCreation(globalData);
171 ASSERT(inherits(&s_info));
174 JSObject* JSSVGColor::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
176 return JSSVGColorPrototype::create(exec->globalData(), globalObject, JSSVGColorPrototype::createStructure(exec->globalData(), globalObject, JSCSSValuePrototype::self(exec, globalObject)));
179 bool JSSVGColor::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
181 JSSVGColor* thisObject = jsCast<JSSVGColor*>(cell);
182 ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
183 return getStaticValueSlot<JSSVGColor, Base>(exec, &JSSVGColorTable, thisObject, propertyName, slot);
186 bool JSSVGColor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
188 JSSVGColor* thisObject = jsCast<JSSVGColor*>(object);
189 ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
190 return getStaticValueDescriptor<JSSVGColor, Base>(exec, &JSSVGColorTable, thisObject, propertyName, descriptor);
193 JSValue jsSVGColorColorType(ExecState* exec, JSValue slotBase, const Identifier&)
195 JSSVGColor* castedThis = static_cast<JSSVGColor*>(asObject(slotBase));
197 SVGColor* imp = static_cast<SVGColor*>(castedThis->impl());
198 JSValue result = jsNumber(imp->colorType());
203 JSValue jsSVGColorRgbColor(ExecState* exec, JSValue slotBase, const Identifier&)
205 JSSVGColor* castedThis = static_cast<JSSVGColor*>(asObject(slotBase));
207 SVGColor* imp = static_cast<SVGColor*>(castedThis->impl());
208 JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->rgbColor()));
213 JSValue jsSVGColorConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
215 JSSVGColor* domObject = static_cast<JSSVGColor*>(asObject(slotBase));
216 return JSSVGColor::getConstructor(exec, domObject->globalObject());
219 JSValue JSSVGColor::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
221 return getDOMConstructor<JSSVGColorConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));
224 EncodedJSValue JSC_HOST_CALL jsSVGColorPrototypeFunctionSetRGBColor(ExecState* exec)
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());
243 EncodedJSValue JSC_HOST_CALL jsSVGColorPrototypeFunctionSetRGBColorICCColor(ExecState* exec)
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());
265 EncodedJSValue JSC_HOST_CALL jsSVGColorPrototypeFunctionSetColor(ExecState* exec)
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());
292 JSValue jsSVGColorSVG_COLORTYPE_UNKNOWN(ExecState* exec, JSValue, const Identifier&)
295 return jsNumber(static_cast<int>(0));
298 JSValue jsSVGColorSVG_COLORTYPE_RGBCOLOR(ExecState* exec, JSValue, const Identifier&)
301 return jsNumber(static_cast<int>(1));
304 JSValue jsSVGColorSVG_COLORTYPE_RGBCOLOR_ICCCOLOR(ExecState* exec, JSValue, const Identifier&)
307 return jsNumber(static_cast<int>(2));
310 JSValue jsSVGColorSVG_COLORTYPE_CURRENTCOLOR(ExecState* exec, JSValue, const Identifier&)
313 return jsNumber(static_cast<int>(3));
319 #endif // ENABLE(SVG)