WebCore/generated/JSClipboard.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 "JSClipboard.h"
       
    23 
       
    24 #include "Clipboard.h"
       
    25 #include "FileList.h"
       
    26 #include "JSFileList.h"
       
    27 #include "KURL.h"
       
    28 #include <runtime/Error.h>
       
    29 #include <wtf/GetPtr.h>
       
    30 
       
    31 using namespace JSC;
       
    32 
       
    33 namespace WebCore {
       
    34 
       
    35 ASSERT_CLASS_FITS_IN_CELL(JSClipboard);
       
    36 
       
    37 /* Hash table */
       
    38 #if ENABLE(JIT)
       
    39 #define THUNK_GENERATOR(generator) , generator
       
    40 #else
       
    41 #define THUNK_GENERATOR(generator)
       
    42 #endif
       
    43 
       
    44 static const HashTableValue JSClipboardTableValues[6] =
       
    45 {
       
    46     { "dropEffect", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsClipboardDropEffect), (intptr_t)setJSClipboardDropEffect THUNK_GENERATOR(0) },
       
    47     { "effectAllowed", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsClipboardEffectAllowed), (intptr_t)setJSClipboardEffectAllowed THUNK_GENERATOR(0) },
       
    48     { "types", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsClipboardTypes), (intptr_t)0 THUNK_GENERATOR(0) },
       
    49     { "files", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsClipboardFiles), (intptr_t)0 THUNK_GENERATOR(0) },
       
    50     { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsClipboardConstructor), (intptr_t)0 THUNK_GENERATOR(0) },
       
    51     { 0, 0, 0, 0 THUNK_GENERATOR(0) }
       
    52 };
       
    53 
       
    54 #undef THUNK_GENERATOR
       
    55 static JSC_CONST_HASHTABLE HashTable JSClipboardTable = { 17, 15, JSClipboardTableValues, 0 };
       
    56 /* Hash table for constructor */
       
    57 #if ENABLE(JIT)
       
    58 #define THUNK_GENERATOR(generator) , generator
       
    59 #else
       
    60 #define THUNK_GENERATOR(generator)
       
    61 #endif
       
    62 
       
    63 static const HashTableValue JSClipboardConstructorTableValues[1] =
       
    64 {
       
    65     { 0, 0, 0, 0 THUNK_GENERATOR(0) }
       
    66 };
       
    67 
       
    68 #undef THUNK_GENERATOR
       
    69 static JSC_CONST_HASHTABLE HashTable JSClipboardConstructorTable = { 1, 0, JSClipboardConstructorTableValues, 0 };
       
    70 class JSClipboardConstructor : public DOMConstructorObject {
       
    71 public:
       
    72     JSClipboardConstructor(JSC::ExecState*, JSDOMGlobalObject*);
       
    73 
       
    74     virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&);
       
    75     virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&);
       
    76     virtual const JSC::ClassInfo* classInfo() const { return &s_info; }
       
    77     static const JSC::ClassInfo s_info;
       
    78     static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype)
       
    79     {
       
    80         return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount);
       
    81     }
       
    82 protected:
       
    83     static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::ImplementsHasInstance | DOMConstructorObject::StructureFlags;
       
    84 };
       
    85 
       
    86 const ClassInfo JSClipboardConstructor::s_info = { "ClipboardConstructor", 0, &JSClipboardConstructorTable, 0 };
       
    87 
       
    88 JSClipboardConstructor::JSClipboardConstructor(ExecState* exec, JSDOMGlobalObject* globalObject)
       
    89     : DOMConstructorObject(JSClipboardConstructor::createStructure(globalObject->objectPrototype()), globalObject)
       
    90 {
       
    91     putDirect(exec->propertyNames().prototype, JSClipboardPrototype::self(exec, globalObject), DontDelete | ReadOnly);
       
    92 }
       
    93 
       
    94 bool JSClipboardConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
    95 {
       
    96     return getStaticValueSlot<JSClipboardConstructor, DOMObject>(exec, &JSClipboardConstructorTable, this, propertyName, slot);
       
    97 }
       
    98 
       
    99 bool JSClipboardConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
       
   100 {
       
   101     return getStaticValueDescriptor<JSClipboardConstructor, DOMObject>(exec, &JSClipboardConstructorTable, this, propertyName, descriptor);
       
   102 }
       
   103 
       
   104 /* Hash table for prototype */
       
   105 #if ENABLE(JIT)
       
   106 #define THUNK_GENERATOR(generator) , generator
       
   107 #else
       
   108 #define THUNK_GENERATOR(generator)
       
   109 #endif
       
   110 
       
   111 static const HashTableValue JSClipboardPrototypeTableValues[5] =
       
   112 {
       
   113     { "clearData", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsClipboardPrototypeFunctionClearData), (intptr_t)1 THUNK_GENERATOR(0) },
       
   114     { "getData", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsClipboardPrototypeFunctionGetData), (intptr_t)1 THUNK_GENERATOR(0) },
       
   115     { "setData", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsClipboardPrototypeFunctionSetData), (intptr_t)2 THUNK_GENERATOR(0) },
       
   116     { "setDragImage", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsClipboardPrototypeFunctionSetDragImage), (intptr_t)3 THUNK_GENERATOR(0) },
       
   117     { 0, 0, 0, 0 THUNK_GENERATOR(0) }
       
   118 };
       
   119 
       
   120 #undef THUNK_GENERATOR
       
   121 static JSC_CONST_HASHTABLE HashTable JSClipboardPrototypeTable = { 8, 7, JSClipboardPrototypeTableValues, 0 };
       
   122 const ClassInfo JSClipboardPrototype::s_info = { "ClipboardPrototype", 0, &JSClipboardPrototypeTable, 0 };
       
   123 
       
   124 JSObject* JSClipboardPrototype::self(ExecState* exec, JSGlobalObject* globalObject)
       
   125 {
       
   126     return getDOMPrototype<JSClipboard>(exec, globalObject);
       
   127 }
       
   128 
       
   129 bool JSClipboardPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
   130 {
       
   131     return getStaticFunctionSlot<JSObject>(exec, &JSClipboardPrototypeTable, this, propertyName, slot);
       
   132 }
       
   133 
       
   134 bool JSClipboardPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
       
   135 {
       
   136     return getStaticFunctionDescriptor<JSObject>(exec, &JSClipboardPrototypeTable, this, propertyName, descriptor);
       
   137 }
       
   138 
       
   139 const ClassInfo JSClipboard::s_info = { "Clipboard", 0, &JSClipboardTable, 0 };
       
   140 
       
   141 JSClipboard::JSClipboard(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<Clipboard> impl)
       
   142     : DOMObjectWithGlobalPointer(structure, globalObject)
       
   143     , m_impl(impl)
       
   144 {
       
   145 }
       
   146 
       
   147 JSClipboard::~JSClipboard()
       
   148 {
       
   149     forgetDOMObject(this, impl());
       
   150 }
       
   151 
       
   152 JSObject* JSClipboard::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
       
   153 {
       
   154     return new (exec) JSClipboardPrototype(globalObject, JSClipboardPrototype::createStructure(globalObject->objectPrototype()));
       
   155 }
       
   156 
       
   157 bool JSClipboard::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
   158 {
       
   159     return getStaticValueSlot<JSClipboard, Base>(exec, &JSClipboardTable, this, propertyName, slot);
       
   160 }
       
   161 
       
   162 bool JSClipboard::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
       
   163 {
       
   164     return getStaticValueDescriptor<JSClipboard, Base>(exec, &JSClipboardTable, this, propertyName, descriptor);
       
   165 }
       
   166 
       
   167 JSValue jsClipboardDropEffect(ExecState* exec, JSValue slotBase, const Identifier&)
       
   168 {
       
   169     JSClipboard* castedThis = static_cast<JSClipboard*>(asObject(slotBase));
       
   170     UNUSED_PARAM(exec);
       
   171     Clipboard* imp = static_cast<Clipboard*>(castedThis->impl());
       
   172     JSValue result = jsStringOrUndefined(exec, imp->dropEffect());
       
   173     return result;
       
   174 }
       
   175 
       
   176 JSValue jsClipboardEffectAllowed(ExecState* exec, JSValue slotBase, const Identifier&)
       
   177 {
       
   178     JSClipboard* castedThis = static_cast<JSClipboard*>(asObject(slotBase));
       
   179     UNUSED_PARAM(exec);
       
   180     Clipboard* imp = static_cast<Clipboard*>(castedThis->impl());
       
   181     JSValue result = jsStringOrUndefined(exec, imp->effectAllowed());
       
   182     return result;
       
   183 }
       
   184 
       
   185 JSValue jsClipboardTypes(ExecState* exec, JSValue slotBase, const Identifier&)
       
   186 {
       
   187     JSClipboard* castedThis = static_cast<JSClipboard*>(asObject(slotBase));
       
   188     return castedThis->types(exec);
       
   189 }
       
   190 
       
   191 JSValue jsClipboardFiles(ExecState* exec, JSValue slotBase, const Identifier&)
       
   192 {
       
   193     JSClipboard* castedThis = static_cast<JSClipboard*>(asObject(slotBase));
       
   194     UNUSED_PARAM(exec);
       
   195     Clipboard* imp = static_cast<Clipboard*>(castedThis->impl());
       
   196     JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->files()));
       
   197     return result;
       
   198 }
       
   199 
       
   200 JSValue jsClipboardConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
       
   201 {
       
   202     JSClipboard* domObject = static_cast<JSClipboard*>(asObject(slotBase));
       
   203     return JSClipboard::getConstructor(exec, domObject->globalObject());
       
   204 }
       
   205 void JSClipboard::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
       
   206 {
       
   207     lookupPut<JSClipboard, Base>(exec, propertyName, value, &JSClipboardTable, this, slot);
       
   208 }
       
   209 
       
   210 void setJSClipboardDropEffect(ExecState* exec, JSObject* thisObject, JSValue value)
       
   211 {
       
   212     JSClipboard* castedThis = static_cast<JSClipboard*>(thisObject);
       
   213     Clipboard* imp = static_cast<Clipboard*>(castedThis->impl());
       
   214     imp->setDropEffect(ustringToString(value.toString(exec)));
       
   215 }
       
   216 
       
   217 void setJSClipboardEffectAllowed(ExecState* exec, JSObject* thisObject, JSValue value)
       
   218 {
       
   219     JSClipboard* castedThis = static_cast<JSClipboard*>(thisObject);
       
   220     Clipboard* imp = static_cast<Clipboard*>(castedThis->impl());
       
   221     imp->setEffectAllowed(ustringToString(value.toString(exec)));
       
   222 }
       
   223 
       
   224 JSValue JSClipboard::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
       
   225 {
       
   226     return getDOMConstructor<JSClipboardConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));
       
   227 }
       
   228 
       
   229 EncodedJSValue JSC_HOST_CALL jsClipboardPrototypeFunctionClearData(ExecState* exec)
       
   230 {
       
   231     JSValue thisValue = exec->hostThisValue();
       
   232     if (!thisValue.inherits(&JSClipboard::s_info))
       
   233         return throwVMTypeError(exec);
       
   234     JSClipboard* castedThis = static_cast<JSClipboard*>(asObject(thisValue));
       
   235     return JSValue::encode(castedThis->clearData(exec));
       
   236 }
       
   237 
       
   238 EncodedJSValue JSC_HOST_CALL jsClipboardPrototypeFunctionGetData(ExecState* exec)
       
   239 {
       
   240     JSValue thisValue = exec->hostThisValue();
       
   241     if (!thisValue.inherits(&JSClipboard::s_info))
       
   242         return throwVMTypeError(exec);
       
   243     JSClipboard* castedThis = static_cast<JSClipboard*>(asObject(thisValue));
       
   244     return JSValue::encode(castedThis->getData(exec));
       
   245 }
       
   246 
       
   247 EncodedJSValue JSC_HOST_CALL jsClipboardPrototypeFunctionSetData(ExecState* exec)
       
   248 {
       
   249     JSValue thisValue = exec->hostThisValue();
       
   250     if (!thisValue.inherits(&JSClipboard::s_info))
       
   251         return throwVMTypeError(exec);
       
   252     JSClipboard* castedThis = static_cast<JSClipboard*>(asObject(thisValue));
       
   253     Clipboard* imp = static_cast<Clipboard*>(castedThis->impl());
       
   254     if (exec->argumentCount() < 2)
       
   255         return JSValue::encode(jsUndefined());
       
   256     const String& type = ustringToString(exec->argument(0).toString(exec));
       
   257     const String& data = ustringToString(exec->argument(1).toString(exec));
       
   258 
       
   259 
       
   260     JSC::JSValue result = jsBoolean(imp->setData(type, data));
       
   261     return JSValue::encode(result);
       
   262 }
       
   263 
       
   264 EncodedJSValue JSC_HOST_CALL jsClipboardPrototypeFunctionSetDragImage(ExecState* exec)
       
   265 {
       
   266     JSValue thisValue = exec->hostThisValue();
       
   267     if (!thisValue.inherits(&JSClipboard::s_info))
       
   268         return throwVMTypeError(exec);
       
   269     JSClipboard* castedThis = static_cast<JSClipboard*>(asObject(thisValue));
       
   270     return JSValue::encode(castedThis->setDragImage(exec));
       
   271 }
       
   272 
       
   273 JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, Clipboard* object)
       
   274 {
       
   275     return getDOMObjectWrapper<JSClipboard>(exec, globalObject, object);
       
   276 }
       
   277 Clipboard* toClipboard(JSC::JSValue value)
       
   278 {
       
   279     return value.inherits(&JSClipboard::s_info) ? static_cast<JSClipboard*>(asObject(value))->impl() : 0;
       
   280 }
       
   281 
       
   282 }