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_TRACK) |
24 | |
25 | #include "JSVTTCue.h" |
26 | |
27 | #include "JSDOMAttribute.h" |
28 | #include "JSDOMBinding.h" |
29 | #include "JSDOMConstructor.h" |
30 | #include "JSDOMConvertBoolean.h" |
31 | #include "JSDOMConvertInterface.h" |
32 | #include "JSDOMConvertNumbers.h" |
33 | #include "JSDOMConvertStrings.h" |
34 | #include "JSDOMConvertUnion.h" |
35 | #include "JSDOMExceptionHandling.h" |
36 | #include "JSDOMGlobalObject.h" |
37 | #include "JSDOMOperation.h" |
38 | #include "JSDOMWrapperCache.h" |
39 | #include "JSDocumentFragment.h" |
40 | #include "ScriptExecutionContext.h" |
41 | #include <JavaScriptCore/HeapSnapshotBuilder.h> |
42 | #include <JavaScriptCore/JSCInlines.h> |
43 | #include <JavaScriptCore/JSString.h> |
44 | #include <wtf/GetPtr.h> |
45 | #include <wtf/NeverDestroyed.h> |
46 | #include <wtf/PointerPreparations.h> |
47 | #include <wtf/URL.h> |
48 | #include <wtf/Variant.h> |
49 | |
50 | |
51 | namespace WebCore { |
52 | using namespace JSC; |
53 | |
54 | String convertEnumerationToString(VTTCue::AutoKeyword enumerationValue) |
55 | { |
56 | static const NeverDestroyed<String> values[] = { |
57 | MAKE_STATIC_STRING_IMPL("auto" ), |
58 | }; |
59 | static_assert(static_cast<size_t>(VTTCue::AutoKeyword::Auto) == 0, "VTTCue::AutoKeyword::Auto is not 0 as expected" ); |
60 | ASSERT(static_cast<size_t>(enumerationValue) < WTF_ARRAY_LENGTH(values)); |
61 | return values[static_cast<size_t>(enumerationValue)]; |
62 | } |
63 | |
64 | template<> JSString* convertEnumerationToJS(ExecState& state, VTTCue::AutoKeyword enumerationValue) |
65 | { |
66 | return jsStringWithCache(&state, convertEnumerationToString(enumerationValue)); |
67 | } |
68 | |
69 | template<> Optional<VTTCue::AutoKeyword> parseEnumeration<VTTCue::AutoKeyword>(ExecState& state, JSValue value) |
70 | { |
71 | auto stringValue = value.toWTFString(&state); |
72 | if (stringValue == "auto" ) |
73 | return VTTCue::AutoKeyword::Auto; |
74 | return WTF::nullopt; |
75 | } |
76 | |
77 | template<> const char* expectedEnumerationValues<VTTCue::AutoKeyword>() |
78 | { |
79 | return "\"auto\"" ; |
80 | } |
81 | |
82 | // Functions |
83 | |
84 | JSC::EncodedJSValue JSC_HOST_CALL jsVTTCuePrototypeFunctionGetCueAsHTML(JSC::ExecState*); |
85 | |
86 | // Attributes |
87 | |
88 | JSC::EncodedJSValue jsVTTCueConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
89 | bool setJSVTTCueConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
90 | JSC::EncodedJSValue jsVTTCueVertical(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
91 | bool setJSVTTCueVertical(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
92 | JSC::EncodedJSValue jsVTTCueSnapToLines(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
93 | bool setJSVTTCueSnapToLines(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
94 | JSC::EncodedJSValue jsVTTCueLine(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
95 | bool setJSVTTCueLine(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
96 | JSC::EncodedJSValue jsVTTCuePosition(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
97 | bool setJSVTTCuePosition(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
98 | JSC::EncodedJSValue jsVTTCueSize(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
99 | bool setJSVTTCueSize(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
100 | JSC::EncodedJSValue jsVTTCueAlign(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
101 | bool setJSVTTCueAlign(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
102 | JSC::EncodedJSValue jsVTTCueText(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
103 | bool setJSVTTCueText(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
104 | JSC::EncodedJSValue jsVTTCueRegionId(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
105 | bool setJSVTTCueRegionId(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
106 | |
107 | class JSVTTCuePrototype : public JSC::JSNonFinalObject { |
108 | public: |
109 | using Base = JSC::JSNonFinalObject; |
110 | static JSVTTCuePrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) |
111 | { |
112 | JSVTTCuePrototype* ptr = new (NotNull, JSC::allocateCell<JSVTTCuePrototype>(vm.heap)) JSVTTCuePrototype(vm, globalObject, structure); |
113 | ptr->finishCreation(vm); |
114 | return ptr; |
115 | } |
116 | |
117 | DECLARE_INFO; |
118 | static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) |
119 | { |
120 | return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); |
121 | } |
122 | |
123 | private: |
124 | JSVTTCuePrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
125 | : JSC::JSNonFinalObject(vm, structure) |
126 | { |
127 | } |
128 | |
129 | void finishCreation(JSC::VM&); |
130 | }; |
131 | |
132 | using JSVTTCueConstructor = JSDOMConstructor<JSVTTCue>; |
133 | |
134 | template<> EncodedJSValue JSC_HOST_CALL JSVTTCueConstructor::construct(ExecState* state) |
135 | { |
136 | VM& vm = state->vm(); |
137 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
138 | UNUSED_PARAM(throwScope); |
139 | auto* castedThis = jsCast<JSVTTCueConstructor*>(state->jsCallee()); |
140 | ASSERT(castedThis); |
141 | if (UNLIKELY(state->argumentCount() < 3)) |
142 | return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
143 | auto* context = castedThis->scriptExecutionContext(); |
144 | if (UNLIKELY(!context)) |
145 | return throwConstructorScriptExecutionContextUnavailableError(*state, throwScope, "VTTCue" ); |
146 | auto startTime = convert<IDLDouble>(*state, state->uncheckedArgument(0)); |
147 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
148 | auto endTime = convert<IDLDouble>(*state, state->uncheckedArgument(1)); |
149 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
150 | auto text = convert<IDLDOMString>(*state, state->uncheckedArgument(2)); |
151 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
152 | auto object = VTTCue::create(*context, WTFMove(startTime), WTFMove(endTime), WTFMove(text)); |
153 | return JSValue::encode(toJSNewlyCreated<IDLInterface<VTTCue>>(*state, *castedThis->globalObject(), WTFMove(object))); |
154 | } |
155 | |
156 | template<> JSValue JSVTTCueConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) |
157 | { |
158 | return JSTextTrackCue::getConstructor(vm, &globalObject); |
159 | } |
160 | |
161 | template<> void JSVTTCueConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) |
162 | { |
163 | putDirect(vm, vm.propertyNames->prototype, JSVTTCue::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
164 | putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("VTTCue"_s )), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
165 | putDirect(vm, vm.propertyNames->length, jsNumber(3), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
166 | } |
167 | |
168 | template<> const ClassInfo JSVTTCueConstructor::s_info = { "VTTCue" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSVTTCueConstructor) }; |
169 | |
170 | /* Hash table for prototype */ |
171 | |
172 | static const HashTableValue JSVTTCuePrototypeTableValues[] = |
173 | { |
174 | { "constructor" , static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsVTTCueConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSVTTCueConstructor) } }, |
175 | { "vertical" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsVTTCueVertical), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSVTTCueVertical) } }, |
176 | { "snapToLines" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsVTTCueSnapToLines), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSVTTCueSnapToLines) } }, |
177 | { "line" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsVTTCueLine), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSVTTCueLine) } }, |
178 | { "position" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsVTTCuePosition), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSVTTCuePosition) } }, |
179 | { "size" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsVTTCueSize), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSVTTCueSize) } }, |
180 | { "align" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsVTTCueAlign), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSVTTCueAlign) } }, |
181 | { "text" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsVTTCueText), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSVTTCueText) } }, |
182 | { "regionId" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsVTTCueRegionId), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSVTTCueRegionId) } }, |
183 | { "getCueAsHTML" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsVTTCuePrototypeFunctionGetCueAsHTML), (intptr_t) (0) } }, |
184 | }; |
185 | |
186 | const ClassInfo JSVTTCuePrototype::s_info = { "VTTCuePrototype" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSVTTCuePrototype) }; |
187 | |
188 | void JSVTTCuePrototype::finishCreation(VM& vm) |
189 | { |
190 | Base::finishCreation(vm); |
191 | reifyStaticProperties(vm, JSVTTCue::info(), JSVTTCuePrototypeTableValues, *this); |
192 | } |
193 | |
194 | const ClassInfo JSVTTCue::s_info = { "VTTCue" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSVTTCue) }; |
195 | |
196 | JSVTTCue::JSVTTCue(Structure* structure, JSDOMGlobalObject& globalObject, Ref<VTTCue>&& impl) |
197 | : JSTextTrackCue(structure, globalObject, WTFMove(impl)) |
198 | { |
199 | } |
200 | |
201 | void JSVTTCue::finishCreation(VM& vm) |
202 | { |
203 | Base::finishCreation(vm); |
204 | ASSERT(inherits(vm, info())); |
205 | |
206 | } |
207 | |
208 | JSObject* JSVTTCue::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) |
209 | { |
210 | return JSVTTCuePrototype::create(vm, &globalObject, JSVTTCuePrototype::createStructure(vm, &globalObject, JSTextTrackCue::prototype(vm, globalObject))); |
211 | } |
212 | |
213 | JSObject* JSVTTCue::prototype(VM& vm, JSDOMGlobalObject& globalObject) |
214 | { |
215 | return getDOMPrototype<JSVTTCue>(vm, globalObject); |
216 | } |
217 | |
218 | JSValue JSVTTCue::getConstructor(VM& vm, const JSGlobalObject* globalObject) |
219 | { |
220 | return getDOMConstructor<JSVTTCueConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); |
221 | } |
222 | |
223 | template<> inline JSVTTCue* IDLAttribute<JSVTTCue>::cast(ExecState& state, EncodedJSValue thisValue) |
224 | { |
225 | return jsDynamicCast<JSVTTCue*>(state.vm(), JSValue::decode(thisValue)); |
226 | } |
227 | |
228 | template<> inline JSVTTCue* IDLOperation<JSVTTCue>::cast(ExecState& state) |
229 | { |
230 | return jsDynamicCast<JSVTTCue*>(state.vm(), state.thisValue()); |
231 | } |
232 | |
233 | EncodedJSValue jsVTTCueConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
234 | { |
235 | VM& vm = state->vm(); |
236 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
237 | auto* prototype = jsDynamicCast<JSVTTCuePrototype*>(vm, JSValue::decode(thisValue)); |
238 | if (UNLIKELY(!prototype)) |
239 | return throwVMTypeError(state, throwScope); |
240 | return JSValue::encode(JSVTTCue::getConstructor(state->vm(), prototype->globalObject())); |
241 | } |
242 | |
243 | bool setJSVTTCueConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
244 | { |
245 | VM& vm = state->vm(); |
246 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
247 | auto* prototype = jsDynamicCast<JSVTTCuePrototype*>(vm, JSValue::decode(thisValue)); |
248 | if (UNLIKELY(!prototype)) { |
249 | throwVMTypeError(state, throwScope); |
250 | return false; |
251 | } |
252 | // Shadowing a built-in constructor |
253 | return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue)); |
254 | } |
255 | |
256 | static inline JSValue jsVTTCueVerticalGetter(ExecState& state, JSVTTCue& thisObject, ThrowScope& throwScope) |
257 | { |
258 | UNUSED_PARAM(throwScope); |
259 | UNUSED_PARAM(state); |
260 | auto& impl = thisObject.wrapped(); |
261 | JSValue result = toJS<IDLDOMString>(state, throwScope, impl.vertical()); |
262 | return result; |
263 | } |
264 | |
265 | EncodedJSValue jsVTTCueVertical(ExecState* state, EncodedJSValue thisValue, PropertyName) |
266 | { |
267 | return IDLAttribute<JSVTTCue>::get<jsVTTCueVerticalGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "vertical" ); |
268 | } |
269 | |
270 | static inline bool setJSVTTCueVerticalSetter(ExecState& state, JSVTTCue& thisObject, JSValue value, ThrowScope& throwScope) |
271 | { |
272 | UNUSED_PARAM(throwScope); |
273 | auto& impl = thisObject.wrapped(); |
274 | auto nativeValue = convert<IDLDOMString>(state, value); |
275 | RETURN_IF_EXCEPTION(throwScope, false); |
276 | AttributeSetter::call(state, throwScope, [&] { |
277 | return impl.setVertical(WTFMove(nativeValue)); |
278 | }); |
279 | return true; |
280 | } |
281 | |
282 | bool setJSVTTCueVertical(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
283 | { |
284 | return IDLAttribute<JSVTTCue>::set<setJSVTTCueVerticalSetter>(*state, thisValue, encodedValue, "vertical" ); |
285 | } |
286 | |
287 | static inline JSValue jsVTTCueSnapToLinesGetter(ExecState& state, JSVTTCue& thisObject, ThrowScope& throwScope) |
288 | { |
289 | UNUSED_PARAM(throwScope); |
290 | UNUSED_PARAM(state); |
291 | auto& impl = thisObject.wrapped(); |
292 | JSValue result = toJS<IDLBoolean>(state, throwScope, impl.snapToLines()); |
293 | return result; |
294 | } |
295 | |
296 | EncodedJSValue jsVTTCueSnapToLines(ExecState* state, EncodedJSValue thisValue, PropertyName) |
297 | { |
298 | return IDLAttribute<JSVTTCue>::get<jsVTTCueSnapToLinesGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "snapToLines" ); |
299 | } |
300 | |
301 | static inline bool setJSVTTCueSnapToLinesSetter(ExecState& state, JSVTTCue& thisObject, JSValue value, ThrowScope& throwScope) |
302 | { |
303 | UNUSED_PARAM(throwScope); |
304 | auto& impl = thisObject.wrapped(); |
305 | auto nativeValue = convert<IDLBoolean>(state, value); |
306 | RETURN_IF_EXCEPTION(throwScope, false); |
307 | AttributeSetter::call(state, throwScope, [&] { |
308 | return impl.setSnapToLines(WTFMove(nativeValue)); |
309 | }); |
310 | return true; |
311 | } |
312 | |
313 | bool setJSVTTCueSnapToLines(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
314 | { |
315 | return IDLAttribute<JSVTTCue>::set<setJSVTTCueSnapToLinesSetter>(*state, thisValue, encodedValue, "snapToLines" ); |
316 | } |
317 | |
318 | static inline JSValue jsVTTCueLineGetter(ExecState& state, JSVTTCue& thisObject, ThrowScope& throwScope) |
319 | { |
320 | UNUSED_PARAM(throwScope); |
321 | UNUSED_PARAM(state); |
322 | auto& impl = thisObject.wrapped(); |
323 | JSValue result = toJS<IDLDouble>(state, throwScope, impl.line()); |
324 | return result; |
325 | } |
326 | |
327 | EncodedJSValue jsVTTCueLine(ExecState* state, EncodedJSValue thisValue, PropertyName) |
328 | { |
329 | return IDLAttribute<JSVTTCue>::get<jsVTTCueLineGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "line" ); |
330 | } |
331 | |
332 | static inline bool setJSVTTCueLineSetter(ExecState& state, JSVTTCue& thisObject, JSValue value, ThrowScope& throwScope) |
333 | { |
334 | UNUSED_PARAM(throwScope); |
335 | auto& impl = thisObject.wrapped(); |
336 | auto nativeValue = convert<IDLDouble>(state, value); |
337 | RETURN_IF_EXCEPTION(throwScope, false); |
338 | AttributeSetter::call(state, throwScope, [&] { |
339 | return impl.setLine(WTFMove(nativeValue)); |
340 | }); |
341 | return true; |
342 | } |
343 | |
344 | bool setJSVTTCueLine(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
345 | { |
346 | return IDLAttribute<JSVTTCue>::set<setJSVTTCueLineSetter>(*state, thisValue, encodedValue, "line" ); |
347 | } |
348 | |
349 | static inline JSValue jsVTTCuePositionGetter(ExecState& state, JSVTTCue& thisObject, ThrowScope& throwScope) |
350 | { |
351 | UNUSED_PARAM(throwScope); |
352 | UNUSED_PARAM(state); |
353 | auto& impl = thisObject.wrapped(); |
354 | JSValue result = toJS<IDLUnion<IDLDouble, IDLEnumeration<VTTCue::AutoKeyword>>>(state, *thisObject.globalObject(), throwScope, impl.position()); |
355 | return result; |
356 | } |
357 | |
358 | EncodedJSValue jsVTTCuePosition(ExecState* state, EncodedJSValue thisValue, PropertyName) |
359 | { |
360 | return IDLAttribute<JSVTTCue>::get<jsVTTCuePositionGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "position" ); |
361 | } |
362 | |
363 | static inline bool setJSVTTCuePositionSetter(ExecState& state, JSVTTCue& thisObject, JSValue value, ThrowScope& throwScope) |
364 | { |
365 | UNUSED_PARAM(throwScope); |
366 | auto& impl = thisObject.wrapped(); |
367 | auto nativeValue = convert<IDLUnion<IDLDouble, IDLEnumeration<VTTCue::AutoKeyword>>>(state, value); |
368 | RETURN_IF_EXCEPTION(throwScope, false); |
369 | AttributeSetter::call(state, throwScope, [&] { |
370 | return impl.setPosition(WTFMove(nativeValue)); |
371 | }); |
372 | return true; |
373 | } |
374 | |
375 | bool setJSVTTCuePosition(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
376 | { |
377 | return IDLAttribute<JSVTTCue>::set<setJSVTTCuePositionSetter>(*state, thisValue, encodedValue, "position" ); |
378 | } |
379 | |
380 | static inline JSValue jsVTTCueSizeGetter(ExecState& state, JSVTTCue& thisObject, ThrowScope& throwScope) |
381 | { |
382 | UNUSED_PARAM(throwScope); |
383 | UNUSED_PARAM(state); |
384 | auto& impl = thisObject.wrapped(); |
385 | JSValue result = toJS<IDLDouble>(state, throwScope, impl.size()); |
386 | return result; |
387 | } |
388 | |
389 | EncodedJSValue jsVTTCueSize(ExecState* state, EncodedJSValue thisValue, PropertyName) |
390 | { |
391 | return IDLAttribute<JSVTTCue>::get<jsVTTCueSizeGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "size" ); |
392 | } |
393 | |
394 | static inline bool setJSVTTCueSizeSetter(ExecState& state, JSVTTCue& thisObject, JSValue value, ThrowScope& throwScope) |
395 | { |
396 | UNUSED_PARAM(throwScope); |
397 | auto& impl = thisObject.wrapped(); |
398 | auto nativeValue = convert<IDLDouble>(state, value); |
399 | RETURN_IF_EXCEPTION(throwScope, false); |
400 | AttributeSetter::call(state, throwScope, [&] { |
401 | return impl.setSize(WTFMove(nativeValue)); |
402 | }); |
403 | return true; |
404 | } |
405 | |
406 | bool setJSVTTCueSize(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
407 | { |
408 | return IDLAttribute<JSVTTCue>::set<setJSVTTCueSizeSetter>(*state, thisValue, encodedValue, "size" ); |
409 | } |
410 | |
411 | static inline JSValue jsVTTCueAlignGetter(ExecState& state, JSVTTCue& thisObject, ThrowScope& throwScope) |
412 | { |
413 | UNUSED_PARAM(throwScope); |
414 | UNUSED_PARAM(state); |
415 | auto& impl = thisObject.wrapped(); |
416 | JSValue result = toJS<IDLDOMString>(state, throwScope, impl.align()); |
417 | return result; |
418 | } |
419 | |
420 | EncodedJSValue jsVTTCueAlign(ExecState* state, EncodedJSValue thisValue, PropertyName) |
421 | { |
422 | return IDLAttribute<JSVTTCue>::get<jsVTTCueAlignGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "align" ); |
423 | } |
424 | |
425 | static inline bool setJSVTTCueAlignSetter(ExecState& state, JSVTTCue& thisObject, JSValue value, ThrowScope& throwScope) |
426 | { |
427 | UNUSED_PARAM(throwScope); |
428 | auto& impl = thisObject.wrapped(); |
429 | auto nativeValue = convert<IDLDOMString>(state, value); |
430 | RETURN_IF_EXCEPTION(throwScope, false); |
431 | AttributeSetter::call(state, throwScope, [&] { |
432 | return impl.setAlign(WTFMove(nativeValue)); |
433 | }); |
434 | return true; |
435 | } |
436 | |
437 | bool setJSVTTCueAlign(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
438 | { |
439 | return IDLAttribute<JSVTTCue>::set<setJSVTTCueAlignSetter>(*state, thisValue, encodedValue, "align" ); |
440 | } |
441 | |
442 | static inline JSValue jsVTTCueTextGetter(ExecState& state, JSVTTCue& thisObject, ThrowScope& throwScope) |
443 | { |
444 | UNUSED_PARAM(throwScope); |
445 | UNUSED_PARAM(state); |
446 | auto& impl = thisObject.wrapped(); |
447 | JSValue result = toJS<IDLDOMString>(state, throwScope, impl.text()); |
448 | return result; |
449 | } |
450 | |
451 | EncodedJSValue jsVTTCueText(ExecState* state, EncodedJSValue thisValue, PropertyName) |
452 | { |
453 | return IDLAttribute<JSVTTCue>::get<jsVTTCueTextGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "text" ); |
454 | } |
455 | |
456 | static inline bool setJSVTTCueTextSetter(ExecState& state, JSVTTCue& thisObject, JSValue value, ThrowScope& throwScope) |
457 | { |
458 | UNUSED_PARAM(throwScope); |
459 | auto& impl = thisObject.wrapped(); |
460 | auto nativeValue = convert<IDLDOMString>(state, value); |
461 | RETURN_IF_EXCEPTION(throwScope, false); |
462 | AttributeSetter::call(state, throwScope, [&] { |
463 | return impl.setText(WTFMove(nativeValue)); |
464 | }); |
465 | return true; |
466 | } |
467 | |
468 | bool setJSVTTCueText(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
469 | { |
470 | return IDLAttribute<JSVTTCue>::set<setJSVTTCueTextSetter>(*state, thisValue, encodedValue, "text" ); |
471 | } |
472 | |
473 | static inline JSValue jsVTTCueRegionIdGetter(ExecState& state, JSVTTCue& thisObject, ThrowScope& throwScope) |
474 | { |
475 | UNUSED_PARAM(throwScope); |
476 | UNUSED_PARAM(state); |
477 | auto& impl = thisObject.wrapped(); |
478 | JSValue result = toJS<IDLDOMString>(state, throwScope, impl.regionId()); |
479 | return result; |
480 | } |
481 | |
482 | EncodedJSValue jsVTTCueRegionId(ExecState* state, EncodedJSValue thisValue, PropertyName) |
483 | { |
484 | return IDLAttribute<JSVTTCue>::get<jsVTTCueRegionIdGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "regionId" ); |
485 | } |
486 | |
487 | static inline bool setJSVTTCueRegionIdSetter(ExecState& state, JSVTTCue& thisObject, JSValue value, ThrowScope& throwScope) |
488 | { |
489 | UNUSED_PARAM(throwScope); |
490 | auto& impl = thisObject.wrapped(); |
491 | auto nativeValue = convert<IDLDOMString>(state, value); |
492 | RETURN_IF_EXCEPTION(throwScope, false); |
493 | AttributeSetter::call(state, throwScope, [&] { |
494 | return impl.setRegionId(WTFMove(nativeValue)); |
495 | }); |
496 | return true; |
497 | } |
498 | |
499 | bool setJSVTTCueRegionId(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
500 | { |
501 | return IDLAttribute<JSVTTCue>::set<setJSVTTCueRegionIdSetter>(*state, thisValue, encodedValue, "regionId" ); |
502 | } |
503 | |
504 | static inline JSC::EncodedJSValue jsVTTCuePrototypeFunctionGetCueAsHTMLBody(JSC::ExecState* state, typename IDLOperation<JSVTTCue>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
505 | { |
506 | UNUSED_PARAM(state); |
507 | UNUSED_PARAM(throwScope); |
508 | auto& impl = castedThis->wrapped(); |
509 | return JSValue::encode(toJS<IDLInterface<DocumentFragment>>(*state, *castedThis->globalObject(), impl.getCueAsHTML())); |
510 | } |
511 | |
512 | EncodedJSValue JSC_HOST_CALL jsVTTCuePrototypeFunctionGetCueAsHTML(ExecState* state) |
513 | { |
514 | return IDLOperation<JSVTTCue>::call<jsVTTCuePrototypeFunctionGetCueAsHTMLBody>(*state, "getCueAsHTML" ); |
515 | } |
516 | |
517 | void JSVTTCue::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder) |
518 | { |
519 | auto* thisObject = jsCast<JSVTTCue*>(cell); |
520 | builder.setWrappedObjectForCell(cell, &thisObject->wrapped()); |
521 | if (thisObject->scriptExecutionContext()) |
522 | builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); |
523 | Base::heapSnapshot(cell, builder); |
524 | } |
525 | |
526 | #if ENABLE(BINDING_INTEGRITY) |
527 | #if PLATFORM(WIN) |
528 | #pragma warning(disable: 4483) |
529 | extern "C" { extern void (*const __identifier("??_7VTTCue@WebCore@@6B@" )[])(); } |
530 | #else |
531 | extern "C" { extern void* _ZTVN7WebCore6VTTCueE[]; } |
532 | #endif |
533 | #endif |
534 | |
535 | JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<VTTCue>&& impl) |
536 | { |
537 | |
538 | #if ENABLE(BINDING_INTEGRITY) |
539 | void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr())); |
540 | #if PLATFORM(WIN) |
541 | void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(__identifier("??_7VTTCue@WebCore@@6B@" )); |
542 | #else |
543 | void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(&_ZTVN7WebCore6VTTCueE[2]); |
544 | #endif |
545 | |
546 | // If this fails VTTCue does not have a vtable, so you need to add the |
547 | // ImplementationLacksVTable attribute to the interface definition |
548 | static_assert(std::is_polymorphic<VTTCue>::value, "VTTCue is not polymorphic" ); |
549 | |
550 | // If you hit this assertion you either have a use after free bug, or |
551 | // VTTCue has subclasses. If VTTCue has subclasses that get passed |
552 | // to toJS() we currently require VTTCue you to opt out of binding hardening |
553 | // by adding the SkipVTableValidation attribute to the interface IDL definition |
554 | RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer); |
555 | #endif |
556 | return createWrapper<VTTCue>(globalObject, WTFMove(impl)); |
557 | } |
558 | |
559 | JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, VTTCue& impl) |
560 | { |
561 | return wrap(state, globalObject, impl); |
562 | } |
563 | |
564 | VTTCue* JSVTTCue::toWrapped(JSC::VM& vm, JSC::JSValue value) |
565 | { |
566 | if (auto* wrapper = jsDynamicCast<JSVTTCue*>(vm, value)) |
567 | return &wrapper->wrapped(); |
568 | return nullptr; |
569 | } |
570 | |
571 | } |
572 | |
573 | #endif // ENABLE(VIDEO_TRACK) |
574 | |