tizen beta release
[profile/ivi/webkit-efl.git] / DerivedSources / WebCore / JSSVGLength.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 "JSSVGLength.h"
26
27 #include "ExceptionCode.h"
28 #include "JSDOMBinding.h"
29 #include "KURL.h"
30 #include "SVGLength.h"
31 #include <runtime/Error.h>
32 #include <runtime/JSString.h>
33 #include <wtf/GetPtr.h>
34
35 using namespace JSC;
36
37 namespace WebCore {
38
39 ASSERT_CLASS_FITS_IN_CELL(JSSVGLength);
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 JSSVGLengthTableValues[] =
54 {
55     { "unitType", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGLengthUnitType), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
56     { "value", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGLengthValue), (intptr_t)setJSSVGLengthValue THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
57     { "valueInSpecifiedUnits", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGLengthValueInSpecifiedUnits), (intptr_t)setJSSVGLengthValueInSpecifiedUnits THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
58     { "valueAsString", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGLengthValueAsString), (intptr_t)setJSSVGLengthValueAsString THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
59     { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGLengthConstructor), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
60     { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
61 };
62
63 #undef THUNK_GENERATOR
64 static const HashTable JSSVGLengthTable = { 17, 15, JSSVGLengthTableValues, 0 };
65 /* Hash table for constructor */
66 #if ENABLE(JIT)
67 #define THUNK_GENERATOR(generator) , generator
68 #else
69 #define THUNK_GENERATOR(generator)
70 #endif
71 #if ENABLE(DFG_JIT)
72 #define INTRINSIC(intrinsic) , intrinsic
73 #else
74 #define INTRINSIC(intrinsic)
75 #endif
76
77 static const HashTableValue JSSVGLengthConstructorTableValues[] =
78 {
79     { "SVG_LENGTHTYPE_UNKNOWN", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGLengthSVG_LENGTHTYPE_UNKNOWN), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
80     { "SVG_LENGTHTYPE_NUMBER", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGLengthSVG_LENGTHTYPE_NUMBER), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
81     { "SVG_LENGTHTYPE_PERCENTAGE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGLengthSVG_LENGTHTYPE_PERCENTAGE), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
82     { "SVG_LENGTHTYPE_EMS", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGLengthSVG_LENGTHTYPE_EMS), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
83     { "SVG_LENGTHTYPE_EXS", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGLengthSVG_LENGTHTYPE_EXS), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
84     { "SVG_LENGTHTYPE_PX", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGLengthSVG_LENGTHTYPE_PX), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
85     { "SVG_LENGTHTYPE_CM", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGLengthSVG_LENGTHTYPE_CM), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
86     { "SVG_LENGTHTYPE_MM", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGLengthSVG_LENGTHTYPE_MM), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
87     { "SVG_LENGTHTYPE_IN", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGLengthSVG_LENGTHTYPE_IN), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
88     { "SVG_LENGTHTYPE_PT", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGLengthSVG_LENGTHTYPE_PT), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
89     { "SVG_LENGTHTYPE_PC", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGLengthSVG_LENGTHTYPE_PC), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
90     { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
91 };
92
93 #undef THUNK_GENERATOR
94 static const HashTable JSSVGLengthConstructorTable = { 33, 31, JSSVGLengthConstructorTableValues, 0 };
95
96 COMPILE_ASSERT(0 == SVGLength::SVG_LENGTHTYPE_UNKNOWN, SVGLengthEnumSVG_LENGTHTYPE_UNKNOWNIsWrongUseDontCheckEnums);
97 COMPILE_ASSERT(1 == SVGLength::SVG_LENGTHTYPE_NUMBER, SVGLengthEnumSVG_LENGTHTYPE_NUMBERIsWrongUseDontCheckEnums);
98 COMPILE_ASSERT(2 == SVGLength::SVG_LENGTHTYPE_PERCENTAGE, SVGLengthEnumSVG_LENGTHTYPE_PERCENTAGEIsWrongUseDontCheckEnums);
99 COMPILE_ASSERT(3 == SVGLength::SVG_LENGTHTYPE_EMS, SVGLengthEnumSVG_LENGTHTYPE_EMSIsWrongUseDontCheckEnums);
100 COMPILE_ASSERT(4 == SVGLength::SVG_LENGTHTYPE_EXS, SVGLengthEnumSVG_LENGTHTYPE_EXSIsWrongUseDontCheckEnums);
101 COMPILE_ASSERT(5 == SVGLength::SVG_LENGTHTYPE_PX, SVGLengthEnumSVG_LENGTHTYPE_PXIsWrongUseDontCheckEnums);
102 COMPILE_ASSERT(6 == SVGLength::SVG_LENGTHTYPE_CM, SVGLengthEnumSVG_LENGTHTYPE_CMIsWrongUseDontCheckEnums);
103 COMPILE_ASSERT(7 == SVGLength::SVG_LENGTHTYPE_MM, SVGLengthEnumSVG_LENGTHTYPE_MMIsWrongUseDontCheckEnums);
104 COMPILE_ASSERT(8 == SVGLength::SVG_LENGTHTYPE_IN, SVGLengthEnumSVG_LENGTHTYPE_INIsWrongUseDontCheckEnums);
105 COMPILE_ASSERT(9 == SVGLength::SVG_LENGTHTYPE_PT, SVGLengthEnumSVG_LENGTHTYPE_PTIsWrongUseDontCheckEnums);
106 COMPILE_ASSERT(10 == SVGLength::SVG_LENGTHTYPE_PC, SVGLengthEnumSVG_LENGTHTYPE_PCIsWrongUseDontCheckEnums);
107
108 const ClassInfo JSSVGLengthConstructor::s_info = { "SVGLengthConstructor", &DOMConstructorObject::s_info, &JSSVGLengthConstructorTable, 0, CREATE_METHOD_TABLE(JSSVGLengthConstructor) };
109
110 JSSVGLengthConstructor::JSSVGLengthConstructor(Structure* structure, JSDOMGlobalObject* globalObject)
111     : DOMConstructorObject(structure, globalObject)
112 {
113 }
114
115 void JSSVGLengthConstructor::finishCreation(ExecState* exec, JSDOMGlobalObject* globalObject)
116 {
117     Base::finishCreation(exec->globalData());
118     ASSERT(inherits(&s_info));
119     putDirect(exec->globalData(), exec->propertyNames().prototype, JSSVGLengthPrototype::self(exec, globalObject), DontDelete | ReadOnly);
120 }
121
122 bool JSSVGLengthConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
123 {
124     return getStaticValueSlot<JSSVGLengthConstructor, JSDOMWrapper>(exec, &JSSVGLengthConstructorTable, static_cast<JSSVGLengthConstructor*>(cell), propertyName, slot);
125 }
126
127 bool JSSVGLengthConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
128 {
129     return getStaticValueDescriptor<JSSVGLengthConstructor, JSDOMWrapper>(exec, &JSSVGLengthConstructorTable, static_cast<JSSVGLengthConstructor*>(object), propertyName, descriptor);
130 }
131
132 /* Hash table for prototype */
133 #if ENABLE(JIT)
134 #define THUNK_GENERATOR(generator) , generator
135 #else
136 #define THUNK_GENERATOR(generator)
137 #endif
138 #if ENABLE(DFG_JIT)
139 #define INTRINSIC(intrinsic) , intrinsic
140 #else
141 #define INTRINSIC(intrinsic)
142 #endif
143
144 static const HashTableValue JSSVGLengthPrototypeTableValues[] =
145 {
146     { "SVG_LENGTHTYPE_UNKNOWN", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGLengthSVG_LENGTHTYPE_UNKNOWN), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
147     { "SVG_LENGTHTYPE_NUMBER", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGLengthSVG_LENGTHTYPE_NUMBER), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
148     { "SVG_LENGTHTYPE_PERCENTAGE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGLengthSVG_LENGTHTYPE_PERCENTAGE), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
149     { "SVG_LENGTHTYPE_EMS", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGLengthSVG_LENGTHTYPE_EMS), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
150     { "SVG_LENGTHTYPE_EXS", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGLengthSVG_LENGTHTYPE_EXS), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
151     { "SVG_LENGTHTYPE_PX", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGLengthSVG_LENGTHTYPE_PX), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
152     { "SVG_LENGTHTYPE_CM", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGLengthSVG_LENGTHTYPE_CM), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
153     { "SVG_LENGTHTYPE_MM", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGLengthSVG_LENGTHTYPE_MM), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
154     { "SVG_LENGTHTYPE_IN", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGLengthSVG_LENGTHTYPE_IN), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
155     { "SVG_LENGTHTYPE_PT", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGLengthSVG_LENGTHTYPE_PT), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
156     { "SVG_LENGTHTYPE_PC", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGLengthSVG_LENGTHTYPE_PC), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
157     { "newValueSpecifiedUnits", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsSVGLengthPrototypeFunctionNewValueSpecifiedUnits), (intptr_t)2 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
158     { "convertToSpecifiedUnits", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsSVGLengthPrototypeFunctionConvertToSpecifiedUnits), (intptr_t)1 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
159     { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
160 };
161
162 #undef THUNK_GENERATOR
163 static const HashTable JSSVGLengthPrototypeTable = { 33, 31, JSSVGLengthPrototypeTableValues, 0 };
164 const ClassInfo JSSVGLengthPrototype::s_info = { "SVGLengthPrototype", &JSC::JSNonFinalObject::s_info, &JSSVGLengthPrototypeTable, 0, CREATE_METHOD_TABLE(JSSVGLengthPrototype) };
165
166 JSObject* JSSVGLengthPrototype::self(ExecState* exec, JSGlobalObject* globalObject)
167 {
168     return getDOMPrototype<JSSVGLength>(exec, globalObject);
169 }
170
171 bool JSSVGLengthPrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
172 {
173     JSSVGLengthPrototype* thisObject = jsCast<JSSVGLengthPrototype*>(cell);
174     return getStaticPropertySlot<JSSVGLengthPrototype, JSObject>(exec, &JSSVGLengthPrototypeTable, thisObject, propertyName, slot);
175 }
176
177 bool JSSVGLengthPrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
178 {
179     JSSVGLengthPrototype* thisObject = jsCast<JSSVGLengthPrototype*>(object);
180     return getStaticPropertyDescriptor<JSSVGLengthPrototype, JSObject>(exec, &JSSVGLengthPrototypeTable, thisObject, propertyName, descriptor);
181 }
182
183 const ClassInfo JSSVGLength::s_info = { "SVGLength", &JSDOMWrapper::s_info, &JSSVGLengthTable, 0 , CREATE_METHOD_TABLE(JSSVGLength) };
184
185 JSSVGLength::JSSVGLength(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<SVGPropertyTearOff<SVGLength> > impl)
186     : JSDOMWrapper(structure, globalObject)
187     , m_impl(impl.leakRef())
188 {
189 }
190
191 void JSSVGLength::finishCreation(JSGlobalData& globalData)
192 {
193     Base::finishCreation(globalData);
194     ASSERT(inherits(&s_info));
195 }
196
197 JSObject* JSSVGLength::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
198 {
199     return JSSVGLengthPrototype::create(exec->globalData(), globalObject, JSSVGLengthPrototype::createStructure(globalObject->globalData(), globalObject, globalObject->objectPrototype()));
200 }
201
202 bool JSSVGLength::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
203 {
204     JSSVGLength* thisObject = jsCast<JSSVGLength*>(cell);
205     ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
206     return getStaticValueSlot<JSSVGLength, Base>(exec, &JSSVGLengthTable, thisObject, propertyName, slot);
207 }
208
209 bool JSSVGLength::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
210 {
211     JSSVGLength* thisObject = jsCast<JSSVGLength*>(object);
212     ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
213     return getStaticValueDescriptor<JSSVGLength, Base>(exec, &JSSVGLengthTable, thisObject, propertyName, descriptor);
214 }
215
216 JSValue jsSVGLengthUnitType(ExecState* exec, JSValue slotBase, const Identifier&)
217 {
218     JSSVGLength* castedThis = static_cast<JSSVGLength*>(asObject(slotBase));
219     UNUSED_PARAM(exec);
220     SVGLength& imp = castedThis->impl()->propertyReference();
221     JSValue result =  jsNumber(imp.unitType());
222     return result;
223 }
224
225
226 JSValue jsSVGLengthValue(ExecState* exec, JSValue slotBase, const Identifier&)
227 {
228     JSSVGLength* castedThis = static_cast<JSSVGLength*>(asObject(slotBase));
229     return castedThis->value(exec);
230 }
231
232
233 JSValue jsSVGLengthValueInSpecifiedUnits(ExecState* exec, JSValue slotBase, const Identifier&)
234 {
235     JSSVGLength* castedThis = static_cast<JSSVGLength*>(asObject(slotBase));
236     UNUSED_PARAM(exec);
237     SVGLength& imp = castedThis->impl()->propertyReference();
238     JSValue result =  jsNumber(imp.valueInSpecifiedUnits());
239     return result;
240 }
241
242
243 JSValue jsSVGLengthValueAsString(ExecState* exec, JSValue slotBase, const Identifier&)
244 {
245     JSSVGLength* castedThis = static_cast<JSSVGLength*>(asObject(slotBase));
246     UNUSED_PARAM(exec);
247     SVGLength& imp = castedThis->impl()->propertyReference();
248     JSValue result =  jsString(exec, imp.valueAsString());
249     return result;
250 }
251
252
253 JSValue jsSVGLengthConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
254 {
255     JSSVGLength* domObject = static_cast<JSSVGLength*>(asObject(slotBase));
256     return JSSVGLength::getConstructor(exec, domObject->globalObject());
257 }
258
259 void JSSVGLength::put(JSCell* cell, ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
260 {
261     JSSVGLength* thisObject = jsCast<JSSVGLength*>(cell);
262     ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
263     lookupPut<JSSVGLength, Base>(exec, propertyName, value, &JSSVGLengthTable, thisObject, slot);
264 }
265
266 void setJSSVGLengthValue(ExecState* exec, JSObject* thisObject, JSValue value)
267 {
268     static_cast<JSSVGLength*>(thisObject)->setValue(exec, value);
269 }
270
271
272 void setJSSVGLengthValueInSpecifiedUnits(ExecState* exec, JSObject* thisObject, JSValue value)
273 {
274     JSSVGLength* castedThis = static_cast<JSSVGLength*>(thisObject);
275     SVGPropertyTearOff<SVGLength> * imp = static_cast<SVGPropertyTearOff<SVGLength> *>(castedThis->impl());
276     if (imp->role() == AnimValRole) {
277         setDOMException(exec, NO_MODIFICATION_ALLOWED_ERR);
278         return;
279     }
280     SVGLength& podImp = imp->propertyReference();
281     podImp.setValueInSpecifiedUnits(value.toFloat(exec));
282     imp->commitChange();
283 }
284
285
286 void setJSSVGLengthValueAsString(ExecState* exec, JSObject* thisObject, JSValue value)
287 {
288     JSSVGLength* castedThis = static_cast<JSSVGLength*>(thisObject);
289     SVGPropertyTearOff<SVGLength> * imp = static_cast<SVGPropertyTearOff<SVGLength> *>(castedThis->impl());
290     ExceptionCode ec = 0;
291     if (imp->role() == AnimValRole) {
292         setDOMException(exec, NO_MODIFICATION_ALLOWED_ERR);
293         return;
294     }
295     SVGLength& podImp = imp->propertyReference();
296     podImp.setValueAsString(valueToStringWithNullCheck(exec, value), ec);
297     setDOMException(exec, ec);
298     if (!ec)
299         imp->commitChange();
300 }
301
302
303 JSValue JSSVGLength::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
304 {
305     return getDOMConstructor<JSSVGLengthConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));
306 }
307
308 EncodedJSValue JSC_HOST_CALL jsSVGLengthPrototypeFunctionNewValueSpecifiedUnits(ExecState* exec)
309 {
310     JSValue thisValue = exec->hostThisValue();
311     if (!thisValue.inherits(&JSSVGLength::s_info))
312         return throwVMTypeError(exec);
313     JSSVGLength* castedThis = static_cast<JSSVGLength*>(asObject(thisValue));
314     ASSERT_GC_OBJECT_INHERITS(castedThis, &JSSVGLength::s_info);
315     SVGPropertyTearOff<SVGLength> * imp = static_cast<SVGPropertyTearOff<SVGLength> *>(castedThis->impl());
316     if (imp->role() == AnimValRole) {
317         setDOMException(exec, NO_MODIFICATION_ALLOWED_ERR);
318         return JSValue::encode(jsUndefined());
319     }
320     SVGLength& podImp = imp->propertyReference();
321     if (exec->argumentCount() < 2)
322         return throwVMError(exec, createTypeError(exec, "Not enough arguments"));
323     ExceptionCode ec = 0;
324     unsigned short unitType(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).toUInt32(exec));
325     if (exec->hadException())
326         return JSValue::encode(jsUndefined());
327     float valueInSpecifiedUnits(MAYBE_MISSING_PARAMETER(exec, 1, MissingIsUndefined).toFloat(exec));
328     if (exec->hadException())
329         return JSValue::encode(jsUndefined());
330     podImp.newValueSpecifiedUnits(unitType, valueInSpecifiedUnits, ec);
331     setDOMException(exec, ec);
332     if (!ec)
333         imp->commitChange();
334     return JSValue::encode(jsUndefined());
335 }
336
337 EncodedJSValue JSC_HOST_CALL jsSVGLengthPrototypeFunctionConvertToSpecifiedUnits(ExecState* exec)
338 {
339     JSValue thisValue = exec->hostThisValue();
340     if (!thisValue.inherits(&JSSVGLength::s_info))
341         return throwVMTypeError(exec);
342     JSSVGLength* castedThis = static_cast<JSSVGLength*>(asObject(thisValue));
343     ASSERT_GC_OBJECT_INHERITS(castedThis, &JSSVGLength::s_info);
344     return JSValue::encode(castedThis->convertToSpecifiedUnits(exec));
345 }
346
347 // Constant getters
348
349 JSValue jsSVGLengthSVG_LENGTHTYPE_UNKNOWN(ExecState* exec, JSValue, const Identifier&)
350 {
351     UNUSED_PARAM(exec);
352     return jsNumber(static_cast<int>(0));
353 }
354
355 JSValue jsSVGLengthSVG_LENGTHTYPE_NUMBER(ExecState* exec, JSValue, const Identifier&)
356 {
357     UNUSED_PARAM(exec);
358     return jsNumber(static_cast<int>(1));
359 }
360
361 JSValue jsSVGLengthSVG_LENGTHTYPE_PERCENTAGE(ExecState* exec, JSValue, const Identifier&)
362 {
363     UNUSED_PARAM(exec);
364     return jsNumber(static_cast<int>(2));
365 }
366
367 JSValue jsSVGLengthSVG_LENGTHTYPE_EMS(ExecState* exec, JSValue, const Identifier&)
368 {
369     UNUSED_PARAM(exec);
370     return jsNumber(static_cast<int>(3));
371 }
372
373 JSValue jsSVGLengthSVG_LENGTHTYPE_EXS(ExecState* exec, JSValue, const Identifier&)
374 {
375     UNUSED_PARAM(exec);
376     return jsNumber(static_cast<int>(4));
377 }
378
379 JSValue jsSVGLengthSVG_LENGTHTYPE_PX(ExecState* exec, JSValue, const Identifier&)
380 {
381     UNUSED_PARAM(exec);
382     return jsNumber(static_cast<int>(5));
383 }
384
385 JSValue jsSVGLengthSVG_LENGTHTYPE_CM(ExecState* exec, JSValue, const Identifier&)
386 {
387     UNUSED_PARAM(exec);
388     return jsNumber(static_cast<int>(6));
389 }
390
391 JSValue jsSVGLengthSVG_LENGTHTYPE_MM(ExecState* exec, JSValue, const Identifier&)
392 {
393     UNUSED_PARAM(exec);
394     return jsNumber(static_cast<int>(7));
395 }
396
397 JSValue jsSVGLengthSVG_LENGTHTYPE_IN(ExecState* exec, JSValue, const Identifier&)
398 {
399     UNUSED_PARAM(exec);
400     return jsNumber(static_cast<int>(8));
401 }
402
403 JSValue jsSVGLengthSVG_LENGTHTYPE_PT(ExecState* exec, JSValue, const Identifier&)
404 {
405     UNUSED_PARAM(exec);
406     return jsNumber(static_cast<int>(9));
407 }
408
409 JSValue jsSVGLengthSVG_LENGTHTYPE_PC(ExecState* exec, JSValue, const Identifier&)
410 {
411     UNUSED_PARAM(exec);
412     return jsNumber(static_cast<int>(10));
413 }
414
415 static inline bool isObservable(JSSVGLength* jsSVGLength)
416 {
417     if (jsSVGLength->hasCustomProperties())
418         return true;
419     return false;
420 }
421
422 bool JSSVGLengthOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
423 {
424     JSSVGLength* jsSVGLength = static_cast<JSSVGLength*>(handle.get().asCell());
425     if (!isObservable(jsSVGLength))
426         return false;
427     UNUSED_PARAM(visitor);
428     return false;
429 }
430
431 void JSSVGLengthOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
432 {
433     JSSVGLength* jsSVGLength = static_cast<JSSVGLength*>(handle.get().asCell());
434     DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context);
435     uncacheWrapper(world, jsSVGLength->impl(), jsSVGLength);
436     jsSVGLength->releaseImpl();
437 }
438
439 JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, SVGPropertyTearOff<SVGLength> * impl)
440 {
441     return wrap<JSSVGLength, SVGPropertyTearOff<SVGLength> >(exec, globalObject, impl);
442 }
443
444 SVGPropertyTearOff<SVGLength> * toSVGLength(JSC::JSValue value)
445 {
446     return value.inherits(&JSSVGLength::s_info) ? static_cast<JSSVGLength*>(asObject(value))->impl() : 0;
447 }
448
449 }
450
451 #endif // ENABLE(SVG)