|
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 "JSSVGDocument.h" |
|
26 |
|
27 #include "Event.h" |
|
28 #include "JSEvent.h" |
|
29 #include "JSSVGSVGElement.h" |
|
30 #include "SVGDocument.h" |
|
31 #include "SVGSVGElement.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(JSSVGDocument); |
|
40 |
|
41 /* Hash table */ |
|
42 #if ENABLE(JIT) |
|
43 #define THUNK_GENERATOR(generator) , generator |
|
44 #else |
|
45 #define THUNK_GENERATOR(generator) |
|
46 #endif |
|
47 |
|
48 static const HashTableValue JSSVGDocumentTableValues[3] = |
|
49 { |
|
50 { "rootElement", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGDocumentRootElement), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
51 { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGDocumentConstructor), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
52 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
53 }; |
|
54 |
|
55 #undef THUNK_GENERATOR |
|
56 static JSC_CONST_HASHTABLE HashTable JSSVGDocumentTable = { 4, 3, JSSVGDocumentTableValues, 0 }; |
|
57 /* Hash table for constructor */ |
|
58 #if ENABLE(JIT) |
|
59 #define THUNK_GENERATOR(generator) , generator |
|
60 #else |
|
61 #define THUNK_GENERATOR(generator) |
|
62 #endif |
|
63 |
|
64 static const HashTableValue JSSVGDocumentConstructorTableValues[1] = |
|
65 { |
|
66 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
67 }; |
|
68 |
|
69 #undef THUNK_GENERATOR |
|
70 static JSC_CONST_HASHTABLE HashTable JSSVGDocumentConstructorTable = { 1, 0, JSSVGDocumentConstructorTableValues, 0 }; |
|
71 class JSSVGDocumentConstructor : public DOMConstructorObject { |
|
72 public: |
|
73 JSSVGDocumentConstructor(JSC::ExecState*, JSDOMGlobalObject*); |
|
74 |
|
75 virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&); |
|
76 virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&); |
|
77 virtual const JSC::ClassInfo* classInfo() const { return &s_info; } |
|
78 static const JSC::ClassInfo s_info; |
|
79 static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype) |
|
80 { |
|
81 return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount); |
|
82 } |
|
83 protected: |
|
84 static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::ImplementsHasInstance | DOMConstructorObject::StructureFlags; |
|
85 }; |
|
86 |
|
87 const ClassInfo JSSVGDocumentConstructor::s_info = { "SVGDocumentConstructor", 0, &JSSVGDocumentConstructorTable, 0 }; |
|
88 |
|
89 JSSVGDocumentConstructor::JSSVGDocumentConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) |
|
90 : DOMConstructorObject(JSSVGDocumentConstructor::createStructure(globalObject->objectPrototype()), globalObject) |
|
91 { |
|
92 putDirect(exec->propertyNames().prototype, JSSVGDocumentPrototype::self(exec, globalObject), DontDelete | ReadOnly); |
|
93 } |
|
94 |
|
95 bool JSSVGDocumentConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
96 { |
|
97 return getStaticValueSlot<JSSVGDocumentConstructor, DOMObject>(exec, &JSSVGDocumentConstructorTable, this, propertyName, slot); |
|
98 } |
|
99 |
|
100 bool JSSVGDocumentConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
101 { |
|
102 return getStaticValueDescriptor<JSSVGDocumentConstructor, DOMObject>(exec, &JSSVGDocumentConstructorTable, this, propertyName, descriptor); |
|
103 } |
|
104 |
|
105 /* Hash table for prototype */ |
|
106 #if ENABLE(JIT) |
|
107 #define THUNK_GENERATOR(generator) , generator |
|
108 #else |
|
109 #define THUNK_GENERATOR(generator) |
|
110 #endif |
|
111 |
|
112 static const HashTableValue JSSVGDocumentPrototypeTableValues[2] = |
|
113 { |
|
114 { "createEvent", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsSVGDocumentPrototypeFunctionCreateEvent), (intptr_t)1 THUNK_GENERATOR(0) }, |
|
115 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
116 }; |
|
117 |
|
118 #undef THUNK_GENERATOR |
|
119 static JSC_CONST_HASHTABLE HashTable JSSVGDocumentPrototypeTable = { 2, 1, JSSVGDocumentPrototypeTableValues, 0 }; |
|
120 const ClassInfo JSSVGDocumentPrototype::s_info = { "SVGDocumentPrototype", 0, &JSSVGDocumentPrototypeTable, 0 }; |
|
121 |
|
122 JSObject* JSSVGDocumentPrototype::self(ExecState* exec, JSGlobalObject* globalObject) |
|
123 { |
|
124 return getDOMPrototype<JSSVGDocument>(exec, globalObject); |
|
125 } |
|
126 |
|
127 bool JSSVGDocumentPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
128 { |
|
129 return getStaticFunctionSlot<JSObject>(exec, &JSSVGDocumentPrototypeTable, this, propertyName, slot); |
|
130 } |
|
131 |
|
132 bool JSSVGDocumentPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
133 { |
|
134 return getStaticFunctionDescriptor<JSObject>(exec, &JSSVGDocumentPrototypeTable, this, propertyName, descriptor); |
|
135 } |
|
136 |
|
137 const ClassInfo JSSVGDocument::s_info = { "SVGDocument", &JSDocument::s_info, &JSSVGDocumentTable, 0 }; |
|
138 |
|
139 JSSVGDocument::JSSVGDocument(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<SVGDocument> impl) |
|
140 : JSDocument(structure, globalObject, impl) |
|
141 { |
|
142 } |
|
143 |
|
144 JSObject* JSSVGDocument::createPrototype(ExecState* exec, JSGlobalObject* globalObject) |
|
145 { |
|
146 return new (exec) JSSVGDocumentPrototype(globalObject, JSSVGDocumentPrototype::createStructure(JSDocumentPrototype::self(exec, globalObject))); |
|
147 } |
|
148 |
|
149 bool JSSVGDocument::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
150 { |
|
151 return getStaticValueSlot<JSSVGDocument, Base>(exec, &JSSVGDocumentTable, this, propertyName, slot); |
|
152 } |
|
153 |
|
154 bool JSSVGDocument::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
155 { |
|
156 return getStaticValueDescriptor<JSSVGDocument, Base>(exec, &JSSVGDocumentTable, this, propertyName, descriptor); |
|
157 } |
|
158 |
|
159 JSValue jsSVGDocumentRootElement(ExecState* exec, JSValue slotBase, const Identifier&) |
|
160 { |
|
161 JSSVGDocument* castedThis = static_cast<JSSVGDocument*>(asObject(slotBase)); |
|
162 UNUSED_PARAM(exec); |
|
163 SVGDocument* imp = static_cast<SVGDocument*>(castedThis->impl()); |
|
164 JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->rootElement())); |
|
165 return result; |
|
166 } |
|
167 |
|
168 JSValue jsSVGDocumentConstructor(ExecState* exec, JSValue slotBase, const Identifier&) |
|
169 { |
|
170 JSSVGDocument* domObject = static_cast<JSSVGDocument*>(asObject(slotBase)); |
|
171 return JSSVGDocument::getConstructor(exec, domObject->globalObject()); |
|
172 } |
|
173 JSValue JSSVGDocument::getConstructor(ExecState* exec, JSGlobalObject* globalObject) |
|
174 { |
|
175 return getDOMConstructor<JSSVGDocumentConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject)); |
|
176 } |
|
177 |
|
178 EncodedJSValue JSC_HOST_CALL jsSVGDocumentPrototypeFunctionCreateEvent(ExecState* exec) |
|
179 { |
|
180 JSValue thisValue = exec->hostThisValue(); |
|
181 if (!thisValue.inherits(&JSSVGDocument::s_info)) |
|
182 return throwVMTypeError(exec); |
|
183 JSSVGDocument* castedThis = static_cast<JSSVGDocument*>(asObject(thisValue)); |
|
184 SVGDocument* imp = static_cast<SVGDocument*>(castedThis->impl()); |
|
185 ExceptionCode ec = 0; |
|
186 const String& eventType = ustringToString(exec->argument(0).toString(exec)); |
|
187 |
|
188 |
|
189 JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->createEvent(eventType, ec))); |
|
190 setDOMException(exec, ec); |
|
191 return JSValue::encode(result); |
|
192 } |
|
193 |
|
194 |
|
195 } |
|
196 |
|
197 #endif // ENABLE(SVG) |