|
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 |
|
24 #if ENABLE(SVG) |
|
25 |
|
26 #include "Document.h" |
|
27 #include "Frame.h" |
|
28 #include "SVGDocumentExtensions.h" |
|
29 #include "SVGElement.h" |
|
30 #include "SVGAnimatedTemplate.h" |
|
31 #include "JSSVGLengthList.h" |
|
32 |
|
33 #include <wtf/GetPtr.h> |
|
34 |
|
35 #include "ExceptionCode.h" |
|
36 #include "JSSVGLength.h" |
|
37 #include "SVGLength.h" |
|
38 #include "SVGLengthList.h" |
|
39 |
|
40 using namespace KJS; |
|
41 |
|
42 namespace WebCore { |
|
43 |
|
44 /* Hash table */ |
|
45 |
|
46 static const HashEntry JSSVGLengthListTableEntries[] = |
|
47 { |
|
48 { "numberOfItems", JSSVGLengthList::NumberOfItemsAttrNum, DontDelete|ReadOnly, 0, 0 } |
|
49 }; |
|
50 |
|
51 static const HashTable JSSVGLengthListTable = |
|
52 { |
|
53 2, 1, JSSVGLengthListTableEntries, 1 |
|
54 }; |
|
55 |
|
56 /* Hash table for prototype */ |
|
57 |
|
58 static const HashEntry JSSVGLengthListPrototypeTableEntries[] = |
|
59 { |
|
60 { 0, 0, 0, 0, 0 }, |
|
61 { "clear", JSSVGLengthList::ClearFuncNum, DontDelete|Function, 0, &JSSVGLengthListPrototypeTableEntries[9] }, |
|
62 { "getItem", JSSVGLengthList::GetItemFuncNum, DontDelete|Function, 1, &JSSVGLengthListPrototypeTableEntries[7] }, |
|
63 { "insertItemBefore", JSSVGLengthList::InsertItemBeforeFuncNum, DontDelete|Function, 2, &JSSVGLengthListPrototypeTableEntries[8] }, |
|
64 { 0, 0, 0, 0, 0 }, |
|
65 { 0, 0, 0, 0, 0 }, |
|
66 { "initialize", JSSVGLengthList::InitializeFuncNum, DontDelete|Function, 1, 0 }, |
|
67 { "replaceItem", JSSVGLengthList::ReplaceItemFuncNum, DontDelete|Function, 2, 0 }, |
|
68 { "removeItem", JSSVGLengthList::RemoveItemFuncNum, DontDelete|Function, 1, 0 }, |
|
69 { "appendItem", JSSVGLengthList::AppendItemFuncNum, DontDelete|Function, 1, 0 } |
|
70 }; |
|
71 |
|
72 static const HashTable JSSVGLengthListPrototypeTable = |
|
73 { |
|
74 2, 10, JSSVGLengthListPrototypeTableEntries, 7 |
|
75 }; |
|
76 |
|
77 const ClassInfo JSSVGLengthListPrototype::info = { "SVGLengthListPrototype", 0, &JSSVGLengthListPrototypeTable, 0 }; |
|
78 |
|
79 JSObject* JSSVGLengthListPrototype::self(ExecState* exec) |
|
80 { |
|
81 return KJS::cacheGlobalObject<JSSVGLengthListPrototype>(exec, "[[JSSVGLengthList.prototype]]"); |
|
82 } |
|
83 |
|
84 bool JSSVGLengthListPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
85 { |
|
86 return getStaticFunctionSlot<JSSVGLengthListPrototypeFunction, JSObject>(exec, &JSSVGLengthListPrototypeTable, this, propertyName, slot); |
|
87 } |
|
88 |
|
89 const ClassInfo JSSVGLengthList::info = { "SVGLengthList", 0, &JSSVGLengthListTable, 0 }; |
|
90 |
|
91 JSSVGLengthList::JSSVGLengthList(ExecState* exec, SVGLengthList* impl) |
|
92 : m_impl(impl) |
|
93 { |
|
94 setPrototype(JSSVGLengthListPrototype::self(exec)); |
|
95 } |
|
96 |
|
97 JSSVGLengthList::~JSSVGLengthList() |
|
98 { |
|
99 ScriptInterpreter::forgetDOMObject(m_impl.get()); |
|
100 } |
|
101 |
|
102 bool JSSVGLengthList::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
103 { |
|
104 return getStaticValueSlot<JSSVGLengthList, KJS::DOMObject>(exec, &JSSVGLengthListTable, this, propertyName, slot); |
|
105 } |
|
106 |
|
107 JSValue* JSSVGLengthList::getValueProperty(ExecState* exec, int token) const |
|
108 { |
|
109 switch (token) { |
|
110 case NumberOfItemsAttrNum: { |
|
111 SVGLengthList* imp = static_cast<SVGLengthList*>(impl()); |
|
112 |
|
113 return jsNumber(imp->numberOfItems()); |
|
114 } |
|
115 } |
|
116 return 0; |
|
117 } |
|
118 |
|
119 JSValue* JSSVGLengthListPrototypeFunction::callAsFunction(ExecState* exec, JSObject* thisObj, const List& args) |
|
120 { |
|
121 if (!thisObj->inherits(&JSSVGLengthList::info)) |
|
122 return throwError(exec, TypeError); |
|
123 |
|
124 SVGLengthList* imp = static_cast<SVGLengthList*>(static_cast<JSSVGLengthList*>(thisObj)->impl()); |
|
125 |
|
126 switch (id) { |
|
127 case JSSVGLengthList::ClearFuncNum: { |
|
128 ExceptionCode ec = 0; |
|
129 |
|
130 imp->clear(ec); |
|
131 setDOMException(exec, ec); |
|
132 return jsUndefined(); |
|
133 } |
|
134 case JSSVGLengthList::InitializeFuncNum: { |
|
135 ExceptionCode ec = 0; |
|
136 SVGLength item = toSVGLength(args[0]); |
|
137 |
|
138 |
|
139 KJS::JSValue* result = toJS(exec, new JSSVGPODTypeWrapper<SVGLength>(imp->initialize(item, ec))); |
|
140 setDOMException(exec, ec); |
|
141 return result; |
|
142 } |
|
143 case JSSVGLengthList::GetItemFuncNum: { |
|
144 ExceptionCode ec = 0; |
|
145 bool indexOk; |
|
146 unsigned index = args[0]->toInt32(exec, indexOk); |
|
147 if (!indexOk) { |
|
148 setDOMException(exec, TYPE_MISMATCH_ERR); |
|
149 return jsUndefined(); |
|
150 } |
|
151 |
|
152 |
|
153 KJS::JSValue* result = toJS(exec, new JSSVGPODTypeWrapper<SVGLength>(imp->getItem(index, ec))); |
|
154 setDOMException(exec, ec); |
|
155 return result; |
|
156 } |
|
157 case JSSVGLengthList::InsertItemBeforeFuncNum: { |
|
158 ExceptionCode ec = 0; |
|
159 SVGLength item = toSVGLength(args[0]); |
|
160 bool indexOk; |
|
161 unsigned index = args[1]->toInt32(exec, indexOk); |
|
162 if (!indexOk) { |
|
163 setDOMException(exec, TYPE_MISMATCH_ERR); |
|
164 return jsUndefined(); |
|
165 } |
|
166 |
|
167 |
|
168 KJS::JSValue* result = toJS(exec, new JSSVGPODTypeWrapper<SVGLength>(imp->insertItemBefore(item, index, ec))); |
|
169 setDOMException(exec, ec); |
|
170 return result; |
|
171 } |
|
172 case JSSVGLengthList::ReplaceItemFuncNum: { |
|
173 ExceptionCode ec = 0; |
|
174 SVGLength item = toSVGLength(args[0]); |
|
175 bool indexOk; |
|
176 unsigned index = args[1]->toInt32(exec, indexOk); |
|
177 if (!indexOk) { |
|
178 setDOMException(exec, TYPE_MISMATCH_ERR); |
|
179 return jsUndefined(); |
|
180 } |
|
181 |
|
182 |
|
183 KJS::JSValue* result = toJS(exec, new JSSVGPODTypeWrapper<SVGLength>(imp->replaceItem(item, index, ec))); |
|
184 setDOMException(exec, ec); |
|
185 return result; |
|
186 } |
|
187 case JSSVGLengthList::RemoveItemFuncNum: { |
|
188 ExceptionCode ec = 0; |
|
189 bool indexOk; |
|
190 unsigned index = args[0]->toInt32(exec, indexOk); |
|
191 if (!indexOk) { |
|
192 setDOMException(exec, TYPE_MISMATCH_ERR); |
|
193 return jsUndefined(); |
|
194 } |
|
195 |
|
196 |
|
197 KJS::JSValue* result = toJS(exec, new JSSVGPODTypeWrapper<SVGLength>(imp->removeItem(index, ec))); |
|
198 setDOMException(exec, ec); |
|
199 return result; |
|
200 } |
|
201 case JSSVGLengthList::AppendItemFuncNum: { |
|
202 ExceptionCode ec = 0; |
|
203 SVGLength item = toSVGLength(args[0]); |
|
204 |
|
205 |
|
206 KJS::JSValue* result = toJS(exec, new JSSVGPODTypeWrapper<SVGLength>(imp->appendItem(item, ec))); |
|
207 setDOMException(exec, ec); |
|
208 return result; |
|
209 } |
|
210 } |
|
211 return 0; |
|
212 } |
|
213 KJS::JSValue* toJS(KJS::ExecState* exec, SVGLengthList* obj) |
|
214 { |
|
215 return KJS::cacheDOMObject<SVGLengthList, JSSVGLengthList>(exec, obj); |
|
216 } |
|
217 SVGLengthList* toSVGLengthList(KJS::JSValue* val) |
|
218 { |
|
219 return val->isObject(&JSSVGLengthList::info) ? static_cast<JSSVGLengthList*>(val)->impl() : 0; |
|
220 } |
|
221 |
|
222 } |
|
223 |
|
224 #endif // ENABLE(SVG) |