WebCore/generated/JSTextMetrics.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 "JSTextMetrics.h"
       
    23 
       
    24 #include "TextMetrics.h"
       
    25 #include <runtime/JSNumberCell.h>
       
    26 #include <wtf/GetPtr.h>
       
    27 
       
    28 using namespace JSC;
       
    29 
       
    30 namespace WebCore {
       
    31 
       
    32 ASSERT_CLASS_FITS_IN_CELL(JSTextMetrics);
       
    33 
       
    34 /* Hash table */
       
    35 #if ENABLE(JIT)
       
    36 #define THUNK_GENERATOR(generator) , generator
       
    37 #else
       
    38 #define THUNK_GENERATOR(generator)
       
    39 #endif
       
    40 
       
    41 static const HashTableValue JSTextMetricsTableValues[3] =
       
    42 {
       
    43     { "width", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTextMetricsWidth), (intptr_t)0 THUNK_GENERATOR(0) },
       
    44     { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTextMetricsConstructor), (intptr_t)0 THUNK_GENERATOR(0) },
       
    45     { 0, 0, 0, 0 THUNK_GENERATOR(0) }
       
    46 };
       
    47 
       
    48 #undef THUNK_GENERATOR
       
    49 static JSC_CONST_HASHTABLE HashTable JSTextMetricsTable = { 4, 3, JSTextMetricsTableValues, 0 };
       
    50 /* Hash table for constructor */
       
    51 #if ENABLE(JIT)
       
    52 #define THUNK_GENERATOR(generator) , generator
       
    53 #else
       
    54 #define THUNK_GENERATOR(generator)
       
    55 #endif
       
    56 
       
    57 static const HashTableValue JSTextMetricsConstructorTableValues[1] =
       
    58 {
       
    59     { 0, 0, 0, 0 THUNK_GENERATOR(0) }
       
    60 };
       
    61 
       
    62 #undef THUNK_GENERATOR
       
    63 static JSC_CONST_HASHTABLE HashTable JSTextMetricsConstructorTable = { 1, 0, JSTextMetricsConstructorTableValues, 0 };
       
    64 class JSTextMetricsConstructor : public DOMConstructorObject {
       
    65 public:
       
    66     JSTextMetricsConstructor(JSC::ExecState*, JSDOMGlobalObject*);
       
    67 
       
    68     virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&);
       
    69     virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&);
       
    70     virtual const JSC::ClassInfo* classInfo() const { return &s_info; }
       
    71     static const JSC::ClassInfo s_info;
       
    72     static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype)
       
    73     {
       
    74         return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount);
       
    75     }
       
    76 protected:
       
    77     static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::ImplementsHasInstance | DOMConstructorObject::StructureFlags;
       
    78 };
       
    79 
       
    80 const ClassInfo JSTextMetricsConstructor::s_info = { "TextMetricsConstructor", 0, &JSTextMetricsConstructorTable, 0 };
       
    81 
       
    82 JSTextMetricsConstructor::JSTextMetricsConstructor(ExecState* exec, JSDOMGlobalObject* globalObject)
       
    83     : DOMConstructorObject(JSTextMetricsConstructor::createStructure(globalObject->objectPrototype()), globalObject)
       
    84 {
       
    85     putDirect(exec->propertyNames().prototype, JSTextMetricsPrototype::self(exec, globalObject), DontDelete | ReadOnly);
       
    86 }
       
    87 
       
    88 bool JSTextMetricsConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
    89 {
       
    90     return getStaticValueSlot<JSTextMetricsConstructor, DOMObject>(exec, &JSTextMetricsConstructorTable, this, propertyName, slot);
       
    91 }
       
    92 
       
    93 bool JSTextMetricsConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
       
    94 {
       
    95     return getStaticValueDescriptor<JSTextMetricsConstructor, DOMObject>(exec, &JSTextMetricsConstructorTable, this, propertyName, descriptor);
       
    96 }
       
    97 
       
    98 /* Hash table for prototype */
       
    99 #if ENABLE(JIT)
       
   100 #define THUNK_GENERATOR(generator) , generator
       
   101 #else
       
   102 #define THUNK_GENERATOR(generator)
       
   103 #endif
       
   104 
       
   105 static const HashTableValue JSTextMetricsPrototypeTableValues[1] =
       
   106 {
       
   107     { 0, 0, 0, 0 THUNK_GENERATOR(0) }
       
   108 };
       
   109 
       
   110 #undef THUNK_GENERATOR
       
   111 static JSC_CONST_HASHTABLE HashTable JSTextMetricsPrototypeTable = { 1, 0, JSTextMetricsPrototypeTableValues, 0 };
       
   112 const ClassInfo JSTextMetricsPrototype::s_info = { "TextMetricsPrototype", 0, &JSTextMetricsPrototypeTable, 0 };
       
   113 
       
   114 JSObject* JSTextMetricsPrototype::self(ExecState* exec, JSGlobalObject* globalObject)
       
   115 {
       
   116     return getDOMPrototype<JSTextMetrics>(exec, globalObject);
       
   117 }
       
   118 
       
   119 const ClassInfo JSTextMetrics::s_info = { "TextMetrics", 0, &JSTextMetricsTable, 0 };
       
   120 
       
   121 JSTextMetrics::JSTextMetrics(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<TextMetrics> impl)
       
   122     : DOMObjectWithGlobalPointer(structure, globalObject)
       
   123     , m_impl(impl)
       
   124 {
       
   125 }
       
   126 
       
   127 JSTextMetrics::~JSTextMetrics()
       
   128 {
       
   129     forgetDOMObject(this, impl());
       
   130 }
       
   131 
       
   132 JSObject* JSTextMetrics::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
       
   133 {
       
   134     return new (exec) JSTextMetricsPrototype(globalObject, JSTextMetricsPrototype::createStructure(globalObject->objectPrototype()));
       
   135 }
       
   136 
       
   137 bool JSTextMetrics::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
   138 {
       
   139     return getStaticValueSlot<JSTextMetrics, Base>(exec, &JSTextMetricsTable, this, propertyName, slot);
       
   140 }
       
   141 
       
   142 bool JSTextMetrics::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
       
   143 {
       
   144     return getStaticValueDescriptor<JSTextMetrics, Base>(exec, &JSTextMetricsTable, this, propertyName, descriptor);
       
   145 }
       
   146 
       
   147 JSValue jsTextMetricsWidth(ExecState* exec, JSValue slotBase, const Identifier&)
       
   148 {
       
   149     JSTextMetrics* castedThis = static_cast<JSTextMetrics*>(asObject(slotBase));
       
   150     UNUSED_PARAM(exec);
       
   151     TextMetrics* imp = static_cast<TextMetrics*>(castedThis->impl());
       
   152     JSValue result = jsNumber(exec, imp->width());
       
   153     return result;
       
   154 }
       
   155 
       
   156 JSValue jsTextMetricsConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
       
   157 {
       
   158     JSTextMetrics* domObject = static_cast<JSTextMetrics*>(asObject(slotBase));
       
   159     return JSTextMetrics::getConstructor(exec, domObject->globalObject());
       
   160 }
       
   161 JSValue JSTextMetrics::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
       
   162 {
       
   163     return getDOMConstructor<JSTextMetricsConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));
       
   164 }
       
   165 
       
   166 JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, TextMetrics* object)
       
   167 {
       
   168     return getDOMObjectWrapper<JSTextMetrics>(exec, globalObject, object);
       
   169 }
       
   170 TextMetrics* toTextMetrics(JSC::JSValue value)
       
   171 {
       
   172     return value.inherits(&JSTextMetrics::s_info) ? static_cast<JSTextMetrics*>(asObject(value))->impl() : 0;
       
   173 }
       
   174 
       
   175 }