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 "JSWebKitCSSKeyframesRule.h"
23
24 #include "CSSRuleList.h"
25 #include "ExceptionCode.h"
26 #include "JSCSSRuleList.h"
27 #include "JSDOMBinding.h"
28 #include "JSWebKitCSSKeyframeRule.h"
29 #include "KURL.h"
30 #include "WebKitCSSKeyframeRule.h"
31 #include "WebKitCSSKeyframesRule.h"
32 #include <runtime/Error.h>
33 #include <runtime/PropertyNameArray.h>
34 #include <wtf/GetPtr.h>
35
36 using namespace JSC;
37
38 namespace WebCore {
39
40 ASSERT_CLASS_FITS_IN_CELL(JSWebKitCSSKeyframesRule);
41
42 /* Hash table */
43 #if ENABLE(JIT)
44 #define THUNK_GENERATOR(generator) , generator
45 #else
46 #define THUNK_GENERATOR(generator)
47 #endif
48
49 static const HashTableValue JSWebKitCSSKeyframesRuleTableValues[4] =
50 {
51 { "name", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWebKitCSSKeyframesRuleName), (intptr_t)setJSWebKitCSSKeyframesRuleName THUNK_GENERATOR(0) },
52 { "cssRules", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWebKitCSSKeyframesRuleCssRules), (intptr_t)0 THUNK_GENERATOR(0) },
53 { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWebKitCSSKeyframesRuleConstructor), (intptr_t)0 THUNK_GENERATOR(0) },
54 { 0, 0, 0, 0 THUNK_GENERATOR(0) }
55 };
56
57 #undef THUNK_GENERATOR
58 static JSC_CONST_HASHTABLE HashTable JSWebKitCSSKeyframesRuleTable = { 9, 7, JSWebKitCSSKeyframesRuleTableValues, 0 };
59 /* Hash table for constructor */
60 #if ENABLE(JIT)
61 #define THUNK_GENERATOR(generator) , generator
62 #else
63 #define THUNK_GENERATOR(generator)
64 #endif
65
66 static const HashTableValue JSWebKitCSSKeyframesRuleConstructorTableValues[1] =
67 {
68 { 0, 0, 0, 0 THUNK_GENERATOR(0) }
69 };
70
71 #undef THUNK_GENERATOR
72 static JSC_CONST_HASHTABLE HashTable JSWebKitCSSKeyframesRuleConstructorTable = { 1, 0, JSWebKitCSSKeyframesRuleConstructorTableValues, 0 };
73 class JSWebKitCSSKeyframesRuleConstructor : public DOMConstructorObject {
74 public:
75 JSWebKitCSSKeyframesRuleConstructor(JSC::ExecState*, JSC::Structure*, JSDOMGlobalObject*);
76
77 virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&);
78 virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&);
79 static const JSC::ClassInfo s_info;
createStructure(JSC::JSGlobalData & globalData,JSC::JSValue prototype)80 static JSC::Structure* createStructure(JSC::JSGlobalData& globalData, JSC::JSValue prototype)
81 {
82 return JSC::Structure::create(globalData, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
83 }
84 protected:
85 static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::ImplementsHasInstance | DOMConstructorObject::StructureFlags;
86 };
87
88 const ClassInfo JSWebKitCSSKeyframesRuleConstructor::s_info = { "WebKitCSSKeyframesRuleConstructor", &DOMConstructorObject::s_info, &JSWebKitCSSKeyframesRuleConstructorTable, 0 };
89
JSWebKitCSSKeyframesRuleConstructor(ExecState * exec,Structure * structure,JSDOMGlobalObject * globalObject)90 JSWebKitCSSKeyframesRuleConstructor::JSWebKitCSSKeyframesRuleConstructor(ExecState* exec, Structure* structure, JSDOMGlobalObject* globalObject)
91 : DOMConstructorObject(structure, globalObject)
92 {
93 ASSERT(inherits(&s_info));
94 putDirect(exec->globalData(), exec->propertyNames().prototype, JSWebKitCSSKeyframesRulePrototype::self(exec, globalObject), DontDelete | ReadOnly);
95 }
96
getOwnPropertySlot(ExecState * exec,const Identifier & propertyName,PropertySlot & slot)97 bool JSWebKitCSSKeyframesRuleConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
98 {
99 return getStaticValueSlot<JSWebKitCSSKeyframesRuleConstructor, JSDOMWrapper>(exec, &JSWebKitCSSKeyframesRuleConstructorTable, this, propertyName, slot);
100 }
101
getOwnPropertyDescriptor(ExecState * exec,const Identifier & propertyName,PropertyDescriptor & descriptor)102 bool JSWebKitCSSKeyframesRuleConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
103 {
104 return getStaticValueDescriptor<JSWebKitCSSKeyframesRuleConstructor, JSDOMWrapper>(exec, &JSWebKitCSSKeyframesRuleConstructorTable, this, propertyName, descriptor);
105 }
106
107 /* Hash table for prototype */
108 #if ENABLE(JIT)
109 #define THUNK_GENERATOR(generator) , generator
110 #else
111 #define THUNK_GENERATOR(generator)
112 #endif
113
114 static const HashTableValue JSWebKitCSSKeyframesRulePrototypeTableValues[4] =
115 {
116 { "insertRule", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsWebKitCSSKeyframesRulePrototypeFunctionInsertRule), (intptr_t)1 THUNK_GENERATOR(0) },
117 { "deleteRule", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsWebKitCSSKeyframesRulePrototypeFunctionDeleteRule), (intptr_t)1 THUNK_GENERATOR(0) },
118 { "findRule", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsWebKitCSSKeyframesRulePrototypeFunctionFindRule), (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 JSWebKitCSSKeyframesRulePrototypeTable = { 8, 7, JSWebKitCSSKeyframesRulePrototypeTableValues, 0 };
124 const ClassInfo JSWebKitCSSKeyframesRulePrototype::s_info = { "WebKitCSSKeyframesRulePrototype", &JSC::JSObjectWithGlobalObject::s_info, &JSWebKitCSSKeyframesRulePrototypeTable, 0 };
125
self(ExecState * exec,JSGlobalObject * globalObject)126 JSObject* JSWebKitCSSKeyframesRulePrototype::self(ExecState* exec, JSGlobalObject* globalObject)
127 {
128 return getDOMPrototype<JSWebKitCSSKeyframesRule>(exec, globalObject);
129 }
130
getOwnPropertySlot(ExecState * exec,const Identifier & propertyName,PropertySlot & slot)131 bool JSWebKitCSSKeyframesRulePrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
132 {
133 return getStaticFunctionSlot<JSObject>(exec, &JSWebKitCSSKeyframesRulePrototypeTable, this, propertyName, slot);
134 }
135
getOwnPropertyDescriptor(ExecState * exec,const Identifier & propertyName,PropertyDescriptor & descriptor)136 bool JSWebKitCSSKeyframesRulePrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
137 {
138 return getStaticFunctionDescriptor<JSObject>(exec, &JSWebKitCSSKeyframesRulePrototypeTable, this, propertyName, descriptor);
139 }
140
141 const ClassInfo JSWebKitCSSKeyframesRule::s_info = { "WebKitCSSKeyframesRule", &JSCSSRule::s_info, &JSWebKitCSSKeyframesRuleTable, 0 };
142
JSWebKitCSSKeyframesRule(Structure * structure,JSDOMGlobalObject * globalObject,PassRefPtr<WebKitCSSKeyframesRule> impl)143 JSWebKitCSSKeyframesRule::JSWebKitCSSKeyframesRule(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<WebKitCSSKeyframesRule> impl)
144 : JSCSSRule(structure, globalObject, impl)
145 {
146 ASSERT(inherits(&s_info));
147 }
148
createPrototype(ExecState * exec,JSGlobalObject * globalObject)149 JSObject* JSWebKitCSSKeyframesRule::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
150 {
151 return new (exec) JSWebKitCSSKeyframesRulePrototype(exec->globalData(), globalObject, JSWebKitCSSKeyframesRulePrototype::createStructure(exec->globalData(), JSCSSRulePrototype::self(exec, globalObject)));
152 }
153
getOwnPropertySlot(ExecState * exec,const Identifier & propertyName,PropertySlot & slot)154 bool JSWebKitCSSKeyframesRule::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
155 {
156 const HashEntry* entry = JSWebKitCSSKeyframesRuleTable.entry(exec, propertyName);
157 if (entry) {
158 slot.setCustom(this, entry->propertyGetter());
159 return true;
160 }
161 bool ok;
162 unsigned index = propertyName.toUInt32(ok);
163 if (ok && index < static_cast<WebKitCSSKeyframesRule*>(impl())->length()) {
164 slot.setCustomIndex(this, index, indexGetter);
165 return true;
166 }
167 return getStaticValueSlot<JSWebKitCSSKeyframesRule, Base>(exec, &JSWebKitCSSKeyframesRuleTable, this, propertyName, slot);
168 }
169
getOwnPropertyDescriptor(ExecState * exec,const Identifier & propertyName,PropertyDescriptor & descriptor)170 bool JSWebKitCSSKeyframesRule::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
171 {
172 const HashEntry* entry = JSWebKitCSSKeyframesRuleTable.entry(exec, propertyName);
173 if (entry) {
174 PropertySlot slot;
175 slot.setCustom(this, entry->propertyGetter());
176 descriptor.setDescriptor(slot.getValue(exec, propertyName), entry->attributes());
177 return true;
178 }
179 bool ok;
180 unsigned index = propertyName.toUInt32(ok);
181 if (ok && index < static_cast<WebKitCSSKeyframesRule*>(impl())->length()) {
182 PropertySlot slot;
183 slot.setCustomIndex(this, index, indexGetter);
184 descriptor.setDescriptor(slot.getValue(exec, propertyName), DontDelete | ReadOnly);
185 return true;
186 }
187 return getStaticValueDescriptor<JSWebKitCSSKeyframesRule, Base>(exec, &JSWebKitCSSKeyframesRuleTable, this, propertyName, descriptor);
188 }
189
getOwnPropertySlot(ExecState * exec,unsigned propertyName,PropertySlot & slot)190 bool JSWebKitCSSKeyframesRule::getOwnPropertySlot(ExecState* exec, unsigned propertyName, PropertySlot& slot)
191 {
192 if (propertyName < static_cast<WebKitCSSKeyframesRule*>(impl())->length()) {
193 slot.setCustomIndex(this, propertyName, indexGetter);
194 return true;
195 }
196 return getOwnPropertySlot(exec, Identifier::from(exec, propertyName), slot);
197 }
198
jsWebKitCSSKeyframesRuleName(ExecState * exec,JSValue slotBase,const Identifier &)199 JSValue jsWebKitCSSKeyframesRuleName(ExecState* exec, JSValue slotBase, const Identifier&)
200 {
201 JSWebKitCSSKeyframesRule* castedThis = static_cast<JSWebKitCSSKeyframesRule*>(asObject(slotBase));
202 UNUSED_PARAM(exec);
203 WebKitCSSKeyframesRule* imp = static_cast<WebKitCSSKeyframesRule*>(castedThis->impl());
204 JSValue result = jsStringOrNull(exec, imp->name());
205 return result;
206 }
207
208
jsWebKitCSSKeyframesRuleCssRules(ExecState * exec,JSValue slotBase,const Identifier &)209 JSValue jsWebKitCSSKeyframesRuleCssRules(ExecState* exec, JSValue slotBase, const Identifier&)
210 {
211 JSWebKitCSSKeyframesRule* castedThis = static_cast<JSWebKitCSSKeyframesRule*>(asObject(slotBase));
212 UNUSED_PARAM(exec);
213 WebKitCSSKeyframesRule* imp = static_cast<WebKitCSSKeyframesRule*>(castedThis->impl());
214 JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->cssRules()));
215 return result;
216 }
217
218
jsWebKitCSSKeyframesRuleConstructor(ExecState * exec,JSValue slotBase,const Identifier &)219 JSValue jsWebKitCSSKeyframesRuleConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
220 {
221 JSWebKitCSSKeyframesRule* domObject = static_cast<JSWebKitCSSKeyframesRule*>(asObject(slotBase));
222 return JSWebKitCSSKeyframesRule::getConstructor(exec, domObject->globalObject());
223 }
224
put(ExecState * exec,const Identifier & propertyName,JSValue value,PutPropertySlot & slot)225 void JSWebKitCSSKeyframesRule::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
226 {
227 lookupPut<JSWebKitCSSKeyframesRule, Base>(exec, propertyName, value, &JSWebKitCSSKeyframesRuleTable, this, slot);
228 }
229
setJSWebKitCSSKeyframesRuleName(ExecState * exec,JSObject * thisObject,JSValue value)230 void setJSWebKitCSSKeyframesRuleName(ExecState* exec, JSObject* thisObject, JSValue value)
231 {
232 JSWebKitCSSKeyframesRule* castedThis = static_cast<JSWebKitCSSKeyframesRule*>(thisObject);
233 WebKitCSSKeyframesRule* imp = static_cast<WebKitCSSKeyframesRule*>(castedThis->impl());
234 imp->setName(valueToStringWithNullCheck(exec, value));
235 }
236
237
getOwnPropertyNames(ExecState * exec,PropertyNameArray & propertyNames,EnumerationMode mode)238 void JSWebKitCSSKeyframesRule::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
239 {
240 for (unsigned i = 0; i < static_cast<WebKitCSSKeyframesRule*>(impl())->length(); ++i)
241 propertyNames.add(Identifier::from(exec, i));
242 Base::getOwnPropertyNames(exec, propertyNames, mode);
243 }
244
getConstructor(ExecState * exec,JSGlobalObject * globalObject)245 JSValue JSWebKitCSSKeyframesRule::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
246 {
247 return getDOMConstructor<JSWebKitCSSKeyframesRuleConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));
248 }
249
jsWebKitCSSKeyframesRulePrototypeFunctionInsertRule(ExecState * exec)250 EncodedJSValue JSC_HOST_CALL jsWebKitCSSKeyframesRulePrototypeFunctionInsertRule(ExecState* exec)
251 {
252 JSValue thisValue = exec->hostThisValue();
253 if (!thisValue.inherits(&JSWebKitCSSKeyframesRule::s_info))
254 return throwVMTypeError(exec);
255 JSWebKitCSSKeyframesRule* castedThis = static_cast<JSWebKitCSSKeyframesRule*>(asObject(thisValue));
256 WebKitCSSKeyframesRule* imp = static_cast<WebKitCSSKeyframesRule*>(castedThis->impl());
257 const String& rule(ustringToString(exec->argument(0).toString(exec)));
258 if (exec->hadException())
259 return JSValue::encode(jsUndefined());
260
261 imp->insertRule(rule);
262 return JSValue::encode(jsUndefined());
263 }
264
jsWebKitCSSKeyframesRulePrototypeFunctionDeleteRule(ExecState * exec)265 EncodedJSValue JSC_HOST_CALL jsWebKitCSSKeyframesRulePrototypeFunctionDeleteRule(ExecState* exec)
266 {
267 JSValue thisValue = exec->hostThisValue();
268 if (!thisValue.inherits(&JSWebKitCSSKeyframesRule::s_info))
269 return throwVMTypeError(exec);
270 JSWebKitCSSKeyframesRule* castedThis = static_cast<JSWebKitCSSKeyframesRule*>(asObject(thisValue));
271 WebKitCSSKeyframesRule* imp = static_cast<WebKitCSSKeyframesRule*>(castedThis->impl());
272 const String& key(ustringToString(exec->argument(0).toString(exec)));
273 if (exec->hadException())
274 return JSValue::encode(jsUndefined());
275
276 imp->deleteRule(key);
277 return JSValue::encode(jsUndefined());
278 }
279
jsWebKitCSSKeyframesRulePrototypeFunctionFindRule(ExecState * exec)280 EncodedJSValue JSC_HOST_CALL jsWebKitCSSKeyframesRulePrototypeFunctionFindRule(ExecState* exec)
281 {
282 JSValue thisValue = exec->hostThisValue();
283 if (!thisValue.inherits(&JSWebKitCSSKeyframesRule::s_info))
284 return throwVMTypeError(exec);
285 JSWebKitCSSKeyframesRule* castedThis = static_cast<JSWebKitCSSKeyframesRule*>(asObject(thisValue));
286 WebKitCSSKeyframesRule* imp = static_cast<WebKitCSSKeyframesRule*>(castedThis->impl());
287 const String& key(ustringToString(exec->argument(0).toString(exec)));
288 if (exec->hadException())
289 return JSValue::encode(jsUndefined());
290
291
292 JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->findRule(key)));
293 return JSValue::encode(result);
294 }
295
296
indexGetter(ExecState * exec,JSValue slotBase,unsigned index)297 JSValue JSWebKitCSSKeyframesRule::indexGetter(ExecState* exec, JSValue slotBase, unsigned index)
298 {
299 JSWebKitCSSKeyframesRule* thisObj = static_cast<JSWebKitCSSKeyframesRule*>(asObject(slotBase));
300 return toJS(exec, thisObj->globalObject(), static_cast<WebKitCSSKeyframesRule*>(thisObj->impl())->item(index));
301 }
302
303
304 }
305