| 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 "JSVTTRegion.h" |
| 26 | |
| 27 | #include "JSDOMAttribute.h" |
| 28 | #include "JSDOMBinding.h" |
| 29 | #include "JSDOMConstructor.h" |
| 30 | #include "JSDOMConvertInterface.h" |
| 31 | #include "JSDOMConvertNumbers.h" |
| 32 | #include "JSDOMConvertStrings.h" |
| 33 | #include "JSDOMExceptionHandling.h" |
| 34 | #include "JSDOMGlobalObject.h" |
| 35 | #include "JSDOMWrapperCache.h" |
| 36 | #include "JSTextTrack.h" |
| 37 | #include "ScriptExecutionContext.h" |
| 38 | #include <JavaScriptCore/FunctionPrototype.h> |
| 39 | #include <JavaScriptCore/HeapSnapshotBuilder.h> |
| 40 | #include <JavaScriptCore/JSCInlines.h> |
| 41 | #include <wtf/GetPtr.h> |
| 42 | #include <wtf/PointerPreparations.h> |
| 43 | #include <wtf/URL.h> |
| 44 | |
| 45 | |
| 46 | namespace WebCore { |
| 47 | using namespace JSC; |
| 48 | |
| 49 | // Attributes |
| 50 | |
| 51 | JSC::EncodedJSValue jsVTTRegionConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 52 | bool setJSVTTRegionConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| 53 | JSC::EncodedJSValue jsVTTRegionTrack(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 54 | JSC::EncodedJSValue jsVTTRegionId(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 55 | bool setJSVTTRegionId(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| 56 | JSC::EncodedJSValue jsVTTRegionWidth(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 57 | bool setJSVTTRegionWidth(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| 58 | JSC::EncodedJSValue jsVTTRegionLines(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 59 | bool setJSVTTRegionLines(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| 60 | JSC::EncodedJSValue jsVTTRegionRegionAnchorX(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 61 | bool setJSVTTRegionRegionAnchorX(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| 62 | JSC::EncodedJSValue jsVTTRegionRegionAnchorY(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 63 | bool setJSVTTRegionRegionAnchorY(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| 64 | JSC::EncodedJSValue jsVTTRegionViewportAnchorX(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 65 | bool setJSVTTRegionViewportAnchorX(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| 66 | JSC::EncodedJSValue jsVTTRegionViewportAnchorY(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 67 | bool setJSVTTRegionViewportAnchorY(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| 68 | JSC::EncodedJSValue jsVTTRegionScroll(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 69 | bool setJSVTTRegionScroll(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| 70 | |
| 71 | class JSVTTRegionPrototype : public JSC::JSNonFinalObject { |
| 72 | public: |
| 73 | using Base = JSC::JSNonFinalObject; |
| 74 | static JSVTTRegionPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) |
| 75 | { |
| 76 | JSVTTRegionPrototype* ptr = new (NotNull, JSC::allocateCell<JSVTTRegionPrototype>(vm.heap)) JSVTTRegionPrototype(vm, globalObject, structure); |
| 77 | ptr->finishCreation(vm); |
| 78 | return ptr; |
| 79 | } |
| 80 | |
| 81 | DECLARE_INFO; |
| 82 | static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) |
| 83 | { |
| 84 | return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); |
| 85 | } |
| 86 | |
| 87 | private: |
| 88 | JSVTTRegionPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
| 89 | : JSC::JSNonFinalObject(vm, structure) |
| 90 | { |
| 91 | } |
| 92 | |
| 93 | void finishCreation(JSC::VM&); |
| 94 | }; |
| 95 | |
| 96 | using JSVTTRegionConstructor = JSDOMConstructor<JSVTTRegion>; |
| 97 | |
| 98 | template<> EncodedJSValue JSC_HOST_CALL JSVTTRegionConstructor::construct(ExecState* state) |
| 99 | { |
| 100 | VM& vm = state->vm(); |
| 101 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
| 102 | UNUSED_PARAM(throwScope); |
| 103 | auto* castedThis = jsCast<JSVTTRegionConstructor*>(state->jsCallee()); |
| 104 | ASSERT(castedThis); |
| 105 | auto* context = castedThis->scriptExecutionContext(); |
| 106 | if (UNLIKELY(!context)) |
| 107 | return throwConstructorScriptExecutionContextUnavailableError(*state, throwScope, "VTTRegion" ); |
| 108 | auto object = VTTRegion::create(*context); |
| 109 | return JSValue::encode(toJSNewlyCreated<IDLInterface<VTTRegion>>(*state, *castedThis->globalObject(), WTFMove(object))); |
| 110 | } |
| 111 | |
| 112 | template<> JSValue JSVTTRegionConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) |
| 113 | { |
| 114 | UNUSED_PARAM(vm); |
| 115 | return globalObject.functionPrototype(); |
| 116 | } |
| 117 | |
| 118 | template<> void JSVTTRegionConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) |
| 119 | { |
| 120 | putDirect(vm, vm.propertyNames->prototype, JSVTTRegion::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
| 121 | putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("VTTRegion"_s )), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
| 122 | putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
| 123 | } |
| 124 | |
| 125 | template<> const ClassInfo JSVTTRegionConstructor::s_info = { "VTTRegion" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSVTTRegionConstructor) }; |
| 126 | |
| 127 | /* Hash table for prototype */ |
| 128 | |
| 129 | static const HashTableValue JSVTTRegionPrototypeTableValues[] = |
| 130 | { |
| 131 | { "constructor" , static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsVTTRegionConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSVTTRegionConstructor) } }, |
| 132 | { "track" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsVTTRegionTrack), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 133 | { "id" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsVTTRegionId), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSVTTRegionId) } }, |
| 134 | { "width" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsVTTRegionWidth), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSVTTRegionWidth) } }, |
| 135 | { "lines" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsVTTRegionLines), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSVTTRegionLines) } }, |
| 136 | { "regionAnchorX" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsVTTRegionRegionAnchorX), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSVTTRegionRegionAnchorX) } }, |
| 137 | { "regionAnchorY" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsVTTRegionRegionAnchorY), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSVTTRegionRegionAnchorY) } }, |
| 138 | { "viewportAnchorX" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsVTTRegionViewportAnchorX), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSVTTRegionViewportAnchorX) } }, |
| 139 | { "viewportAnchorY" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsVTTRegionViewportAnchorY), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSVTTRegionViewportAnchorY) } }, |
| 140 | { "scroll" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsVTTRegionScroll), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSVTTRegionScroll) } }, |
| 141 | }; |
| 142 | |
| 143 | const ClassInfo JSVTTRegionPrototype::s_info = { "VTTRegionPrototype" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSVTTRegionPrototype) }; |
| 144 | |
| 145 | void JSVTTRegionPrototype::finishCreation(VM& vm) |
| 146 | { |
| 147 | Base::finishCreation(vm); |
| 148 | reifyStaticProperties(vm, JSVTTRegion::info(), JSVTTRegionPrototypeTableValues, *this); |
| 149 | } |
| 150 | |
| 151 | const ClassInfo JSVTTRegion::s_info = { "VTTRegion" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSVTTRegion) }; |
| 152 | |
| 153 | JSVTTRegion::JSVTTRegion(Structure* structure, JSDOMGlobalObject& globalObject, Ref<VTTRegion>&& impl) |
| 154 | : JSDOMWrapper<VTTRegion>(structure, globalObject, WTFMove(impl)) |
| 155 | { |
| 156 | } |
| 157 | |
| 158 | void JSVTTRegion::finishCreation(VM& vm) |
| 159 | { |
| 160 | Base::finishCreation(vm); |
| 161 | ASSERT(inherits(vm, info())); |
| 162 | |
| 163 | } |
| 164 | |
| 165 | JSObject* JSVTTRegion::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) |
| 166 | { |
| 167 | return JSVTTRegionPrototype::create(vm, &globalObject, JSVTTRegionPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype())); |
| 168 | } |
| 169 | |
| 170 | JSObject* JSVTTRegion::prototype(VM& vm, JSDOMGlobalObject& globalObject) |
| 171 | { |
| 172 | return getDOMPrototype<JSVTTRegion>(vm, globalObject); |
| 173 | } |
| 174 | |
| 175 | JSValue JSVTTRegion::getConstructor(VM& vm, const JSGlobalObject* globalObject) |
| 176 | { |
| 177 | return getDOMConstructor<JSVTTRegionConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); |
| 178 | } |
| 179 | |
| 180 | void JSVTTRegion::destroy(JSC::JSCell* cell) |
| 181 | { |
| 182 | JSVTTRegion* thisObject = static_cast<JSVTTRegion*>(cell); |
| 183 | thisObject->JSVTTRegion::~JSVTTRegion(); |
| 184 | } |
| 185 | |
| 186 | template<> inline JSVTTRegion* IDLAttribute<JSVTTRegion>::cast(ExecState& state, EncodedJSValue thisValue) |
| 187 | { |
| 188 | return jsDynamicCast<JSVTTRegion*>(state.vm(), JSValue::decode(thisValue)); |
| 189 | } |
| 190 | |
| 191 | EncodedJSValue jsVTTRegionConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 192 | { |
| 193 | VM& vm = state->vm(); |
| 194 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
| 195 | auto* prototype = jsDynamicCast<JSVTTRegionPrototype*>(vm, JSValue::decode(thisValue)); |
| 196 | if (UNLIKELY(!prototype)) |
| 197 | return throwVMTypeError(state, throwScope); |
| 198 | return JSValue::encode(JSVTTRegion::getConstructor(state->vm(), prototype->globalObject())); |
| 199 | } |
| 200 | |
| 201 | bool setJSVTTRegionConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| 202 | { |
| 203 | VM& vm = state->vm(); |
| 204 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
| 205 | auto* prototype = jsDynamicCast<JSVTTRegionPrototype*>(vm, JSValue::decode(thisValue)); |
| 206 | if (UNLIKELY(!prototype)) { |
| 207 | throwVMTypeError(state, throwScope); |
| 208 | return false; |
| 209 | } |
| 210 | // Shadowing a built-in constructor |
| 211 | return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue)); |
| 212 | } |
| 213 | |
| 214 | static inline JSValue jsVTTRegionTrackGetter(ExecState& state, JSVTTRegion& thisObject, ThrowScope& throwScope) |
| 215 | { |
| 216 | UNUSED_PARAM(throwScope); |
| 217 | UNUSED_PARAM(state); |
| 218 | auto& impl = thisObject.wrapped(); |
| 219 | JSValue result = toJS<IDLInterface<TextTrack>>(state, *thisObject.globalObject(), throwScope, impl.track()); |
| 220 | return result; |
| 221 | } |
| 222 | |
| 223 | EncodedJSValue jsVTTRegionTrack(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 224 | { |
| 225 | return IDLAttribute<JSVTTRegion>::get<jsVTTRegionTrackGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "track" ); |
| 226 | } |
| 227 | |
| 228 | static inline JSValue jsVTTRegionIdGetter(ExecState& state, JSVTTRegion& thisObject, ThrowScope& throwScope) |
| 229 | { |
| 230 | UNUSED_PARAM(throwScope); |
| 231 | UNUSED_PARAM(state); |
| 232 | auto& impl = thisObject.wrapped(); |
| 233 | JSValue result = toJS<IDLDOMString>(state, throwScope, impl.id()); |
| 234 | return result; |
| 235 | } |
| 236 | |
| 237 | EncodedJSValue jsVTTRegionId(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 238 | { |
| 239 | return IDLAttribute<JSVTTRegion>::get<jsVTTRegionIdGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "id" ); |
| 240 | } |
| 241 | |
| 242 | static inline bool setJSVTTRegionIdSetter(ExecState& state, JSVTTRegion& thisObject, JSValue value, ThrowScope& throwScope) |
| 243 | { |
| 244 | UNUSED_PARAM(throwScope); |
| 245 | auto& impl = thisObject.wrapped(); |
| 246 | auto nativeValue = convert<IDLDOMString>(state, value); |
| 247 | RETURN_IF_EXCEPTION(throwScope, false); |
| 248 | AttributeSetter::call(state, throwScope, [&] { |
| 249 | return impl.setId(WTFMove(nativeValue)); |
| 250 | }); |
| 251 | return true; |
| 252 | } |
| 253 | |
| 254 | bool setJSVTTRegionId(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| 255 | { |
| 256 | return IDLAttribute<JSVTTRegion>::set<setJSVTTRegionIdSetter>(*state, thisValue, encodedValue, "id" ); |
| 257 | } |
| 258 | |
| 259 | static inline JSValue jsVTTRegionWidthGetter(ExecState& state, JSVTTRegion& thisObject, ThrowScope& throwScope) |
| 260 | { |
| 261 | UNUSED_PARAM(throwScope); |
| 262 | UNUSED_PARAM(state); |
| 263 | auto& impl = thisObject.wrapped(); |
| 264 | JSValue result = toJS<IDLDouble>(state, throwScope, impl.width()); |
| 265 | return result; |
| 266 | } |
| 267 | |
| 268 | EncodedJSValue jsVTTRegionWidth(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 269 | { |
| 270 | return IDLAttribute<JSVTTRegion>::get<jsVTTRegionWidthGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "width" ); |
| 271 | } |
| 272 | |
| 273 | static inline bool setJSVTTRegionWidthSetter(ExecState& state, JSVTTRegion& thisObject, JSValue value, ThrowScope& throwScope) |
| 274 | { |
| 275 | UNUSED_PARAM(throwScope); |
| 276 | auto& impl = thisObject.wrapped(); |
| 277 | auto nativeValue = convert<IDLDouble>(state, value); |
| 278 | RETURN_IF_EXCEPTION(throwScope, false); |
| 279 | AttributeSetter::call(state, throwScope, [&] { |
| 280 | return impl.setWidth(WTFMove(nativeValue)); |
| 281 | }); |
| 282 | return true; |
| 283 | } |
| 284 | |
| 285 | bool setJSVTTRegionWidth(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| 286 | { |
| 287 | return IDLAttribute<JSVTTRegion>::set<setJSVTTRegionWidthSetter>(*state, thisValue, encodedValue, "width" ); |
| 288 | } |
| 289 | |
| 290 | static inline JSValue jsVTTRegionLinesGetter(ExecState& state, JSVTTRegion& thisObject, ThrowScope& throwScope) |
| 291 | { |
| 292 | UNUSED_PARAM(throwScope); |
| 293 | UNUSED_PARAM(state); |
| 294 | auto& impl = thisObject.wrapped(); |
| 295 | JSValue result = toJS<IDLLong>(state, throwScope, impl.lines()); |
| 296 | return result; |
| 297 | } |
| 298 | |
| 299 | EncodedJSValue jsVTTRegionLines(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 300 | { |
| 301 | return IDLAttribute<JSVTTRegion>::get<jsVTTRegionLinesGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "lines" ); |
| 302 | } |
| 303 | |
| 304 | static inline bool setJSVTTRegionLinesSetter(ExecState& state, JSVTTRegion& thisObject, JSValue value, ThrowScope& throwScope) |
| 305 | { |
| 306 | UNUSED_PARAM(throwScope); |
| 307 | auto& impl = thisObject.wrapped(); |
| 308 | auto nativeValue = convert<IDLLong>(state, value); |
| 309 | RETURN_IF_EXCEPTION(throwScope, false); |
| 310 | AttributeSetter::call(state, throwScope, [&] { |
| 311 | return impl.setLines(WTFMove(nativeValue)); |
| 312 | }); |
| 313 | return true; |
| 314 | } |
| 315 | |
| 316 | bool setJSVTTRegionLines(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| 317 | { |
| 318 | return IDLAttribute<JSVTTRegion>::set<setJSVTTRegionLinesSetter>(*state, thisValue, encodedValue, "lines" ); |
| 319 | } |
| 320 | |
| 321 | static inline JSValue jsVTTRegionRegionAnchorXGetter(ExecState& state, JSVTTRegion& thisObject, ThrowScope& throwScope) |
| 322 | { |
| 323 | UNUSED_PARAM(throwScope); |
| 324 | UNUSED_PARAM(state); |
| 325 | auto& impl = thisObject.wrapped(); |
| 326 | JSValue result = toJS<IDLDouble>(state, throwScope, impl.regionAnchorX()); |
| 327 | return result; |
| 328 | } |
| 329 | |
| 330 | EncodedJSValue jsVTTRegionRegionAnchorX(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 331 | { |
| 332 | return IDLAttribute<JSVTTRegion>::get<jsVTTRegionRegionAnchorXGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "regionAnchorX" ); |
| 333 | } |
| 334 | |
| 335 | static inline bool setJSVTTRegionRegionAnchorXSetter(ExecState& state, JSVTTRegion& thisObject, JSValue value, ThrowScope& throwScope) |
| 336 | { |
| 337 | UNUSED_PARAM(throwScope); |
| 338 | auto& impl = thisObject.wrapped(); |
| 339 | auto nativeValue = convert<IDLDouble>(state, value); |
| 340 | RETURN_IF_EXCEPTION(throwScope, false); |
| 341 | AttributeSetter::call(state, throwScope, [&] { |
| 342 | return impl.setRegionAnchorX(WTFMove(nativeValue)); |
| 343 | }); |
| 344 | return true; |
| 345 | } |
| 346 | |
| 347 | bool setJSVTTRegionRegionAnchorX(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| 348 | { |
| 349 | return IDLAttribute<JSVTTRegion>::set<setJSVTTRegionRegionAnchorXSetter>(*state, thisValue, encodedValue, "regionAnchorX" ); |
| 350 | } |
| 351 | |
| 352 | static inline JSValue jsVTTRegionRegionAnchorYGetter(ExecState& state, JSVTTRegion& thisObject, ThrowScope& throwScope) |
| 353 | { |
| 354 | UNUSED_PARAM(throwScope); |
| 355 | UNUSED_PARAM(state); |
| 356 | auto& impl = thisObject.wrapped(); |
| 357 | JSValue result = toJS<IDLDouble>(state, throwScope, impl.regionAnchorY()); |
| 358 | return result; |
| 359 | } |
| 360 | |
| 361 | EncodedJSValue jsVTTRegionRegionAnchorY(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 362 | { |
| 363 | return IDLAttribute<JSVTTRegion>::get<jsVTTRegionRegionAnchorYGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "regionAnchorY" ); |
| 364 | } |
| 365 | |
| 366 | static inline bool setJSVTTRegionRegionAnchorYSetter(ExecState& state, JSVTTRegion& thisObject, JSValue value, ThrowScope& throwScope) |
| 367 | { |
| 368 | UNUSED_PARAM(throwScope); |
| 369 | auto& impl = thisObject.wrapped(); |
| 370 | auto nativeValue = convert<IDLDouble>(state, value); |
| 371 | RETURN_IF_EXCEPTION(throwScope, false); |
| 372 | AttributeSetter::call(state, throwScope, [&] { |
| 373 | return impl.setRegionAnchorY(WTFMove(nativeValue)); |
| 374 | }); |
| 375 | return true; |
| 376 | } |
| 377 | |
| 378 | bool setJSVTTRegionRegionAnchorY(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| 379 | { |
| 380 | return IDLAttribute<JSVTTRegion>::set<setJSVTTRegionRegionAnchorYSetter>(*state, thisValue, encodedValue, "regionAnchorY" ); |
| 381 | } |
| 382 | |
| 383 | static inline JSValue jsVTTRegionViewportAnchorXGetter(ExecState& state, JSVTTRegion& thisObject, ThrowScope& throwScope) |
| 384 | { |
| 385 | UNUSED_PARAM(throwScope); |
| 386 | UNUSED_PARAM(state); |
| 387 | auto& impl = thisObject.wrapped(); |
| 388 | JSValue result = toJS<IDLDouble>(state, throwScope, impl.viewportAnchorX()); |
| 389 | return result; |
| 390 | } |
| 391 | |
| 392 | EncodedJSValue jsVTTRegionViewportAnchorX(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 393 | { |
| 394 | return IDLAttribute<JSVTTRegion>::get<jsVTTRegionViewportAnchorXGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "viewportAnchorX" ); |
| 395 | } |
| 396 | |
| 397 | static inline bool setJSVTTRegionViewportAnchorXSetter(ExecState& state, JSVTTRegion& thisObject, JSValue value, ThrowScope& throwScope) |
| 398 | { |
| 399 | UNUSED_PARAM(throwScope); |
| 400 | auto& impl = thisObject.wrapped(); |
| 401 | auto nativeValue = convert<IDLDouble>(state, value); |
| 402 | RETURN_IF_EXCEPTION(throwScope, false); |
| 403 | AttributeSetter::call(state, throwScope, [&] { |
| 404 | return impl.setViewportAnchorX(WTFMove(nativeValue)); |
| 405 | }); |
| 406 | return true; |
| 407 | } |
| 408 | |
| 409 | bool setJSVTTRegionViewportAnchorX(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| 410 | { |
| 411 | return IDLAttribute<JSVTTRegion>::set<setJSVTTRegionViewportAnchorXSetter>(*state, thisValue, encodedValue, "viewportAnchorX" ); |
| 412 | } |
| 413 | |
| 414 | static inline JSValue jsVTTRegionViewportAnchorYGetter(ExecState& state, JSVTTRegion& thisObject, ThrowScope& throwScope) |
| 415 | { |
| 416 | UNUSED_PARAM(throwScope); |
| 417 | UNUSED_PARAM(state); |
| 418 | auto& impl = thisObject.wrapped(); |
| 419 | JSValue result = toJS<IDLDouble>(state, throwScope, impl.viewportAnchorY()); |
| 420 | return result; |
| 421 | } |
| 422 | |
| 423 | EncodedJSValue jsVTTRegionViewportAnchorY(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 424 | { |
| 425 | return IDLAttribute<JSVTTRegion>::get<jsVTTRegionViewportAnchorYGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "viewportAnchorY" ); |
| 426 | } |
| 427 | |
| 428 | static inline bool setJSVTTRegionViewportAnchorYSetter(ExecState& state, JSVTTRegion& thisObject, JSValue value, ThrowScope& throwScope) |
| 429 | { |
| 430 | UNUSED_PARAM(throwScope); |
| 431 | auto& impl = thisObject.wrapped(); |
| 432 | auto nativeValue = convert<IDLDouble>(state, value); |
| 433 | RETURN_IF_EXCEPTION(throwScope, false); |
| 434 | AttributeSetter::call(state, throwScope, [&] { |
| 435 | return impl.setViewportAnchorY(WTFMove(nativeValue)); |
| 436 | }); |
| 437 | return true; |
| 438 | } |
| 439 | |
| 440 | bool setJSVTTRegionViewportAnchorY(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| 441 | { |
| 442 | return IDLAttribute<JSVTTRegion>::set<setJSVTTRegionViewportAnchorYSetter>(*state, thisValue, encodedValue, "viewportAnchorY" ); |
| 443 | } |
| 444 | |
| 445 | static inline JSValue jsVTTRegionScrollGetter(ExecState& state, JSVTTRegion& thisObject, ThrowScope& throwScope) |
| 446 | { |
| 447 | UNUSED_PARAM(throwScope); |
| 448 | UNUSED_PARAM(state); |
| 449 | auto& impl = thisObject.wrapped(); |
| 450 | JSValue result = toJS<IDLDOMString>(state, throwScope, impl.scroll()); |
| 451 | return result; |
| 452 | } |
| 453 | |
| 454 | EncodedJSValue jsVTTRegionScroll(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 455 | { |
| 456 | return IDLAttribute<JSVTTRegion>::get<jsVTTRegionScrollGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "scroll" ); |
| 457 | } |
| 458 | |
| 459 | static inline bool setJSVTTRegionScrollSetter(ExecState& state, JSVTTRegion& thisObject, JSValue value, ThrowScope& throwScope) |
| 460 | { |
| 461 | UNUSED_PARAM(throwScope); |
| 462 | auto& impl = thisObject.wrapped(); |
| 463 | auto nativeValue = convert<IDLDOMString>(state, value); |
| 464 | RETURN_IF_EXCEPTION(throwScope, false); |
| 465 | AttributeSetter::call(state, throwScope, [&] { |
| 466 | return impl.setScroll(WTFMove(nativeValue)); |
| 467 | }); |
| 468 | return true; |
| 469 | } |
| 470 | |
| 471 | bool setJSVTTRegionScroll(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| 472 | { |
| 473 | return IDLAttribute<JSVTTRegion>::set<setJSVTTRegionScrollSetter>(*state, thisValue, encodedValue, "scroll" ); |
| 474 | } |
| 475 | |
| 476 | void JSVTTRegion::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder) |
| 477 | { |
| 478 | auto* thisObject = jsCast<JSVTTRegion*>(cell); |
| 479 | builder.setWrappedObjectForCell(cell, &thisObject->wrapped()); |
| 480 | if (thisObject->scriptExecutionContext()) |
| 481 | builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); |
| 482 | Base::heapSnapshot(cell, builder); |
| 483 | } |
| 484 | |
| 485 | bool JSVTTRegionOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor, const char** reason) |
| 486 | { |
| 487 | UNUSED_PARAM(handle); |
| 488 | UNUSED_PARAM(visitor); |
| 489 | UNUSED_PARAM(reason); |
| 490 | return false; |
| 491 | } |
| 492 | |
| 493 | void JSVTTRegionOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) |
| 494 | { |
| 495 | auto* jsVTTRegion = static_cast<JSVTTRegion*>(handle.slot()->asCell()); |
| 496 | auto& world = *static_cast<DOMWrapperWorld*>(context); |
| 497 | uncacheWrapper(world, &jsVTTRegion->wrapped(), jsVTTRegion); |
| 498 | } |
| 499 | |
| 500 | #if ENABLE(BINDING_INTEGRITY) |
| 501 | #if PLATFORM(WIN) |
| 502 | #pragma warning(disable: 4483) |
| 503 | extern "C" { extern void (*const __identifier("??_7VTTRegion@WebCore@@6B@" )[])(); } |
| 504 | #else |
| 505 | extern "C" { extern void* _ZTVN7WebCore9VTTRegionE[]; } |
| 506 | #endif |
| 507 | #endif |
| 508 | |
| 509 | JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<VTTRegion>&& impl) |
| 510 | { |
| 511 | |
| 512 | #if ENABLE(BINDING_INTEGRITY) |
| 513 | void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr())); |
| 514 | #if PLATFORM(WIN) |
| 515 | void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(__identifier("??_7VTTRegion@WebCore@@6B@" )); |
| 516 | #else |
| 517 | void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(&_ZTVN7WebCore9VTTRegionE[2]); |
| 518 | #endif |
| 519 | |
| 520 | // If this fails VTTRegion does not have a vtable, so you need to add the |
| 521 | // ImplementationLacksVTable attribute to the interface definition |
| 522 | static_assert(std::is_polymorphic<VTTRegion>::value, "VTTRegion is not polymorphic" ); |
| 523 | |
| 524 | // If you hit this assertion you either have a use after free bug, or |
| 525 | // VTTRegion has subclasses. If VTTRegion has subclasses that get passed |
| 526 | // to toJS() we currently require VTTRegion you to opt out of binding hardening |
| 527 | // by adding the SkipVTableValidation attribute to the interface IDL definition |
| 528 | RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer); |
| 529 | #endif |
| 530 | return createWrapper<VTTRegion>(globalObject, WTFMove(impl)); |
| 531 | } |
| 532 | |
| 533 | JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, VTTRegion& impl) |
| 534 | { |
| 535 | return wrap(state, globalObject, impl); |
| 536 | } |
| 537 | |
| 538 | VTTRegion* JSVTTRegion::toWrapped(JSC::VM& vm, JSC::JSValue value) |
| 539 | { |
| 540 | if (auto* wrapper = jsDynamicCast<JSVTTRegion*>(vm, value)) |
| 541 | return &wrapper->wrapped(); |
| 542 | return nullptr; |
| 543 | } |
| 544 | |
| 545 | } |
| 546 | |
| 547 | #endif // ENABLE(VIDEO_TRACK) |
| 548 | |