|
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 #include "JSNode.h" |
|
23 |
|
24 #include "Document.h" |
|
25 #include "Element.h" |
|
26 #include "Event.h" |
|
27 #include "JSDocument.h" |
|
28 #include "JSElement.h" |
|
29 #include "JSEvent.h" |
|
30 #include "JSEventListener.h" |
|
31 #include "JSNamedNodeMap.h" |
|
32 #include "JSNode.h" |
|
33 #include "JSNodeList.h" |
|
34 #include "KURL.h" |
|
35 #include "NameNodeList.h" |
|
36 #include "NamedNodeMap.h" |
|
37 #include "Node.h" |
|
38 #include "NodeList.h" |
|
39 #include "RegisteredEventListener.h" |
|
40 #include <runtime/Error.h> |
|
41 #include <runtime/JSNumberCell.h> |
|
42 #include <wtf/GetPtr.h> |
|
43 |
|
44 using namespace JSC; |
|
45 |
|
46 namespace WebCore { |
|
47 |
|
48 ASSERT_CLASS_FITS_IN_CELL(JSNode); |
|
49 |
|
50 /* Hash table */ |
|
51 #if ENABLE(JIT) |
|
52 #define THUNK_GENERATOR(generator) , generator |
|
53 #else |
|
54 #define THUNK_GENERATOR(generator) |
|
55 #endif |
|
56 |
|
57 static const HashTableValue JSNodeTableValues[19] = |
|
58 { |
|
59 { "nodeName", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeNodeName), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
60 { "nodeValue", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeNodeValue), (intptr_t)setJSNodeNodeValue THUNK_GENERATOR(0) }, |
|
61 { "nodeType", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeNodeType), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
62 { "parentNode", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeParentNode), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
63 { "childNodes", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeChildNodes), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
64 { "firstChild", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeFirstChild), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
65 { "lastChild", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeLastChild), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
66 { "previousSibling", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodePreviousSibling), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
67 { "nextSibling", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeNextSibling), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
68 { "attributes", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeAttributes), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
69 { "ownerDocument", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeOwnerDocument), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
70 { "namespaceURI", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeNamespaceURI), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
71 { "prefix", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodePrefix), (intptr_t)setJSNodePrefix THUNK_GENERATOR(0) }, |
|
72 { "localName", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeLocalName), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
73 { "baseURI", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeBaseURI), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
74 { "textContent", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeTextContent), (intptr_t)setJSNodeTextContent THUNK_GENERATOR(0) }, |
|
75 { "parentElement", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeParentElement), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
76 { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeConstructor), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
77 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
78 }; |
|
79 |
|
80 #undef THUNK_GENERATOR |
|
81 static JSC_CONST_HASHTABLE HashTable JSNodeTable = { 68, 63, JSNodeTableValues, 0 }; |
|
82 /* Hash table for constructor */ |
|
83 #if ENABLE(JIT) |
|
84 #define THUNK_GENERATOR(generator) , generator |
|
85 #else |
|
86 #define THUNK_GENERATOR(generator) |
|
87 #endif |
|
88 |
|
89 static const HashTableValue JSNodeConstructorTableValues[19] = |
|
90 { |
|
91 { "ELEMENT_NODE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeELEMENT_NODE), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
92 { "ATTRIBUTE_NODE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeATTRIBUTE_NODE), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
93 { "TEXT_NODE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeTEXT_NODE), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
94 { "CDATA_SECTION_NODE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeCDATA_SECTION_NODE), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
95 { "ENTITY_REFERENCE_NODE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeENTITY_REFERENCE_NODE), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
96 { "ENTITY_NODE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeENTITY_NODE), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
97 { "PROCESSING_INSTRUCTION_NODE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodePROCESSING_INSTRUCTION_NODE), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
98 { "COMMENT_NODE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeCOMMENT_NODE), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
99 { "DOCUMENT_NODE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeDOCUMENT_NODE), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
100 { "DOCUMENT_TYPE_NODE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeDOCUMENT_TYPE_NODE), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
101 { "DOCUMENT_FRAGMENT_NODE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeDOCUMENT_FRAGMENT_NODE), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
102 { "NOTATION_NODE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeNOTATION_NODE), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
103 { "DOCUMENT_POSITION_DISCONNECTED", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeDOCUMENT_POSITION_DISCONNECTED), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
104 { "DOCUMENT_POSITION_PRECEDING", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeDOCUMENT_POSITION_PRECEDING), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
105 { "DOCUMENT_POSITION_FOLLOWING", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeDOCUMENT_POSITION_FOLLOWING), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
106 { "DOCUMENT_POSITION_CONTAINS", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeDOCUMENT_POSITION_CONTAINS), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
107 { "DOCUMENT_POSITION_CONTAINED_BY", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeDOCUMENT_POSITION_CONTAINED_BY), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
108 { "DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeDOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
109 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
110 }; |
|
111 |
|
112 #undef THUNK_GENERATOR |
|
113 static JSC_CONST_HASHTABLE HashTable JSNodeConstructorTable = { 67, 63, JSNodeConstructorTableValues, 0 }; |
|
114 class JSNodeConstructor : public DOMConstructorObject { |
|
115 public: |
|
116 JSNodeConstructor(JSC::ExecState*, JSDOMGlobalObject*); |
|
117 |
|
118 virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&); |
|
119 virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&); |
|
120 virtual const JSC::ClassInfo* classInfo() const { return &s_info; } |
|
121 static const JSC::ClassInfo s_info; |
|
122 static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype) |
|
123 { |
|
124 return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount); |
|
125 } |
|
126 protected: |
|
127 static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::ImplementsHasInstance | DOMConstructorObject::StructureFlags; |
|
128 }; |
|
129 |
|
130 const ClassInfo JSNodeConstructor::s_info = { "NodeConstructor", 0, &JSNodeConstructorTable, 0 }; |
|
131 |
|
132 JSNodeConstructor::JSNodeConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) |
|
133 : DOMConstructorObject(JSNodeConstructor::createStructure(globalObject->objectPrototype()), globalObject) |
|
134 { |
|
135 putDirect(exec->propertyNames().prototype, JSNodePrototype::self(exec, globalObject), DontDelete | ReadOnly); |
|
136 } |
|
137 |
|
138 bool JSNodeConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
139 { |
|
140 return getStaticValueSlot<JSNodeConstructor, DOMObject>(exec, &JSNodeConstructorTable, this, propertyName, slot); |
|
141 } |
|
142 |
|
143 bool JSNodeConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
144 { |
|
145 return getStaticValueDescriptor<JSNodeConstructor, DOMObject>(exec, &JSNodeConstructorTable, this, propertyName, descriptor); |
|
146 } |
|
147 |
|
148 /* Hash table for prototype */ |
|
149 #if ENABLE(JIT) |
|
150 #define THUNK_GENERATOR(generator) , generator |
|
151 #else |
|
152 #define THUNK_GENERATOR(generator) |
|
153 #endif |
|
154 |
|
155 static const HashTableValue JSNodePrototypeTableValues[37] = |
|
156 { |
|
157 { "ELEMENT_NODE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeELEMENT_NODE), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
158 { "ATTRIBUTE_NODE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeATTRIBUTE_NODE), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
159 { "TEXT_NODE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeTEXT_NODE), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
160 { "CDATA_SECTION_NODE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeCDATA_SECTION_NODE), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
161 { "ENTITY_REFERENCE_NODE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeENTITY_REFERENCE_NODE), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
162 { "ENTITY_NODE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeENTITY_NODE), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
163 { "PROCESSING_INSTRUCTION_NODE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodePROCESSING_INSTRUCTION_NODE), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
164 { "COMMENT_NODE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeCOMMENT_NODE), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
165 { "DOCUMENT_NODE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeDOCUMENT_NODE), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
166 { "DOCUMENT_TYPE_NODE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeDOCUMENT_TYPE_NODE), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
167 { "DOCUMENT_FRAGMENT_NODE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeDOCUMENT_FRAGMENT_NODE), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
168 { "NOTATION_NODE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeNOTATION_NODE), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
169 { "DOCUMENT_POSITION_DISCONNECTED", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeDOCUMENT_POSITION_DISCONNECTED), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
170 { "DOCUMENT_POSITION_PRECEDING", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeDOCUMENT_POSITION_PRECEDING), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
171 { "DOCUMENT_POSITION_FOLLOWING", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeDOCUMENT_POSITION_FOLLOWING), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
172 { "DOCUMENT_POSITION_CONTAINS", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeDOCUMENT_POSITION_CONTAINS), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
173 { "DOCUMENT_POSITION_CONTAINED_BY", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeDOCUMENT_POSITION_CONTAINED_BY), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
174 { "DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsNodeDOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
175 { "insertBefore", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsNodePrototypeFunctionInsertBefore), (intptr_t)2 THUNK_GENERATOR(0) }, |
|
176 { "replaceChild", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsNodePrototypeFunctionReplaceChild), (intptr_t)2 THUNK_GENERATOR(0) }, |
|
177 { "removeChild", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsNodePrototypeFunctionRemoveChild), (intptr_t)1 THUNK_GENERATOR(0) }, |
|
178 { "appendChild", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsNodePrototypeFunctionAppendChild), (intptr_t)1 THUNK_GENERATOR(0) }, |
|
179 { "hasChildNodes", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsNodePrototypeFunctionHasChildNodes), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
180 { "cloneNode", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsNodePrototypeFunctionCloneNode), (intptr_t)1 THUNK_GENERATOR(0) }, |
|
181 { "normalize", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsNodePrototypeFunctionNormalize), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
182 { "isSupported", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsNodePrototypeFunctionIsSupported), (intptr_t)2 THUNK_GENERATOR(0) }, |
|
183 { "hasAttributes", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsNodePrototypeFunctionHasAttributes), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
184 { "isSameNode", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsNodePrototypeFunctionIsSameNode), (intptr_t)1 THUNK_GENERATOR(0) }, |
|
185 { "isEqualNode", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsNodePrototypeFunctionIsEqualNode), (intptr_t)1 THUNK_GENERATOR(0) }, |
|
186 { "lookupPrefix", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsNodePrototypeFunctionLookupPrefix), (intptr_t)1 THUNK_GENERATOR(0) }, |
|
187 { "isDefaultNamespace", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsNodePrototypeFunctionIsDefaultNamespace), (intptr_t)1 THUNK_GENERATOR(0) }, |
|
188 { "lookupNamespaceURI", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsNodePrototypeFunctionLookupNamespaceURI), (intptr_t)1 THUNK_GENERATOR(0) }, |
|
189 { "compareDocumentPosition", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsNodePrototypeFunctionCompareDocumentPosition), (intptr_t)1 THUNK_GENERATOR(0) }, |
|
190 { "addEventListener", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsNodePrototypeFunctionAddEventListener), (intptr_t)3 THUNK_GENERATOR(0) }, |
|
191 { "removeEventListener", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsNodePrototypeFunctionRemoveEventListener), (intptr_t)3 THUNK_GENERATOR(0) }, |
|
192 { "dispatchEvent", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsNodePrototypeFunctionDispatchEvent), (intptr_t)1 THUNK_GENERATOR(0) }, |
|
193 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
194 }; |
|
195 |
|
196 #undef THUNK_GENERATOR |
|
197 static JSC_CONST_HASHTABLE HashTable JSNodePrototypeTable = { 134, 127, JSNodePrototypeTableValues, 0 }; |
|
198 const ClassInfo JSNodePrototype::s_info = { "NodePrototype", 0, &JSNodePrototypeTable, 0 }; |
|
199 |
|
200 JSObject* JSNodePrototype::self(ExecState* exec, JSGlobalObject* globalObject) |
|
201 { |
|
202 return getDOMPrototype<JSNode>(exec, globalObject); |
|
203 } |
|
204 |
|
205 bool JSNodePrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
206 { |
|
207 return getStaticPropertySlot<JSNodePrototype, JSObject>(exec, &JSNodePrototypeTable, this, propertyName, slot); |
|
208 } |
|
209 |
|
210 bool JSNodePrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
211 { |
|
212 return getStaticPropertyDescriptor<JSNodePrototype, JSObject>(exec, &JSNodePrototypeTable, this, propertyName, descriptor); |
|
213 } |
|
214 |
|
215 const ClassInfo JSNode::s_info = { "Node", 0, &JSNodeTable, 0 }; |
|
216 |
|
217 JSNode::JSNode(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<Node> impl) |
|
218 : DOMObjectWithGlobalPointer(structure, globalObject) |
|
219 , m_impl(impl) |
|
220 { |
|
221 } |
|
222 |
|
223 JSNode::~JSNode() |
|
224 { |
|
225 impl()->invalidateJSEventListeners(this); |
|
226 forgetDOMNode(this, impl(), impl()->document()); |
|
227 } |
|
228 |
|
229 JSObject* JSNode::createPrototype(ExecState* exec, JSGlobalObject* globalObject) |
|
230 { |
|
231 return new (exec) JSNodePrototype(globalObject, JSNodePrototype::createStructure(globalObject->objectPrototype())); |
|
232 } |
|
233 |
|
234 JSValue jsNodeNodeName(ExecState* exec, JSValue slotBase, const Identifier&) |
|
235 { |
|
236 JSNode* castedThis = static_cast<JSNode*>(asObject(slotBase)); |
|
237 UNUSED_PARAM(exec); |
|
238 Node* imp = static_cast<Node*>(castedThis->impl()); |
|
239 JSValue result = jsStringOrNull(exec, imp->nodeName()); |
|
240 return result; |
|
241 } |
|
242 |
|
243 JSValue jsNodeNodeValue(ExecState* exec, JSValue slotBase, const Identifier&) |
|
244 { |
|
245 JSNode* castedThis = static_cast<JSNode*>(asObject(slotBase)); |
|
246 UNUSED_PARAM(exec); |
|
247 Node* imp = static_cast<Node*>(castedThis->impl()); |
|
248 JSValue result = jsStringOrNull(exec, imp->nodeValue()); |
|
249 return result; |
|
250 } |
|
251 |
|
252 JSValue jsNodeNodeType(ExecState* exec, JSValue slotBase, const Identifier&) |
|
253 { |
|
254 JSNode* castedThis = static_cast<JSNode*>(asObject(slotBase)); |
|
255 UNUSED_PARAM(exec); |
|
256 Node* imp = static_cast<Node*>(castedThis->impl()); |
|
257 JSValue result = jsNumber(exec, imp->nodeType()); |
|
258 return result; |
|
259 } |
|
260 |
|
261 JSValue jsNodeParentNode(ExecState* exec, JSValue slotBase, const Identifier&) |
|
262 { |
|
263 JSNode* castedThis = static_cast<JSNode*>(asObject(slotBase)); |
|
264 UNUSED_PARAM(exec); |
|
265 Node* imp = static_cast<Node*>(castedThis->impl()); |
|
266 JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->parentNode())); |
|
267 return result; |
|
268 } |
|
269 |
|
270 JSValue jsNodeChildNodes(ExecState* exec, JSValue slotBase, const Identifier&) |
|
271 { |
|
272 JSNode* castedThis = static_cast<JSNode*>(asObject(slotBase)); |
|
273 UNUSED_PARAM(exec); |
|
274 Node* imp = static_cast<Node*>(castedThis->impl()); |
|
275 JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->childNodes())); |
|
276 return result; |
|
277 } |
|
278 |
|
279 JSValue jsNodeFirstChild(ExecState* exec, JSValue slotBase, const Identifier&) |
|
280 { |
|
281 JSNode* castedThis = static_cast<JSNode*>(asObject(slotBase)); |
|
282 UNUSED_PARAM(exec); |
|
283 Node* imp = static_cast<Node*>(castedThis->impl()); |
|
284 JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->firstChild())); |
|
285 return result; |
|
286 } |
|
287 |
|
288 JSValue jsNodeLastChild(ExecState* exec, JSValue slotBase, const Identifier&) |
|
289 { |
|
290 JSNode* castedThis = static_cast<JSNode*>(asObject(slotBase)); |
|
291 UNUSED_PARAM(exec); |
|
292 Node* imp = static_cast<Node*>(castedThis->impl()); |
|
293 JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->lastChild())); |
|
294 return result; |
|
295 } |
|
296 |
|
297 JSValue jsNodePreviousSibling(ExecState* exec, JSValue slotBase, const Identifier&) |
|
298 { |
|
299 JSNode* castedThis = static_cast<JSNode*>(asObject(slotBase)); |
|
300 UNUSED_PARAM(exec); |
|
301 Node* imp = static_cast<Node*>(castedThis->impl()); |
|
302 JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->previousSibling())); |
|
303 return result; |
|
304 } |
|
305 |
|
306 JSValue jsNodeNextSibling(ExecState* exec, JSValue slotBase, const Identifier&) |
|
307 { |
|
308 JSNode* castedThis = static_cast<JSNode*>(asObject(slotBase)); |
|
309 UNUSED_PARAM(exec); |
|
310 Node* imp = static_cast<Node*>(castedThis->impl()); |
|
311 JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->nextSibling())); |
|
312 return result; |
|
313 } |
|
314 |
|
315 JSValue jsNodeAttributes(ExecState* exec, JSValue slotBase, const Identifier&) |
|
316 { |
|
317 JSNode* castedThis = static_cast<JSNode*>(asObject(slotBase)); |
|
318 UNUSED_PARAM(exec); |
|
319 Node* imp = static_cast<Node*>(castedThis->impl()); |
|
320 JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->attributes())); |
|
321 return result; |
|
322 } |
|
323 |
|
324 JSValue jsNodeOwnerDocument(ExecState* exec, JSValue slotBase, const Identifier&) |
|
325 { |
|
326 JSNode* castedThis = static_cast<JSNode*>(asObject(slotBase)); |
|
327 UNUSED_PARAM(exec); |
|
328 Node* imp = static_cast<Node*>(castedThis->impl()); |
|
329 JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->ownerDocument())); |
|
330 return result; |
|
331 } |
|
332 |
|
333 JSValue jsNodeNamespaceURI(ExecState* exec, JSValue slotBase, const Identifier&) |
|
334 { |
|
335 JSNode* castedThis = static_cast<JSNode*>(asObject(slotBase)); |
|
336 UNUSED_PARAM(exec); |
|
337 Node* imp = static_cast<Node*>(castedThis->impl()); |
|
338 JSValue result = jsStringOrNull(exec, imp->namespaceURI()); |
|
339 return result; |
|
340 } |
|
341 |
|
342 JSValue jsNodePrefix(ExecState* exec, JSValue slotBase, const Identifier&) |
|
343 { |
|
344 JSNode* castedThis = static_cast<JSNode*>(asObject(slotBase)); |
|
345 UNUSED_PARAM(exec); |
|
346 Node* imp = static_cast<Node*>(castedThis->impl()); |
|
347 JSValue result = jsStringOrNull(exec, imp->prefix()); |
|
348 return result; |
|
349 } |
|
350 |
|
351 JSValue jsNodeLocalName(ExecState* exec, JSValue slotBase, const Identifier&) |
|
352 { |
|
353 JSNode* castedThis = static_cast<JSNode*>(asObject(slotBase)); |
|
354 UNUSED_PARAM(exec); |
|
355 Node* imp = static_cast<Node*>(castedThis->impl()); |
|
356 JSValue result = jsStringOrNull(exec, imp->localName()); |
|
357 return result; |
|
358 } |
|
359 |
|
360 JSValue jsNodeBaseURI(ExecState* exec, JSValue slotBase, const Identifier&) |
|
361 { |
|
362 JSNode* castedThis = static_cast<JSNode*>(asObject(slotBase)); |
|
363 UNUSED_PARAM(exec); |
|
364 Node* imp = static_cast<Node*>(castedThis->impl()); |
|
365 JSValue result = jsStringOrNull(exec, imp->baseURI()); |
|
366 return result; |
|
367 } |
|
368 |
|
369 JSValue jsNodeTextContent(ExecState* exec, JSValue slotBase, const Identifier&) |
|
370 { |
|
371 JSNode* castedThis = static_cast<JSNode*>(asObject(slotBase)); |
|
372 UNUSED_PARAM(exec); |
|
373 Node* imp = static_cast<Node*>(castedThis->impl()); |
|
374 JSValue result = jsStringOrNull(exec, imp->textContent()); |
|
375 return result; |
|
376 } |
|
377 |
|
378 JSValue jsNodeParentElement(ExecState* exec, JSValue slotBase, const Identifier&) |
|
379 { |
|
380 JSNode* castedThis = static_cast<JSNode*>(asObject(slotBase)); |
|
381 UNUSED_PARAM(exec); |
|
382 Node* imp = static_cast<Node*>(castedThis->impl()); |
|
383 JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->parentElement())); |
|
384 return result; |
|
385 } |
|
386 |
|
387 JSValue jsNodeConstructor(ExecState* exec, JSValue slotBase, const Identifier&) |
|
388 { |
|
389 JSNode* domObject = static_cast<JSNode*>(asObject(slotBase)); |
|
390 return JSNode::getConstructor(exec, domObject->globalObject()); |
|
391 } |
|
392 void JSNode::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) |
|
393 { |
|
394 lookupPut<JSNode, Base>(exec, propertyName, value, &JSNodeTable, this, slot); |
|
395 } |
|
396 |
|
397 void setJSNodeNodeValue(ExecState* exec, JSObject* thisObject, JSValue value) |
|
398 { |
|
399 JSNode* castedThis = static_cast<JSNode*>(thisObject); |
|
400 Node* imp = static_cast<Node*>(castedThis->impl()); |
|
401 ExceptionCode ec = 0; |
|
402 imp->setNodeValue(valueToStringWithNullCheck(exec, value), ec); |
|
403 setDOMException(exec, ec); |
|
404 } |
|
405 |
|
406 void setJSNodePrefix(ExecState* exec, JSObject* thisObject, JSValue value) |
|
407 { |
|
408 JSNode* castedThis = static_cast<JSNode*>(thisObject); |
|
409 Node* imp = static_cast<Node*>(castedThis->impl()); |
|
410 ExceptionCode ec = 0; |
|
411 imp->setPrefix(valueToStringWithNullCheck(exec, value), ec); |
|
412 setDOMException(exec, ec); |
|
413 } |
|
414 |
|
415 void setJSNodeTextContent(ExecState* exec, JSObject* thisObject, JSValue value) |
|
416 { |
|
417 JSNode* castedThis = static_cast<JSNode*>(thisObject); |
|
418 Node* imp = static_cast<Node*>(castedThis->impl()); |
|
419 ExceptionCode ec = 0; |
|
420 imp->setTextContent(valueToStringWithNullCheck(exec, value), ec); |
|
421 setDOMException(exec, ec); |
|
422 } |
|
423 |
|
424 JSValue JSNode::getConstructor(ExecState* exec, JSGlobalObject* globalObject) |
|
425 { |
|
426 return getDOMConstructor<JSNodeConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject)); |
|
427 } |
|
428 |
|
429 EncodedJSValue JSC_HOST_CALL jsNodePrototypeFunctionInsertBefore(ExecState* exec) |
|
430 { |
|
431 JSValue thisValue = exec->hostThisValue(); |
|
432 if (!thisValue.inherits(&JSNode::s_info)) |
|
433 return throwVMTypeError(exec); |
|
434 JSNode* castedThis = static_cast<JSNode*>(asObject(thisValue)); |
|
435 return JSValue::encode(castedThis->insertBefore(exec)); |
|
436 } |
|
437 |
|
438 EncodedJSValue JSC_HOST_CALL jsNodePrototypeFunctionReplaceChild(ExecState* exec) |
|
439 { |
|
440 JSValue thisValue = exec->hostThisValue(); |
|
441 if (!thisValue.inherits(&JSNode::s_info)) |
|
442 return throwVMTypeError(exec); |
|
443 JSNode* castedThis = static_cast<JSNode*>(asObject(thisValue)); |
|
444 return JSValue::encode(castedThis->replaceChild(exec)); |
|
445 } |
|
446 |
|
447 EncodedJSValue JSC_HOST_CALL jsNodePrototypeFunctionRemoveChild(ExecState* exec) |
|
448 { |
|
449 JSValue thisValue = exec->hostThisValue(); |
|
450 if (!thisValue.inherits(&JSNode::s_info)) |
|
451 return throwVMTypeError(exec); |
|
452 JSNode* castedThis = static_cast<JSNode*>(asObject(thisValue)); |
|
453 return JSValue::encode(castedThis->removeChild(exec)); |
|
454 } |
|
455 |
|
456 EncodedJSValue JSC_HOST_CALL jsNodePrototypeFunctionAppendChild(ExecState* exec) |
|
457 { |
|
458 JSValue thisValue = exec->hostThisValue(); |
|
459 if (!thisValue.inherits(&JSNode::s_info)) |
|
460 return throwVMTypeError(exec); |
|
461 JSNode* castedThis = static_cast<JSNode*>(asObject(thisValue)); |
|
462 return JSValue::encode(castedThis->appendChild(exec)); |
|
463 } |
|
464 |
|
465 EncodedJSValue JSC_HOST_CALL jsNodePrototypeFunctionHasChildNodes(ExecState* exec) |
|
466 { |
|
467 JSValue thisValue = exec->hostThisValue(); |
|
468 if (!thisValue.inherits(&JSNode::s_info)) |
|
469 return throwVMTypeError(exec); |
|
470 JSNode* castedThis = static_cast<JSNode*>(asObject(thisValue)); |
|
471 Node* imp = static_cast<Node*>(castedThis->impl()); |
|
472 |
|
473 |
|
474 JSC::JSValue result = jsBoolean(imp->hasChildNodes()); |
|
475 return JSValue::encode(result); |
|
476 } |
|
477 |
|
478 EncodedJSValue JSC_HOST_CALL jsNodePrototypeFunctionCloneNode(ExecState* exec) |
|
479 { |
|
480 JSValue thisValue = exec->hostThisValue(); |
|
481 if (!thisValue.inherits(&JSNode::s_info)) |
|
482 return throwVMTypeError(exec); |
|
483 JSNode* castedThis = static_cast<JSNode*>(asObject(thisValue)); |
|
484 Node* imp = static_cast<Node*>(castedThis->impl()); |
|
485 bool deep = exec->argument(0).toBoolean(exec); |
|
486 |
|
487 |
|
488 JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->cloneNode(deep))); |
|
489 return JSValue::encode(result); |
|
490 } |
|
491 |
|
492 EncodedJSValue JSC_HOST_CALL jsNodePrototypeFunctionNormalize(ExecState* exec) |
|
493 { |
|
494 JSValue thisValue = exec->hostThisValue(); |
|
495 if (!thisValue.inherits(&JSNode::s_info)) |
|
496 return throwVMTypeError(exec); |
|
497 JSNode* castedThis = static_cast<JSNode*>(asObject(thisValue)); |
|
498 Node* imp = static_cast<Node*>(castedThis->impl()); |
|
499 |
|
500 imp->normalize(); |
|
501 return JSValue::encode(jsUndefined()); |
|
502 } |
|
503 |
|
504 EncodedJSValue JSC_HOST_CALL jsNodePrototypeFunctionIsSupported(ExecState* exec) |
|
505 { |
|
506 JSValue thisValue = exec->hostThisValue(); |
|
507 if (!thisValue.inherits(&JSNode::s_info)) |
|
508 return throwVMTypeError(exec); |
|
509 JSNode* castedThis = static_cast<JSNode*>(asObject(thisValue)); |
|
510 Node* imp = static_cast<Node*>(castedThis->impl()); |
|
511 const String& feature = ustringToString(exec->argument(0).toString(exec)); |
|
512 const String& version = valueToStringWithNullCheck(exec, exec->argument(1)); |
|
513 |
|
514 |
|
515 JSC::JSValue result = jsBoolean(imp->isSupported(feature, version)); |
|
516 return JSValue::encode(result); |
|
517 } |
|
518 |
|
519 EncodedJSValue JSC_HOST_CALL jsNodePrototypeFunctionHasAttributes(ExecState* exec) |
|
520 { |
|
521 JSValue thisValue = exec->hostThisValue(); |
|
522 if (!thisValue.inherits(&JSNode::s_info)) |
|
523 return throwVMTypeError(exec); |
|
524 JSNode* castedThis = static_cast<JSNode*>(asObject(thisValue)); |
|
525 Node* imp = static_cast<Node*>(castedThis->impl()); |
|
526 |
|
527 |
|
528 JSC::JSValue result = jsBoolean(imp->hasAttributes()); |
|
529 return JSValue::encode(result); |
|
530 } |
|
531 |
|
532 EncodedJSValue JSC_HOST_CALL jsNodePrototypeFunctionIsSameNode(ExecState* exec) |
|
533 { |
|
534 JSValue thisValue = exec->hostThisValue(); |
|
535 if (!thisValue.inherits(&JSNode::s_info)) |
|
536 return throwVMTypeError(exec); |
|
537 JSNode* castedThis = static_cast<JSNode*>(asObject(thisValue)); |
|
538 Node* imp = static_cast<Node*>(castedThis->impl()); |
|
539 Node* other = toNode(exec->argument(0)); |
|
540 |
|
541 |
|
542 JSC::JSValue result = jsBoolean(imp->isSameNode(other)); |
|
543 return JSValue::encode(result); |
|
544 } |
|
545 |
|
546 EncodedJSValue JSC_HOST_CALL jsNodePrototypeFunctionIsEqualNode(ExecState* exec) |
|
547 { |
|
548 JSValue thisValue = exec->hostThisValue(); |
|
549 if (!thisValue.inherits(&JSNode::s_info)) |
|
550 return throwVMTypeError(exec); |
|
551 JSNode* castedThis = static_cast<JSNode*>(asObject(thisValue)); |
|
552 Node* imp = static_cast<Node*>(castedThis->impl()); |
|
553 Node* other = toNode(exec->argument(0)); |
|
554 |
|
555 |
|
556 JSC::JSValue result = jsBoolean(imp->isEqualNode(other)); |
|
557 return JSValue::encode(result); |
|
558 } |
|
559 |
|
560 EncodedJSValue JSC_HOST_CALL jsNodePrototypeFunctionLookupPrefix(ExecState* exec) |
|
561 { |
|
562 JSValue thisValue = exec->hostThisValue(); |
|
563 if (!thisValue.inherits(&JSNode::s_info)) |
|
564 return throwVMTypeError(exec); |
|
565 JSNode* castedThis = static_cast<JSNode*>(asObject(thisValue)); |
|
566 Node* imp = static_cast<Node*>(castedThis->impl()); |
|
567 const String& namespaceURI = valueToStringWithNullCheck(exec, exec->argument(0)); |
|
568 |
|
569 |
|
570 JSC::JSValue result = jsStringOrNull(exec, imp->lookupPrefix(namespaceURI)); |
|
571 return JSValue::encode(result); |
|
572 } |
|
573 |
|
574 EncodedJSValue JSC_HOST_CALL jsNodePrototypeFunctionIsDefaultNamespace(ExecState* exec) |
|
575 { |
|
576 JSValue thisValue = exec->hostThisValue(); |
|
577 if (!thisValue.inherits(&JSNode::s_info)) |
|
578 return throwVMTypeError(exec); |
|
579 JSNode* castedThis = static_cast<JSNode*>(asObject(thisValue)); |
|
580 Node* imp = static_cast<Node*>(castedThis->impl()); |
|
581 const String& namespaceURI = valueToStringWithNullCheck(exec, exec->argument(0)); |
|
582 |
|
583 |
|
584 JSC::JSValue result = jsBoolean(imp->isDefaultNamespace(namespaceURI)); |
|
585 return JSValue::encode(result); |
|
586 } |
|
587 |
|
588 EncodedJSValue JSC_HOST_CALL jsNodePrototypeFunctionLookupNamespaceURI(ExecState* exec) |
|
589 { |
|
590 JSValue thisValue = exec->hostThisValue(); |
|
591 if (!thisValue.inherits(&JSNode::s_info)) |
|
592 return throwVMTypeError(exec); |
|
593 JSNode* castedThis = static_cast<JSNode*>(asObject(thisValue)); |
|
594 Node* imp = static_cast<Node*>(castedThis->impl()); |
|
595 const String& prefix = valueToStringWithNullCheck(exec, exec->argument(0)); |
|
596 |
|
597 |
|
598 JSC::JSValue result = jsStringOrNull(exec, imp->lookupNamespaceURI(prefix)); |
|
599 return JSValue::encode(result); |
|
600 } |
|
601 |
|
602 EncodedJSValue JSC_HOST_CALL jsNodePrototypeFunctionCompareDocumentPosition(ExecState* exec) |
|
603 { |
|
604 JSValue thisValue = exec->hostThisValue(); |
|
605 if (!thisValue.inherits(&JSNode::s_info)) |
|
606 return throwVMTypeError(exec); |
|
607 JSNode* castedThis = static_cast<JSNode*>(asObject(thisValue)); |
|
608 Node* imp = static_cast<Node*>(castedThis->impl()); |
|
609 Node* other = toNode(exec->argument(0)); |
|
610 |
|
611 |
|
612 JSC::JSValue result = jsNumber(exec, imp->compareDocumentPosition(other)); |
|
613 return JSValue::encode(result); |
|
614 } |
|
615 |
|
616 EncodedJSValue JSC_HOST_CALL jsNodePrototypeFunctionAddEventListener(ExecState* exec) |
|
617 { |
|
618 JSValue thisValue = exec->hostThisValue(); |
|
619 if (!thisValue.inherits(&JSNode::s_info)) |
|
620 return throwVMTypeError(exec); |
|
621 JSNode* castedThis = static_cast<JSNode*>(asObject(thisValue)); |
|
622 Node* imp = static_cast<Node*>(castedThis->impl()); |
|
623 JSValue listener = exec->argument(1); |
|
624 if (!listener.isObject()) |
|
625 return JSValue::encode(jsUndefined()); |
|
626 imp->addEventListener(ustringToAtomicString(exec->argument(0).toString(exec)), JSEventListener::create(asObject(listener), castedThis, false, currentWorld(exec)), exec->argument(2).toBoolean(exec)); |
|
627 return JSValue::encode(jsUndefined()); |
|
628 } |
|
629 |
|
630 EncodedJSValue JSC_HOST_CALL jsNodePrototypeFunctionRemoveEventListener(ExecState* exec) |
|
631 { |
|
632 JSValue thisValue = exec->hostThisValue(); |
|
633 if (!thisValue.inherits(&JSNode::s_info)) |
|
634 return throwVMTypeError(exec); |
|
635 JSNode* castedThis = static_cast<JSNode*>(asObject(thisValue)); |
|
636 Node* imp = static_cast<Node*>(castedThis->impl()); |
|
637 JSValue listener = exec->argument(1); |
|
638 if (!listener.isObject()) |
|
639 return JSValue::encode(jsUndefined()); |
|
640 imp->removeEventListener(ustringToAtomicString(exec->argument(0).toString(exec)), JSEventListener::create(asObject(listener), castedThis, false, currentWorld(exec)).get(), exec->argument(2).toBoolean(exec)); |
|
641 return JSValue::encode(jsUndefined()); |
|
642 } |
|
643 |
|
644 EncodedJSValue JSC_HOST_CALL jsNodePrototypeFunctionDispatchEvent(ExecState* exec) |
|
645 { |
|
646 JSValue thisValue = exec->hostThisValue(); |
|
647 if (!thisValue.inherits(&JSNode::s_info)) |
|
648 return throwVMTypeError(exec); |
|
649 JSNode* castedThis = static_cast<JSNode*>(asObject(thisValue)); |
|
650 Node* imp = static_cast<Node*>(castedThis->impl()); |
|
651 ExceptionCode ec = 0; |
|
652 Event* event = toEvent(exec->argument(0)); |
|
653 |
|
654 |
|
655 JSC::JSValue result = jsBoolean(imp->dispatchEvent(event, ec)); |
|
656 setDOMException(exec, ec); |
|
657 return JSValue::encode(result); |
|
658 } |
|
659 |
|
660 // Constant getters |
|
661 |
|
662 JSValue jsNodeELEMENT_NODE(ExecState* exec, JSValue, const Identifier&) |
|
663 { |
|
664 return jsNumber(exec, static_cast<int>(1)); |
|
665 } |
|
666 |
|
667 JSValue jsNodeATTRIBUTE_NODE(ExecState* exec, JSValue, const Identifier&) |
|
668 { |
|
669 return jsNumber(exec, static_cast<int>(2)); |
|
670 } |
|
671 |
|
672 JSValue jsNodeTEXT_NODE(ExecState* exec, JSValue, const Identifier&) |
|
673 { |
|
674 return jsNumber(exec, static_cast<int>(3)); |
|
675 } |
|
676 |
|
677 JSValue jsNodeCDATA_SECTION_NODE(ExecState* exec, JSValue, const Identifier&) |
|
678 { |
|
679 return jsNumber(exec, static_cast<int>(4)); |
|
680 } |
|
681 |
|
682 JSValue jsNodeENTITY_REFERENCE_NODE(ExecState* exec, JSValue, const Identifier&) |
|
683 { |
|
684 return jsNumber(exec, static_cast<int>(5)); |
|
685 } |
|
686 |
|
687 JSValue jsNodeENTITY_NODE(ExecState* exec, JSValue, const Identifier&) |
|
688 { |
|
689 return jsNumber(exec, static_cast<int>(6)); |
|
690 } |
|
691 |
|
692 JSValue jsNodePROCESSING_INSTRUCTION_NODE(ExecState* exec, JSValue, const Identifier&) |
|
693 { |
|
694 return jsNumber(exec, static_cast<int>(7)); |
|
695 } |
|
696 |
|
697 JSValue jsNodeCOMMENT_NODE(ExecState* exec, JSValue, const Identifier&) |
|
698 { |
|
699 return jsNumber(exec, static_cast<int>(8)); |
|
700 } |
|
701 |
|
702 JSValue jsNodeDOCUMENT_NODE(ExecState* exec, JSValue, const Identifier&) |
|
703 { |
|
704 return jsNumber(exec, static_cast<int>(9)); |
|
705 } |
|
706 |
|
707 JSValue jsNodeDOCUMENT_TYPE_NODE(ExecState* exec, JSValue, const Identifier&) |
|
708 { |
|
709 return jsNumber(exec, static_cast<int>(10)); |
|
710 } |
|
711 |
|
712 JSValue jsNodeDOCUMENT_FRAGMENT_NODE(ExecState* exec, JSValue, const Identifier&) |
|
713 { |
|
714 return jsNumber(exec, static_cast<int>(11)); |
|
715 } |
|
716 |
|
717 JSValue jsNodeNOTATION_NODE(ExecState* exec, JSValue, const Identifier&) |
|
718 { |
|
719 return jsNumber(exec, static_cast<int>(12)); |
|
720 } |
|
721 |
|
722 JSValue jsNodeDOCUMENT_POSITION_DISCONNECTED(ExecState* exec, JSValue, const Identifier&) |
|
723 { |
|
724 return jsNumber(exec, static_cast<int>(0x01)); |
|
725 } |
|
726 |
|
727 JSValue jsNodeDOCUMENT_POSITION_PRECEDING(ExecState* exec, JSValue, const Identifier&) |
|
728 { |
|
729 return jsNumber(exec, static_cast<int>(0x02)); |
|
730 } |
|
731 |
|
732 JSValue jsNodeDOCUMENT_POSITION_FOLLOWING(ExecState* exec, JSValue, const Identifier&) |
|
733 { |
|
734 return jsNumber(exec, static_cast<int>(0x04)); |
|
735 } |
|
736 |
|
737 JSValue jsNodeDOCUMENT_POSITION_CONTAINS(ExecState* exec, JSValue, const Identifier&) |
|
738 { |
|
739 return jsNumber(exec, static_cast<int>(0x08)); |
|
740 } |
|
741 |
|
742 JSValue jsNodeDOCUMENT_POSITION_CONTAINED_BY(ExecState* exec, JSValue, const Identifier&) |
|
743 { |
|
744 return jsNumber(exec, static_cast<int>(0x10)); |
|
745 } |
|
746 |
|
747 JSValue jsNodeDOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC(ExecState* exec, JSValue, const Identifier&) |
|
748 { |
|
749 return jsNumber(exec, static_cast<int>(0x20)); |
|
750 } |
|
751 |
|
752 Node* toNode(JSC::JSValue value) |
|
753 { |
|
754 return value.inherits(&JSNode::s_info) ? static_cast<JSNode*>(asObject(value))->impl() : 0; |
|
755 } |
|
756 |
|
757 } |