WebCore/generated/JSWebKitCSSKeyframesRule.cpp
changeset 0 4f2f89ce4247
equal deleted inserted replaced
-1:000000000000 0:4f2f89ce4247
       
     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 "JSCSSRuleList.h"
       
    26 #include "JSWebKitCSSKeyframeRule.h"
       
    27 #include "KURL.h"
       
    28 #include "WebKitCSSKeyframeRule.h"
       
    29 #include "WebKitCSSKeyframesRule.h"
       
    30 #include <runtime/Error.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(JSWebKitCSSKeyframesRule);
       
    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 JSWebKitCSSKeyframesRuleTableValues[4] =
       
    48 {
       
    49     { "name", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWebKitCSSKeyframesRuleName), (intptr_t)setJSWebKitCSSKeyframesRuleName THUNK_GENERATOR(0) },
       
    50     { "cssRules", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWebKitCSSKeyframesRuleCssRules), (intptr_t)0 THUNK_GENERATOR(0) },
       
    51     { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWebKitCSSKeyframesRuleConstructor), (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 JSWebKitCSSKeyframesRuleTable = { 9, 7, JSWebKitCSSKeyframesRuleTableValues, 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 JSWebKitCSSKeyframesRuleConstructorTableValues[1] =
       
    65 {
       
    66     { 0, 0, 0, 0 THUNK_GENERATOR(0) }
       
    67 };
       
    68 
       
    69 #undef THUNK_GENERATOR
       
    70 static JSC_CONST_HASHTABLE HashTable JSWebKitCSSKeyframesRuleConstructorTable = { 1, 0, JSWebKitCSSKeyframesRuleConstructorTableValues, 0 };
       
    71 class JSWebKitCSSKeyframesRuleConstructor : public DOMConstructorObject {
       
    72 public:
       
    73     JSWebKitCSSKeyframesRuleConstructor(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 JSWebKitCSSKeyframesRuleConstructor::s_info = { "WebKitCSSKeyframesRuleConstructor", 0, &JSWebKitCSSKeyframesRuleConstructorTable, 0 };
       
    88 
       
    89 JSWebKitCSSKeyframesRuleConstructor::JSWebKitCSSKeyframesRuleConstructor(ExecState* exec, JSDOMGlobalObject* globalObject)
       
    90     : DOMConstructorObject(JSWebKitCSSKeyframesRuleConstructor::createStructure(globalObject->objectPrototype()), globalObject)
       
    91 {
       
    92     putDirect(exec->propertyNames().prototype, JSWebKitCSSKeyframesRulePrototype::self(exec, globalObject), DontDelete | ReadOnly);
       
    93 }
       
    94 
       
    95 bool JSWebKitCSSKeyframesRuleConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
    96 {
       
    97     return getStaticValueSlot<JSWebKitCSSKeyframesRuleConstructor, DOMObject>(exec, &JSWebKitCSSKeyframesRuleConstructorTable, this, propertyName, slot);
       
    98 }
       
    99 
       
   100 bool JSWebKitCSSKeyframesRuleConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
       
   101 {
       
   102     return getStaticValueDescriptor<JSWebKitCSSKeyframesRuleConstructor, DOMObject>(exec, &JSWebKitCSSKeyframesRuleConstructorTable, 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 JSWebKitCSSKeyframesRulePrototypeTableValues[4] =
       
   113 {
       
   114     { "insertRule", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsWebKitCSSKeyframesRulePrototypeFunctionInsertRule), (intptr_t)1 THUNK_GENERATOR(0) },
       
   115     { "deleteRule", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsWebKitCSSKeyframesRulePrototypeFunctionDeleteRule), (intptr_t)1 THUNK_GENERATOR(0) },
       
   116     { "findRule", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsWebKitCSSKeyframesRulePrototypeFunctionFindRule), (intptr_t)1 THUNK_GENERATOR(0) },
       
   117     { 0, 0, 0, 0 THUNK_GENERATOR(0) }
       
   118 };
       
   119 
       
   120 #undef THUNK_GENERATOR
       
   121 static JSC_CONST_HASHTABLE HashTable JSWebKitCSSKeyframesRulePrototypeTable = { 8, 7, JSWebKitCSSKeyframesRulePrototypeTableValues, 0 };
       
   122 const ClassInfo JSWebKitCSSKeyframesRulePrototype::s_info = { "WebKitCSSKeyframesRulePrototype", 0, &JSWebKitCSSKeyframesRulePrototypeTable, 0 };
       
   123 
       
   124 JSObject* JSWebKitCSSKeyframesRulePrototype::self(ExecState* exec, JSGlobalObject* globalObject)
       
   125 {
       
   126     return getDOMPrototype<JSWebKitCSSKeyframesRule>(exec, globalObject);
       
   127 }
       
   128 
       
   129 bool JSWebKitCSSKeyframesRulePrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
   130 {
       
   131     return getStaticFunctionSlot<JSObject>(exec, &JSWebKitCSSKeyframesRulePrototypeTable, this, propertyName, slot);
       
   132 }
       
   133 
       
   134 bool JSWebKitCSSKeyframesRulePrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
       
   135 {
       
   136     return getStaticFunctionDescriptor<JSObject>(exec, &JSWebKitCSSKeyframesRulePrototypeTable, this, propertyName, descriptor);
       
   137 }
       
   138 
       
   139 const ClassInfo JSWebKitCSSKeyframesRule::s_info = { "WebKitCSSKeyframesRule", &JSCSSRule::s_info, &JSWebKitCSSKeyframesRuleTable, 0 };
       
   140 
       
   141 JSWebKitCSSKeyframesRule::JSWebKitCSSKeyframesRule(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<WebKitCSSKeyframesRule> impl)
       
   142     : JSCSSRule(structure, globalObject, impl)
       
   143 {
       
   144 }
       
   145 
       
   146 JSObject* JSWebKitCSSKeyframesRule::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
       
   147 {
       
   148     return new (exec) JSWebKitCSSKeyframesRulePrototype(globalObject, JSWebKitCSSKeyframesRulePrototype::createStructure(JSCSSRulePrototype::self(exec, globalObject)));
       
   149 }
       
   150 
       
   151 bool JSWebKitCSSKeyframesRule::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
   152 {
       
   153     const HashEntry* entry = JSWebKitCSSKeyframesRuleTable.entry(exec, propertyName);
       
   154     if (entry) {
       
   155         slot.setCustom(this, entry->propertyGetter());
       
   156         return true;
       
   157     }
       
   158     bool ok;
       
   159     unsigned index = propertyName.toUInt32(&ok, false);
       
   160     if (ok && index < static_cast<WebKitCSSKeyframesRule*>(impl())->length()) {
       
   161         slot.setCustomIndex(this, index, indexGetter);
       
   162         return true;
       
   163     }
       
   164     return getStaticValueSlot<JSWebKitCSSKeyframesRule, Base>(exec, &JSWebKitCSSKeyframesRuleTable, this, propertyName, slot);
       
   165 }
       
   166 
       
   167 bool JSWebKitCSSKeyframesRule::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
       
   168 {
       
   169     const HashEntry* entry = JSWebKitCSSKeyframesRuleTable.entry(exec, propertyName);
       
   170     if (entry) {
       
   171         PropertySlot slot;
       
   172         slot.setCustom(this, entry->propertyGetter());
       
   173         descriptor.setDescriptor(slot.getValue(exec, propertyName), entry->attributes());
       
   174         return true;
       
   175     }
       
   176     bool ok;
       
   177     unsigned index = propertyName.toUInt32(&ok, false);
       
   178     if (ok && index < static_cast<WebKitCSSKeyframesRule*>(impl())->length()) {
       
   179         PropertySlot slot;
       
   180         slot.setCustomIndex(this, index, indexGetter);
       
   181         descriptor.setDescriptor(slot.getValue(exec, propertyName), DontDelete | ReadOnly);
       
   182         return true;
       
   183     }
       
   184     return getStaticValueDescriptor<JSWebKitCSSKeyframesRule, Base>(exec, &JSWebKitCSSKeyframesRuleTable, this, propertyName, descriptor);
       
   185 }
       
   186 
       
   187 bool JSWebKitCSSKeyframesRule::getOwnPropertySlot(ExecState* exec, unsigned propertyName, PropertySlot& slot)
       
   188 {
       
   189     if (propertyName < static_cast<WebKitCSSKeyframesRule*>(impl())->length()) {
       
   190         slot.setCustomIndex(this, propertyName, indexGetter);
       
   191         return true;
       
   192     }
       
   193     return getOwnPropertySlot(exec, Identifier::from(exec, propertyName), slot);
       
   194 }
       
   195 
       
   196 JSValue jsWebKitCSSKeyframesRuleName(ExecState* exec, JSValue slotBase, const Identifier&)
       
   197 {
       
   198     JSWebKitCSSKeyframesRule* castedThis = static_cast<JSWebKitCSSKeyframesRule*>(asObject(slotBase));
       
   199     UNUSED_PARAM(exec);
       
   200     WebKitCSSKeyframesRule* imp = static_cast<WebKitCSSKeyframesRule*>(castedThis->impl());
       
   201     JSValue result = jsStringOrNull(exec, imp->name());
       
   202     return result;
       
   203 }
       
   204 
       
   205 JSValue jsWebKitCSSKeyframesRuleCssRules(ExecState* exec, JSValue slotBase, const Identifier&)
       
   206 {
       
   207     JSWebKitCSSKeyframesRule* castedThis = static_cast<JSWebKitCSSKeyframesRule*>(asObject(slotBase));
       
   208     UNUSED_PARAM(exec);
       
   209     WebKitCSSKeyframesRule* imp = static_cast<WebKitCSSKeyframesRule*>(castedThis->impl());
       
   210     JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->cssRules()));
       
   211     return result;
       
   212 }
       
   213 
       
   214 JSValue jsWebKitCSSKeyframesRuleConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
       
   215 {
       
   216     JSWebKitCSSKeyframesRule* domObject = static_cast<JSWebKitCSSKeyframesRule*>(asObject(slotBase));
       
   217     return JSWebKitCSSKeyframesRule::getConstructor(exec, domObject->globalObject());
       
   218 }
       
   219 void JSWebKitCSSKeyframesRule::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
       
   220 {
       
   221     lookupPut<JSWebKitCSSKeyframesRule, Base>(exec, propertyName, value, &JSWebKitCSSKeyframesRuleTable, this, slot);
       
   222 }
       
   223 
       
   224 void setJSWebKitCSSKeyframesRuleName(ExecState* exec, JSObject* thisObject, JSValue value)
       
   225 {
       
   226     JSWebKitCSSKeyframesRule* castedThis = static_cast<JSWebKitCSSKeyframesRule*>(thisObject);
       
   227     WebKitCSSKeyframesRule* imp = static_cast<WebKitCSSKeyframesRule*>(castedThis->impl());
       
   228     imp->setName(valueToStringWithNullCheck(exec, value));
       
   229 }
       
   230 
       
   231 void JSWebKitCSSKeyframesRule::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
       
   232 {
       
   233     for (unsigned i = 0; i < static_cast<WebKitCSSKeyframesRule*>(impl())->length(); ++i)
       
   234         propertyNames.add(Identifier::from(exec, i));
       
   235      Base::getOwnPropertyNames(exec, propertyNames, mode);
       
   236 }
       
   237 
       
   238 JSValue JSWebKitCSSKeyframesRule::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
       
   239 {
       
   240     return getDOMConstructor<JSWebKitCSSKeyframesRuleConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));
       
   241 }
       
   242 
       
   243 EncodedJSValue JSC_HOST_CALL jsWebKitCSSKeyframesRulePrototypeFunctionInsertRule(ExecState* exec)
       
   244 {
       
   245     JSValue thisValue = exec->hostThisValue();
       
   246     if (!thisValue.inherits(&JSWebKitCSSKeyframesRule::s_info))
       
   247         return throwVMTypeError(exec);
       
   248     JSWebKitCSSKeyframesRule* castedThis = static_cast<JSWebKitCSSKeyframesRule*>(asObject(thisValue));
       
   249     WebKitCSSKeyframesRule* imp = static_cast<WebKitCSSKeyframesRule*>(castedThis->impl());
       
   250     const String& rule = ustringToString(exec->argument(0).toString(exec));
       
   251 
       
   252     imp->insertRule(rule);
       
   253     return JSValue::encode(jsUndefined());
       
   254 }
       
   255 
       
   256 EncodedJSValue JSC_HOST_CALL jsWebKitCSSKeyframesRulePrototypeFunctionDeleteRule(ExecState* exec)
       
   257 {
       
   258     JSValue thisValue = exec->hostThisValue();
       
   259     if (!thisValue.inherits(&JSWebKitCSSKeyframesRule::s_info))
       
   260         return throwVMTypeError(exec);
       
   261     JSWebKitCSSKeyframesRule* castedThis = static_cast<JSWebKitCSSKeyframesRule*>(asObject(thisValue));
       
   262     WebKitCSSKeyframesRule* imp = static_cast<WebKitCSSKeyframesRule*>(castedThis->impl());
       
   263     const String& key = ustringToString(exec->argument(0).toString(exec));
       
   264 
       
   265     imp->deleteRule(key);
       
   266     return JSValue::encode(jsUndefined());
       
   267 }
       
   268 
       
   269 EncodedJSValue JSC_HOST_CALL jsWebKitCSSKeyframesRulePrototypeFunctionFindRule(ExecState* exec)
       
   270 {
       
   271     JSValue thisValue = exec->hostThisValue();
       
   272     if (!thisValue.inherits(&JSWebKitCSSKeyframesRule::s_info))
       
   273         return throwVMTypeError(exec);
       
   274     JSWebKitCSSKeyframesRule* castedThis = static_cast<JSWebKitCSSKeyframesRule*>(asObject(thisValue));
       
   275     WebKitCSSKeyframesRule* imp = static_cast<WebKitCSSKeyframesRule*>(castedThis->impl());
       
   276     const String& key = ustringToString(exec->argument(0).toString(exec));
       
   277 
       
   278 
       
   279     JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->findRule(key)));
       
   280     return JSValue::encode(result);
       
   281 }
       
   282 
       
   283 
       
   284 JSValue JSWebKitCSSKeyframesRule::indexGetter(ExecState* exec, JSValue slotBase, unsigned index)
       
   285 {
       
   286     JSWebKitCSSKeyframesRule* thisObj = static_cast<JSWebKitCSSKeyframesRule*>(asObject(slotBase));
       
   287     return toJS(exec, thisObj->globalObject(), static_cast<WebKitCSSKeyframesRule*>(thisObj->impl())->item(index));
       
   288 }
       
   289 
       
   290 }