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