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 "CustomElementReactionQueue.h" |
28 | #include "HTMLNames.h" |
29 | #include "JSDOMAttribute.h" |
30 | #include "JSDOMBinding.h" |
31 | #include "JSDOMConstructorNotConstructable.h" |
32 | #include "JSDOMConvertBoolean.h" |
33 | #include "JSDOMConvertNumbers.h" |
34 | #include "JSDOMConvertStrings.h" |
35 | #include "JSDOMExceptionHandling.h" |
36 | #include "JSDOMOperation.h" |
37 | #include "JSDOMWrapperCache.h" |
38 | #include "ScriptExecutionContext.h" |
39 | #include <JavaScriptCore/HeapSnapshotBuilder.h> |
40 | #include <JavaScriptCore/JSCInlines.h> |
41 | #include <JavaScriptCore/JSString.h> |
42 | #include <wtf/GetPtr.h> |
43 | #include <wtf/PointerPreparations.h> |
44 | #include <wtf/URL.h> |
45 | |
46 | |
47 | namespace WebCore { |
48 | using namespace JSC; |
49 | |
50 | #if ENABLE(VIDEO_PRESENTATION_MODE) |
51 | |
52 | String convertEnumerationToString(HTMLVideoElement::VideoPresentationMode enumerationValue) |
53 | { |
54 | static const NeverDestroyed<String> values[] = { |
55 | MAKE_STATIC_STRING_IMPL("fullscreen" ), |
56 | MAKE_STATIC_STRING_IMPL("picture-in-picture" ), |
57 | MAKE_STATIC_STRING_IMPL("inline" ), |
58 | }; |
59 | static_assert(static_cast<size_t>(HTMLVideoElement::VideoPresentationMode::Fullscreen) == 0, "HTMLVideoElement::VideoPresentationMode::Fullscreen is not 0 as expected" ); |
60 | static_assert(static_cast<size_t>(HTMLVideoElement::VideoPresentationMode::PictureInPicture) == 1, "HTMLVideoElement::VideoPresentationMode::PictureInPicture is not 1 as expected" ); |
61 | static_assert(static_cast<size_t>(HTMLVideoElement::VideoPresentationMode::Inline) == 2, "HTMLVideoElement::VideoPresentationMode::Inline is not 2 as expected" ); |
62 | ASSERT(static_cast<size_t>(enumerationValue) < WTF_ARRAY_LENGTH(values)); |
63 | return values[static_cast<size_t>(enumerationValue)]; |
64 | } |
65 | |
66 | template<> JSString* convertEnumerationToJS(ExecState& state, HTMLVideoElement::VideoPresentationMode enumerationValue) |
67 | { |
68 | return jsStringWithCache(&state, convertEnumerationToString(enumerationValue)); |
69 | } |
70 | |
71 | template<> Optional<HTMLVideoElement::VideoPresentationMode> parseEnumeration<HTMLVideoElement::VideoPresentationMode>(ExecState& state, JSValue value) |
72 | { |
73 | auto stringValue = value.toWTFString(&state); |
74 | if (stringValue == "fullscreen" ) |
75 | return HTMLVideoElement::VideoPresentationMode::Fullscreen; |
76 | if (stringValue == "picture-in-picture" ) |
77 | return HTMLVideoElement::VideoPresentationMode::PictureInPicture; |
78 | if (stringValue == "inline" ) |
79 | return HTMLVideoElement::VideoPresentationMode::Inline; |
80 | return WTF::nullopt; |
81 | } |
82 | |
83 | template<> const char* expectedEnumerationValues<HTMLVideoElement::VideoPresentationMode>() |
84 | { |
85 | return "\"fullscreen\", \"picture-in-picture\", \"inline\"" ; |
86 | } |
87 | |
88 | #endif |
89 | |
90 | // Functions |
91 | |
92 | JSC::EncodedJSValue JSC_HOST_CALL jsHTMLVideoElementPrototypeFunctionWebkitEnterFullscreen(JSC::ExecState*); |
93 | JSC::EncodedJSValue JSC_HOST_CALL jsHTMLVideoElementPrototypeFunctionWebkitExitFullscreen(JSC::ExecState*); |
94 | JSC::EncodedJSValue JSC_HOST_CALL jsHTMLVideoElementPrototypeFunctionWebkitEnterFullScreen(JSC::ExecState*); |
95 | JSC::EncodedJSValue JSC_HOST_CALL jsHTMLVideoElementPrototypeFunctionWebkitExitFullScreen(JSC::ExecState*); |
96 | #if ENABLE(VIDEO_PRESENTATION_MODE) |
97 | JSC::EncodedJSValue JSC_HOST_CALL jsHTMLVideoElementPrototypeFunctionWebkitSupportsPresentationMode(JSC::ExecState*); |
98 | #endif |
99 | #if ENABLE(VIDEO_PRESENTATION_MODE) |
100 | JSC::EncodedJSValue JSC_HOST_CALL jsHTMLVideoElementPrototypeFunctionWebkitSetPresentationMode(JSC::ExecState*); |
101 | #endif |
102 | |
103 | // Attributes |
104 | |
105 | JSC::EncodedJSValue jsHTMLVideoElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
106 | bool setJSHTMLVideoElementConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
107 | JSC::EncodedJSValue jsHTMLVideoElementWidth(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
108 | bool setJSHTMLVideoElementWidth(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
109 | JSC::EncodedJSValue jsHTMLVideoElementHeight(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
110 | bool setJSHTMLVideoElementHeight(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
111 | JSC::EncodedJSValue jsHTMLVideoElementVideoWidth(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
112 | JSC::EncodedJSValue jsHTMLVideoElementVideoHeight(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
113 | JSC::EncodedJSValue jsHTMLVideoElementPoster(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
114 | bool setJSHTMLVideoElementPoster(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
115 | JSC::EncodedJSValue jsHTMLVideoElementPlaysInline(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
116 | bool setJSHTMLVideoElementPlaysInline(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
117 | JSC::EncodedJSValue jsHTMLVideoElementWebkitSupportsFullscreen(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
118 | JSC::EncodedJSValue jsHTMLVideoElementWebkitDisplayingFullscreen(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
119 | #if ENABLE(WIRELESS_PLAYBACK_TARGET) |
120 | JSC::EncodedJSValue jsHTMLVideoElementWebkitWirelessVideoPlaybackDisabled(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
121 | bool setJSHTMLVideoElementWebkitWirelessVideoPlaybackDisabled(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
122 | #endif |
123 | #if ENABLE(MEDIA_STATISTICS) |
124 | JSC::EncodedJSValue jsHTMLVideoElementWebkitDecodedFrameCount(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
125 | #endif |
126 | #if ENABLE(MEDIA_STATISTICS) |
127 | JSC::EncodedJSValue jsHTMLVideoElementWebkitDroppedFrameCount(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
128 | #endif |
129 | #if ENABLE(VIDEO_PRESENTATION_MODE) |
130 | JSC::EncodedJSValue jsHTMLVideoElementWebkitPresentationMode(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
131 | #endif |
132 | |
133 | class JSHTMLVideoElementPrototype : public JSC::JSNonFinalObject { |
134 | public: |
135 | using Base = JSC::JSNonFinalObject; |
136 | static JSHTMLVideoElementPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) |
137 | { |
138 | JSHTMLVideoElementPrototype* ptr = new (NotNull, JSC::allocateCell<JSHTMLVideoElementPrototype>(vm.heap)) JSHTMLVideoElementPrototype(vm, globalObject, structure); |
139 | ptr->finishCreation(vm); |
140 | return ptr; |
141 | } |
142 | |
143 | DECLARE_INFO; |
144 | static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) |
145 | { |
146 | return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); |
147 | } |
148 | |
149 | private: |
150 | JSHTMLVideoElementPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
151 | : JSC::JSNonFinalObject(vm, structure) |
152 | { |
153 | } |
154 | |
155 | void finishCreation(JSC::VM&); |
156 | }; |
157 | |
158 | using JSHTMLVideoElementConstructor = JSDOMConstructorNotConstructable<JSHTMLVideoElement>; |
159 | |
160 | template<> JSValue JSHTMLVideoElementConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) |
161 | { |
162 | return JSHTMLMediaElement::getConstructor(vm, &globalObject); |
163 | } |
164 | |
165 | template<> void JSHTMLVideoElementConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) |
166 | { |
167 | putDirect(vm, vm.propertyNames->prototype, JSHTMLVideoElement::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
168 | putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("HTMLVideoElement"_s )), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
169 | putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
170 | } |
171 | |
172 | template<> const ClassInfo JSHTMLVideoElementConstructor::s_info = { "HTMLVideoElement" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSHTMLVideoElementConstructor) }; |
173 | |
174 | /* Hash table for prototype */ |
175 | |
176 | static const HashTableValue JSHTMLVideoElementPrototypeTableValues[] = |
177 | { |
178 | { "constructor" , static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLVideoElementConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLVideoElementConstructor) } }, |
179 | { "width" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLVideoElementWidth), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLVideoElementWidth) } }, |
180 | { "height" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLVideoElementHeight), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLVideoElementHeight) } }, |
181 | { "videoWidth" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLVideoElementVideoWidth), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
182 | { "videoHeight" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLVideoElementVideoHeight), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
183 | { "poster" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLVideoElementPoster), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLVideoElementPoster) } }, |
184 | { "playsInline" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLVideoElementPlaysInline), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLVideoElementPlaysInline) } }, |
185 | { "webkitSupportsFullscreen" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLVideoElementWebkitSupportsFullscreen), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
186 | { "webkitDisplayingFullscreen" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLVideoElementWebkitDisplayingFullscreen), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
187 | #if ENABLE(WIRELESS_PLAYBACK_TARGET) |
188 | { "webkitWirelessVideoPlaybackDisabled" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLVideoElementWebkitWirelessVideoPlaybackDisabled), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSHTMLVideoElementWebkitWirelessVideoPlaybackDisabled) } }, |
189 | #else |
190 | { 0, 0, NoIntrinsic, { 0, 0 } }, |
191 | #endif |
192 | #if ENABLE(MEDIA_STATISTICS) |
193 | { "webkitDecodedFrameCount" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLVideoElementWebkitDecodedFrameCount), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
194 | #else |
195 | { 0, 0, NoIntrinsic, { 0, 0 } }, |
196 | #endif |
197 | #if ENABLE(MEDIA_STATISTICS) |
198 | { "webkitDroppedFrameCount" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLVideoElementWebkitDroppedFrameCount), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
199 | #else |
200 | { 0, 0, NoIntrinsic, { 0, 0 } }, |
201 | #endif |
202 | #if ENABLE(VIDEO_PRESENTATION_MODE) |
203 | { "webkitPresentationMode" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLVideoElementWebkitPresentationMode), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
204 | #else |
205 | { 0, 0, NoIntrinsic, { 0, 0 } }, |
206 | #endif |
207 | { "webkitEnterFullscreen" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsHTMLVideoElementPrototypeFunctionWebkitEnterFullscreen), (intptr_t) (0) } }, |
208 | { "webkitExitFullscreen" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsHTMLVideoElementPrototypeFunctionWebkitExitFullscreen), (intptr_t) (0) } }, |
209 | { "webkitEnterFullScreen" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsHTMLVideoElementPrototypeFunctionWebkitEnterFullScreen), (intptr_t) (0) } }, |
210 | { "webkitExitFullScreen" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsHTMLVideoElementPrototypeFunctionWebkitExitFullScreen), (intptr_t) (0) } }, |
211 | #if ENABLE(VIDEO_PRESENTATION_MODE) |
212 | { "webkitSupportsPresentationMode" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsHTMLVideoElementPrototypeFunctionWebkitSupportsPresentationMode), (intptr_t) (1) } }, |
213 | #else |
214 | { 0, 0, NoIntrinsic, { 0, 0 } }, |
215 | #endif |
216 | #if ENABLE(VIDEO_PRESENTATION_MODE) |
217 | { "webkitSetPresentationMode" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsHTMLVideoElementPrototypeFunctionWebkitSetPresentationMode), (intptr_t) (1) } }, |
218 | #else |
219 | { 0, 0, NoIntrinsic, { 0, 0 } }, |
220 | #endif |
221 | }; |
222 | |
223 | const ClassInfo JSHTMLVideoElementPrototype::s_info = { "HTMLVideoElementPrototype" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSHTMLVideoElementPrototype) }; |
224 | |
225 | void JSHTMLVideoElementPrototype::finishCreation(VM& vm) |
226 | { |
227 | Base::finishCreation(vm); |
228 | reifyStaticProperties(vm, JSHTMLVideoElement::info(), JSHTMLVideoElementPrototypeTableValues, *this); |
229 | } |
230 | |
231 | const ClassInfo JSHTMLVideoElement::s_info = { "HTMLVideoElement" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSHTMLVideoElement) }; |
232 | |
233 | JSHTMLVideoElement::JSHTMLVideoElement(Structure* structure, JSDOMGlobalObject& globalObject, Ref<HTMLVideoElement>&& impl) |
234 | : JSHTMLMediaElement(structure, globalObject, WTFMove(impl)) |
235 | { |
236 | } |
237 | |
238 | void JSHTMLVideoElement::finishCreation(VM& vm) |
239 | { |
240 | Base::finishCreation(vm); |
241 | ASSERT(inherits(vm, info())); |
242 | |
243 | } |
244 | |
245 | JSObject* JSHTMLVideoElement::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) |
246 | { |
247 | return JSHTMLVideoElementPrototype::create(vm, &globalObject, JSHTMLVideoElementPrototype::createStructure(vm, &globalObject, JSHTMLMediaElement::prototype(vm, globalObject))); |
248 | } |
249 | |
250 | JSObject* JSHTMLVideoElement::prototype(VM& vm, JSDOMGlobalObject& globalObject) |
251 | { |
252 | return getDOMPrototype<JSHTMLVideoElement>(vm, globalObject); |
253 | } |
254 | |
255 | JSValue JSHTMLVideoElement::getConstructor(VM& vm, const JSGlobalObject* globalObject) |
256 | { |
257 | return getDOMConstructor<JSHTMLVideoElementConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); |
258 | } |
259 | |
260 | template<> inline JSHTMLVideoElement* IDLAttribute<JSHTMLVideoElement>::cast(ExecState& state, EncodedJSValue thisValue) |
261 | { |
262 | return jsDynamicCast<JSHTMLVideoElement*>(state.vm(), JSValue::decode(thisValue)); |
263 | } |
264 | |
265 | template<> inline JSHTMLVideoElement* IDLOperation<JSHTMLVideoElement>::cast(ExecState& state) |
266 | { |
267 | return jsDynamicCast<JSHTMLVideoElement*>(state.vm(), state.thisValue()); |
268 | } |
269 | |
270 | EncodedJSValue jsHTMLVideoElementConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
271 | { |
272 | VM& vm = state->vm(); |
273 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
274 | auto* prototype = jsDynamicCast<JSHTMLVideoElementPrototype*>(vm, JSValue::decode(thisValue)); |
275 | if (UNLIKELY(!prototype)) |
276 | return throwVMTypeError(state, throwScope); |
277 | return JSValue::encode(JSHTMLVideoElement::getConstructor(state->vm(), prototype->globalObject())); |
278 | } |
279 | |
280 | bool setJSHTMLVideoElementConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
281 | { |
282 | VM& vm = state->vm(); |
283 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
284 | auto* prototype = jsDynamicCast<JSHTMLVideoElementPrototype*>(vm, JSValue::decode(thisValue)); |
285 | if (UNLIKELY(!prototype)) { |
286 | throwVMTypeError(state, throwScope); |
287 | return false; |
288 | } |
289 | // Shadowing a built-in constructor |
290 | return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue)); |
291 | } |
292 | |
293 | static inline JSValue jsHTMLVideoElementWidthGetter(ExecState& state, JSHTMLVideoElement& thisObject, ThrowScope& throwScope) |
294 | { |
295 | UNUSED_PARAM(throwScope); |
296 | UNUSED_PARAM(state); |
297 | auto& impl = thisObject.wrapped(); |
298 | JSValue result = toJS<IDLUnsignedLong>(state, throwScope, std::max(0, impl.getIntegralAttribute(WebCore::HTMLNames::widthAttr))); |
299 | return result; |
300 | } |
301 | |
302 | EncodedJSValue jsHTMLVideoElementWidth(ExecState* state, EncodedJSValue thisValue, PropertyName) |
303 | { |
304 | return IDLAttribute<JSHTMLVideoElement>::get<jsHTMLVideoElementWidthGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "width" ); |
305 | } |
306 | |
307 | static inline bool setJSHTMLVideoElementWidthSetter(ExecState& state, JSHTMLVideoElement& thisObject, JSValue value, ThrowScope& throwScope) |
308 | { |
309 | UNUSED_PARAM(throwScope); |
310 | CustomElementReactionDisallowedScope customElementReactionDisallowedScope; |
311 | auto& impl = thisObject.wrapped(); |
312 | auto nativeValue = convert<IDLUnsignedLong>(state, value); |
313 | RETURN_IF_EXCEPTION(throwScope, false); |
314 | AttributeSetter::call(state, throwScope, [&] { |
315 | return impl.setUnsignedIntegralAttribute(WebCore::HTMLNames::widthAttr, WTFMove(nativeValue)); |
316 | }); |
317 | return true; |
318 | } |
319 | |
320 | bool setJSHTMLVideoElementWidth(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
321 | { |
322 | return IDLAttribute<JSHTMLVideoElement>::set<setJSHTMLVideoElementWidthSetter>(*state, thisValue, encodedValue, "width" ); |
323 | } |
324 | |
325 | static inline JSValue jsHTMLVideoElementHeightGetter(ExecState& state, JSHTMLVideoElement& thisObject, ThrowScope& throwScope) |
326 | { |
327 | UNUSED_PARAM(throwScope); |
328 | UNUSED_PARAM(state); |
329 | auto& impl = thisObject.wrapped(); |
330 | JSValue result = toJS<IDLUnsignedLong>(state, throwScope, std::max(0, impl.getIntegralAttribute(WebCore::HTMLNames::heightAttr))); |
331 | return result; |
332 | } |
333 | |
334 | EncodedJSValue jsHTMLVideoElementHeight(ExecState* state, EncodedJSValue thisValue, PropertyName) |
335 | { |
336 | return IDLAttribute<JSHTMLVideoElement>::get<jsHTMLVideoElementHeightGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "height" ); |
337 | } |
338 | |
339 | static inline bool setJSHTMLVideoElementHeightSetter(ExecState& state, JSHTMLVideoElement& thisObject, JSValue value, ThrowScope& throwScope) |
340 | { |
341 | UNUSED_PARAM(throwScope); |
342 | CustomElementReactionDisallowedScope customElementReactionDisallowedScope; |
343 | auto& impl = thisObject.wrapped(); |
344 | auto nativeValue = convert<IDLUnsignedLong>(state, value); |
345 | RETURN_IF_EXCEPTION(throwScope, false); |
346 | AttributeSetter::call(state, throwScope, [&] { |
347 | return impl.setUnsignedIntegralAttribute(WebCore::HTMLNames::heightAttr, WTFMove(nativeValue)); |
348 | }); |
349 | return true; |
350 | } |
351 | |
352 | bool setJSHTMLVideoElementHeight(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
353 | { |
354 | return IDLAttribute<JSHTMLVideoElement>::set<setJSHTMLVideoElementHeightSetter>(*state, thisValue, encodedValue, "height" ); |
355 | } |
356 | |
357 | static inline JSValue jsHTMLVideoElementVideoWidthGetter(ExecState& state, JSHTMLVideoElement& thisObject, ThrowScope& throwScope) |
358 | { |
359 | UNUSED_PARAM(throwScope); |
360 | UNUSED_PARAM(state); |
361 | auto& impl = thisObject.wrapped(); |
362 | JSValue result = toJS<IDLUnsignedLong>(state, throwScope, impl.videoWidth()); |
363 | return result; |
364 | } |
365 | |
366 | EncodedJSValue jsHTMLVideoElementVideoWidth(ExecState* state, EncodedJSValue thisValue, PropertyName) |
367 | { |
368 | return IDLAttribute<JSHTMLVideoElement>::get<jsHTMLVideoElementVideoWidthGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "videoWidth" ); |
369 | } |
370 | |
371 | static inline JSValue jsHTMLVideoElementVideoHeightGetter(ExecState& state, JSHTMLVideoElement& thisObject, ThrowScope& throwScope) |
372 | { |
373 | UNUSED_PARAM(throwScope); |
374 | UNUSED_PARAM(state); |
375 | auto& impl = thisObject.wrapped(); |
376 | JSValue result = toJS<IDLUnsignedLong>(state, throwScope, impl.videoHeight()); |
377 | return result; |
378 | } |
379 | |
380 | EncodedJSValue jsHTMLVideoElementVideoHeight(ExecState* state, EncodedJSValue thisValue, PropertyName) |
381 | { |
382 | return IDLAttribute<JSHTMLVideoElement>::get<jsHTMLVideoElementVideoHeightGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "videoHeight" ); |
383 | } |
384 | |
385 | static inline JSValue jsHTMLVideoElementPosterGetter(ExecState& state, JSHTMLVideoElement& thisObject, ThrowScope& throwScope) |
386 | { |
387 | UNUSED_PARAM(throwScope); |
388 | UNUSED_PARAM(state); |
389 | auto& impl = thisObject.wrapped(); |
390 | JSValue result = toJS<IDLUSVString>(state, throwScope, impl.getURLAttribute(WebCore::HTMLNames::posterAttr)); |
391 | return result; |
392 | } |
393 | |
394 | EncodedJSValue jsHTMLVideoElementPoster(ExecState* state, EncodedJSValue thisValue, PropertyName) |
395 | { |
396 | return IDLAttribute<JSHTMLVideoElement>::get<jsHTMLVideoElementPosterGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "poster" ); |
397 | } |
398 | |
399 | static inline bool setJSHTMLVideoElementPosterSetter(ExecState& state, JSHTMLVideoElement& thisObject, JSValue value, ThrowScope& throwScope) |
400 | { |
401 | UNUSED_PARAM(throwScope); |
402 | CustomElementReactionDisallowedScope customElementReactionDisallowedScope; |
403 | auto& impl = thisObject.wrapped(); |
404 | auto nativeValue = convert<IDLUSVString>(state, value); |
405 | RETURN_IF_EXCEPTION(throwScope, false); |
406 | AttributeSetter::call(state, throwScope, [&] { |
407 | return impl.setAttributeWithoutSynchronization(WebCore::HTMLNames::posterAttr, WTFMove(nativeValue)); |
408 | }); |
409 | return true; |
410 | } |
411 | |
412 | bool setJSHTMLVideoElementPoster(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
413 | { |
414 | return IDLAttribute<JSHTMLVideoElement>::set<setJSHTMLVideoElementPosterSetter>(*state, thisValue, encodedValue, "poster" ); |
415 | } |
416 | |
417 | static inline JSValue jsHTMLVideoElementPlaysInlineGetter(ExecState& state, JSHTMLVideoElement& thisObject, ThrowScope& throwScope) |
418 | { |
419 | UNUSED_PARAM(throwScope); |
420 | UNUSED_PARAM(state); |
421 | auto& impl = thisObject.wrapped(); |
422 | JSValue result = toJS<IDLBoolean>(state, throwScope, impl.hasAttributeWithoutSynchronization(WebCore::HTMLNames::playsinlineAttr)); |
423 | return result; |
424 | } |
425 | |
426 | EncodedJSValue jsHTMLVideoElementPlaysInline(ExecState* state, EncodedJSValue thisValue, PropertyName) |
427 | { |
428 | return IDLAttribute<JSHTMLVideoElement>::get<jsHTMLVideoElementPlaysInlineGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "playsInline" ); |
429 | } |
430 | |
431 | static inline bool setJSHTMLVideoElementPlaysInlineSetter(ExecState& state, JSHTMLVideoElement& thisObject, JSValue value, ThrowScope& throwScope) |
432 | { |
433 | UNUSED_PARAM(throwScope); |
434 | CustomElementReactionDisallowedScope customElementReactionDisallowedScope; |
435 | auto& impl = thisObject.wrapped(); |
436 | auto nativeValue = convert<IDLBoolean>(state, value); |
437 | RETURN_IF_EXCEPTION(throwScope, false); |
438 | AttributeSetter::call(state, throwScope, [&] { |
439 | return impl.setBooleanAttribute(WebCore::HTMLNames::playsinlineAttr, WTFMove(nativeValue)); |
440 | }); |
441 | return true; |
442 | } |
443 | |
444 | bool setJSHTMLVideoElementPlaysInline(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
445 | { |
446 | return IDLAttribute<JSHTMLVideoElement>::set<setJSHTMLVideoElementPlaysInlineSetter>(*state, thisValue, encodedValue, "playsInline" ); |
447 | } |
448 | |
449 | static inline JSValue jsHTMLVideoElementWebkitSupportsFullscreenGetter(ExecState& state, JSHTMLVideoElement& thisObject, ThrowScope& throwScope) |
450 | { |
451 | UNUSED_PARAM(throwScope); |
452 | UNUSED_PARAM(state); |
453 | auto& impl = thisObject.wrapped(); |
454 | JSValue result = toJS<IDLBoolean>(state, throwScope, impl.webkitSupportsFullscreen()); |
455 | return result; |
456 | } |
457 | |
458 | EncodedJSValue jsHTMLVideoElementWebkitSupportsFullscreen(ExecState* state, EncodedJSValue thisValue, PropertyName) |
459 | { |
460 | return IDLAttribute<JSHTMLVideoElement>::get<jsHTMLVideoElementWebkitSupportsFullscreenGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "webkitSupportsFullscreen" ); |
461 | } |
462 | |
463 | static inline JSValue jsHTMLVideoElementWebkitDisplayingFullscreenGetter(ExecState& state, JSHTMLVideoElement& thisObject, ThrowScope& throwScope) |
464 | { |
465 | UNUSED_PARAM(throwScope); |
466 | UNUSED_PARAM(state); |
467 | auto& impl = thisObject.wrapped(); |
468 | JSValue result = toJS<IDLBoolean>(state, throwScope, impl.webkitDisplayingFullscreen()); |
469 | return result; |
470 | } |
471 | |
472 | EncodedJSValue jsHTMLVideoElementWebkitDisplayingFullscreen(ExecState* state, EncodedJSValue thisValue, PropertyName) |
473 | { |
474 | return IDLAttribute<JSHTMLVideoElement>::get<jsHTMLVideoElementWebkitDisplayingFullscreenGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "webkitDisplayingFullscreen" ); |
475 | } |
476 | |
477 | #if ENABLE(WIRELESS_PLAYBACK_TARGET) |
478 | static inline JSValue jsHTMLVideoElementWebkitWirelessVideoPlaybackDisabledGetter(ExecState& state, JSHTMLVideoElement& thisObject, ThrowScope& throwScope) |
479 | { |
480 | UNUSED_PARAM(throwScope); |
481 | UNUSED_PARAM(state); |
482 | auto& impl = thisObject.wrapped(); |
483 | JSValue result = toJS<IDLBoolean>(state, throwScope, impl.webkitWirelessVideoPlaybackDisabled()); |
484 | return result; |
485 | } |
486 | |
487 | EncodedJSValue jsHTMLVideoElementWebkitWirelessVideoPlaybackDisabled(ExecState* state, EncodedJSValue thisValue, PropertyName) |
488 | { |
489 | return IDLAttribute<JSHTMLVideoElement>::get<jsHTMLVideoElementWebkitWirelessVideoPlaybackDisabledGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "webkitWirelessVideoPlaybackDisabled" ); |
490 | } |
491 | |
492 | #endif |
493 | |
494 | #if ENABLE(WIRELESS_PLAYBACK_TARGET) |
495 | static inline bool setJSHTMLVideoElementWebkitWirelessVideoPlaybackDisabledSetter(ExecState& state, JSHTMLVideoElement& thisObject, JSValue value, ThrowScope& throwScope) |
496 | { |
497 | UNUSED_PARAM(throwScope); |
498 | auto& impl = thisObject.wrapped(); |
499 | auto nativeValue = convert<IDLBoolean>(state, value); |
500 | RETURN_IF_EXCEPTION(throwScope, false); |
501 | AttributeSetter::call(state, throwScope, [&] { |
502 | return impl.setWebkitWirelessVideoPlaybackDisabled(WTFMove(nativeValue)); |
503 | }); |
504 | return true; |
505 | } |
506 | |
507 | bool setJSHTMLVideoElementWebkitWirelessVideoPlaybackDisabled(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
508 | { |
509 | return IDLAttribute<JSHTMLVideoElement>::set<setJSHTMLVideoElementWebkitWirelessVideoPlaybackDisabledSetter>(*state, thisValue, encodedValue, "webkitWirelessVideoPlaybackDisabled" ); |
510 | } |
511 | |
512 | #endif |
513 | |
514 | #if ENABLE(MEDIA_STATISTICS) |
515 | static inline JSValue jsHTMLVideoElementWebkitDecodedFrameCountGetter(ExecState& state, JSHTMLVideoElement& thisObject, ThrowScope& throwScope) |
516 | { |
517 | UNUSED_PARAM(throwScope); |
518 | UNUSED_PARAM(state); |
519 | auto& impl = thisObject.wrapped(); |
520 | JSValue result = toJS<IDLUnsignedLong>(state, throwScope, impl.webkitDecodedFrameCount()); |
521 | return result; |
522 | } |
523 | |
524 | EncodedJSValue jsHTMLVideoElementWebkitDecodedFrameCount(ExecState* state, EncodedJSValue thisValue, PropertyName) |
525 | { |
526 | return IDLAttribute<JSHTMLVideoElement>::get<jsHTMLVideoElementWebkitDecodedFrameCountGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "webkitDecodedFrameCount" ); |
527 | } |
528 | |
529 | #endif |
530 | |
531 | #if ENABLE(MEDIA_STATISTICS) |
532 | static inline JSValue jsHTMLVideoElementWebkitDroppedFrameCountGetter(ExecState& state, JSHTMLVideoElement& thisObject, ThrowScope& throwScope) |
533 | { |
534 | UNUSED_PARAM(throwScope); |
535 | UNUSED_PARAM(state); |
536 | auto& impl = thisObject.wrapped(); |
537 | JSValue result = toJS<IDLUnsignedLong>(state, throwScope, impl.webkitDroppedFrameCount()); |
538 | return result; |
539 | } |
540 | |
541 | EncodedJSValue jsHTMLVideoElementWebkitDroppedFrameCount(ExecState* state, EncodedJSValue thisValue, PropertyName) |
542 | { |
543 | return IDLAttribute<JSHTMLVideoElement>::get<jsHTMLVideoElementWebkitDroppedFrameCountGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "webkitDroppedFrameCount" ); |
544 | } |
545 | |
546 | #endif |
547 | |
548 | #if ENABLE(VIDEO_PRESENTATION_MODE) |
549 | static inline JSValue jsHTMLVideoElementWebkitPresentationModeGetter(ExecState& state, JSHTMLVideoElement& thisObject, ThrowScope& throwScope) |
550 | { |
551 | UNUSED_PARAM(throwScope); |
552 | UNUSED_PARAM(state); |
553 | auto& impl = thisObject.wrapped(); |
554 | JSValue result = toJS<IDLEnumeration<HTMLVideoElement::VideoPresentationMode>>(state, throwScope, impl.webkitPresentationMode()); |
555 | return result; |
556 | } |
557 | |
558 | EncodedJSValue jsHTMLVideoElementWebkitPresentationMode(ExecState* state, EncodedJSValue thisValue, PropertyName) |
559 | { |
560 | return IDLAttribute<JSHTMLVideoElement>::get<jsHTMLVideoElementWebkitPresentationModeGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "webkitPresentationMode" ); |
561 | } |
562 | |
563 | #endif |
564 | |
565 | static inline JSC::EncodedJSValue jsHTMLVideoElementPrototypeFunctionWebkitEnterFullscreenBody(JSC::ExecState* state, typename IDLOperation<JSHTMLVideoElement>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
566 | { |
567 | UNUSED_PARAM(state); |
568 | UNUSED_PARAM(throwScope); |
569 | auto& impl = castedThis->wrapped(); |
570 | propagateException(*state, throwScope, impl.webkitEnterFullscreen()); |
571 | return JSValue::encode(jsUndefined()); |
572 | } |
573 | |
574 | EncodedJSValue JSC_HOST_CALL jsHTMLVideoElementPrototypeFunctionWebkitEnterFullscreen(ExecState* state) |
575 | { |
576 | return IDLOperation<JSHTMLVideoElement>::call<jsHTMLVideoElementPrototypeFunctionWebkitEnterFullscreenBody>(*state, "webkitEnterFullscreen" ); |
577 | } |
578 | |
579 | static inline JSC::EncodedJSValue jsHTMLVideoElementPrototypeFunctionWebkitExitFullscreenBody(JSC::ExecState* state, typename IDLOperation<JSHTMLVideoElement>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
580 | { |
581 | UNUSED_PARAM(state); |
582 | UNUSED_PARAM(throwScope); |
583 | auto& impl = castedThis->wrapped(); |
584 | impl.webkitExitFullscreen(); |
585 | return JSValue::encode(jsUndefined()); |
586 | } |
587 | |
588 | EncodedJSValue JSC_HOST_CALL jsHTMLVideoElementPrototypeFunctionWebkitExitFullscreen(ExecState* state) |
589 | { |
590 | return IDLOperation<JSHTMLVideoElement>::call<jsHTMLVideoElementPrototypeFunctionWebkitExitFullscreenBody>(*state, "webkitExitFullscreen" ); |
591 | } |
592 | |
593 | static inline JSC::EncodedJSValue jsHTMLVideoElementPrototypeFunctionWebkitEnterFullScreenBody(JSC::ExecState* state, typename IDLOperation<JSHTMLVideoElement>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
594 | { |
595 | UNUSED_PARAM(state); |
596 | UNUSED_PARAM(throwScope); |
597 | auto& impl = castedThis->wrapped(); |
598 | propagateException(*state, throwScope, impl.webkitEnterFullscreen()); |
599 | return JSValue::encode(jsUndefined()); |
600 | } |
601 | |
602 | EncodedJSValue JSC_HOST_CALL jsHTMLVideoElementPrototypeFunctionWebkitEnterFullScreen(ExecState* state) |
603 | { |
604 | return IDLOperation<JSHTMLVideoElement>::call<jsHTMLVideoElementPrototypeFunctionWebkitEnterFullScreenBody>(*state, "webkitEnterFullScreen" ); |
605 | } |
606 | |
607 | static inline JSC::EncodedJSValue jsHTMLVideoElementPrototypeFunctionWebkitExitFullScreenBody(JSC::ExecState* state, typename IDLOperation<JSHTMLVideoElement>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
608 | { |
609 | UNUSED_PARAM(state); |
610 | UNUSED_PARAM(throwScope); |
611 | auto& impl = castedThis->wrapped(); |
612 | impl.webkitExitFullscreen(); |
613 | return JSValue::encode(jsUndefined()); |
614 | } |
615 | |
616 | EncodedJSValue JSC_HOST_CALL jsHTMLVideoElementPrototypeFunctionWebkitExitFullScreen(ExecState* state) |
617 | { |
618 | return IDLOperation<JSHTMLVideoElement>::call<jsHTMLVideoElementPrototypeFunctionWebkitExitFullScreenBody>(*state, "webkitExitFullScreen" ); |
619 | } |
620 | |
621 | #if ENABLE(VIDEO_PRESENTATION_MODE) |
622 | static inline JSC::EncodedJSValue jsHTMLVideoElementPrototypeFunctionWebkitSupportsPresentationModeBody(JSC::ExecState* state, typename IDLOperation<JSHTMLVideoElement>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
623 | { |
624 | UNUSED_PARAM(state); |
625 | UNUSED_PARAM(throwScope); |
626 | auto& impl = castedThis->wrapped(); |
627 | if (UNLIKELY(state->argumentCount() < 1)) |
628 | return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
629 | auto mode = convert<IDLEnumeration<HTMLVideoElement::VideoPresentationMode>>(*state, state->uncheckedArgument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentMustBeEnumError(state, scope, 0, "mode" , "HTMLVideoElement" , "webkitSupportsPresentationMode" , expectedEnumerationValues<HTMLVideoElement::VideoPresentationMode>()); }); |
630 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
631 | return JSValue::encode(toJS<IDLBoolean>(impl.webkitSupportsPresentationMode(WTFMove(mode)))); |
632 | } |
633 | |
634 | EncodedJSValue JSC_HOST_CALL jsHTMLVideoElementPrototypeFunctionWebkitSupportsPresentationMode(ExecState* state) |
635 | { |
636 | return IDLOperation<JSHTMLVideoElement>::call<jsHTMLVideoElementPrototypeFunctionWebkitSupportsPresentationModeBody>(*state, "webkitSupportsPresentationMode" ); |
637 | } |
638 | |
639 | #endif |
640 | |
641 | #if ENABLE(VIDEO_PRESENTATION_MODE) |
642 | static inline JSC::EncodedJSValue jsHTMLVideoElementPrototypeFunctionWebkitSetPresentationModeBody(JSC::ExecState* state, typename IDLOperation<JSHTMLVideoElement>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
643 | { |
644 | UNUSED_PARAM(state); |
645 | UNUSED_PARAM(throwScope); |
646 | auto& impl = castedThis->wrapped(); |
647 | if (UNLIKELY(state->argumentCount() < 1)) |
648 | return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
649 | auto mode = convert<IDLEnumeration<HTMLVideoElement::VideoPresentationMode>>(*state, state->uncheckedArgument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentMustBeEnumError(state, scope, 0, "mode" , "HTMLVideoElement" , "webkitSetPresentationMode" , expectedEnumerationValues<HTMLVideoElement::VideoPresentationMode>()); }); |
650 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
651 | impl.webkitSetPresentationMode(WTFMove(mode)); |
652 | return JSValue::encode(jsUndefined()); |
653 | } |
654 | |
655 | EncodedJSValue JSC_HOST_CALL jsHTMLVideoElementPrototypeFunctionWebkitSetPresentationMode(ExecState* state) |
656 | { |
657 | return IDLOperation<JSHTMLVideoElement>::call<jsHTMLVideoElementPrototypeFunctionWebkitSetPresentationModeBody>(*state, "webkitSetPresentationMode" ); |
658 | } |
659 | |
660 | #endif |
661 | |
662 | void JSHTMLVideoElement::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder) |
663 | { |
664 | auto* thisObject = jsCast<JSHTMLVideoElement*>(cell); |
665 | builder.setWrappedObjectForCell(cell, &thisObject->wrapped()); |
666 | if (thisObject->scriptExecutionContext()) |
667 | builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); |
668 | Base::heapSnapshot(cell, builder); |
669 | } |
670 | |
671 | bool JSHTMLVideoElementOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor, const char** reason) |
672 | { |
673 | auto* jsHTMLVideoElement = jsCast<JSHTMLVideoElement*>(handle.slot()->asCell()); |
674 | if (jsHTMLVideoElement->wrapped().hasPendingActivity()) { |
675 | if (UNLIKELY(reason)) |
676 | *reason = "ActiveDOMObject with pending activity" ; |
677 | return true; |
678 | } |
679 | if (jsHTMLVideoElement->wrapped().isFiringEventListeners()) { |
680 | if (UNLIKELY(reason)) |
681 | *reason = "EventTarget firing event listeners" ; |
682 | return true; |
683 | } |
684 | if (JSNodeOwner::isReachableFromOpaqueRoots(handle, 0, visitor, reason)) |
685 | return true; |
686 | UNUSED_PARAM(visitor); |
687 | UNUSED_PARAM(reason); |
688 | return false; |
689 | } |
690 | |
691 | void JSHTMLVideoElementOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) |
692 | { |
693 | auto* jsHTMLVideoElement = static_cast<JSHTMLVideoElement*>(handle.slot()->asCell()); |
694 | auto& world = *static_cast<DOMWrapperWorld*>(context); |
695 | uncacheWrapper(world, &jsHTMLVideoElement->wrapped(), jsHTMLVideoElement); |
696 | } |
697 | |
698 | HTMLVideoElement* JSHTMLVideoElement::toWrapped(JSC::VM& vm, JSC::JSValue value) |
699 | { |
700 | if (auto* wrapper = jsDynamicCast<JSHTMLVideoElement*>(vm, value)) |
701 | return &wrapper->wrapped(); |
702 | return nullptr; |
703 | } |
704 | |
705 | } |
706 | |
707 | #endif // ENABLE(VIDEO) |
708 | |