diff options
author | 2022-04-03 02:42:08 -0700 | |
---|---|---|
committer | 2022-04-03 02:42:08 -0700 | |
commit | 4a19a3f07f1887903e5638a3be167f0c7b377ba3 (patch) | |
tree | 24b5ebd36910d19e690352cf343943e0e6b0459d /src/javascript/jsc/bindings/webcore/JSPath2D.cpp | |
parent | e62c7dc9e5709b1ce54838aee30668a4c358a528 (diff) | |
download | bun-4a19a3f07f1887903e5638a3be167f0c7b377ba3.tar.gz bun-4a19a3f07f1887903e5638a3be167f0c7b377ba3.tar.zst bun-4a19a3f07f1887903e5638a3be167f0c7b377ba3.zip |
wip
Diffstat (limited to 'src/javascript/jsc/bindings/webcore/JSPath2D.cpp')
-rw-r--r-- | src/javascript/jsc/bindings/webcore/JSPath2D.cpp | 779 |
1 files changed, 779 insertions, 0 deletions
diff --git a/src/javascript/jsc/bindings/webcore/JSPath2D.cpp b/src/javascript/jsc/bindings/webcore/JSPath2D.cpp new file mode 100644 index 000000000..5a976b397 --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/JSPath2D.cpp @@ -0,0 +1,779 @@ +/* + This file is part of the WebKit open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "config.h" +#include "JSPath2D.h" + +#include "ActiveDOMObject.h" +#include "ExtendedDOMClientIsoSubspaces.h" +#include "ExtendedDOMIsoSubspaces.h" +#include "IDLTypes.h" +#include "JSDOMAttribute.h" +#include "JSDOMBinding.h" +#include "JSDOMConstructor.h" +#include "JSDOMConvertBase.h" +#include "JSDOMConvertBoolean.h" +#include "JSDOMConvertDictionary.h" +#include "JSDOMConvertInterface.h" +#include "JSDOMConvertNumbers.h" +#include "JSDOMConvertSequences.h" +#include "JSDOMConvertStrings.h" +#include "JSDOMConvertUnion.h" +#include "JSDOMExceptionHandling.h" +#include "JSDOMGlobalObjectInlines.h" +#include "JSDOMMatrix2DInit.h" +#include "JSDOMOperation.h" +#include "JSDOMPointInit.h" +#include "JSDOMWrapperCache.h" +#include "JSPath2D.h" +// #include "RuntimeEnabledFeatures.h" +#include "ScriptExecutionContext.h" +#include "WebCoreJSClientData.h" +#include <JavaScriptCore/FunctionPrototype.h> +#include <JavaScriptCore/HeapAnalyzer.h> +#include <JavaScriptCore/IteratorOperations.h> +#include <JavaScriptCore/JSArray.h> +#include <JavaScriptCore/JSCInlines.h> +#include <JavaScriptCore/JSDestructibleObjectHeapCellType.h> +#include <JavaScriptCore/SlotVisitorMacros.h> +#include <JavaScriptCore/SubspaceInlines.h> +#include <variant> +#include <wtf/GetPtr.h> +#include <wtf/PointerPreparations.h> +#include <wtf/URL.h> + +namespace WebCore { +using namespace JSC; + +// Functions + +static JSC_DECLARE_HOST_FUNCTION(jsPath2DPrototypeFunction_addPath); +static JSC_DECLARE_HOST_FUNCTION(jsPath2DPrototypeFunction_closePath); +static JSC_DECLARE_HOST_FUNCTION(jsPath2DPrototypeFunction_moveTo); +static JSC_DECLARE_HOST_FUNCTION(jsPath2DPrototypeFunction_lineTo); +static JSC_DECLARE_HOST_FUNCTION(jsPath2DPrototypeFunction_quadraticCurveTo); +static JSC_DECLARE_HOST_FUNCTION(jsPath2DPrototypeFunction_bezierCurveTo); +static JSC_DECLARE_HOST_FUNCTION(jsPath2DPrototypeFunction_arcTo); +static JSC_DECLARE_HOST_FUNCTION(jsPath2DPrototypeFunction_rect); +static JSC_DECLARE_HOST_FUNCTION(jsPath2DPrototypeFunction_roundRect); +static JSC_DECLARE_HOST_FUNCTION(jsPath2DPrototypeFunction_arc); +static JSC_DECLARE_HOST_FUNCTION(jsPath2DPrototypeFunction_ellipse); + +// Attributes + +static JSC_DECLARE_CUSTOM_GETTER(jsPath2DConstructor); +static JSC_DECLARE_CUSTOM_GETTER(jsPath2D_currentX); +static JSC_DECLARE_CUSTOM_GETTER(jsPath2D_currentY); + +class JSPath2DPrototype final : public JSC::JSNonFinalObject { +public: + using Base = JSC::JSNonFinalObject; + static JSPath2DPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) + { + JSPath2DPrototype* ptr = new (NotNull, JSC::allocateCell<JSPath2DPrototype>(vm)) JSPath2DPrototype(vm, globalObject, structure); + ptr->finishCreation(vm); + return ptr; + } + + DECLARE_INFO; + template<typename CellType, JSC::SubspaceAccess> + static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSPath2DPrototype, Base); + return &vm.plainObjectSpace(); + } + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) + { + return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); + } + +private: + JSPath2DPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) + : JSC::JSNonFinalObject(vm, structure) + { + } + + void finishCreation(JSC::VM&); +}; +STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSPath2DPrototype, JSPath2DPrototype::Base); + +using JSPath2DDOMConstructor = JSDOMConstructor<JSPath2D>; + +static inline EncodedJSValue constructJSPath2D1(JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame) +{ + VM& vm = lexicalGlobalObject->vm(); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto* castedThis = jsCast<JSPath2DDOMConstructor*>(callFrame->jsCallee()); + ASSERT(castedThis); + auto object = Path2D::create(); + if constexpr (IsExceptionOr<decltype(object)>) + RETURN_IF_EXCEPTION(throwScope, {}); + static_assert(TypeOrExceptionOrUnderlyingType<decltype(object)>::isRef); + auto jsValue = toJSNewlyCreated<IDLInterface<Path2D>>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, WTFMove(object)); + if constexpr (IsExceptionOr<decltype(object)>) + RETURN_IF_EXCEPTION(throwScope, {}); + setSubclassStructureIfNeeded<Path2D>(lexicalGlobalObject, callFrame, asObject(jsValue)); + RETURN_IF_EXCEPTION(throwScope, {}); + return JSValue::encode(jsValue); +} + +static inline EncodedJSValue constructJSPath2D2(JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame) +{ + VM& vm = lexicalGlobalObject->vm(); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto* castedThis = jsCast<JSPath2DDOMConstructor*>(callFrame->jsCallee()); + ASSERT(castedThis); + EnsureStillAliveScope argument0 = callFrame->uncheckedArgument(0); + auto path = convert<IDLInterface<Path2D>>(*lexicalGlobalObject, argument0.value(), [](JSC::JSGlobalObject& lexicalGlobalObject, JSC::ThrowScope& scope) { throwArgumentTypeError(lexicalGlobalObject, scope, 0, "path", "Path2D", nullptr, "Path2D"); }); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + auto object = Path2D::create(*path); + if constexpr (IsExceptionOr<decltype(object)>) + RETURN_IF_EXCEPTION(throwScope, {}); + static_assert(TypeOrExceptionOrUnderlyingType<decltype(object)>::isRef); + auto jsValue = toJSNewlyCreated<IDLInterface<Path2D>>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, WTFMove(object)); + if constexpr (IsExceptionOr<decltype(object)>) + RETURN_IF_EXCEPTION(throwScope, {}); + setSubclassStructureIfNeeded<Path2D>(lexicalGlobalObject, callFrame, asObject(jsValue)); + RETURN_IF_EXCEPTION(throwScope, {}); + return JSValue::encode(jsValue); +} + +static inline EncodedJSValue constructJSPath2D3(JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame) +{ + VM& vm = lexicalGlobalObject->vm(); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto* castedThis = jsCast<JSPath2DDOMConstructor*>(callFrame->jsCallee()); + ASSERT(castedThis); + EnsureStillAliveScope argument0 = callFrame->uncheckedArgument(0); + auto d = convert<IDLDOMString>(*lexicalGlobalObject, argument0.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + auto object = Path2D::create(WTFMove(d)); + if constexpr (IsExceptionOr<decltype(object)>) + RETURN_IF_EXCEPTION(throwScope, {}); + static_assert(TypeOrExceptionOrUnderlyingType<decltype(object)>::isRef); + auto jsValue = toJSNewlyCreated<IDLInterface<Path2D>>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, WTFMove(object)); + if constexpr (IsExceptionOr<decltype(object)>) + RETURN_IF_EXCEPTION(throwScope, {}); + setSubclassStructureIfNeeded<Path2D>(lexicalGlobalObject, callFrame, asObject(jsValue)); + RETURN_IF_EXCEPTION(throwScope, {}); + return JSValue::encode(jsValue); +} + +template<> EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSPath2DDOMConstructor::construct(JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame) +{ + VM& vm = lexicalGlobalObject->vm(); + auto throwScope = DECLARE_THROW_SCOPE(vm); + UNUSED_PARAM(throwScope); + size_t argsCount = std::min<size_t>(1, callFrame->argumentCount()); + if (argsCount == 0) { + RELEASE_AND_RETURN(throwScope, (constructJSPath2D1(lexicalGlobalObject, callFrame))); + } + if (argsCount == 1) { + JSValue distinguishingArg = callFrame->uncheckedArgument(0); + if (distinguishingArg.isObject() && asObject(distinguishingArg)->inherits<JSPath2D>(vm)) + RELEASE_AND_RETURN(throwScope, (constructJSPath2D2(lexicalGlobalObject, callFrame))); + RELEASE_AND_RETURN(throwScope, (constructJSPath2D3(lexicalGlobalObject, callFrame))); + } + return throwVMTypeError(lexicalGlobalObject, throwScope); +} +JSC_ANNOTATE_HOST_FUNCTION(JSPath2DConstructorConstruct, JSPath2DDOMConstructor::construct); + +template<> const ClassInfo JSPath2DDOMConstructor::s_info = { "Path2D"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSPath2DDOMConstructor) }; + +template<> JSValue JSPath2DDOMConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) +{ + UNUSED_PARAM(vm); + return globalObject.functionPrototype(); +} + +template<> void JSPath2DDOMConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) +{ + putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); + JSString* nameString = jsNontrivialString(vm, "Path2D"_s); + m_originalName.set(vm, this, nameString); + putDirect(vm, vm.propertyNames->name, nameString, JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); + putDirect(vm, vm.propertyNames->prototype, JSPath2D::prototype(vm, globalObject), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum | JSC::PropertyAttribute::DontDelete); +} + +/* Hash table for prototype */ + +static const HashTableValue JSPath2DPrototypeTableValues[] = { + { "constructor", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(jsPath2DConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, + { "currentX", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(jsPath2D_currentX), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, + { "currentY", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(jsPath2D_currentY), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, + { "addPath", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(jsPath2DPrototypeFunction_addPath), (intptr_t)(1) } }, + { "closePath", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(jsPath2DPrototypeFunction_closePath), (intptr_t)(0) } }, + { "moveTo", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(jsPath2DPrototypeFunction_moveTo), (intptr_t)(2) } }, + { "lineTo", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(jsPath2DPrototypeFunction_lineTo), (intptr_t)(2) } }, + { "quadraticCurveTo", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(jsPath2DPrototypeFunction_quadraticCurveTo), (intptr_t)(4) } }, + { "bezierCurveTo", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(jsPath2DPrototypeFunction_bezierCurveTo), (intptr_t)(6) } }, + { "arcTo", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(jsPath2DPrototypeFunction_arcTo), (intptr_t)(5) } }, + { "rect", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(jsPath2DPrototypeFunction_rect), (intptr_t)(4) } }, + { "roundRect", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(jsPath2DPrototypeFunction_roundRect), (intptr_t)(5) } }, + { "arc", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(jsPath2DPrototypeFunction_arc), (intptr_t)(5) } }, + { "ellipse", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(jsPath2DPrototypeFunction_ellipse), (intptr_t)(7) } }, +}; + +const ClassInfo JSPath2DPrototype::s_info = { "Path2D"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSPath2DPrototype) }; + +void JSPath2DPrototype::finishCreation(VM& vm) +{ + Base::finishCreation(vm); + reifyStaticProperties(vm, JSPath2D::info(), JSPath2DPrototypeTableValues, *this); + bool hasDisabledRuntimeProperties = false; + // if (!RuntimeEnabledFeatures::sharedFeatures().inspectorAdditionsEnabled()) { + // hasDisabledRuntimeProperties = true; + // auto propertyName = Identifier::fromString(vm, reinterpret_cast<const LChar*>("currentX"), strlen("currentX")); + // VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable); + // DeletePropertySlot slot; + // JSObject::deleteProperty(this, globalObject(), propertyName, slot); + // } + // if (!RuntimeEnabledFeatures::sharedFeatures().inspectorAdditionsEnabled()) { + // hasDisabledRuntimeProperties = true; + // auto propertyName = Identifier::fromString(vm, reinterpret_cast<const LChar*>("currentY"), strlen("currentY")); + // VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable); + // DeletePropertySlot slot; + // JSObject::deleteProperty(this, globalObject(), propertyName, slot); + // } + if (hasDisabledRuntimeProperties && structure()->isDictionary()) + flattenDictionaryObject(vm); + JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); +} + +const ClassInfo JSPath2D::s_info = { "Path2D"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSPath2D) }; + +JSPath2D::JSPath2D(Structure* structure, JSDOMGlobalObject& globalObject, Ref<Path2D>&& impl) + : JSDOMWrapper<Path2D>(structure, globalObject, WTFMove(impl)) +{ +} + +void JSPath2D::finishCreation(VM& vm) +{ + Base::finishCreation(vm); + ASSERT(inherits(vm, info())); + + // static_assert(!std::is_base_of<ActiveDOMObject, Path2D>::value, "Interface is not marked as [ActiveDOMObject] even though implementation class subclasses ActiveDOMObject."); +} + +JSObject* JSPath2D::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) +{ + return JSPath2DPrototype::create(vm, &globalObject, JSPath2DPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype())); +} + +JSObject* JSPath2D::prototype(VM& vm, JSDOMGlobalObject& globalObject) +{ + return getDOMPrototype<JSPath2D>(vm, globalObject); +} + +JSValue JSPath2D::getConstructor(VM& vm, const JSGlobalObject* globalObject) +{ + return getDOMConstructor<JSPath2DDOMConstructor, DOMConstructorID::Path2D>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); +} + +void JSPath2D::destroy(JSC::JSCell* cell) +{ + JSPath2D* thisObject = static_cast<JSPath2D*>(cell); + thisObject->JSPath2D::~JSPath2D(); +} + +JSC_DEFINE_CUSTOM_GETTER(jsPath2DConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) +{ + VM& vm = JSC::getVM(lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto* prototype = jsDynamicCast<JSPath2DPrototype*>(vm, JSValue::decode(thisValue)); + if (UNLIKELY(!prototype)) + return throwVMTypeError(lexicalGlobalObject, throwScope); + return JSValue::encode(JSPath2D::getConstructor(JSC::getVM(lexicalGlobalObject), prototype->globalObject())); +} + +static inline JSValue jsPath2D_currentXGetter(JSGlobalObject& lexicalGlobalObject, JSPath2D& thisObject) +{ + auto& vm = JSC::getVM(&lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto& impl = thisObject.wrapped(); + RELEASE_AND_RETURN(throwScope, (toJS<IDLFloat>(lexicalGlobalObject, throwScope, impl.currentX()))); +} + +JSC_DEFINE_CUSTOM_GETTER(jsPath2D_currentX, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +{ + return IDLAttribute<JSPath2D>::get<jsPath2D_currentXGetter, CastedThisErrorBehavior::Assert>(*lexicalGlobalObject, thisValue, attributeName); +} + +static inline JSValue jsPath2D_currentYGetter(JSGlobalObject& lexicalGlobalObject, JSPath2D& thisObject) +{ + auto& vm = JSC::getVM(&lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto& impl = thisObject.wrapped(); + RELEASE_AND_RETURN(throwScope, (toJS<IDLFloat>(lexicalGlobalObject, throwScope, impl.currentY()))); +} + +JSC_DEFINE_CUSTOM_GETTER(jsPath2D_currentY, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +{ + return IDLAttribute<JSPath2D>::get<jsPath2D_currentYGetter, CastedThisErrorBehavior::Assert>(*lexicalGlobalObject, thisValue, attributeName); +} + +static inline JSC::EncodedJSValue jsPath2DPrototypeFunction_addPathBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSPath2D>::ClassParameter castedThis) +{ + auto& vm = JSC::getVM(lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + UNUSED_PARAM(throwScope); + UNUSED_PARAM(callFrame); + auto& impl = castedThis->wrapped(); + if (UNLIKELY(callFrame->argumentCount() < 1)) + return throwVMError(lexicalGlobalObject, throwScope, createNotEnoughArgumentsError(lexicalGlobalObject)); + EnsureStillAliveScope argument0 = callFrame->uncheckedArgument(0); + auto path = convert<IDLInterface<Path2D>>(*lexicalGlobalObject, argument0.value(), [](JSC::JSGlobalObject& lexicalGlobalObject, JSC::ThrowScope& scope) { throwArgumentTypeError(lexicalGlobalObject, scope, 0, "path", "Path2D", "addPath", "Path2D"); }); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument1 = callFrame->argument(1); + auto transform = convert<IDLDictionary<DOMMatrix2DInit>>(*lexicalGlobalObject, argument1.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS<IDLUndefined>(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.addPath(*path, WTFMove(transform)); }))); +} + +JSC_DEFINE_HOST_FUNCTION(jsPath2DPrototypeFunction_addPath, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + return IDLOperation<JSPath2D>::call<jsPath2DPrototypeFunction_addPathBody>(*lexicalGlobalObject, *callFrame, "addPath"); +} + +static inline JSC::EncodedJSValue jsPath2DPrototypeFunction_closePathBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSPath2D>::ClassParameter castedThis) +{ + auto& vm = JSC::getVM(lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + UNUSED_PARAM(throwScope); + UNUSED_PARAM(callFrame); + auto& impl = castedThis->wrapped(); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS<IDLUndefined>(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.closePath(); }))); +} + +JSC_DEFINE_HOST_FUNCTION(jsPath2DPrototypeFunction_closePath, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + return IDLOperation<JSPath2D>::call<jsPath2DPrototypeFunction_closePathBody>(*lexicalGlobalObject, *callFrame, "closePath"); +} + +static inline JSC::EncodedJSValue jsPath2DPrototypeFunction_moveToBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSPath2D>::ClassParameter castedThis) +{ + auto& vm = JSC::getVM(lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + UNUSED_PARAM(throwScope); + UNUSED_PARAM(callFrame); + auto& impl = castedThis->wrapped(); + if (UNLIKELY(callFrame->argumentCount() < 2)) + return throwVMError(lexicalGlobalObject, throwScope, createNotEnoughArgumentsError(lexicalGlobalObject)); + EnsureStillAliveScope argument0 = callFrame->uncheckedArgument(0); + auto x = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument0.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument1 = callFrame->uncheckedArgument(1); + auto y = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument1.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS<IDLUndefined>(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.moveTo(WTFMove(x), WTFMove(y)); }))); +} + +JSC_DEFINE_HOST_FUNCTION(jsPath2DPrototypeFunction_moveTo, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + return IDLOperation<JSPath2D>::call<jsPath2DPrototypeFunction_moveToBody>(*lexicalGlobalObject, *callFrame, "moveTo"); +} + +static inline JSC::EncodedJSValue jsPath2DPrototypeFunction_lineToBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSPath2D>::ClassParameter castedThis) +{ + auto& vm = JSC::getVM(lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + UNUSED_PARAM(throwScope); + UNUSED_PARAM(callFrame); + auto& impl = castedThis->wrapped(); + if (UNLIKELY(callFrame->argumentCount() < 2)) + return throwVMError(lexicalGlobalObject, throwScope, createNotEnoughArgumentsError(lexicalGlobalObject)); + EnsureStillAliveScope argument0 = callFrame->uncheckedArgument(0); + auto x = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument0.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument1 = callFrame->uncheckedArgument(1); + auto y = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument1.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS<IDLUndefined>(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.lineTo(WTFMove(x), WTFMove(y)); }))); +} + +JSC_DEFINE_HOST_FUNCTION(jsPath2DPrototypeFunction_lineTo, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + return IDLOperation<JSPath2D>::call<jsPath2DPrototypeFunction_lineToBody>(*lexicalGlobalObject, *callFrame, "lineTo"); +} + +static inline JSC::EncodedJSValue jsPath2DPrototypeFunction_quadraticCurveToBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSPath2D>::ClassParameter castedThis) +{ + auto& vm = JSC::getVM(lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + UNUSED_PARAM(throwScope); + UNUSED_PARAM(callFrame); + auto& impl = castedThis->wrapped(); + if (UNLIKELY(callFrame->argumentCount() < 4)) + return throwVMError(lexicalGlobalObject, throwScope, createNotEnoughArgumentsError(lexicalGlobalObject)); + EnsureStillAliveScope argument0 = callFrame->uncheckedArgument(0); + auto cpx = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument0.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument1 = callFrame->uncheckedArgument(1); + auto cpy = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument1.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument2 = callFrame->uncheckedArgument(2); + auto x = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument2.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument3 = callFrame->uncheckedArgument(3); + auto y = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument3.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS<IDLUndefined>(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.quadraticCurveTo(WTFMove(cpx), WTFMove(cpy), WTFMove(x), WTFMove(y)); }))); +} + +JSC_DEFINE_HOST_FUNCTION(jsPath2DPrototypeFunction_quadraticCurveTo, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + return IDLOperation<JSPath2D>::call<jsPath2DPrototypeFunction_quadraticCurveToBody>(*lexicalGlobalObject, *callFrame, "quadraticCurveTo"); +} + +static inline JSC::EncodedJSValue jsPath2DPrototypeFunction_bezierCurveToBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSPath2D>::ClassParameter castedThis) +{ + auto& vm = JSC::getVM(lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + UNUSED_PARAM(throwScope); + UNUSED_PARAM(callFrame); + auto& impl = castedThis->wrapped(); + if (UNLIKELY(callFrame->argumentCount() < 6)) + return throwVMError(lexicalGlobalObject, throwScope, createNotEnoughArgumentsError(lexicalGlobalObject)); + EnsureStillAliveScope argument0 = callFrame->uncheckedArgument(0); + auto cp1x = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument0.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument1 = callFrame->uncheckedArgument(1); + auto cp1y = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument1.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument2 = callFrame->uncheckedArgument(2); + auto cp2x = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument2.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument3 = callFrame->uncheckedArgument(3); + auto cp2y = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument3.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument4 = callFrame->uncheckedArgument(4); + auto x = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument4.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument5 = callFrame->uncheckedArgument(5); + auto y = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument5.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS<IDLUndefined>(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.bezierCurveTo(WTFMove(cp1x), WTFMove(cp1y), WTFMove(cp2x), WTFMove(cp2y), WTFMove(x), WTFMove(y)); }))); +} + +JSC_DEFINE_HOST_FUNCTION(jsPath2DPrototypeFunction_bezierCurveTo, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + return IDLOperation<JSPath2D>::call<jsPath2DPrototypeFunction_bezierCurveToBody>(*lexicalGlobalObject, *callFrame, "bezierCurveTo"); +} + +static inline JSC::EncodedJSValue jsPath2DPrototypeFunction_arcToBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSPath2D>::ClassParameter castedThis) +{ + auto& vm = JSC::getVM(lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + UNUSED_PARAM(throwScope); + UNUSED_PARAM(callFrame); + auto& impl = castedThis->wrapped(); + if (UNLIKELY(callFrame->argumentCount() < 5)) + return throwVMError(lexicalGlobalObject, throwScope, createNotEnoughArgumentsError(lexicalGlobalObject)); + EnsureStillAliveScope argument0 = callFrame->uncheckedArgument(0); + auto x1 = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument0.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument1 = callFrame->uncheckedArgument(1); + auto y1 = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument1.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument2 = callFrame->uncheckedArgument(2); + auto x2 = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument2.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument3 = callFrame->uncheckedArgument(3); + auto y2 = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument3.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument4 = callFrame->uncheckedArgument(4); + auto radius = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument4.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS<IDLUndefined>(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.arcTo(WTFMove(x1), WTFMove(y1), WTFMove(x2), WTFMove(y2), WTFMove(radius)); }))); +} + +JSC_DEFINE_HOST_FUNCTION(jsPath2DPrototypeFunction_arcTo, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + return IDLOperation<JSPath2D>::call<jsPath2DPrototypeFunction_arcToBody>(*lexicalGlobalObject, *callFrame, "arcTo"); +} + +static inline JSC::EncodedJSValue jsPath2DPrototypeFunction_rectBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSPath2D>::ClassParameter castedThis) +{ + auto& vm = JSC::getVM(lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + UNUSED_PARAM(throwScope); + UNUSED_PARAM(callFrame); + auto& impl = castedThis->wrapped(); + if (UNLIKELY(callFrame->argumentCount() < 4)) + return throwVMError(lexicalGlobalObject, throwScope, createNotEnoughArgumentsError(lexicalGlobalObject)); + EnsureStillAliveScope argument0 = callFrame->uncheckedArgument(0); + auto x = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument0.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument1 = callFrame->uncheckedArgument(1); + auto y = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument1.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument2 = callFrame->uncheckedArgument(2); + auto w = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument2.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument3 = callFrame->uncheckedArgument(3); + auto h = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument3.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS<IDLUndefined>(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.rect(WTFMove(x), WTFMove(y), WTFMove(w), WTFMove(h)); }))); +} + +JSC_DEFINE_HOST_FUNCTION(jsPath2DPrototypeFunction_rect, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + return IDLOperation<JSPath2D>::call<jsPath2DPrototypeFunction_rectBody>(*lexicalGlobalObject, *callFrame, "rect"); +} + +static inline JSC::EncodedJSValue jsPath2DPrototypeFunction_roundRect1Body(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSPath2D>::ClassParameter castedThis) +{ + auto& vm = JSC::getVM(lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + UNUSED_PARAM(throwScope); + UNUSED_PARAM(callFrame); + auto& impl = castedThis->wrapped(); + EnsureStillAliveScope argument0 = callFrame->uncheckedArgument(0); + auto x = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument0.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument1 = callFrame->uncheckedArgument(1); + auto y = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument1.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument2 = callFrame->uncheckedArgument(2); + auto w = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument2.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument3 = callFrame->uncheckedArgument(3); + auto h = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument3.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument4 = callFrame->uncheckedArgument(4); + auto radii = convert<IDLSequence<IDLUnion<IDLUnrestrictedDouble, IDLDictionary<DOMPointInit>>>>(*lexicalGlobalObject, argument4.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS<IDLUndefined>(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.roundRect(WTFMove(x), WTFMove(y), WTFMove(w), WTFMove(h), WTFMove(radii)); }))); +} + +static inline JSC::EncodedJSValue jsPath2DPrototypeFunction_roundRect2Body(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSPath2D>::ClassParameter castedThis) +{ + auto& vm = JSC::getVM(lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + UNUSED_PARAM(throwScope); + UNUSED_PARAM(callFrame); + auto& impl = castedThis->wrapped(); + EnsureStillAliveScope argument0 = callFrame->uncheckedArgument(0); + auto x = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument0.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument1 = callFrame->uncheckedArgument(1); + auto y = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument1.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument2 = callFrame->uncheckedArgument(2); + auto w = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument2.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument3 = callFrame->uncheckedArgument(3); + auto h = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument3.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument4 = callFrame->uncheckedArgument(4); + auto radii = convert<IDLUnion<IDLUnrestrictedDouble, IDLDictionary<DOMPointInit>>>(*lexicalGlobalObject, argument4.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS<IDLUndefined>(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.roundRect(WTFMove(x), WTFMove(y), WTFMove(w), WTFMove(h), WTFMove(radii)); }))); +} + +static inline JSC::EncodedJSValue jsPath2DPrototypeFunction_roundRectOverloadDispatcher(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSPath2D>::ClassParameter castedThis) +{ + auto& vm = JSC::getVM(lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + UNUSED_PARAM(throwScope); + UNUSED_PARAM(callFrame); + size_t argsCount = std::min<size_t>(5, callFrame->argumentCount()); + if (argsCount == 5) { + JSValue distinguishingArg = callFrame->uncheckedArgument(4); + if (distinguishingArg.isUndefinedOrNull()) + RELEASE_AND_RETURN(throwScope, (jsPath2DPrototypeFunction_roundRect2Body(lexicalGlobalObject, callFrame, castedThis))); + { + bool success = hasIteratorMethod(lexicalGlobalObject, distinguishingArg); + RETURN_IF_EXCEPTION(throwScope, {}); + if (success) + RELEASE_AND_RETURN(throwScope, (jsPath2DPrototypeFunction_roundRect1Body(lexicalGlobalObject, callFrame, castedThis))); + } + if (distinguishingArg.isObject()) + RELEASE_AND_RETURN(throwScope, (jsPath2DPrototypeFunction_roundRect2Body(lexicalGlobalObject, callFrame, castedThis))); + if (distinguishingArg.isNumber()) + RELEASE_AND_RETURN(throwScope, (jsPath2DPrototypeFunction_roundRect2Body(lexicalGlobalObject, callFrame, castedThis))); + RELEASE_AND_RETURN(throwScope, (jsPath2DPrototypeFunction_roundRect2Body(lexicalGlobalObject, callFrame, castedThis))); + } + return argsCount < 5 ? throwVMError(lexicalGlobalObject, throwScope, createNotEnoughArgumentsError(lexicalGlobalObject)) : throwVMTypeError(lexicalGlobalObject, throwScope); +} + +JSC_DEFINE_HOST_FUNCTION(jsPath2DPrototypeFunction_roundRect, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + return IDLOperation<JSPath2D>::call<jsPath2DPrototypeFunction_roundRectOverloadDispatcher>(*lexicalGlobalObject, *callFrame, "roundRect"); +} + +static inline JSC::EncodedJSValue jsPath2DPrototypeFunction_arcBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSPath2D>::ClassParameter castedThis) +{ + auto& vm = JSC::getVM(lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + UNUSED_PARAM(throwScope); + UNUSED_PARAM(callFrame); + auto& impl = castedThis->wrapped(); + if (UNLIKELY(callFrame->argumentCount() < 5)) + return throwVMError(lexicalGlobalObject, throwScope, createNotEnoughArgumentsError(lexicalGlobalObject)); + EnsureStillAliveScope argument0 = callFrame->uncheckedArgument(0); + auto x = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument0.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument1 = callFrame->uncheckedArgument(1); + auto y = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument1.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument2 = callFrame->uncheckedArgument(2); + auto radius = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument2.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument3 = callFrame->uncheckedArgument(3); + auto startAngle = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument3.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument4 = callFrame->uncheckedArgument(4); + auto endAngle = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument4.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument5 = callFrame->argument(5); + auto anticlockwise = convert<IDLBoolean>(*lexicalGlobalObject, argument5.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS<IDLUndefined>(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.arc(WTFMove(x), WTFMove(y), WTFMove(radius), WTFMove(startAngle), WTFMove(endAngle), WTFMove(anticlockwise)); }))); +} + +JSC_DEFINE_HOST_FUNCTION(jsPath2DPrototypeFunction_arc, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + return IDLOperation<JSPath2D>::call<jsPath2DPrototypeFunction_arcBody>(*lexicalGlobalObject, *callFrame, "arc"); +} + +static inline JSC::EncodedJSValue jsPath2DPrototypeFunction_ellipseBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSPath2D>::ClassParameter castedThis) +{ + auto& vm = JSC::getVM(lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + UNUSED_PARAM(throwScope); + UNUSED_PARAM(callFrame); + auto& impl = castedThis->wrapped(); + if (UNLIKELY(callFrame->argumentCount() < 7)) + return throwVMError(lexicalGlobalObject, throwScope, createNotEnoughArgumentsError(lexicalGlobalObject)); + EnsureStillAliveScope argument0 = callFrame->uncheckedArgument(0); + auto x = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument0.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument1 = callFrame->uncheckedArgument(1); + auto y = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument1.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument2 = callFrame->uncheckedArgument(2); + auto radiusX = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument2.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument3 = callFrame->uncheckedArgument(3); + auto radiusY = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument3.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument4 = callFrame->uncheckedArgument(4); + auto rotation = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument4.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument5 = callFrame->uncheckedArgument(5); + auto startAngle = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument5.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument6 = callFrame->uncheckedArgument(6); + auto endAngle = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument6.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument7 = callFrame->argument(7); + auto anticlockwise = convert<IDLBoolean>(*lexicalGlobalObject, argument7.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS<IDLUndefined>(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.ellipse(WTFMove(x), WTFMove(y), WTFMove(radiusX), WTFMove(radiusY), WTFMove(rotation), WTFMove(startAngle), WTFMove(endAngle), WTFMove(anticlockwise)); }))); +} + +JSC_DEFINE_HOST_FUNCTION(jsPath2DPrototypeFunction_ellipse, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + return IDLOperation<JSPath2D>::call<jsPath2DPrototypeFunction_ellipseBody>(*lexicalGlobalObject, *callFrame, "ellipse"); +} + +JSC::GCClient::IsoSubspace* JSPath2D::subspaceForImpl(JSC::VM& vm) +{ + return WebCore::subspaceForImpl<JSPath2D, UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForPath2D.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForPath2D = WTFMove(space); }, + [](auto& spaces) { return spaces.m_subspaceForPath2D.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForPath2D = WTFMove(space); }); +} + +void JSPath2D::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) +{ + auto* thisObject = jsCast<JSPath2D*>(cell); + analyzer.setWrappedObjectForCell(cell, &thisObject->wrapped()); + if (thisObject->scriptExecutionContext()) + analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); + Base::analyzeHeap(cell, analyzer); +} + +bool JSPath2DOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, AbstractSlotVisitor& visitor, const char** reason) +{ + UNUSED_PARAM(handle); + UNUSED_PARAM(visitor); + UNUSED_PARAM(reason); + return false; +} + +void JSPath2DOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) +{ + auto* jsPath2D = static_cast<JSPath2D*>(handle.slot()->asCell()); + auto& world = *static_cast<DOMWrapperWorld*>(context); + uncacheWrapper(world, &jsPath2D->wrapped(), jsPath2D); +} + +#if ENABLE(BINDING_INTEGRITY) +#if PLATFORM(WIN) +#pragma warning(disable : 4483) +extern "C" { +extern void (*const __identifier("??_7Path2D@WebCore@@6B@")[])(); +} +#else +extern "C" { +extern void* _ZTVN7WebCore6Path2DE[]; +} +#endif +#endif + +JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject*, JSDOMGlobalObject* globalObject, Ref<Path2D>&& impl) +{ + + if constexpr (std::is_polymorphic_v<Path2D>) { +#if ENABLE(BINDING_INTEGRITY) + const void* actualVTablePointer = getVTablePointer(impl.ptr()); +#if PLATFORM(WIN) + void* expectedVTablePointer = __identifier("??_7Path2D@WebCore@@6B@"); +#else + void* expectedVTablePointer = &_ZTVN7WebCore6Path2DE[2]; +#endif + + // If you hit this assertion you either have a use after free bug, or + // Path2D has subclasses. If Path2D has subclasses that get passed + // to toJS() we currently require Path2D you to opt out of binding hardening + // by adding the SkipVTableValidation attribute to the interface IDL definition + RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer); +#endif + } + return createWrapper<Path2D>(globalObject, WTFMove(impl)); +} + +JSC::JSValue toJS(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, Path2D& impl) +{ + return wrap(lexicalGlobalObject, globalObject, impl); +} + +Path2D* JSPath2D::toWrapped(JSC::VM& vm, JSC::JSValue value) +{ + if (auto* wrapper = jsDynamicCast<JSPath2D*>(vm, value)) + return &wrapper->wrapped(); + return nullptr; +} + +} |