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