~oif-team/ubuntu/natty/qt4-x11/xi2.1

« back to all changes in this revision

Viewing changes to src/3rdparty/webkit/WebCore/generated/JSHTMLCanvasElement.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Alessandro Ghersi
  • Date: 2009-11-02 18:30:08 UTC
  • mfrom: (1.2.2 upstream)
  • mto: (15.2.5 experimental)
  • mto: This revision was merged to the branch mainline in revision 88.
  • Revision ID: james.westby@ubuntu.com-20091102183008-b6a4gcs128mvfb3m
Tags: upstream-4.6.0~beta1
ImportĀ upstreamĀ versionĀ 4.6.0~beta1

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
*/
20
20
 
21
21
#include "config.h"
22
 
 
23
22
#include "JSHTMLCanvasElement.h"
24
23
 
25
 
#include <wtf/GetPtr.h>
26
 
 
27
24
#include "HTMLCanvasElement.h"
28
25
#include "JSCanvasRenderingContext2D.h"
29
26
#include "KURL.h"
30
 
 
31
27
#include <runtime/Error.h>
32
28
#include <runtime/JSNumberCell.h>
33
29
#include <runtime/JSString.h>
 
30
#include <wtf/GetPtr.h>
34
31
 
35
32
using namespace JSC;
36
33
 
37
34
namespace WebCore {
38
35
 
39
 
ASSERT_CLASS_FITS_IN_CELL(JSHTMLCanvasElement)
 
36
ASSERT_CLASS_FITS_IN_CELL(JSHTMLCanvasElement);
40
37
 
41
38
/* Hash table */
42
39
 
48
45
    { 0, 0, 0, 0 }
49
46
};
50
47
 
51
 
static const HashTable JSHTMLCanvasElementTable =
 
48
static JSC_CONST_HASHTABLE HashTable JSHTMLCanvasElementTable =
52
49
#if ENABLE(PERFECT_HASH_SIZE)
53
50
    { 31, JSHTMLCanvasElementTableValues, 0 };
54
51
#else
62
59
    { 0, 0, 0, 0 }
63
60
};
64
61
 
65
 
static const HashTable JSHTMLCanvasElementConstructorTable =
 
62
static JSC_CONST_HASHTABLE HashTable JSHTMLCanvasElementConstructorTable =
66
63
#if ENABLE(PERFECT_HASH_SIZE)
67
64
    { 0, JSHTMLCanvasElementConstructorTableValues, 0 };
68
65
#else
69
66
    { 1, 0, JSHTMLCanvasElementConstructorTableValues, 0 };
70
67
#endif
71
68
 
72
 
class JSHTMLCanvasElementConstructor : public DOMObject {
 
69
class JSHTMLCanvasElementConstructor : public DOMConstructorObject {
73
70
public:
74
 
    JSHTMLCanvasElementConstructor(ExecState* exec)
75
 
        : DOMObject(JSHTMLCanvasElementConstructor::createStructure(exec->lexicalGlobalObject()->objectPrototype()))
 
71
    JSHTMLCanvasElementConstructor(ExecState* exec, JSDOMGlobalObject* globalObject)
 
72
        : DOMConstructorObject(JSHTMLCanvasElementConstructor::createStructure(globalObject->objectPrototype()), globalObject)
76
73
    {
77
 
        putDirect(exec->propertyNames().prototype, JSHTMLCanvasElementPrototype::self(exec, exec->lexicalGlobalObject()), None);
 
74
        putDirect(exec->propertyNames().prototype, JSHTMLCanvasElementPrototype::self(exec, globalObject), None);
78
75
    }
79
76
    virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
 
77
    virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
80
78
    virtual const ClassInfo* classInfo() const { return &s_info; }
81
79
    static const ClassInfo s_info;
82
80
 
83
 
    static PassRefPtr<Structure> createStructure(JSValuePtr proto) 
 
81
    static PassRefPtr<Structure> createStructure(JSValue proto) 
84
82
    { 
85
83
        return Structure::create(proto, TypeInfo(ObjectType, ImplementsHasInstance)); 
86
84
    }
93
91
    return getStaticValueSlot<JSHTMLCanvasElementConstructor, DOMObject>(exec, &JSHTMLCanvasElementConstructorTable, this, propertyName, slot);
94
92
}
95
93
 
 
94
bool JSHTMLCanvasElementConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
 
95
{
 
96
    return getStaticValueDescriptor<JSHTMLCanvasElementConstructor, DOMObject>(exec, &JSHTMLCanvasElementConstructorTable, this, propertyName, descriptor);
 
97
}
 
98
 
96
99
/* Hash table for prototype */
97
100
 
98
101
static const HashTableValue JSHTMLCanvasElementPrototypeTableValues[3] =
102
105
    { 0, 0, 0, 0 }
103
106
};
104
107
 
105
 
static const HashTable JSHTMLCanvasElementPrototypeTable =
 
108
static JSC_CONST_HASHTABLE HashTable JSHTMLCanvasElementPrototypeTable =
106
109
#if ENABLE(PERFECT_HASH_SIZE)
107
110
    { 3, JSHTMLCanvasElementPrototypeTableValues, 0 };
108
111
#else
121
124
    return getStaticFunctionSlot<JSObject>(exec, &JSHTMLCanvasElementPrototypeTable, this, propertyName, slot);
122
125
}
123
126
 
 
127
bool JSHTMLCanvasElementPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
 
128
{
 
129
    return getStaticFunctionDescriptor<JSObject>(exec, &JSHTMLCanvasElementPrototypeTable, this, propertyName, descriptor);
 
130
}
 
131
 
124
132
const ClassInfo JSHTMLCanvasElement::s_info = { "HTMLCanvasElement", &JSHTMLElement::s_info, &JSHTMLCanvasElementTable, 0 };
125
133
 
126
 
JSHTMLCanvasElement::JSHTMLCanvasElement(PassRefPtr<Structure> structure, PassRefPtr<HTMLCanvasElement> impl)
127
 
    : JSHTMLElement(structure, impl)
 
134
JSHTMLCanvasElement::JSHTMLCanvasElement(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<HTMLCanvasElement> impl)
 
135
    : JSHTMLElement(structure, globalObject, impl)
128
136
{
129
137
}
130
138
 
138
146
    return getStaticValueSlot<JSHTMLCanvasElement, Base>(exec, &JSHTMLCanvasElementTable, this, propertyName, slot);
139
147
}
140
148
 
141
 
JSValuePtr jsHTMLCanvasElementWidth(ExecState* exec, const Identifier&, const PropertySlot& slot)
142
 
{
143
 
    HTMLCanvasElement* imp = static_cast<HTMLCanvasElement*>(static_cast<JSHTMLCanvasElement*>(asObject(slot.slotBase()))->impl());
 
149
bool JSHTMLCanvasElement::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
 
150
{
 
151
    return getStaticValueDescriptor<JSHTMLCanvasElement, Base>(exec, &JSHTMLCanvasElementTable, this, propertyName, descriptor);
 
152
}
 
153
 
 
154
JSValue jsHTMLCanvasElementWidth(ExecState* exec, const Identifier&, const PropertySlot& slot)
 
155
{
 
156
    JSHTMLCanvasElement* castedThis = static_cast<JSHTMLCanvasElement*>(asObject(slot.slotBase()));
 
157
    UNUSED_PARAM(exec);
 
158
    HTMLCanvasElement* imp = static_cast<HTMLCanvasElement*>(castedThis->impl());
144
159
    return jsNumber(exec, imp->width());
145
160
}
146
161
 
147
 
JSValuePtr jsHTMLCanvasElementHeight(ExecState* exec, const Identifier&, const PropertySlot& slot)
 
162
JSValue jsHTMLCanvasElementHeight(ExecState* exec, const Identifier&, const PropertySlot& slot)
148
163
{
149
 
    HTMLCanvasElement* imp = static_cast<HTMLCanvasElement*>(static_cast<JSHTMLCanvasElement*>(asObject(slot.slotBase()))->impl());
 
164
    JSHTMLCanvasElement* castedThis = static_cast<JSHTMLCanvasElement*>(asObject(slot.slotBase()));
 
165
    UNUSED_PARAM(exec);
 
166
    HTMLCanvasElement* imp = static_cast<HTMLCanvasElement*>(castedThis->impl());
150
167
    return jsNumber(exec, imp->height());
151
168
}
152
169
 
153
 
JSValuePtr jsHTMLCanvasElementConstructor(ExecState* exec, const Identifier&, const PropertySlot& slot)
 
170
JSValue jsHTMLCanvasElementConstructor(ExecState* exec, const Identifier&, const PropertySlot& slot)
154
171
{
155
 
    return static_cast<JSHTMLCanvasElement*>(asObject(slot.slotBase()))->getConstructor(exec);
 
172
    JSHTMLCanvasElement* domObject = static_cast<JSHTMLCanvasElement*>(asObject(slot.slotBase()));
 
173
    return JSHTMLCanvasElement::getConstructor(exec, domObject->globalObject());
156
174
}
157
 
void JSHTMLCanvasElement::put(ExecState* exec, const Identifier& propertyName, JSValuePtr value, PutPropertySlot& slot)
 
175
void JSHTMLCanvasElement::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
158
176
{
159
177
    lookupPut<JSHTMLCanvasElement, Base>(exec, propertyName, value, &JSHTMLCanvasElementTable, this, slot);
160
178
}
161
179
 
162
 
void setJSHTMLCanvasElementWidth(ExecState* exec, JSObject* thisObject, JSValuePtr value)
163
 
{
164
 
    HTMLCanvasElement* imp = static_cast<HTMLCanvasElement*>(static_cast<JSHTMLCanvasElement*>(thisObject)->impl());
165
 
    imp->setWidth(value->toInt32(exec));
166
 
}
167
 
 
168
 
void setJSHTMLCanvasElementHeight(ExecState* exec, JSObject* thisObject, JSValuePtr value)
169
 
{
170
 
    HTMLCanvasElement* imp = static_cast<HTMLCanvasElement*>(static_cast<JSHTMLCanvasElement*>(thisObject)->impl());
171
 
    imp->setHeight(value->toInt32(exec));
172
 
}
173
 
 
174
 
JSValuePtr JSHTMLCanvasElement::getConstructor(ExecState* exec)
175
 
{
176
 
    return getDOMConstructor<JSHTMLCanvasElementConstructor>(exec);
177
 
}
178
 
 
179
 
JSValuePtr jsHTMLCanvasElementPrototypeFunctionToDataURL(ExecState* exec, JSObject*, JSValuePtr thisValue, const ArgList& args)
180
 
{
181
 
    if (!thisValue->isObject(&JSHTMLCanvasElement::s_info))
 
180
void setJSHTMLCanvasElementWidth(ExecState* exec, JSObject* thisObject, JSValue value)
 
181
{
 
182
    HTMLCanvasElement* imp = static_cast<HTMLCanvasElement*>(static_cast<JSHTMLCanvasElement*>(thisObject)->impl());
 
183
    imp->setWidth(value.toInt32(exec));
 
184
}
 
185
 
 
186
void setJSHTMLCanvasElementHeight(ExecState* exec, JSObject* thisObject, JSValue value)
 
187
{
 
188
    HTMLCanvasElement* imp = static_cast<HTMLCanvasElement*>(static_cast<JSHTMLCanvasElement*>(thisObject)->impl());
 
189
    imp->setHeight(value.toInt32(exec));
 
190
}
 
191
 
 
192
JSValue JSHTMLCanvasElement::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
 
193
{
 
194
    return getDOMConstructor<JSHTMLCanvasElementConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));
 
195
}
 
196
 
 
197
JSValue JSC_HOST_CALL jsHTMLCanvasElementPrototypeFunctionToDataURL(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
 
198
{
 
199
    UNUSED_PARAM(args);
 
200
    if (!thisValue.inherits(&JSHTMLCanvasElement::s_info))
182
201
        return throwError(exec, TypeError);
183
202
    JSHTMLCanvasElement* castedThisObj = static_cast<JSHTMLCanvasElement*>(asObject(thisValue));
184
203
    HTMLCanvasElement* imp = static_cast<HTMLCanvasElement*>(castedThisObj->impl());
185
204
    ExceptionCode ec = 0;
186
 
    const UString& type = valueToStringWithUndefinedOrNullCheck(exec, args.at(exec, 0));
187
 
 
188
 
 
189
 
    JSC::JSValuePtr result = jsString(exec, imp->toDataURL(type, ec));
 
205
    const UString& type = valueToStringWithUndefinedOrNullCheck(exec, args.at(0));
 
206
 
 
207
 
 
208
    JSC::JSValue result = jsString(exec, imp->toDataURL(type, ec));
190
209
    setDOMException(exec, ec);
191
210
    return result;
192
211
}
193
212
 
194
 
JSValuePtr jsHTMLCanvasElementPrototypeFunctionGetContext(ExecState* exec, JSObject*, JSValuePtr thisValue, const ArgList& args)
 
213
JSValue JSC_HOST_CALL jsHTMLCanvasElementPrototypeFunctionGetContext(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
195
214
{
196
 
    if (!thisValue->isObject(&JSHTMLCanvasElement::s_info))
 
215
    UNUSED_PARAM(args);
 
216
    if (!thisValue.inherits(&JSHTMLCanvasElement::s_info))
197
217
        return throwError(exec, TypeError);
198
218
    JSHTMLCanvasElement* castedThisObj = static_cast<JSHTMLCanvasElement*>(asObject(thisValue));
199
219
    HTMLCanvasElement* imp = static_cast<HTMLCanvasElement*>(castedThisObj->impl());
200
 
    const UString& contextId = args.at(exec, 0)->toString(exec);
201
 
 
202
 
 
203
 
    JSC::JSValuePtr result = toJS(exec, WTF::getPtr(imp->getContext(contextId)));
 
220
    const UString& contextId = args.at(0).toString(exec);
 
221
 
 
222
 
 
223
    JSC::JSValue result = toJS(exec, castedThisObj->globalObject(), WTF::getPtr(imp->getContext(contextId)));
204
224
    return result;
205
225
}
206
226