diff -r 000000000000 -r 4f2f89ce4247 WebCore/generated/JSHTMLFormElement.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/WebCore/generated/JSHTMLFormElement.cpp Fri Sep 17 09:02:29 2010 +0300 @@ -0,0 +1,422 @@ +/* + This file is part of the WebKit open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "config.h" +#include "JSHTMLFormElement.h" + +#include "AtomicString.h" +#include "HTMLCollection.h" +#include "HTMLFormElement.h" +#include "HTMLNames.h" +#include "JSHTMLCollection.h" +#include "KURL.h" +#include +#include +#include +#include +#include + +using namespace JSC; + +namespace WebCore { + +ASSERT_CLASS_FITS_IN_CELL(JSHTMLFormElement); + +/* Hash table */ +#if ENABLE(JIT) +#define THUNK_GENERATOR(generator) , generator +#else +#define THUNK_GENERATOR(generator) +#endif + +static const HashTableValue JSHTMLFormElementTableValues[12] = +{ + { "elements", DontDelete | ReadOnly, (intptr_t)static_cast(jsHTMLFormElementElements), (intptr_t)0 THUNK_GENERATOR(0) }, + { "length", DontDelete | ReadOnly, (intptr_t)static_cast(jsHTMLFormElementLength), (intptr_t)0 THUNK_GENERATOR(0) }, + { "name", DontDelete, (intptr_t)static_cast(jsHTMLFormElementName), (intptr_t)setJSHTMLFormElementName THUNK_GENERATOR(0) }, + { "noValidate", DontDelete, (intptr_t)static_cast(jsHTMLFormElementNoValidate), (intptr_t)setJSHTMLFormElementNoValidate THUNK_GENERATOR(0) }, + { "acceptCharset", DontDelete, (intptr_t)static_cast(jsHTMLFormElementAcceptCharset), (intptr_t)setJSHTMLFormElementAcceptCharset THUNK_GENERATOR(0) }, + { "action", DontDelete, (intptr_t)static_cast(jsHTMLFormElementAction), (intptr_t)setJSHTMLFormElementAction THUNK_GENERATOR(0) }, + { "encoding", DontDelete, (intptr_t)static_cast(jsHTMLFormElementEncoding), (intptr_t)setJSHTMLFormElementEncoding THUNK_GENERATOR(0) }, + { "enctype", DontDelete, (intptr_t)static_cast(jsHTMLFormElementEnctype), (intptr_t)setJSHTMLFormElementEnctype THUNK_GENERATOR(0) }, + { "method", DontDelete, (intptr_t)static_cast(jsHTMLFormElementMethod), (intptr_t)setJSHTMLFormElementMethod THUNK_GENERATOR(0) }, + { "target", DontDelete, (intptr_t)static_cast(jsHTMLFormElementTarget), (intptr_t)setJSHTMLFormElementTarget THUNK_GENERATOR(0) }, + { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast(jsHTMLFormElementConstructor), (intptr_t)0 THUNK_GENERATOR(0) }, + { 0, 0, 0, 0 THUNK_GENERATOR(0) } +}; + +#undef THUNK_GENERATOR +static JSC_CONST_HASHTABLE HashTable JSHTMLFormElementTable = { 35, 31, JSHTMLFormElementTableValues, 0 }; +/* Hash table for constructor */ +#if ENABLE(JIT) +#define THUNK_GENERATOR(generator) , generator +#else +#define THUNK_GENERATOR(generator) +#endif + +static const HashTableValue JSHTMLFormElementConstructorTableValues[1] = +{ + { 0, 0, 0, 0 THUNK_GENERATOR(0) } +}; + +#undef THUNK_GENERATOR +static JSC_CONST_HASHTABLE HashTable JSHTMLFormElementConstructorTable = { 1, 0, JSHTMLFormElementConstructorTableValues, 0 }; +class JSHTMLFormElementConstructor : public DOMConstructorObject { +public: + JSHTMLFormElementConstructor(JSC::ExecState*, JSDOMGlobalObject*); + + virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&); + virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&); + virtual const JSC::ClassInfo* classInfo() const { return &s_info; } + static const JSC::ClassInfo s_info; + static PassRefPtr createStructure(JSC::JSValue prototype) + { + return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount); + } +protected: + static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::ImplementsHasInstance | DOMConstructorObject::StructureFlags; +}; + +const ClassInfo JSHTMLFormElementConstructor::s_info = { "HTMLFormElementConstructor", 0, &JSHTMLFormElementConstructorTable, 0 }; + +JSHTMLFormElementConstructor::JSHTMLFormElementConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) + : DOMConstructorObject(JSHTMLFormElementConstructor::createStructure(globalObject->objectPrototype()), globalObject) +{ + putDirect(exec->propertyNames().prototype, JSHTMLFormElementPrototype::self(exec, globalObject), DontDelete | ReadOnly); +} + +bool JSHTMLFormElementConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +{ + return getStaticValueSlot(exec, &JSHTMLFormElementConstructorTable, this, propertyName, slot); +} + +bool JSHTMLFormElementConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +{ + return getStaticValueDescriptor(exec, &JSHTMLFormElementConstructorTable, this, propertyName, descriptor); +} + +/* Hash table for prototype */ +#if ENABLE(JIT) +#define THUNK_GENERATOR(generator) , generator +#else +#define THUNK_GENERATOR(generator) +#endif + +static const HashTableValue JSHTMLFormElementPrototypeTableValues[4] = +{ + { "submit", DontDelete | Function, (intptr_t)static_cast(jsHTMLFormElementPrototypeFunctionSubmit), (intptr_t)0 THUNK_GENERATOR(0) }, + { "reset", DontDelete | Function, (intptr_t)static_cast(jsHTMLFormElementPrototypeFunctionReset), (intptr_t)0 THUNK_GENERATOR(0) }, + { "checkValidity", DontDelete | Function, (intptr_t)static_cast(jsHTMLFormElementPrototypeFunctionCheckValidity), (intptr_t)0 THUNK_GENERATOR(0) }, + { 0, 0, 0, 0 THUNK_GENERATOR(0) } +}; + +#undef THUNK_GENERATOR +static JSC_CONST_HASHTABLE HashTable JSHTMLFormElementPrototypeTable = { 9, 7, JSHTMLFormElementPrototypeTableValues, 0 }; +const ClassInfo JSHTMLFormElementPrototype::s_info = { "HTMLFormElementPrototype", 0, &JSHTMLFormElementPrototypeTable, 0 }; + +JSObject* JSHTMLFormElementPrototype::self(ExecState* exec, JSGlobalObject* globalObject) +{ + return getDOMPrototype(exec, globalObject); +} + +bool JSHTMLFormElementPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +{ + return getStaticFunctionSlot(exec, &JSHTMLFormElementPrototypeTable, this, propertyName, slot); +} + +bool JSHTMLFormElementPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +{ + return getStaticFunctionDescriptor(exec, &JSHTMLFormElementPrototypeTable, this, propertyName, descriptor); +} + +const ClassInfo JSHTMLFormElement::s_info = { "HTMLFormElement", &JSHTMLElement::s_info, &JSHTMLFormElementTable, 0 }; + +JSHTMLFormElement::JSHTMLFormElement(NonNullPassRefPtr structure, JSDOMGlobalObject* globalObject, PassRefPtr impl) + : JSHTMLElement(structure, globalObject, impl) +{ +} + +JSObject* JSHTMLFormElement::createPrototype(ExecState* exec, JSGlobalObject* globalObject) +{ + return new (exec) JSHTMLFormElementPrototype(globalObject, JSHTMLFormElementPrototype::createStructure(JSHTMLElementPrototype::self(exec, globalObject))); +} + +bool JSHTMLFormElement::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +{ + bool ok; + unsigned index = propertyName.toUInt32(&ok, false); + if (ok && index < static_cast(impl())->length()) { + slot.setCustomIndex(this, index, indexGetter); + return true; + } + if (canGetItemsForName(exec, static_cast(impl()), propertyName)) { + slot.setCustom(this, nameGetter); + return true; + } + const HashEntry* entry = JSHTMLFormElementTable.entry(exec, propertyName); + if (entry) { + slot.setCustom(this, entry->propertyGetter()); + return true; + } + return getStaticValueSlot(exec, &JSHTMLFormElementTable, this, propertyName, slot); +} + +bool JSHTMLFormElement::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +{ + bool ok; + unsigned index = propertyName.toUInt32(&ok, false); + if (ok && index < static_cast(impl())->length()) { + PropertySlot slot; + slot.setCustomIndex(this, index, indexGetter); + descriptor.setDescriptor(slot.getValue(exec, propertyName), DontDelete | ReadOnly); + return true; + } + if (canGetItemsForName(exec, static_cast(impl()), propertyName)) { + PropertySlot slot; + slot.setCustom(this, nameGetter); + descriptor.setDescriptor(slot.getValue(exec, propertyName), ReadOnly | DontDelete | DontEnum); + return true; + } + const HashEntry* entry = JSHTMLFormElementTable.entry(exec, propertyName); + if (entry) { + PropertySlot slot; + slot.setCustom(this, entry->propertyGetter()); + descriptor.setDescriptor(slot.getValue(exec, propertyName), entry->attributes()); + return true; + } + return getStaticValueDescriptor(exec, &JSHTMLFormElementTable, this, propertyName, descriptor); +} + +JSValue jsHTMLFormElementElements(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSHTMLFormElement* castedThis = static_cast(asObject(slotBase)); + UNUSED_PARAM(exec); + HTMLFormElement* imp = static_cast(castedThis->impl()); + JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->elements())); + return result; +} + +JSValue jsHTMLFormElementLength(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSHTMLFormElement* castedThis = static_cast(asObject(slotBase)); + UNUSED_PARAM(exec); + HTMLFormElement* imp = static_cast(castedThis->impl()); + JSValue result = jsNumber(exec, imp->length()); + return result; +} + +JSValue jsHTMLFormElementName(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSHTMLFormElement* castedThis = static_cast(asObject(slotBase)); + UNUSED_PARAM(exec); + HTMLFormElement* imp = static_cast(castedThis->impl()); + JSValue result = jsString(exec, imp->getAttribute(WebCore::HTMLNames::nameAttr)); + return result; +} + +JSValue jsHTMLFormElementNoValidate(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSHTMLFormElement* castedThis = static_cast(asObject(slotBase)); + UNUSED_PARAM(exec); + HTMLFormElement* imp = static_cast(castedThis->impl()); + JSValue result = jsBoolean(imp->hasAttribute(WebCore::HTMLNames::novalidateAttr)); + return result; +} + +JSValue jsHTMLFormElementAcceptCharset(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSHTMLFormElement* castedThis = static_cast(asObject(slotBase)); + UNUSED_PARAM(exec); + HTMLFormElement* imp = static_cast(castedThis->impl()); + JSValue result = jsString(exec, imp->getAttribute(WebCore::HTMLNames::accept_charsetAttr)); + return result; +} + +JSValue jsHTMLFormElementAction(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSHTMLFormElement* castedThis = static_cast(asObject(slotBase)); + UNUSED_PARAM(exec); + HTMLFormElement* imp = static_cast(castedThis->impl()); + JSValue result = jsString(exec, imp->getAttribute(WebCore::HTMLNames::actionAttr)); + return result; +} + +JSValue jsHTMLFormElementEncoding(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSHTMLFormElement* castedThis = static_cast(asObject(slotBase)); + UNUSED_PARAM(exec); + HTMLFormElement* imp = static_cast(castedThis->impl()); + JSValue result = jsString(exec, imp->encoding()); + return result; +} + +JSValue jsHTMLFormElementEnctype(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSHTMLFormElement* castedThis = static_cast(asObject(slotBase)); + UNUSED_PARAM(exec); + HTMLFormElement* imp = static_cast(castedThis->impl()); + JSValue result = jsString(exec, imp->enctype()); + return result; +} + +JSValue jsHTMLFormElementMethod(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSHTMLFormElement* castedThis = static_cast(asObject(slotBase)); + UNUSED_PARAM(exec); + HTMLFormElement* imp = static_cast(castedThis->impl()); + JSValue result = jsString(exec, imp->getAttribute(WebCore::HTMLNames::methodAttr)); + return result; +} + +JSValue jsHTMLFormElementTarget(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSHTMLFormElement* castedThis = static_cast(asObject(slotBase)); + UNUSED_PARAM(exec); + HTMLFormElement* imp = static_cast(castedThis->impl()); + JSValue result = jsString(exec, imp->getAttribute(WebCore::HTMLNames::targetAttr)); + return result; +} + +JSValue jsHTMLFormElementConstructor(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSHTMLFormElement* domObject = static_cast(asObject(slotBase)); + return JSHTMLFormElement::getConstructor(exec, domObject->globalObject()); +} +void JSHTMLFormElement::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) +{ + lookupPut(exec, propertyName, value, &JSHTMLFormElementTable, this, slot); +} + +void setJSHTMLFormElementName(ExecState* exec, JSObject* thisObject, JSValue value) +{ + JSHTMLFormElement* castedThis = static_cast(thisObject); + HTMLFormElement* imp = static_cast(castedThis->impl()); + imp->setAttribute(WebCore::HTMLNames::nameAttr, valueToStringWithNullCheck(exec, value)); +} + +void setJSHTMLFormElementNoValidate(ExecState* exec, JSObject* thisObject, JSValue value) +{ + JSHTMLFormElement* castedThis = static_cast(thisObject); + HTMLFormElement* imp = static_cast(castedThis->impl()); + imp->setBooleanAttribute(WebCore::HTMLNames::novalidateAttr, value.toBoolean(exec)); +} + +void setJSHTMLFormElementAcceptCharset(ExecState* exec, JSObject* thisObject, JSValue value) +{ + JSHTMLFormElement* castedThis = static_cast(thisObject); + HTMLFormElement* imp = static_cast(castedThis->impl()); + imp->setAttribute(WebCore::HTMLNames::accept_charsetAttr, valueToStringWithNullCheck(exec, value)); +} + +void setJSHTMLFormElementAction(ExecState* exec, JSObject* thisObject, JSValue value) +{ + JSHTMLFormElement* castedThis = static_cast(thisObject); + HTMLFormElement* imp = static_cast(castedThis->impl()); + imp->setAttribute(WebCore::HTMLNames::actionAttr, valueToStringWithNullCheck(exec, value)); +} + +void setJSHTMLFormElementEncoding(ExecState* exec, JSObject* thisObject, JSValue value) +{ + JSHTMLFormElement* castedThis = static_cast(thisObject); + HTMLFormElement* imp = static_cast(castedThis->impl()); + imp->setEncoding(valueToStringWithNullCheck(exec, value)); +} + +void setJSHTMLFormElementEnctype(ExecState* exec, JSObject* thisObject, JSValue value) +{ + JSHTMLFormElement* castedThis = static_cast(thisObject); + HTMLFormElement* imp = static_cast(castedThis->impl()); + imp->setEnctype(valueToStringWithNullCheck(exec, value)); +} + +void setJSHTMLFormElementMethod(ExecState* exec, JSObject* thisObject, JSValue value) +{ + JSHTMLFormElement* castedThis = static_cast(thisObject); + HTMLFormElement* imp = static_cast(castedThis->impl()); + imp->setAttribute(WebCore::HTMLNames::methodAttr, valueToStringWithNullCheck(exec, value)); +} + +void setJSHTMLFormElementTarget(ExecState* exec, JSObject* thisObject, JSValue value) +{ + JSHTMLFormElement* castedThis = static_cast(thisObject); + HTMLFormElement* imp = static_cast(castedThis->impl()); + imp->setAttribute(WebCore::HTMLNames::targetAttr, valueToStringWithNullCheck(exec, value)); +} + +void JSHTMLFormElement::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode) +{ + for (unsigned i = 0; i < static_cast(impl())->length(); ++i) + propertyNames.add(Identifier::from(exec, i)); + Base::getOwnPropertyNames(exec, propertyNames, mode); +} + +JSValue JSHTMLFormElement::getConstructor(ExecState* exec, JSGlobalObject* globalObject) +{ + return getDOMConstructor(exec, static_cast(globalObject)); +} + +EncodedJSValue JSC_HOST_CALL jsHTMLFormElementPrototypeFunctionSubmit(ExecState* exec) +{ + JSValue thisValue = exec->hostThisValue(); + if (!thisValue.inherits(&JSHTMLFormElement::s_info)) + return throwVMTypeError(exec); + JSHTMLFormElement* castedThis = static_cast(asObject(thisValue)); + HTMLFormElement* imp = static_cast(castedThis->impl()); + Frame* dynamicFrame = toDynamicFrame(exec); + if (!dynamicFrame) + return JSValue::encode(jsUndefined()); + + imp->submit(dynamicFrame); + return JSValue::encode(jsUndefined()); +} + +EncodedJSValue JSC_HOST_CALL jsHTMLFormElementPrototypeFunctionReset(ExecState* exec) +{ + JSValue thisValue = exec->hostThisValue(); + if (!thisValue.inherits(&JSHTMLFormElement::s_info)) + return throwVMTypeError(exec); + JSHTMLFormElement* castedThis = static_cast(asObject(thisValue)); + HTMLFormElement* imp = static_cast(castedThis->impl()); + + imp->reset(); + return JSValue::encode(jsUndefined()); +} + +EncodedJSValue JSC_HOST_CALL jsHTMLFormElementPrototypeFunctionCheckValidity(ExecState* exec) +{ + JSValue thisValue = exec->hostThisValue(); + if (!thisValue.inherits(&JSHTMLFormElement::s_info)) + return throwVMTypeError(exec); + JSHTMLFormElement* castedThis = static_cast(asObject(thisValue)); + HTMLFormElement* imp = static_cast(castedThis->impl()); + + + JSC::JSValue result = jsBoolean(imp->checkValidity()); + return JSValue::encode(result); +} + + +JSValue JSHTMLFormElement::indexGetter(ExecState* exec, JSValue slotBase, unsigned index) +{ + JSHTMLFormElement* thisObj = static_cast(asObject(slotBase)); + return toJS(exec, thisObj->globalObject(), static_cast(thisObj->impl())->item(index)); +} + +}