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