| 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(MEDIA_CONTROLS_SCRIPT) |
| 24 | |
| 25 | #include "JSMediaControlsHost.h" |
| 26 | |
| 27 | #include "JSAudioTrack.h" |
| 28 | #include "JSAudioTrackList.h" |
| 29 | #include "JSDOMAttribute.h" |
| 30 | #include "JSDOMBinding.h" |
| 31 | #include "JSDOMConvertBoolean.h" |
| 32 | #include "JSDOMConvertInterface.h" |
| 33 | #include "JSDOMConvertNullable.h" |
| 34 | #include "JSDOMConvertNumbers.h" |
| 35 | #include "JSDOMConvertSequences.h" |
| 36 | #include "JSDOMConvertStrings.h" |
| 37 | #include "JSDOMConvertUnion.h" |
| 38 | #include "JSDOMExceptionHandling.h" |
| 39 | #include "JSDOMGlobalObject.h" |
| 40 | #include "JSDOMOperation.h" |
| 41 | #include "JSDOMWrapperCache.h" |
| 42 | #include "JSHTMLElement.h" |
| 43 | #include "JSTextTrack.h" |
| 44 | #include "JSTextTrackList.h" |
| 45 | #include "RuntimeEnabledFeatures.h" |
| 46 | #include "ScriptExecutionContext.h" |
| 47 | #include <JavaScriptCore/HeapSnapshotBuilder.h> |
| 48 | #include <JavaScriptCore/JSArray.h> |
| 49 | #include <JavaScriptCore/JSCInlines.h> |
| 50 | #include <JavaScriptCore/JSString.h> |
| 51 | #include <wtf/GetPtr.h> |
| 52 | #include <wtf/PointerPreparations.h> |
| 53 | #include <wtf/URL.h> |
| 54 | #include <wtf/Variant.h> |
| 55 | |
| 56 | |
| 57 | namespace WebCore { |
| 58 | using namespace JSC; |
| 59 | |
| 60 | String convertEnumerationToString(MediaControlsHost::DeviceType enumerationValue) |
| 61 | { |
| 62 | static const NeverDestroyed<String> values[] = { |
| 63 | MAKE_STATIC_STRING_IMPL("none" ), |
| 64 | MAKE_STATIC_STRING_IMPL("airplay" ), |
| 65 | MAKE_STATIC_STRING_IMPL("tvout" ), |
| 66 | }; |
| 67 | static_assert(static_cast<size_t>(MediaControlsHost::DeviceType::None) == 0, "MediaControlsHost::DeviceType::None is not 0 as expected" ); |
| 68 | static_assert(static_cast<size_t>(MediaControlsHost::DeviceType::Airplay) == 1, "MediaControlsHost::DeviceType::Airplay is not 1 as expected" ); |
| 69 | static_assert(static_cast<size_t>(MediaControlsHost::DeviceType::Tvout) == 2, "MediaControlsHost::DeviceType::Tvout is not 2 as expected" ); |
| 70 | ASSERT(static_cast<size_t>(enumerationValue) < WTF_ARRAY_LENGTH(values)); |
| 71 | return values[static_cast<size_t>(enumerationValue)]; |
| 72 | } |
| 73 | |
| 74 | template<> JSString* convertEnumerationToJS(ExecState& state, MediaControlsHost::DeviceType enumerationValue) |
| 75 | { |
| 76 | return jsStringWithCache(&state, convertEnumerationToString(enumerationValue)); |
| 77 | } |
| 78 | |
| 79 | template<> Optional<MediaControlsHost::DeviceType> parseEnumeration<MediaControlsHost::DeviceType>(ExecState& state, JSValue value) |
| 80 | { |
| 81 | auto stringValue = value.toWTFString(&state); |
| 82 | if (stringValue == "none" ) |
| 83 | return MediaControlsHost::DeviceType::None; |
| 84 | if (stringValue == "airplay" ) |
| 85 | return MediaControlsHost::DeviceType::Airplay; |
| 86 | if (stringValue == "tvout" ) |
| 87 | return MediaControlsHost::DeviceType::Tvout; |
| 88 | return WTF::nullopt; |
| 89 | } |
| 90 | |
| 91 | template<> const char* expectedEnumerationValues<MediaControlsHost::DeviceType>() |
| 92 | { |
| 93 | return "\"none\", \"airplay\", \"tvout\"" ; |
| 94 | } |
| 95 | |
| 96 | // Functions |
| 97 | |
| 98 | JSC::EncodedJSValue JSC_HOST_CALL jsMediaControlsHostPrototypeFunctionSortedTrackListForMenu(JSC::ExecState*); |
| 99 | JSC::EncodedJSValue JSC_HOST_CALL jsMediaControlsHostPrototypeFunctionDisplayNameForTrack(JSC::ExecState*); |
| 100 | JSC::EncodedJSValue JSC_HOST_CALL jsMediaControlsHostPrototypeFunctionSetSelectedTextTrack(JSC::ExecState*); |
| 101 | JSC::EncodedJSValue JSC_HOST_CALL jsMediaControlsHostPrototypeFunctionSetPreparedToReturnVideoLayerToInline(JSC::ExecState*); |
| 102 | JSC::EncodedJSValue JSC_HOST_CALL jsMediaControlsHostPrototypeFunctionUpdateTextTrackContainer(JSC::ExecState*); |
| 103 | JSC::EncodedJSValue JSC_HOST_CALL jsMediaControlsHostPrototypeFunctionEnteredFullscreen(JSC::ExecState*); |
| 104 | JSC::EncodedJSValue JSC_HOST_CALL jsMediaControlsHostPrototypeFunctionExitedFullscreen(JSC::ExecState*); |
| 105 | JSC::EncodedJSValue JSC_HOST_CALL jsMediaControlsHostPrototypeFunctionGenerateUUID(JSC::ExecState*); |
| 106 | JSC::EncodedJSValue JSC_HOST_CALL jsMediaControlsHostPrototypeFunctionBase64StringForIconNameAndType(JSC::ExecState*); |
| 107 | JSC::EncodedJSValue JSC_HOST_CALL jsMediaControlsHostPrototypeFunctionFormattedStringForDuration(JSC::ExecState*); |
| 108 | |
| 109 | // Attributes |
| 110 | |
| 111 | JSC::EncodedJSValue jsMediaControlsHostCaptionMenuOffItem(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 112 | JSC::EncodedJSValue jsMediaControlsHostCaptionMenuAutomaticItem(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 113 | JSC::EncodedJSValue jsMediaControlsHostCaptionDisplayMode(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 114 | JSC::EncodedJSValue jsMediaControlsHostTextTrackContainer(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 115 | JSC::EncodedJSValue jsMediaControlsHostAllowsInlineMediaPlayback(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 116 | JSC::EncodedJSValue jsMediaControlsHostSupportsFullscreen(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 117 | JSC::EncodedJSValue jsMediaControlsHostIsVideoLayerInline(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 118 | JSC::EncodedJSValue jsMediaControlsHostUserGestureRequired(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 119 | JSC::EncodedJSValue jsMediaControlsHostIsInMediaDocument(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 120 | JSC::EncodedJSValue jsMediaControlsHostShouldForceControlsDisplay(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 121 | JSC::EncodedJSValue jsMediaControlsHostCompactMode(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 122 | JSC::EncodedJSValue jsMediaControlsHostExternalDeviceDisplayName(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 123 | JSC::EncodedJSValue jsMediaControlsHostExternalDeviceType(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 124 | JSC::EncodedJSValue jsMediaControlsHostControlsDependOnPageScaleFactor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 125 | bool setJSMediaControlsHostControlsDependOnPageScaleFactor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| 126 | JSC::EncodedJSValue jsMediaControlsHostShadowRootCSSText(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 127 | |
| 128 | class JSMediaControlsHostPrototype : public JSC::JSNonFinalObject { |
| 129 | public: |
| 130 | using Base = JSC::JSNonFinalObject; |
| 131 | static JSMediaControlsHostPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) |
| 132 | { |
| 133 | JSMediaControlsHostPrototype* ptr = new (NotNull, JSC::allocateCell<JSMediaControlsHostPrototype>(vm.heap)) JSMediaControlsHostPrototype(vm, globalObject, structure); |
| 134 | ptr->finishCreation(vm); |
| 135 | return ptr; |
| 136 | } |
| 137 | |
| 138 | DECLARE_INFO; |
| 139 | static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) |
| 140 | { |
| 141 | return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); |
| 142 | } |
| 143 | |
| 144 | private: |
| 145 | JSMediaControlsHostPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
| 146 | : JSC::JSNonFinalObject(vm, structure) |
| 147 | { |
| 148 | } |
| 149 | |
| 150 | void finishCreation(JSC::VM&); |
| 151 | }; |
| 152 | |
| 153 | /* Hash table for prototype */ |
| 154 | |
| 155 | static const HashTableValue JSMediaControlsHostPrototypeTableValues[] = |
| 156 | { |
| 157 | { "captionMenuOffItem" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsMediaControlsHostCaptionMenuOffItem), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 158 | { "captionMenuAutomaticItem" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsMediaControlsHostCaptionMenuAutomaticItem), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 159 | { "captionDisplayMode" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsMediaControlsHostCaptionDisplayMode), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 160 | { "textTrackContainer" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsMediaControlsHostTextTrackContainer), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 161 | { "allowsInlineMediaPlayback" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsMediaControlsHostAllowsInlineMediaPlayback), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 162 | { "supportsFullscreen" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsMediaControlsHostSupportsFullscreen), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 163 | { "isVideoLayerInline" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsMediaControlsHostIsVideoLayerInline), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 164 | { "userGestureRequired" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsMediaControlsHostUserGestureRequired), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 165 | { "isInMediaDocument" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsMediaControlsHostIsInMediaDocument), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 166 | { "shouldForceControlsDisplay" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsMediaControlsHostShouldForceControlsDisplay), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 167 | { "compactMode" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsMediaControlsHostCompactMode), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 168 | { "externalDeviceDisplayName" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsMediaControlsHostExternalDeviceDisplayName), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 169 | { "externalDeviceType" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsMediaControlsHostExternalDeviceType), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 170 | { "controlsDependOnPageScaleFactor" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsMediaControlsHostControlsDependOnPageScaleFactor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSMediaControlsHostControlsDependOnPageScaleFactor) } }, |
| 171 | { "shadowRootCSSText" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsMediaControlsHostShadowRootCSSText), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 172 | { "sortedTrackListForMenu" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsMediaControlsHostPrototypeFunctionSortedTrackListForMenu), (intptr_t) (1) } }, |
| 173 | { "displayNameForTrack" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsMediaControlsHostPrototypeFunctionDisplayNameForTrack), (intptr_t) (1) } }, |
| 174 | { "setSelectedTextTrack" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsMediaControlsHostPrototypeFunctionSetSelectedTextTrack), (intptr_t) (1) } }, |
| 175 | { "setPreparedToReturnVideoLayerToInline" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsMediaControlsHostPrototypeFunctionSetPreparedToReturnVideoLayerToInline), (intptr_t) (1) } }, |
| 176 | { "updateTextTrackContainer" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsMediaControlsHostPrototypeFunctionUpdateTextTrackContainer), (intptr_t) (0) } }, |
| 177 | { "enteredFullscreen" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsMediaControlsHostPrototypeFunctionEnteredFullscreen), (intptr_t) (0) } }, |
| 178 | { "exitedFullscreen" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsMediaControlsHostPrototypeFunctionExitedFullscreen), (intptr_t) (0) } }, |
| 179 | { "generateUUID" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsMediaControlsHostPrototypeFunctionGenerateUUID), (intptr_t) (0) } }, |
| 180 | { "base64StringForIconNameAndType" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsMediaControlsHostPrototypeFunctionBase64StringForIconNameAndType), (intptr_t) (2) } }, |
| 181 | { "formattedStringForDuration" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsMediaControlsHostPrototypeFunctionFormattedStringForDuration), (intptr_t) (1) } }, |
| 182 | }; |
| 183 | |
| 184 | const ClassInfo JSMediaControlsHostPrototype::s_info = { "MediaControlsHostPrototype" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSMediaControlsHostPrototype) }; |
| 185 | |
| 186 | void JSMediaControlsHostPrototype::finishCreation(VM& vm) |
| 187 | { |
| 188 | Base::finishCreation(vm); |
| 189 | reifyStaticProperties(vm, JSMediaControlsHost::info(), JSMediaControlsHostPrototypeTableValues, *this); |
| 190 | bool hasDisabledRuntimeProperties = false; |
| 191 | if (!RuntimeEnabledFeatures::sharedFeatures().modernMediaControlsEnabled()) { |
| 192 | hasDisabledRuntimeProperties = true; |
| 193 | auto propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>("base64StringForIconNameAndType" ), strlen("base64StringForIconNameAndType" )); |
| 194 | VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable); |
| 195 | JSObject::deleteProperty(this, globalObject()->globalExec(), propertyName); |
| 196 | } |
| 197 | if (!RuntimeEnabledFeatures::sharedFeatures().modernMediaControlsEnabled()) { |
| 198 | hasDisabledRuntimeProperties = true; |
| 199 | auto propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>("formattedStringForDuration" ), strlen("formattedStringForDuration" )); |
| 200 | VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable); |
| 201 | JSObject::deleteProperty(this, globalObject()->globalExec(), propertyName); |
| 202 | } |
| 203 | if (!RuntimeEnabledFeatures::sharedFeatures().modernMediaControlsEnabled()) { |
| 204 | hasDisabledRuntimeProperties = true; |
| 205 | auto propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>("shadowRootCSSText" ), strlen("shadowRootCSSText" )); |
| 206 | VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable); |
| 207 | JSObject::deleteProperty(this, globalObject()->globalExec(), propertyName); |
| 208 | } |
| 209 | if (hasDisabledRuntimeProperties && structure()->isDictionary()) |
| 210 | flattenDictionaryObject(vm); |
| 211 | } |
| 212 | |
| 213 | const ClassInfo JSMediaControlsHost::s_info = { "MediaControlsHost" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSMediaControlsHost) }; |
| 214 | |
| 215 | JSMediaControlsHost::JSMediaControlsHost(Structure* structure, JSDOMGlobalObject& globalObject, Ref<MediaControlsHost>&& impl) |
| 216 | : JSDOMWrapper<MediaControlsHost>(structure, globalObject, WTFMove(impl)) |
| 217 | { |
| 218 | } |
| 219 | |
| 220 | void JSMediaControlsHost::finishCreation(VM& vm) |
| 221 | { |
| 222 | Base::finishCreation(vm); |
| 223 | ASSERT(inherits(vm, info())); |
| 224 | |
| 225 | } |
| 226 | |
| 227 | JSObject* JSMediaControlsHost::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) |
| 228 | { |
| 229 | return JSMediaControlsHostPrototype::create(vm, &globalObject, JSMediaControlsHostPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype())); |
| 230 | } |
| 231 | |
| 232 | JSObject* JSMediaControlsHost::prototype(VM& vm, JSDOMGlobalObject& globalObject) |
| 233 | { |
| 234 | return getDOMPrototype<JSMediaControlsHost>(vm, globalObject); |
| 235 | } |
| 236 | |
| 237 | void JSMediaControlsHost::destroy(JSC::JSCell* cell) |
| 238 | { |
| 239 | JSMediaControlsHost* thisObject = static_cast<JSMediaControlsHost*>(cell); |
| 240 | thisObject->JSMediaControlsHost::~JSMediaControlsHost(); |
| 241 | } |
| 242 | |
| 243 | template<> inline JSMediaControlsHost* IDLAttribute<JSMediaControlsHost>::cast(ExecState& state, EncodedJSValue thisValue) |
| 244 | { |
| 245 | return jsDynamicCast<JSMediaControlsHost*>(state.vm(), JSValue::decode(thisValue)); |
| 246 | } |
| 247 | |
| 248 | template<> inline JSMediaControlsHost* IDLOperation<JSMediaControlsHost>::cast(ExecState& state) |
| 249 | { |
| 250 | return jsDynamicCast<JSMediaControlsHost*>(state.vm(), state.thisValue()); |
| 251 | } |
| 252 | |
| 253 | static inline JSValue (ExecState& state, JSMediaControlsHost& thisObject, ThrowScope& throwScope) |
| 254 | { |
| 255 | UNUSED_PARAM(throwScope); |
| 256 | UNUSED_PARAM(state); |
| 257 | auto& impl = thisObject.wrapped(); |
| 258 | JSValue result = toJS<IDLInterface<TextTrack>>(state, *thisObject.globalObject(), throwScope, impl.captionMenuOffItem()); |
| 259 | return result; |
| 260 | } |
| 261 | |
| 262 | EncodedJSValue (ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 263 | { |
| 264 | return IDLAttribute<JSMediaControlsHost>::get<jsMediaControlsHostCaptionMenuOffItemGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "captionMenuOffItem" ); |
| 265 | } |
| 266 | |
| 267 | static inline JSValue (ExecState& state, JSMediaControlsHost& thisObject, ThrowScope& throwScope) |
| 268 | { |
| 269 | UNUSED_PARAM(throwScope); |
| 270 | UNUSED_PARAM(state); |
| 271 | auto& impl = thisObject.wrapped(); |
| 272 | JSValue result = toJS<IDLInterface<TextTrack>>(state, *thisObject.globalObject(), throwScope, impl.captionMenuAutomaticItem()); |
| 273 | return result; |
| 274 | } |
| 275 | |
| 276 | EncodedJSValue (ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 277 | { |
| 278 | return IDLAttribute<JSMediaControlsHost>::get<jsMediaControlsHostCaptionMenuAutomaticItemGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "captionMenuAutomaticItem" ); |
| 279 | } |
| 280 | |
| 281 | static inline JSValue jsMediaControlsHostCaptionDisplayModeGetter(ExecState& state, JSMediaControlsHost& thisObject, ThrowScope& throwScope) |
| 282 | { |
| 283 | UNUSED_PARAM(throwScope); |
| 284 | UNUSED_PARAM(state); |
| 285 | auto& impl = thisObject.wrapped(); |
| 286 | JSValue result = toJS<IDLDOMString>(state, throwScope, impl.captionDisplayMode()); |
| 287 | return result; |
| 288 | } |
| 289 | |
| 290 | EncodedJSValue jsMediaControlsHostCaptionDisplayMode(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 291 | { |
| 292 | return IDLAttribute<JSMediaControlsHost>::get<jsMediaControlsHostCaptionDisplayModeGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "captionDisplayMode" ); |
| 293 | } |
| 294 | |
| 295 | static inline JSValue jsMediaControlsHostTextTrackContainerGetter(ExecState& state, JSMediaControlsHost& thisObject, ThrowScope& throwScope) |
| 296 | { |
| 297 | UNUSED_PARAM(throwScope); |
| 298 | UNUSED_PARAM(state); |
| 299 | auto& impl = thisObject.wrapped(); |
| 300 | JSValue result = toJS<IDLInterface<HTMLElement>>(state, *thisObject.globalObject(), throwScope, impl.textTrackContainer()); |
| 301 | return result; |
| 302 | } |
| 303 | |
| 304 | EncodedJSValue jsMediaControlsHostTextTrackContainer(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 305 | { |
| 306 | return IDLAttribute<JSMediaControlsHost>::get<jsMediaControlsHostTextTrackContainerGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "textTrackContainer" ); |
| 307 | } |
| 308 | |
| 309 | static inline JSValue jsMediaControlsHostAllowsInlineMediaPlaybackGetter(ExecState& state, JSMediaControlsHost& thisObject, ThrowScope& throwScope) |
| 310 | { |
| 311 | UNUSED_PARAM(throwScope); |
| 312 | UNUSED_PARAM(state); |
| 313 | auto& impl = thisObject.wrapped(); |
| 314 | JSValue result = toJS<IDLBoolean>(state, throwScope, impl.allowsInlineMediaPlayback()); |
| 315 | return result; |
| 316 | } |
| 317 | |
| 318 | EncodedJSValue jsMediaControlsHostAllowsInlineMediaPlayback(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 319 | { |
| 320 | return IDLAttribute<JSMediaControlsHost>::get<jsMediaControlsHostAllowsInlineMediaPlaybackGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "allowsInlineMediaPlayback" ); |
| 321 | } |
| 322 | |
| 323 | static inline JSValue jsMediaControlsHostSupportsFullscreenGetter(ExecState& state, JSMediaControlsHost& thisObject, ThrowScope& throwScope) |
| 324 | { |
| 325 | UNUSED_PARAM(throwScope); |
| 326 | UNUSED_PARAM(state); |
| 327 | auto& impl = thisObject.wrapped(); |
| 328 | JSValue result = toJS<IDLBoolean>(state, throwScope, impl.supportsFullscreen()); |
| 329 | return result; |
| 330 | } |
| 331 | |
| 332 | EncodedJSValue jsMediaControlsHostSupportsFullscreen(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 333 | { |
| 334 | return IDLAttribute<JSMediaControlsHost>::get<jsMediaControlsHostSupportsFullscreenGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "supportsFullscreen" ); |
| 335 | } |
| 336 | |
| 337 | static inline JSValue jsMediaControlsHostIsVideoLayerInlineGetter(ExecState& state, JSMediaControlsHost& thisObject, ThrowScope& throwScope) |
| 338 | { |
| 339 | UNUSED_PARAM(throwScope); |
| 340 | UNUSED_PARAM(state); |
| 341 | auto& impl = thisObject.wrapped(); |
| 342 | JSValue result = toJS<IDLBoolean>(state, throwScope, impl.isVideoLayerInline()); |
| 343 | return result; |
| 344 | } |
| 345 | |
| 346 | EncodedJSValue jsMediaControlsHostIsVideoLayerInline(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 347 | { |
| 348 | return IDLAttribute<JSMediaControlsHost>::get<jsMediaControlsHostIsVideoLayerInlineGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "isVideoLayerInline" ); |
| 349 | } |
| 350 | |
| 351 | static inline JSValue jsMediaControlsHostUserGestureRequiredGetter(ExecState& state, JSMediaControlsHost& thisObject, ThrowScope& throwScope) |
| 352 | { |
| 353 | UNUSED_PARAM(throwScope); |
| 354 | UNUSED_PARAM(state); |
| 355 | auto& impl = thisObject.wrapped(); |
| 356 | JSValue result = toJS<IDLBoolean>(state, throwScope, impl.userGestureRequired()); |
| 357 | return result; |
| 358 | } |
| 359 | |
| 360 | EncodedJSValue jsMediaControlsHostUserGestureRequired(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 361 | { |
| 362 | return IDLAttribute<JSMediaControlsHost>::get<jsMediaControlsHostUserGestureRequiredGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "userGestureRequired" ); |
| 363 | } |
| 364 | |
| 365 | static inline JSValue jsMediaControlsHostIsInMediaDocumentGetter(ExecState& state, JSMediaControlsHost& thisObject, ThrowScope& throwScope) |
| 366 | { |
| 367 | UNUSED_PARAM(throwScope); |
| 368 | UNUSED_PARAM(state); |
| 369 | auto& impl = thisObject.wrapped(); |
| 370 | JSValue result = toJS<IDLBoolean>(state, throwScope, impl.isInMediaDocument()); |
| 371 | return result; |
| 372 | } |
| 373 | |
| 374 | EncodedJSValue jsMediaControlsHostIsInMediaDocument(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 375 | { |
| 376 | return IDLAttribute<JSMediaControlsHost>::get<jsMediaControlsHostIsInMediaDocumentGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "isInMediaDocument" ); |
| 377 | } |
| 378 | |
| 379 | static inline JSValue jsMediaControlsHostShouldForceControlsDisplayGetter(ExecState& state, JSMediaControlsHost& thisObject, ThrowScope& throwScope) |
| 380 | { |
| 381 | UNUSED_PARAM(throwScope); |
| 382 | UNUSED_PARAM(state); |
| 383 | auto& impl = thisObject.wrapped(); |
| 384 | JSValue result = toJS<IDLBoolean>(state, throwScope, impl.shouldForceControlsDisplay()); |
| 385 | return result; |
| 386 | } |
| 387 | |
| 388 | EncodedJSValue jsMediaControlsHostShouldForceControlsDisplay(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 389 | { |
| 390 | return IDLAttribute<JSMediaControlsHost>::get<jsMediaControlsHostShouldForceControlsDisplayGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "shouldForceControlsDisplay" ); |
| 391 | } |
| 392 | |
| 393 | static inline JSValue jsMediaControlsHostCompactModeGetter(ExecState& state, JSMediaControlsHost& thisObject, ThrowScope& throwScope) |
| 394 | { |
| 395 | UNUSED_PARAM(throwScope); |
| 396 | UNUSED_PARAM(state); |
| 397 | auto& impl = thisObject.wrapped(); |
| 398 | JSValue result = toJS<IDLBoolean>(state, throwScope, impl.compactMode()); |
| 399 | return result; |
| 400 | } |
| 401 | |
| 402 | EncodedJSValue jsMediaControlsHostCompactMode(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 403 | { |
| 404 | return IDLAttribute<JSMediaControlsHost>::get<jsMediaControlsHostCompactModeGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "compactMode" ); |
| 405 | } |
| 406 | |
| 407 | static inline JSValue jsMediaControlsHostExternalDeviceDisplayNameGetter(ExecState& state, JSMediaControlsHost& thisObject, ThrowScope& throwScope) |
| 408 | { |
| 409 | UNUSED_PARAM(throwScope); |
| 410 | UNUSED_PARAM(state); |
| 411 | auto& impl = thisObject.wrapped(); |
| 412 | JSValue result = toJS<IDLDOMString>(state, throwScope, impl.externalDeviceDisplayName()); |
| 413 | return result; |
| 414 | } |
| 415 | |
| 416 | EncodedJSValue jsMediaControlsHostExternalDeviceDisplayName(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 417 | { |
| 418 | return IDLAttribute<JSMediaControlsHost>::get<jsMediaControlsHostExternalDeviceDisplayNameGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "externalDeviceDisplayName" ); |
| 419 | } |
| 420 | |
| 421 | static inline JSValue jsMediaControlsHostExternalDeviceTypeGetter(ExecState& state, JSMediaControlsHost& thisObject, ThrowScope& throwScope) |
| 422 | { |
| 423 | UNUSED_PARAM(throwScope); |
| 424 | UNUSED_PARAM(state); |
| 425 | auto& impl = thisObject.wrapped(); |
| 426 | JSValue result = toJS<IDLEnumeration<MediaControlsHost::DeviceType>>(state, throwScope, impl.externalDeviceType()); |
| 427 | return result; |
| 428 | } |
| 429 | |
| 430 | EncodedJSValue jsMediaControlsHostExternalDeviceType(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 431 | { |
| 432 | return IDLAttribute<JSMediaControlsHost>::get<jsMediaControlsHostExternalDeviceTypeGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "externalDeviceType" ); |
| 433 | } |
| 434 | |
| 435 | static inline JSValue jsMediaControlsHostControlsDependOnPageScaleFactorGetter(ExecState& state, JSMediaControlsHost& thisObject, ThrowScope& throwScope) |
| 436 | { |
| 437 | UNUSED_PARAM(throwScope); |
| 438 | UNUSED_PARAM(state); |
| 439 | auto& impl = thisObject.wrapped(); |
| 440 | JSValue result = toJS<IDLBoolean>(state, throwScope, impl.controlsDependOnPageScaleFactor()); |
| 441 | return result; |
| 442 | } |
| 443 | |
| 444 | EncodedJSValue jsMediaControlsHostControlsDependOnPageScaleFactor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 445 | { |
| 446 | return IDLAttribute<JSMediaControlsHost>::get<jsMediaControlsHostControlsDependOnPageScaleFactorGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "controlsDependOnPageScaleFactor" ); |
| 447 | } |
| 448 | |
| 449 | static inline bool setJSMediaControlsHostControlsDependOnPageScaleFactorSetter(ExecState& state, JSMediaControlsHost& thisObject, JSValue value, ThrowScope& throwScope) |
| 450 | { |
| 451 | UNUSED_PARAM(throwScope); |
| 452 | auto& impl = thisObject.wrapped(); |
| 453 | auto nativeValue = convert<IDLBoolean>(state, value); |
| 454 | RETURN_IF_EXCEPTION(throwScope, false); |
| 455 | AttributeSetter::call(state, throwScope, [&] { |
| 456 | return impl.setControlsDependOnPageScaleFactor(WTFMove(nativeValue)); |
| 457 | }); |
| 458 | return true; |
| 459 | } |
| 460 | |
| 461 | bool setJSMediaControlsHostControlsDependOnPageScaleFactor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| 462 | { |
| 463 | return IDLAttribute<JSMediaControlsHost>::set<setJSMediaControlsHostControlsDependOnPageScaleFactorSetter>(*state, thisValue, encodedValue, "controlsDependOnPageScaleFactor" ); |
| 464 | } |
| 465 | |
| 466 | static inline JSValue jsMediaControlsHostShadowRootCSSTextGetter(ExecState& state, JSMediaControlsHost& thisObject, ThrowScope& throwScope) |
| 467 | { |
| 468 | UNUSED_PARAM(throwScope); |
| 469 | UNUSED_PARAM(state); |
| 470 | auto& impl = thisObject.wrapped(); |
| 471 | JSValue result = toJS<IDLDOMString>(state, throwScope, impl.shadowRootCSSText()); |
| 472 | return result; |
| 473 | } |
| 474 | |
| 475 | EncodedJSValue jsMediaControlsHostShadowRootCSSText(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 476 | { |
| 477 | return IDLAttribute<JSMediaControlsHost>::get<jsMediaControlsHostShadowRootCSSTextGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "shadowRootCSSText" ); |
| 478 | } |
| 479 | |
| 480 | static inline JSC::EncodedJSValue jsMediaControlsHostPrototypeFunctionSortedTrackListForMenu1Body(JSC::ExecState* state, typename IDLOperation<JSMediaControlsHost>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
| 481 | { |
| 482 | UNUSED_PARAM(state); |
| 483 | UNUSED_PARAM(throwScope); |
| 484 | auto& impl = castedThis->wrapped(); |
| 485 | auto trackList = convert<IDLInterface<TextTrackList>>(*state, state->uncheckedArgument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 0, "trackList" , "MediaControlsHost" , "sortedTrackListForMenu" , "TextTrackList" ); }); |
| 486 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
| 487 | return JSValue::encode(toJS<IDLSequence<IDLInterface<TextTrack>>>(*state, *castedThis->globalObject(), impl.sortedTrackListForMenu(*trackList))); |
| 488 | } |
| 489 | |
| 490 | static inline JSC::EncodedJSValue jsMediaControlsHostPrototypeFunctionSortedTrackListForMenu2Body(JSC::ExecState* state, typename IDLOperation<JSMediaControlsHost>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
| 491 | { |
| 492 | UNUSED_PARAM(state); |
| 493 | UNUSED_PARAM(throwScope); |
| 494 | auto& impl = castedThis->wrapped(); |
| 495 | auto trackList = convert<IDLInterface<AudioTrackList>>(*state, state->uncheckedArgument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 0, "trackList" , "MediaControlsHost" , "sortedTrackListForMenu" , "AudioTrackList" ); }); |
| 496 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
| 497 | return JSValue::encode(toJS<IDLSequence<IDLInterface<AudioTrack>>>(*state, *castedThis->globalObject(), impl.sortedTrackListForMenu(*trackList))); |
| 498 | } |
| 499 | |
| 500 | static inline JSC::EncodedJSValue (JSC::ExecState* state, typename IDLOperation<JSMediaControlsHost>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
| 501 | { |
| 502 | UNUSED_PARAM(state); |
| 503 | UNUSED_PARAM(throwScope); |
| 504 | VM& vm = state->vm(); |
| 505 | UNUSED_PARAM(vm); |
| 506 | size_t argsCount = std::min<size_t>(1, state->argumentCount()); |
| 507 | if (argsCount == 1) { |
| 508 | JSValue distinguishingArg = state->uncheckedArgument(0); |
| 509 | if (distinguishingArg.isObject() && asObject(distinguishingArg)->inherits<JSTextTrackList>(vm)) |
| 510 | return jsMediaControlsHostPrototypeFunctionSortedTrackListForMenu1Body(state, castedThis, throwScope); |
| 511 | if (distinguishingArg.isObject() && asObject(distinguishingArg)->inherits<JSAudioTrackList>(vm)) |
| 512 | return jsMediaControlsHostPrototypeFunctionSortedTrackListForMenu2Body(state, castedThis, throwScope); |
| 513 | } |
| 514 | return argsCount < 1 ? throwVMError(state, throwScope, createNotEnoughArgumentsError(state)) : throwVMTypeError(state, throwScope); |
| 515 | } |
| 516 | |
| 517 | EncodedJSValue JSC_HOST_CALL (ExecState* state) |
| 518 | { |
| 519 | return IDLOperation<JSMediaControlsHost>::call<jsMediaControlsHostPrototypeFunctionSortedTrackListForMenuOverloadDispatcher>(*state, "sortedTrackListForMenu" ); |
| 520 | } |
| 521 | |
| 522 | static inline JSC::EncodedJSValue jsMediaControlsHostPrototypeFunctionDisplayNameForTrackBody(JSC::ExecState* state, typename IDLOperation<JSMediaControlsHost>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
| 523 | { |
| 524 | UNUSED_PARAM(state); |
| 525 | UNUSED_PARAM(throwScope); |
| 526 | auto& impl = castedThis->wrapped(); |
| 527 | if (UNLIKELY(state->argumentCount() < 1)) |
| 528 | return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
| 529 | auto track = convert<IDLNullable<IDLUnion<IDLInterface<TextTrack>, IDLInterface<AudioTrack>>>>(*state, state->uncheckedArgument(0)); |
| 530 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
| 531 | return JSValue::encode(toJS<IDLDOMString>(*state, impl.displayNameForTrack(WTFMove(track)))); |
| 532 | } |
| 533 | |
| 534 | EncodedJSValue JSC_HOST_CALL jsMediaControlsHostPrototypeFunctionDisplayNameForTrack(ExecState* state) |
| 535 | { |
| 536 | return IDLOperation<JSMediaControlsHost>::call<jsMediaControlsHostPrototypeFunctionDisplayNameForTrackBody>(*state, "displayNameForTrack" ); |
| 537 | } |
| 538 | |
| 539 | static inline JSC::EncodedJSValue jsMediaControlsHostPrototypeFunctionSetSelectedTextTrackBody(JSC::ExecState* state, typename IDLOperation<JSMediaControlsHost>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
| 540 | { |
| 541 | UNUSED_PARAM(state); |
| 542 | UNUSED_PARAM(throwScope); |
| 543 | auto& impl = castedThis->wrapped(); |
| 544 | if (UNLIKELY(state->argumentCount() < 1)) |
| 545 | return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
| 546 | auto track = convert<IDLNullable<IDLInterface<TextTrack>>>(*state, state->uncheckedArgument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 0, "track" , "MediaControlsHost" , "setSelectedTextTrack" , "TextTrack" ); }); |
| 547 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
| 548 | impl.setSelectedTextTrack(WTFMove(track)); |
| 549 | return JSValue::encode(jsUndefined()); |
| 550 | } |
| 551 | |
| 552 | EncodedJSValue JSC_HOST_CALL jsMediaControlsHostPrototypeFunctionSetSelectedTextTrack(ExecState* state) |
| 553 | { |
| 554 | return IDLOperation<JSMediaControlsHost>::call<jsMediaControlsHostPrototypeFunctionSetSelectedTextTrackBody>(*state, "setSelectedTextTrack" ); |
| 555 | } |
| 556 | |
| 557 | static inline JSC::EncodedJSValue jsMediaControlsHostPrototypeFunctionSetPreparedToReturnVideoLayerToInlineBody(JSC::ExecState* state, typename IDLOperation<JSMediaControlsHost>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
| 558 | { |
| 559 | UNUSED_PARAM(state); |
| 560 | UNUSED_PARAM(throwScope); |
| 561 | auto& impl = castedThis->wrapped(); |
| 562 | if (UNLIKELY(state->argumentCount() < 1)) |
| 563 | return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
| 564 | auto prepared = convert<IDLBoolean>(*state, state->uncheckedArgument(0)); |
| 565 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
| 566 | impl.setPreparedToReturnVideoLayerToInline(WTFMove(prepared)); |
| 567 | return JSValue::encode(jsUndefined()); |
| 568 | } |
| 569 | |
| 570 | EncodedJSValue JSC_HOST_CALL jsMediaControlsHostPrototypeFunctionSetPreparedToReturnVideoLayerToInline(ExecState* state) |
| 571 | { |
| 572 | return IDLOperation<JSMediaControlsHost>::call<jsMediaControlsHostPrototypeFunctionSetPreparedToReturnVideoLayerToInlineBody>(*state, "setPreparedToReturnVideoLayerToInline" ); |
| 573 | } |
| 574 | |
| 575 | static inline JSC::EncodedJSValue jsMediaControlsHostPrototypeFunctionUpdateTextTrackContainerBody(JSC::ExecState* state, typename IDLOperation<JSMediaControlsHost>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
| 576 | { |
| 577 | UNUSED_PARAM(state); |
| 578 | UNUSED_PARAM(throwScope); |
| 579 | auto& impl = castedThis->wrapped(); |
| 580 | impl.updateTextTrackContainer(); |
| 581 | return JSValue::encode(jsUndefined()); |
| 582 | } |
| 583 | |
| 584 | EncodedJSValue JSC_HOST_CALL jsMediaControlsHostPrototypeFunctionUpdateTextTrackContainer(ExecState* state) |
| 585 | { |
| 586 | return IDLOperation<JSMediaControlsHost>::call<jsMediaControlsHostPrototypeFunctionUpdateTextTrackContainerBody>(*state, "updateTextTrackContainer" ); |
| 587 | } |
| 588 | |
| 589 | static inline JSC::EncodedJSValue jsMediaControlsHostPrototypeFunctionEnteredFullscreenBody(JSC::ExecState* state, typename IDLOperation<JSMediaControlsHost>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
| 590 | { |
| 591 | UNUSED_PARAM(state); |
| 592 | UNUSED_PARAM(throwScope); |
| 593 | auto& impl = castedThis->wrapped(); |
| 594 | impl.enteredFullscreen(); |
| 595 | return JSValue::encode(jsUndefined()); |
| 596 | } |
| 597 | |
| 598 | EncodedJSValue JSC_HOST_CALL jsMediaControlsHostPrototypeFunctionEnteredFullscreen(ExecState* state) |
| 599 | { |
| 600 | return IDLOperation<JSMediaControlsHost>::call<jsMediaControlsHostPrototypeFunctionEnteredFullscreenBody>(*state, "enteredFullscreen" ); |
| 601 | } |
| 602 | |
| 603 | static inline JSC::EncodedJSValue jsMediaControlsHostPrototypeFunctionExitedFullscreenBody(JSC::ExecState* state, typename IDLOperation<JSMediaControlsHost>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
| 604 | { |
| 605 | UNUSED_PARAM(state); |
| 606 | UNUSED_PARAM(throwScope); |
| 607 | auto& impl = castedThis->wrapped(); |
| 608 | impl.exitedFullscreen(); |
| 609 | return JSValue::encode(jsUndefined()); |
| 610 | } |
| 611 | |
| 612 | EncodedJSValue JSC_HOST_CALL jsMediaControlsHostPrototypeFunctionExitedFullscreen(ExecState* state) |
| 613 | { |
| 614 | return IDLOperation<JSMediaControlsHost>::call<jsMediaControlsHostPrototypeFunctionExitedFullscreenBody>(*state, "exitedFullscreen" ); |
| 615 | } |
| 616 | |
| 617 | static inline JSC::EncodedJSValue jsMediaControlsHostPrototypeFunctionGenerateUUIDBody(JSC::ExecState* state, typename IDLOperation<JSMediaControlsHost>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
| 618 | { |
| 619 | UNUSED_PARAM(state); |
| 620 | UNUSED_PARAM(throwScope); |
| 621 | auto& impl = castedThis->wrapped(); |
| 622 | return JSValue::encode(toJS<IDLDOMString>(*state, impl.generateUUID())); |
| 623 | } |
| 624 | |
| 625 | EncodedJSValue JSC_HOST_CALL jsMediaControlsHostPrototypeFunctionGenerateUUID(ExecState* state) |
| 626 | { |
| 627 | return IDLOperation<JSMediaControlsHost>::call<jsMediaControlsHostPrototypeFunctionGenerateUUIDBody>(*state, "generateUUID" ); |
| 628 | } |
| 629 | |
| 630 | static inline JSC::EncodedJSValue jsMediaControlsHostPrototypeFunctionBase64StringForIconNameAndTypeBody(JSC::ExecState* state, typename IDLOperation<JSMediaControlsHost>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
| 631 | { |
| 632 | UNUSED_PARAM(state); |
| 633 | UNUSED_PARAM(throwScope); |
| 634 | auto& impl = castedThis->wrapped(); |
| 635 | if (UNLIKELY(state->argumentCount() < 2)) |
| 636 | return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
| 637 | auto iconName = convert<IDLDOMString>(*state, state->uncheckedArgument(0)); |
| 638 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
| 639 | auto iconType = convert<IDLDOMString>(*state, state->uncheckedArgument(1)); |
| 640 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
| 641 | return JSValue::encode(toJS<IDLDOMString>(*state, impl.base64StringForIconNameAndType(WTFMove(iconName), WTFMove(iconType)))); |
| 642 | } |
| 643 | |
| 644 | EncodedJSValue JSC_HOST_CALL jsMediaControlsHostPrototypeFunctionBase64StringForIconNameAndType(ExecState* state) |
| 645 | { |
| 646 | return IDLOperation<JSMediaControlsHost>::call<jsMediaControlsHostPrototypeFunctionBase64StringForIconNameAndTypeBody>(*state, "base64StringForIconNameAndType" ); |
| 647 | } |
| 648 | |
| 649 | static inline JSC::EncodedJSValue jsMediaControlsHostPrototypeFunctionFormattedStringForDurationBody(JSC::ExecState* state, typename IDLOperation<JSMediaControlsHost>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
| 650 | { |
| 651 | UNUSED_PARAM(state); |
| 652 | UNUSED_PARAM(throwScope); |
| 653 | auto& impl = castedThis->wrapped(); |
| 654 | if (UNLIKELY(state->argumentCount() < 1)) |
| 655 | return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
| 656 | auto durationInSeconds = convert<IDLUnrestrictedDouble>(*state, state->uncheckedArgument(0)); |
| 657 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
| 658 | return JSValue::encode(toJS<IDLDOMString>(*state, impl.formattedStringForDuration(WTFMove(durationInSeconds)))); |
| 659 | } |
| 660 | |
| 661 | EncodedJSValue JSC_HOST_CALL jsMediaControlsHostPrototypeFunctionFormattedStringForDuration(ExecState* state) |
| 662 | { |
| 663 | return IDLOperation<JSMediaControlsHost>::call<jsMediaControlsHostPrototypeFunctionFormattedStringForDurationBody>(*state, "formattedStringForDuration" ); |
| 664 | } |
| 665 | |
| 666 | void JSMediaControlsHost::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder) |
| 667 | { |
| 668 | auto* thisObject = jsCast<JSMediaControlsHost*>(cell); |
| 669 | builder.setWrappedObjectForCell(cell, &thisObject->wrapped()); |
| 670 | if (thisObject->scriptExecutionContext()) |
| 671 | builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); |
| 672 | Base::heapSnapshot(cell, builder); |
| 673 | } |
| 674 | |
| 675 | bool JSMediaControlsHostOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor, const char** reason) |
| 676 | { |
| 677 | UNUSED_PARAM(handle); |
| 678 | UNUSED_PARAM(visitor); |
| 679 | UNUSED_PARAM(reason); |
| 680 | return false; |
| 681 | } |
| 682 | |
| 683 | void JSMediaControlsHostOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) |
| 684 | { |
| 685 | auto* jsMediaControlsHost = static_cast<JSMediaControlsHost*>(handle.slot()->asCell()); |
| 686 | auto& world = *static_cast<DOMWrapperWorld*>(context); |
| 687 | uncacheWrapper(world, &jsMediaControlsHost->wrapped(), jsMediaControlsHost); |
| 688 | } |
| 689 | |
| 690 | JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<MediaControlsHost>&& impl) |
| 691 | { |
| 692 | // If you hit this failure the interface definition has the ImplementationLacksVTable |
| 693 | // attribute. You should remove that attribute. If the class has subclasses |
| 694 | // that may be passed through this toJS() function you should use the SkipVTableValidation |
| 695 | // attribute to MediaControlsHost. |
| 696 | static_assert(!std::is_polymorphic<MediaControlsHost>::value, "MediaControlsHost is polymorphic but the IDL claims it is not" ); |
| 697 | return createWrapper<MediaControlsHost>(globalObject, WTFMove(impl)); |
| 698 | } |
| 699 | |
| 700 | JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, MediaControlsHost& impl) |
| 701 | { |
| 702 | return wrap(state, globalObject, impl); |
| 703 | } |
| 704 | |
| 705 | MediaControlsHost* JSMediaControlsHost::toWrapped(JSC::VM& vm, JSC::JSValue value) |
| 706 | { |
| 707 | if (auto* wrapper = jsDynamicCast<JSMediaControlsHost*>(vm, value)) |
| 708 | return &wrapper->wrapped(); |
| 709 | return nullptr; |
| 710 | } |
| 711 | |
| 712 | } |
| 713 | |
| 714 | #endif // ENABLE(MEDIA_CONTROLS_SCRIPT) |
| 715 | |