diff -r 000000000000 -r 4f2f89ce4247 WebCore/generated/JSText.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/WebCore/generated/JSText.cpp Fri Sep 17 09:02:29 2010 +0300 @@ -0,0 +1,213 @@ +/* + 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 "JSText.h" + +#include "ExceptionCode.h" +#include "JSText.h" +#include "KURL.h" +#include "Text.h" +#include +#include +#include + +using namespace JSC; + +namespace WebCore { + +ASSERT_CLASS_FITS_IN_CELL(JSText); + +/* Hash table */ +#if ENABLE(JIT) +#define THUNK_GENERATOR(generator) , generator +#else +#define THUNK_GENERATOR(generator) +#endif + +static const HashTableValue JSTextTableValues[3] = +{ + { "wholeText", DontDelete | ReadOnly, (intptr_t)static_cast(jsTextWholeText), (intptr_t)0 THUNK_GENERATOR(0) }, + { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast(jsTextConstructor), (intptr_t)0 THUNK_GENERATOR(0) }, + { 0, 0, 0, 0 THUNK_GENERATOR(0) } +}; + +#undef THUNK_GENERATOR +static JSC_CONST_HASHTABLE HashTable JSTextTable = { 5, 3, JSTextTableValues, 0 }; +/* Hash table for constructor */ +#if ENABLE(JIT) +#define THUNK_GENERATOR(generator) , generator +#else +#define THUNK_GENERATOR(generator) +#endif + +static const HashTableValue JSTextConstructorTableValues[1] = +{ + { 0, 0, 0, 0 THUNK_GENERATOR(0) } +}; + +#undef THUNK_GENERATOR +static JSC_CONST_HASHTABLE HashTable JSTextConstructorTable = { 1, 0, JSTextConstructorTableValues, 0 }; +class JSTextConstructor : public DOMConstructorObject { +public: + JSTextConstructor(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 JSTextConstructor::s_info = { "TextConstructor", 0, &JSTextConstructorTable, 0 }; + +JSTextConstructor::JSTextConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) + : DOMConstructorObject(JSTextConstructor::createStructure(globalObject->objectPrototype()), globalObject) +{ + putDirect(exec->propertyNames().prototype, JSTextPrototype::self(exec, globalObject), DontDelete | ReadOnly); +} + +bool JSTextConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +{ + return getStaticValueSlot(exec, &JSTextConstructorTable, this, propertyName, slot); +} + +bool JSTextConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +{ + return getStaticValueDescriptor(exec, &JSTextConstructorTable, this, propertyName, descriptor); +} + +/* Hash table for prototype */ +#if ENABLE(JIT) +#define THUNK_GENERATOR(generator) , generator +#else +#define THUNK_GENERATOR(generator) +#endif + +static const HashTableValue JSTextPrototypeTableValues[3] = +{ + { "splitText", DontDelete | Function, (intptr_t)static_cast(jsTextPrototypeFunctionSplitText), (intptr_t)1 THUNK_GENERATOR(0) }, + { "replaceWholeText", DontDelete | Function, (intptr_t)static_cast(jsTextPrototypeFunctionReplaceWholeText), (intptr_t)1 THUNK_GENERATOR(0) }, + { 0, 0, 0, 0 THUNK_GENERATOR(0) } +}; + +#undef THUNK_GENERATOR +static JSC_CONST_HASHTABLE HashTable JSTextPrototypeTable = { 4, 3, JSTextPrototypeTableValues, 0 }; +const ClassInfo JSTextPrototype::s_info = { "TextPrototype", 0, &JSTextPrototypeTable, 0 }; + +JSObject* JSTextPrototype::self(ExecState* exec, JSGlobalObject* globalObject) +{ + return getDOMPrototype(exec, globalObject); +} + +bool JSTextPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +{ + return getStaticFunctionSlot(exec, &JSTextPrototypeTable, this, propertyName, slot); +} + +bool JSTextPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +{ + return getStaticFunctionDescriptor(exec, &JSTextPrototypeTable, this, propertyName, descriptor); +} + +const ClassInfo JSText::s_info = { "Text", &JSCharacterData::s_info, &JSTextTable, 0 }; + +JSText::JSText(NonNullPassRefPtr structure, JSDOMGlobalObject* globalObject, PassRefPtr impl) + : JSCharacterData(structure, globalObject, impl) +{ +} + +JSObject* JSText::createPrototype(ExecState* exec, JSGlobalObject* globalObject) +{ + return new (exec) JSTextPrototype(globalObject, JSTextPrototype::createStructure(JSCharacterDataPrototype::self(exec, globalObject))); +} + +bool JSText::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +{ + return getStaticValueSlot(exec, &JSTextTable, this, propertyName, slot); +} + +bool JSText::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +{ + return getStaticValueDescriptor(exec, &JSTextTable, this, propertyName, descriptor); +} + +JSValue jsTextWholeText(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSText* castedThis = static_cast(asObject(slotBase)); + UNUSED_PARAM(exec); + Text* imp = static_cast(castedThis->impl()); + JSValue result = jsString(exec, imp->wholeText()); + return result; +} + +JSValue jsTextConstructor(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSText* domObject = static_cast(asObject(slotBase)); + return JSText::getConstructor(exec, domObject->globalObject()); +} +JSValue JSText::getConstructor(ExecState* exec, JSGlobalObject* globalObject) +{ + return getDOMConstructor(exec, static_cast(globalObject)); +} + +EncodedJSValue JSC_HOST_CALL jsTextPrototypeFunctionSplitText(ExecState* exec) +{ + JSValue thisValue = exec->hostThisValue(); + if (!thisValue.inherits(&JSText::s_info)) + return throwVMTypeError(exec); + JSText* castedThis = static_cast(asObject(thisValue)); + Text* imp = static_cast(castedThis->impl()); + ExceptionCode ec = 0; + int offset = exec->argument(0).toInt32(exec); + if (offset < 0) { + setDOMException(exec, INDEX_SIZE_ERR); + return JSValue::encode(jsUndefined()); + } + + + JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->splitText(offset, ec))); + setDOMException(exec, ec); + return JSValue::encode(result); +} + +EncodedJSValue JSC_HOST_CALL jsTextPrototypeFunctionReplaceWholeText(ExecState* exec) +{ + JSValue thisValue = exec->hostThisValue(); + if (!thisValue.inherits(&JSText::s_info)) + return throwVMTypeError(exec); + JSText* castedThis = static_cast(asObject(thisValue)); + Text* imp = static_cast(castedThis->impl()); + ExceptionCode ec = 0; + const String& content = ustringToString(exec->argument(0).toString(exec)); + + + JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->replaceWholeText(content, ec))); + setDOMException(exec, ec); + return JSValue::encode(result); +} + + +}