|
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 |
|
23 #if ENABLE(VIDEO) |
|
24 |
|
25 #include "JSHTMLVideoElement.h" |
|
26 |
|
27 #include "HTMLNames.h" |
|
28 #include "HTMLVideoElement.h" |
|
29 #include "KURL.h" |
|
30 #include <runtime/Error.h> |
|
31 #include <runtime/JSNumberCell.h> |
|
32 #include <runtime/JSString.h> |
|
33 #include <wtf/GetPtr.h> |
|
34 |
|
35 using namespace JSC; |
|
36 |
|
37 namespace WebCore { |
|
38 |
|
39 ASSERT_CLASS_FITS_IN_CELL(JSHTMLVideoElement); |
|
40 |
|
41 /* Hash table */ |
|
42 #if ENABLE(JIT) |
|
43 #define THUNK_GENERATOR(generator) , generator |
|
44 #else |
|
45 #define THUNK_GENERATOR(generator) |
|
46 #endif |
|
47 |
|
48 static const HashTableValue JSHTMLVideoElementTableValues[9] = |
|
49 { |
|
50 { "width", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLVideoElementWidth), (intptr_t)setJSHTMLVideoElementWidth THUNK_GENERATOR(0) }, |
|
51 { "height", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLVideoElementHeight), (intptr_t)setJSHTMLVideoElementHeight THUNK_GENERATOR(0) }, |
|
52 { "videoWidth", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLVideoElementVideoWidth), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
53 { "videoHeight", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLVideoElementVideoHeight), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
54 { "poster", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLVideoElementPoster), (intptr_t)setJSHTMLVideoElementPoster THUNK_GENERATOR(0) }, |
|
55 { "webkitSupportsFullscreen", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLVideoElementWebkitSupportsFullscreen), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
56 { "webkitDisplayingFullscreen", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLVideoElementWebkitDisplayingFullscreen), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
57 { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLVideoElementConstructor), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
58 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
59 }; |
|
60 |
|
61 #undef THUNK_GENERATOR |
|
62 static JSC_CONST_HASHTABLE HashTable JSHTMLVideoElementTable = { 18, 15, JSHTMLVideoElementTableValues, 0 }; |
|
63 /* Hash table for constructor */ |
|
64 #if ENABLE(JIT) |
|
65 #define THUNK_GENERATOR(generator) , generator |
|
66 #else |
|
67 #define THUNK_GENERATOR(generator) |
|
68 #endif |
|
69 |
|
70 static const HashTableValue JSHTMLVideoElementConstructorTableValues[1] = |
|
71 { |
|
72 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
73 }; |
|
74 |
|
75 #undef THUNK_GENERATOR |
|
76 static JSC_CONST_HASHTABLE HashTable JSHTMLVideoElementConstructorTable = { 1, 0, JSHTMLVideoElementConstructorTableValues, 0 }; |
|
77 class JSHTMLVideoElementConstructor : public DOMConstructorObject { |
|
78 public: |
|
79 JSHTMLVideoElementConstructor(JSC::ExecState*, JSDOMGlobalObject*); |
|
80 |
|
81 virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&); |
|
82 virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&); |
|
83 virtual const JSC::ClassInfo* classInfo() const { return &s_info; } |
|
84 static const JSC::ClassInfo s_info; |
|
85 static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype) |
|
86 { |
|
87 return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount); |
|
88 } |
|
89 protected: |
|
90 static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::ImplementsHasInstance | DOMConstructorObject::StructureFlags; |
|
91 }; |
|
92 |
|
93 const ClassInfo JSHTMLVideoElementConstructor::s_info = { "HTMLVideoElementConstructor", 0, &JSHTMLVideoElementConstructorTable, 0 }; |
|
94 |
|
95 JSHTMLVideoElementConstructor::JSHTMLVideoElementConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) |
|
96 : DOMConstructorObject(JSHTMLVideoElementConstructor::createStructure(globalObject->objectPrototype()), globalObject) |
|
97 { |
|
98 putDirect(exec->propertyNames().prototype, JSHTMLVideoElementPrototype::self(exec, globalObject), DontDelete | ReadOnly); |
|
99 } |
|
100 |
|
101 bool JSHTMLVideoElementConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
102 { |
|
103 return getStaticValueSlot<JSHTMLVideoElementConstructor, DOMObject>(exec, &JSHTMLVideoElementConstructorTable, this, propertyName, slot); |
|
104 } |
|
105 |
|
106 bool JSHTMLVideoElementConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
107 { |
|
108 return getStaticValueDescriptor<JSHTMLVideoElementConstructor, DOMObject>(exec, &JSHTMLVideoElementConstructorTable, this, propertyName, descriptor); |
|
109 } |
|
110 |
|
111 /* Hash table for prototype */ |
|
112 #if ENABLE(JIT) |
|
113 #define THUNK_GENERATOR(generator) , generator |
|
114 #else |
|
115 #define THUNK_GENERATOR(generator) |
|
116 #endif |
|
117 |
|
118 static const HashTableValue JSHTMLVideoElementPrototypeTableValues[5] = |
|
119 { |
|
120 { "webkitEnterFullscreen", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsHTMLVideoElementPrototypeFunctionWebkitEnterFullscreen), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
121 { "webkitExitFullscreen", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsHTMLVideoElementPrototypeFunctionWebkitExitFullscreen), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
122 { "webkitEnterFullScreen", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsHTMLVideoElementPrototypeFunctionWebkitEnterFullScreen), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
123 { "webkitExitFullScreen", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsHTMLVideoElementPrototypeFunctionWebkitExitFullScreen), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
124 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
125 }; |
|
126 |
|
127 #undef THUNK_GENERATOR |
|
128 static JSC_CONST_HASHTABLE HashTable JSHTMLVideoElementPrototypeTable = { 8, 7, JSHTMLVideoElementPrototypeTableValues, 0 }; |
|
129 const ClassInfo JSHTMLVideoElementPrototype::s_info = { "HTMLVideoElementPrototype", 0, &JSHTMLVideoElementPrototypeTable, 0 }; |
|
130 |
|
131 JSObject* JSHTMLVideoElementPrototype::self(ExecState* exec, JSGlobalObject* globalObject) |
|
132 { |
|
133 return getDOMPrototype<JSHTMLVideoElement>(exec, globalObject); |
|
134 } |
|
135 |
|
136 bool JSHTMLVideoElementPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
137 { |
|
138 return getStaticFunctionSlot<JSObject>(exec, &JSHTMLVideoElementPrototypeTable, this, propertyName, slot); |
|
139 } |
|
140 |
|
141 bool JSHTMLVideoElementPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
142 { |
|
143 return getStaticFunctionDescriptor<JSObject>(exec, &JSHTMLVideoElementPrototypeTable, this, propertyName, descriptor); |
|
144 } |
|
145 |
|
146 const ClassInfo JSHTMLVideoElement::s_info = { "HTMLVideoElement", &JSHTMLMediaElement::s_info, &JSHTMLVideoElementTable, 0 }; |
|
147 |
|
148 JSHTMLVideoElement::JSHTMLVideoElement(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<HTMLVideoElement> impl) |
|
149 : JSHTMLMediaElement(structure, globalObject, impl) |
|
150 { |
|
151 } |
|
152 |
|
153 JSObject* JSHTMLVideoElement::createPrototype(ExecState* exec, JSGlobalObject* globalObject) |
|
154 { |
|
155 return new (exec) JSHTMLVideoElementPrototype(globalObject, JSHTMLVideoElementPrototype::createStructure(JSHTMLMediaElementPrototype::self(exec, globalObject))); |
|
156 } |
|
157 |
|
158 bool JSHTMLVideoElement::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
159 { |
|
160 return getStaticValueSlot<JSHTMLVideoElement, Base>(exec, &JSHTMLVideoElementTable, this, propertyName, slot); |
|
161 } |
|
162 |
|
163 bool JSHTMLVideoElement::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
164 { |
|
165 return getStaticValueDescriptor<JSHTMLVideoElement, Base>(exec, &JSHTMLVideoElementTable, this, propertyName, descriptor); |
|
166 } |
|
167 |
|
168 JSValue jsHTMLVideoElementWidth(ExecState* exec, JSValue slotBase, const Identifier&) |
|
169 { |
|
170 JSHTMLVideoElement* castedThis = static_cast<JSHTMLVideoElement*>(asObject(slotBase)); |
|
171 UNUSED_PARAM(exec); |
|
172 HTMLVideoElement* imp = static_cast<HTMLVideoElement*>(castedThis->impl()); |
|
173 JSValue result = jsNumber(exec, imp->getUnsignedIntegralAttribute(WebCore::HTMLNames::widthAttr)); |
|
174 return result; |
|
175 } |
|
176 |
|
177 JSValue jsHTMLVideoElementHeight(ExecState* exec, JSValue slotBase, const Identifier&) |
|
178 { |
|
179 JSHTMLVideoElement* castedThis = static_cast<JSHTMLVideoElement*>(asObject(slotBase)); |
|
180 UNUSED_PARAM(exec); |
|
181 HTMLVideoElement* imp = static_cast<HTMLVideoElement*>(castedThis->impl()); |
|
182 JSValue result = jsNumber(exec, imp->getUnsignedIntegralAttribute(WebCore::HTMLNames::heightAttr)); |
|
183 return result; |
|
184 } |
|
185 |
|
186 JSValue jsHTMLVideoElementVideoWidth(ExecState* exec, JSValue slotBase, const Identifier&) |
|
187 { |
|
188 JSHTMLVideoElement* castedThis = static_cast<JSHTMLVideoElement*>(asObject(slotBase)); |
|
189 UNUSED_PARAM(exec); |
|
190 HTMLVideoElement* imp = static_cast<HTMLVideoElement*>(castedThis->impl()); |
|
191 JSValue result = jsNumber(exec, imp->videoWidth()); |
|
192 return result; |
|
193 } |
|
194 |
|
195 JSValue jsHTMLVideoElementVideoHeight(ExecState* exec, JSValue slotBase, const Identifier&) |
|
196 { |
|
197 JSHTMLVideoElement* castedThis = static_cast<JSHTMLVideoElement*>(asObject(slotBase)); |
|
198 UNUSED_PARAM(exec); |
|
199 HTMLVideoElement* imp = static_cast<HTMLVideoElement*>(castedThis->impl()); |
|
200 JSValue result = jsNumber(exec, imp->videoHeight()); |
|
201 return result; |
|
202 } |
|
203 |
|
204 JSValue jsHTMLVideoElementPoster(ExecState* exec, JSValue slotBase, const Identifier&) |
|
205 { |
|
206 JSHTMLVideoElement* castedThis = static_cast<JSHTMLVideoElement*>(asObject(slotBase)); |
|
207 UNUSED_PARAM(exec); |
|
208 HTMLVideoElement* imp = static_cast<HTMLVideoElement*>(castedThis->impl()); |
|
209 JSValue result = jsString(exec, imp->getNonEmptyURLAttribute(WebCore::HTMLNames::posterAttr)); |
|
210 return result; |
|
211 } |
|
212 |
|
213 JSValue jsHTMLVideoElementWebkitSupportsFullscreen(ExecState* exec, JSValue slotBase, const Identifier&) |
|
214 { |
|
215 JSHTMLVideoElement* castedThis = static_cast<JSHTMLVideoElement*>(asObject(slotBase)); |
|
216 UNUSED_PARAM(exec); |
|
217 HTMLVideoElement* imp = static_cast<HTMLVideoElement*>(castedThis->impl()); |
|
218 JSValue result = jsBoolean(imp->webkitSupportsFullscreen()); |
|
219 return result; |
|
220 } |
|
221 |
|
222 JSValue jsHTMLVideoElementWebkitDisplayingFullscreen(ExecState* exec, JSValue slotBase, const Identifier&) |
|
223 { |
|
224 JSHTMLVideoElement* castedThis = static_cast<JSHTMLVideoElement*>(asObject(slotBase)); |
|
225 UNUSED_PARAM(exec); |
|
226 HTMLVideoElement* imp = static_cast<HTMLVideoElement*>(castedThis->impl()); |
|
227 JSValue result = jsBoolean(imp->webkitDisplayingFullscreen()); |
|
228 return result; |
|
229 } |
|
230 |
|
231 JSValue jsHTMLVideoElementConstructor(ExecState* exec, JSValue slotBase, const Identifier&) |
|
232 { |
|
233 JSHTMLVideoElement* domObject = static_cast<JSHTMLVideoElement*>(asObject(slotBase)); |
|
234 return JSHTMLVideoElement::getConstructor(exec, domObject->globalObject()); |
|
235 } |
|
236 void JSHTMLVideoElement::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) |
|
237 { |
|
238 lookupPut<JSHTMLVideoElement, Base>(exec, propertyName, value, &JSHTMLVideoElementTable, this, slot); |
|
239 } |
|
240 |
|
241 void setJSHTMLVideoElementWidth(ExecState* exec, JSObject* thisObject, JSValue value) |
|
242 { |
|
243 JSHTMLVideoElement* castedThis = static_cast<JSHTMLVideoElement*>(thisObject); |
|
244 HTMLVideoElement* imp = static_cast<HTMLVideoElement*>(castedThis->impl()); |
|
245 imp->setUnsignedIntegralAttribute(WebCore::HTMLNames::widthAttr, value.toInt32(exec)); |
|
246 } |
|
247 |
|
248 void setJSHTMLVideoElementHeight(ExecState* exec, JSObject* thisObject, JSValue value) |
|
249 { |
|
250 JSHTMLVideoElement* castedThis = static_cast<JSHTMLVideoElement*>(thisObject); |
|
251 HTMLVideoElement* imp = static_cast<HTMLVideoElement*>(castedThis->impl()); |
|
252 imp->setUnsignedIntegralAttribute(WebCore::HTMLNames::heightAttr, value.toInt32(exec)); |
|
253 } |
|
254 |
|
255 void setJSHTMLVideoElementPoster(ExecState* exec, JSObject* thisObject, JSValue value) |
|
256 { |
|
257 JSHTMLVideoElement* castedThis = static_cast<JSHTMLVideoElement*>(thisObject); |
|
258 HTMLVideoElement* imp = static_cast<HTMLVideoElement*>(castedThis->impl()); |
|
259 imp->setAttribute(WebCore::HTMLNames::posterAttr, valueToStringWithNullCheck(exec, value)); |
|
260 } |
|
261 |
|
262 JSValue JSHTMLVideoElement::getConstructor(ExecState* exec, JSGlobalObject* globalObject) |
|
263 { |
|
264 return getDOMConstructor<JSHTMLVideoElementConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject)); |
|
265 } |
|
266 |
|
267 EncodedJSValue JSC_HOST_CALL jsHTMLVideoElementPrototypeFunctionWebkitEnterFullscreen(ExecState* exec) |
|
268 { |
|
269 JSValue thisValue = exec->hostThisValue(); |
|
270 if (!thisValue.inherits(&JSHTMLVideoElement::s_info)) |
|
271 return throwVMTypeError(exec); |
|
272 JSHTMLVideoElement* castedThis = static_cast<JSHTMLVideoElement*>(asObject(thisValue)); |
|
273 HTMLVideoElement* imp = static_cast<HTMLVideoElement*>(castedThis->impl()); |
|
274 ExceptionCode ec = 0; |
|
275 |
|
276 imp->webkitEnterFullscreen(processingUserGesture(exec), ec); |
|
277 setDOMException(exec, ec); |
|
278 return JSValue::encode(jsUndefined()); |
|
279 } |
|
280 |
|
281 EncodedJSValue JSC_HOST_CALL jsHTMLVideoElementPrototypeFunctionWebkitExitFullscreen(ExecState* exec) |
|
282 { |
|
283 JSValue thisValue = exec->hostThisValue(); |
|
284 if (!thisValue.inherits(&JSHTMLVideoElement::s_info)) |
|
285 return throwVMTypeError(exec); |
|
286 JSHTMLVideoElement* castedThis = static_cast<JSHTMLVideoElement*>(asObject(thisValue)); |
|
287 HTMLVideoElement* imp = static_cast<HTMLVideoElement*>(castedThis->impl()); |
|
288 |
|
289 imp->webkitExitFullscreen(); |
|
290 return JSValue::encode(jsUndefined()); |
|
291 } |
|
292 |
|
293 EncodedJSValue JSC_HOST_CALL jsHTMLVideoElementPrototypeFunctionWebkitEnterFullScreen(ExecState* exec) |
|
294 { |
|
295 JSValue thisValue = exec->hostThisValue(); |
|
296 if (!thisValue.inherits(&JSHTMLVideoElement::s_info)) |
|
297 return throwVMTypeError(exec); |
|
298 JSHTMLVideoElement* castedThis = static_cast<JSHTMLVideoElement*>(asObject(thisValue)); |
|
299 HTMLVideoElement* imp = static_cast<HTMLVideoElement*>(castedThis->impl()); |
|
300 ExceptionCode ec = 0; |
|
301 |
|
302 imp->webkitEnterFullScreen(processingUserGesture(exec), ec); |
|
303 setDOMException(exec, ec); |
|
304 return JSValue::encode(jsUndefined()); |
|
305 } |
|
306 |
|
307 EncodedJSValue JSC_HOST_CALL jsHTMLVideoElementPrototypeFunctionWebkitExitFullScreen(ExecState* exec) |
|
308 { |
|
309 JSValue thisValue = exec->hostThisValue(); |
|
310 if (!thisValue.inherits(&JSHTMLVideoElement::s_info)) |
|
311 return throwVMTypeError(exec); |
|
312 JSHTMLVideoElement* castedThis = static_cast<JSHTMLVideoElement*>(asObject(thisValue)); |
|
313 HTMLVideoElement* imp = static_cast<HTMLVideoElement*>(castedThis->impl()); |
|
314 |
|
315 imp->webkitExitFullScreen(); |
|
316 return JSValue::encode(jsUndefined()); |
|
317 } |
|
318 |
|
319 HTMLVideoElement* toHTMLVideoElement(JSC::JSValue value) |
|
320 { |
|
321 return value.inherits(&JSHTMLVideoElement::s_info) ? static_cast<JSHTMLVideoElement*>(asObject(value))->impl() : 0; |
|
322 } |
|
323 |
|
324 } |
|
325 |
|
326 #endif // ENABLE(VIDEO) |