|
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 "JSCSSVariablesDeclaration.h" |
|
23 |
|
24 #include "CSSRule.h" |
|
25 #include "CSSVariablesDeclaration.h" |
|
26 #include "JSCSSRule.h" |
|
27 #include "KURL.h" |
|
28 #include <runtime/Error.h> |
|
29 #include <runtime/JSNumberCell.h> |
|
30 #include <runtime/JSString.h> |
|
31 #include <runtime/PropertyNameArray.h> |
|
32 #include <wtf/GetPtr.h> |
|
33 |
|
34 using namespace JSC; |
|
35 |
|
36 namespace WebCore { |
|
37 |
|
38 ASSERT_CLASS_FITS_IN_CELL(JSCSSVariablesDeclaration); |
|
39 |
|
40 /* Hash table */ |
|
41 #if ENABLE(JIT) |
|
42 #define THUNK_GENERATOR(generator) , generator |
|
43 #else |
|
44 #define THUNK_GENERATOR(generator) |
|
45 #endif |
|
46 |
|
47 static const HashTableValue JSCSSVariablesDeclarationTableValues[5] = |
|
48 { |
|
49 { "cssText", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsCSSVariablesDeclarationCssText), (intptr_t)setJSCSSVariablesDeclarationCssText THUNK_GENERATOR(0) }, |
|
50 { "length", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsCSSVariablesDeclarationLength), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
51 { "parentRule", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsCSSVariablesDeclarationParentRule), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
52 { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsCSSVariablesDeclarationConstructor), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
53 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
54 }; |
|
55 |
|
56 #undef THUNK_GENERATOR |
|
57 static JSC_CONST_HASHTABLE HashTable JSCSSVariablesDeclarationTable = { 10, 7, JSCSSVariablesDeclarationTableValues, 0 }; |
|
58 /* Hash table for constructor */ |
|
59 #if ENABLE(JIT) |
|
60 #define THUNK_GENERATOR(generator) , generator |
|
61 #else |
|
62 #define THUNK_GENERATOR(generator) |
|
63 #endif |
|
64 |
|
65 static const HashTableValue JSCSSVariablesDeclarationConstructorTableValues[1] = |
|
66 { |
|
67 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
68 }; |
|
69 |
|
70 #undef THUNK_GENERATOR |
|
71 static JSC_CONST_HASHTABLE HashTable JSCSSVariablesDeclarationConstructorTable = { 1, 0, JSCSSVariablesDeclarationConstructorTableValues, 0 }; |
|
72 class JSCSSVariablesDeclarationConstructor : public DOMConstructorObject { |
|
73 public: |
|
74 JSCSSVariablesDeclarationConstructor(JSC::ExecState*, JSDOMGlobalObject*); |
|
75 |
|
76 virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&); |
|
77 virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&); |
|
78 virtual const JSC::ClassInfo* classInfo() const { return &s_info; } |
|
79 static const JSC::ClassInfo s_info; |
|
80 static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype) |
|
81 { |
|
82 return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount); |
|
83 } |
|
84 protected: |
|
85 static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::ImplementsHasInstance | DOMConstructorObject::StructureFlags; |
|
86 }; |
|
87 |
|
88 const ClassInfo JSCSSVariablesDeclarationConstructor::s_info = { "CSSVariablesDeclarationConstructor", 0, &JSCSSVariablesDeclarationConstructorTable, 0 }; |
|
89 |
|
90 JSCSSVariablesDeclarationConstructor::JSCSSVariablesDeclarationConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) |
|
91 : DOMConstructorObject(JSCSSVariablesDeclarationConstructor::createStructure(globalObject->objectPrototype()), globalObject) |
|
92 { |
|
93 putDirect(exec->propertyNames().prototype, JSCSSVariablesDeclarationPrototype::self(exec, globalObject), DontDelete | ReadOnly); |
|
94 } |
|
95 |
|
96 bool JSCSSVariablesDeclarationConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
97 { |
|
98 return getStaticValueSlot<JSCSSVariablesDeclarationConstructor, DOMObject>(exec, &JSCSSVariablesDeclarationConstructorTable, this, propertyName, slot); |
|
99 } |
|
100 |
|
101 bool JSCSSVariablesDeclarationConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
102 { |
|
103 return getStaticValueDescriptor<JSCSSVariablesDeclarationConstructor, DOMObject>(exec, &JSCSSVariablesDeclarationConstructorTable, this, propertyName, descriptor); |
|
104 } |
|
105 |
|
106 /* Hash table for prototype */ |
|
107 #if ENABLE(JIT) |
|
108 #define THUNK_GENERATOR(generator) , generator |
|
109 #else |
|
110 #define THUNK_GENERATOR(generator) |
|
111 #endif |
|
112 |
|
113 static const HashTableValue JSCSSVariablesDeclarationPrototypeTableValues[5] = |
|
114 { |
|
115 { "getVariableValue", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsCSSVariablesDeclarationPrototypeFunctionGetVariableValue), (intptr_t)1 THUNK_GENERATOR(0) }, |
|
116 { "removeVariable", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsCSSVariablesDeclarationPrototypeFunctionRemoveVariable), (intptr_t)1 THUNK_GENERATOR(0) }, |
|
117 { "setVariable", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsCSSVariablesDeclarationPrototypeFunctionSetVariable), (intptr_t)2 THUNK_GENERATOR(0) }, |
|
118 { "item", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsCSSVariablesDeclarationPrototypeFunctionItem), (intptr_t)1 THUNK_GENERATOR(0) }, |
|
119 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
120 }; |
|
121 |
|
122 #undef THUNK_GENERATOR |
|
123 static JSC_CONST_HASHTABLE HashTable JSCSSVariablesDeclarationPrototypeTable = { 9, 7, JSCSSVariablesDeclarationPrototypeTableValues, 0 }; |
|
124 const ClassInfo JSCSSVariablesDeclarationPrototype::s_info = { "CSSVariablesDeclarationPrototype", 0, &JSCSSVariablesDeclarationPrototypeTable, 0 }; |
|
125 |
|
126 JSObject* JSCSSVariablesDeclarationPrototype::self(ExecState* exec, JSGlobalObject* globalObject) |
|
127 { |
|
128 return getDOMPrototype<JSCSSVariablesDeclaration>(exec, globalObject); |
|
129 } |
|
130 |
|
131 bool JSCSSVariablesDeclarationPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
132 { |
|
133 return getStaticFunctionSlot<JSObject>(exec, &JSCSSVariablesDeclarationPrototypeTable, this, propertyName, slot); |
|
134 } |
|
135 |
|
136 bool JSCSSVariablesDeclarationPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
137 { |
|
138 return getStaticFunctionDescriptor<JSObject>(exec, &JSCSSVariablesDeclarationPrototypeTable, this, propertyName, descriptor); |
|
139 } |
|
140 |
|
141 const ClassInfo JSCSSVariablesDeclaration::s_info = { "CSSVariablesDeclaration", 0, &JSCSSVariablesDeclarationTable, 0 }; |
|
142 |
|
143 JSCSSVariablesDeclaration::JSCSSVariablesDeclaration(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<CSSVariablesDeclaration> impl) |
|
144 : DOMObjectWithGlobalPointer(structure, globalObject) |
|
145 , m_impl(impl) |
|
146 { |
|
147 } |
|
148 |
|
149 JSCSSVariablesDeclaration::~JSCSSVariablesDeclaration() |
|
150 { |
|
151 forgetDOMObject(this, impl()); |
|
152 } |
|
153 |
|
154 JSObject* JSCSSVariablesDeclaration::createPrototype(ExecState* exec, JSGlobalObject* globalObject) |
|
155 { |
|
156 return new (exec) JSCSSVariablesDeclarationPrototype(globalObject, JSCSSVariablesDeclarationPrototype::createStructure(globalObject->objectPrototype())); |
|
157 } |
|
158 |
|
159 bool JSCSSVariablesDeclaration::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
160 { |
|
161 const HashEntry* entry = JSCSSVariablesDeclarationTable.entry(exec, propertyName); |
|
162 if (entry) { |
|
163 slot.setCustom(this, entry->propertyGetter()); |
|
164 return true; |
|
165 } |
|
166 bool ok; |
|
167 unsigned index = propertyName.toUInt32(&ok, false); |
|
168 if (ok) { |
|
169 slot.setCustomIndex(this, index, indexGetter); |
|
170 return true; |
|
171 } |
|
172 return getStaticValueSlot<JSCSSVariablesDeclaration, Base>(exec, &JSCSSVariablesDeclarationTable, this, propertyName, slot); |
|
173 } |
|
174 |
|
175 bool JSCSSVariablesDeclaration::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
176 { |
|
177 const HashEntry* entry = JSCSSVariablesDeclarationTable.entry(exec, propertyName); |
|
178 if (entry) { |
|
179 PropertySlot slot; |
|
180 slot.setCustom(this, entry->propertyGetter()); |
|
181 descriptor.setDescriptor(slot.getValue(exec, propertyName), entry->attributes()); |
|
182 return true; |
|
183 } |
|
184 bool ok; |
|
185 unsigned index = propertyName.toUInt32(&ok, false); |
|
186 if (ok && index < static_cast<CSSVariablesDeclaration*>(impl())->length()) { |
|
187 PropertySlot slot; |
|
188 slot.setCustomIndex(this, index, indexGetter); |
|
189 descriptor.setDescriptor(slot.getValue(exec, propertyName), DontDelete | ReadOnly); |
|
190 return true; |
|
191 } |
|
192 return getStaticValueDescriptor<JSCSSVariablesDeclaration, Base>(exec, &JSCSSVariablesDeclarationTable, this, propertyName, descriptor); |
|
193 } |
|
194 |
|
195 bool JSCSSVariablesDeclaration::getOwnPropertySlot(ExecState* exec, unsigned propertyName, PropertySlot& slot) |
|
196 { |
|
197 if (propertyName < static_cast<CSSVariablesDeclaration*>(impl())->length()) { |
|
198 slot.setCustomIndex(this, propertyName, indexGetter); |
|
199 return true; |
|
200 } |
|
201 return getOwnPropertySlot(exec, Identifier::from(exec, propertyName), slot); |
|
202 } |
|
203 |
|
204 JSValue jsCSSVariablesDeclarationCssText(ExecState* exec, JSValue slotBase, const Identifier&) |
|
205 { |
|
206 JSCSSVariablesDeclaration* castedThis = static_cast<JSCSSVariablesDeclaration*>(asObject(slotBase)); |
|
207 UNUSED_PARAM(exec); |
|
208 CSSVariablesDeclaration* imp = static_cast<CSSVariablesDeclaration*>(castedThis->impl()); |
|
209 JSValue result = jsString(exec, imp->cssText()); |
|
210 return result; |
|
211 } |
|
212 |
|
213 JSValue jsCSSVariablesDeclarationLength(ExecState* exec, JSValue slotBase, const Identifier&) |
|
214 { |
|
215 JSCSSVariablesDeclaration* castedThis = static_cast<JSCSSVariablesDeclaration*>(asObject(slotBase)); |
|
216 UNUSED_PARAM(exec); |
|
217 CSSVariablesDeclaration* imp = static_cast<CSSVariablesDeclaration*>(castedThis->impl()); |
|
218 JSValue result = jsNumber(exec, imp->length()); |
|
219 return result; |
|
220 } |
|
221 |
|
222 JSValue jsCSSVariablesDeclarationParentRule(ExecState* exec, JSValue slotBase, const Identifier&) |
|
223 { |
|
224 JSCSSVariablesDeclaration* castedThis = static_cast<JSCSSVariablesDeclaration*>(asObject(slotBase)); |
|
225 UNUSED_PARAM(exec); |
|
226 CSSVariablesDeclaration* imp = static_cast<CSSVariablesDeclaration*>(castedThis->impl()); |
|
227 JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->parentRule())); |
|
228 return result; |
|
229 } |
|
230 |
|
231 JSValue jsCSSVariablesDeclarationConstructor(ExecState* exec, JSValue slotBase, const Identifier&) |
|
232 { |
|
233 JSCSSVariablesDeclaration* domObject = static_cast<JSCSSVariablesDeclaration*>(asObject(slotBase)); |
|
234 return JSCSSVariablesDeclaration::getConstructor(exec, domObject->globalObject()); |
|
235 } |
|
236 void JSCSSVariablesDeclaration::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) |
|
237 { |
|
238 lookupPut<JSCSSVariablesDeclaration, Base>(exec, propertyName, value, &JSCSSVariablesDeclarationTable, this, slot); |
|
239 } |
|
240 |
|
241 void setJSCSSVariablesDeclarationCssText(ExecState* exec, JSObject* thisObject, JSValue value) |
|
242 { |
|
243 JSCSSVariablesDeclaration* castedThis = static_cast<JSCSSVariablesDeclaration*>(thisObject); |
|
244 CSSVariablesDeclaration* imp = static_cast<CSSVariablesDeclaration*>(castedThis->impl()); |
|
245 imp->setCssText(ustringToString(value.toString(exec))); |
|
246 } |
|
247 |
|
248 void JSCSSVariablesDeclaration::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode) |
|
249 { |
|
250 for (unsigned i = 0; i < static_cast<CSSVariablesDeclaration*>(impl())->length(); ++i) |
|
251 propertyNames.add(Identifier::from(exec, i)); |
|
252 Base::getOwnPropertyNames(exec, propertyNames, mode); |
|
253 } |
|
254 |
|
255 JSValue JSCSSVariablesDeclaration::getConstructor(ExecState* exec, JSGlobalObject* globalObject) |
|
256 { |
|
257 return getDOMConstructor<JSCSSVariablesDeclarationConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject)); |
|
258 } |
|
259 |
|
260 EncodedJSValue JSC_HOST_CALL jsCSSVariablesDeclarationPrototypeFunctionGetVariableValue(ExecState* exec) |
|
261 { |
|
262 JSValue thisValue = exec->hostThisValue(); |
|
263 if (!thisValue.inherits(&JSCSSVariablesDeclaration::s_info)) |
|
264 return throwVMTypeError(exec); |
|
265 JSCSSVariablesDeclaration* castedThis = static_cast<JSCSSVariablesDeclaration*>(asObject(thisValue)); |
|
266 CSSVariablesDeclaration* imp = static_cast<CSSVariablesDeclaration*>(castedThis->impl()); |
|
267 const String& variableName = ustringToString(exec->argument(0).toString(exec)); |
|
268 |
|
269 |
|
270 JSC::JSValue result = jsString(exec, imp->getVariableValue(variableName)); |
|
271 return JSValue::encode(result); |
|
272 } |
|
273 |
|
274 EncodedJSValue JSC_HOST_CALL jsCSSVariablesDeclarationPrototypeFunctionRemoveVariable(ExecState* exec) |
|
275 { |
|
276 JSValue thisValue = exec->hostThisValue(); |
|
277 if (!thisValue.inherits(&JSCSSVariablesDeclaration::s_info)) |
|
278 return throwVMTypeError(exec); |
|
279 JSCSSVariablesDeclaration* castedThis = static_cast<JSCSSVariablesDeclaration*>(asObject(thisValue)); |
|
280 CSSVariablesDeclaration* imp = static_cast<CSSVariablesDeclaration*>(castedThis->impl()); |
|
281 ExceptionCode ec = 0; |
|
282 const String& variableName = ustringToString(exec->argument(0).toString(exec)); |
|
283 |
|
284 |
|
285 JSC::JSValue result = jsString(exec, imp->removeVariable(variableName, ec)); |
|
286 setDOMException(exec, ec); |
|
287 return JSValue::encode(result); |
|
288 } |
|
289 |
|
290 EncodedJSValue JSC_HOST_CALL jsCSSVariablesDeclarationPrototypeFunctionSetVariable(ExecState* exec) |
|
291 { |
|
292 JSValue thisValue = exec->hostThisValue(); |
|
293 if (!thisValue.inherits(&JSCSSVariablesDeclaration::s_info)) |
|
294 return throwVMTypeError(exec); |
|
295 JSCSSVariablesDeclaration* castedThis = static_cast<JSCSSVariablesDeclaration*>(asObject(thisValue)); |
|
296 CSSVariablesDeclaration* imp = static_cast<CSSVariablesDeclaration*>(castedThis->impl()); |
|
297 ExceptionCode ec = 0; |
|
298 const String& variableName = ustringToString(exec->argument(0).toString(exec)); |
|
299 const String& value = ustringToString(exec->argument(1).toString(exec)); |
|
300 |
|
301 imp->setVariable(variableName, value, ec); |
|
302 setDOMException(exec, ec); |
|
303 return JSValue::encode(jsUndefined()); |
|
304 } |
|
305 |
|
306 EncodedJSValue JSC_HOST_CALL jsCSSVariablesDeclarationPrototypeFunctionItem(ExecState* exec) |
|
307 { |
|
308 JSValue thisValue = exec->hostThisValue(); |
|
309 if (!thisValue.inherits(&JSCSSVariablesDeclaration::s_info)) |
|
310 return throwVMTypeError(exec); |
|
311 JSCSSVariablesDeclaration* castedThis = static_cast<JSCSSVariablesDeclaration*>(asObject(thisValue)); |
|
312 CSSVariablesDeclaration* imp = static_cast<CSSVariablesDeclaration*>(castedThis->impl()); |
|
313 unsigned index = exec->argument(0).toInt32(exec); |
|
314 |
|
315 |
|
316 JSC::JSValue result = jsString(exec, imp->item(index)); |
|
317 return JSValue::encode(result); |
|
318 } |
|
319 |
|
320 |
|
321 JSValue JSCSSVariablesDeclaration::indexGetter(ExecState* exec, JSValue slotBase, unsigned index) |
|
322 { |
|
323 JSCSSVariablesDeclaration* thisObj = static_cast<JSCSSVariablesDeclaration*>(asObject(slotBase)); |
|
324 return jsStringOrNull(exec, thisObj->impl()->item(index)); |
|
325 } |
|
326 JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, CSSVariablesDeclaration* object) |
|
327 { |
|
328 return getDOMObjectWrapper<JSCSSVariablesDeclaration>(exec, globalObject, object); |
|
329 } |
|
330 CSSVariablesDeclaration* toCSSVariablesDeclaration(JSC::JSValue value) |
|
331 { |
|
332 return value.inherits(&JSCSSVariablesDeclaration::s_info) ? static_cast<JSCSSVariablesDeclaration*>(asObject(value))->impl() : 0; |
|
333 } |
|
334 |
|
335 } |