diff options
120 files changed, 8988 insertions, 20 deletions
diff --git a/src/javascript/jsc/bindings/ZigGlobalObject.cpp b/src/javascript/jsc/bindings/ZigGlobalObject.cpp index ce73975c8..ab9f929a9 100644 --- a/src/javascript/jsc/bindings/ZigGlobalObject.cpp +++ b/src/javascript/jsc/bindings/ZigGlobalObject.cpp @@ -89,6 +89,8 @@ #include "JSErrorEvent.h" #include "JSFetchHeaders.h" #include "JSImageData.h" +#include "JSOffscreenCanvas.h" +#include "JSOffscreenCanvasRenderingContext2D.h" #include "Process.h" @@ -408,6 +410,28 @@ JSC_DEFINE_CUSTOM_GETTER(JSImageData_getter, WebCore::JSImageData::getConstructor(JSC::getVM(lexicalGlobalObject), thisObject)); } +JSC_DECLARE_CUSTOM_GETTER(JSOffscreenCanvas_getter); + +JSC_DEFINE_CUSTOM_GETTER(JSOffscreenCanvas_getter, + (JSC::JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, + JSC::PropertyName)) +{ + Zig::GlobalObject* thisObject = JSC::jsCast<Zig::GlobalObject*>(lexicalGlobalObject); + return JSC::JSValue::encode( + WebCore::JSOffscreenCanvas::getConstructor(JSC::getVM(lexicalGlobalObject), thisObject)); +} + +JSC_DECLARE_CUSTOM_GETTER(JSOffscreenCanvasRenderingContext2D_getter); + +JSC_DEFINE_CUSTOM_GETTER(JSOffscreenCanvasRenderingContext2D_getter, + (JSC::JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, + JSC::PropertyName)) +{ + Zig::GlobalObject* thisObject = JSC::jsCast<Zig::GlobalObject*>(lexicalGlobalObject); + return JSC::JSValue::encode( + WebCore::JSOffscreenCanvasRenderingContext2D::getConstructor(JSC::getVM(lexicalGlobalObject), thisObject)); +} + JSC_DECLARE_CUSTOM_GETTER(JSEventTarget_getter); JSC_DEFINE_CUSTOM_GETTER(JSEventTarget_getter, @@ -894,6 +918,11 @@ void GlobalObject::installAPIGlobals(JSClassRef* globals, int count, JSC::VM& vm putDirectCustomAccessor(vm, JSC::Identifier::fromString(vm, "ImageData"_s), JSC::CustomGetterSetter::create(vm, JSImageData_getter, nullptr), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly); + putDirectCustomAccessor(vm, JSC::Identifier::fromString(vm, "OffscreenCanvas"_s), JSC::CustomGetterSetter::create(vm, JSOffscreenCanvas_getter, nullptr), + JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly); + putDirectCustomAccessor(vm, JSC::Identifier::fromString(vm, "OffscreenCanvasRenderingContext2D"_s), JSC::CustomGetterSetter::create(vm, JSOffscreenCanvasRenderingContext2D_getter, nullptr), + JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly); + extraStaticGlobals.releaseBuffer(); this->setRemoteDebuggingEnabled(true); diff --git a/src/javascript/jsc/bindings/webcore/CanvasDirection.h b/src/javascript/jsc/bindings/webcore/CanvasDirection.h new file mode 100644 index 000000000..c6a9f1ebd --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/CanvasDirection.h @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2017 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#pragma once + +namespace WebCore { + +enum class CanvasDirection { Ltr, Rtl, Inherit }; + +} diff --git a/src/javascript/jsc/bindings/webcore/CanvasFillRule.h b/src/javascript/jsc/bindings/webcore/CanvasFillRule.h new file mode 100644 index 000000000..d3ece5c38 --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/CanvasFillRule.h @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2017 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#pragma once + +namespace WebCore { + +enum class CanvasFillRule { Nonzero, Evenodd }; + +} diff --git a/src/javascript/jsc/bindings/webcore/CanvasFillRule.idl b/src/javascript/jsc/bindings/webcore/CanvasFillRule.idl new file mode 100644 index 000000000..5760daee2 --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/CanvasFillRule.idl @@ -0,0 +1,26 @@ +/* + * Copyright (C) 2017 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +enum CanvasFillRule { "nonzero", "evenodd" }; diff --git a/src/javascript/jsc/bindings/webcore/CanvasFillStrokeStyles.idl b/src/javascript/jsc/bindings/webcore/CanvasFillStrokeStyles.idl new file mode 100644 index 000000000..d38318b78 --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/CanvasFillStrokeStyles.idl @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2017 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +// FIXME: This should include SVGImageElement. +typedef (HTMLImageElement or HTMLCanvasElement or ImageBitmap +#if defined(ENABLE_CSS_TYPED_OM) && ENABLE_CSS_TYPED_OM + or CSSStyleImageValue +#endif +#if defined(ENABLE_OFFSCREEN_CANVAS) && ENABLE_OFFSCREEN_CANVAS + or OffscreenCanvas +#endif +#if defined(ENABLE_VIDEO) && ENABLE_VIDEO + or HTMLVideoElement +#endif +) CanvasImageSource; + +// https://html.spec.whatwg.org/multipage/canvas.html#canvasfillstrokestyles +interface mixin CanvasFillStrokeStyles { + // colors and styles (see also the CanvasPathDrawingStyles and CanvasTextDrawingStyles interfaces) + attribute (DOMString or CanvasGradient or CanvasPattern) strokeStyle; // (default black) + attribute (DOMString or CanvasGradient or CanvasPattern) fillStyle; // (default black) + + CanvasGradient createLinearGradient(double x0, double y0, double x1, double y1); + CanvasGradient createRadialGradient(double x0, double y0, double r0, double x1, double y1, double r1); + CanvasGradient createConicGradient(double angle, double x, double y); + CanvasPattern? createPattern(CanvasImageSource image, [LegacyNullToEmptyString] DOMString repetition); +}; diff --git a/src/javascript/jsc/bindings/webcore/CanvasFilters.idl b/src/javascript/jsc/bindings/webcore/CanvasFilters.idl new file mode 100644 index 000000000..59a7abccd --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/CanvasFilters.idl @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2017 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +// https://html.spec.whatwg.org/multipage/canvas.html#canvasfilters +interface mixin CanvasFilters { + // filters + // FIXME: Implement filter. + // attribute DOMString filter; // (default "none") +}; diff --git a/src/javascript/jsc/bindings/webcore/CanvasGradient.h b/src/javascript/jsc/bindings/webcore/CanvasGradient.h new file mode 100644 index 000000000..830794d18 --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/CanvasGradient.h @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2007 Alp Toker <alp@atoker.com> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#pragma once + +#include "ExceptionOr.h" +#include "FloatPoint.h" + +namespace WebCore { + +class CanvasBase; +class Gradient { +}; + +class CanvasGradient : public RefCounted<CanvasGradient> { +public: + ~CanvasGradient(); + + Gradient& gradient() { return m_gradient; } + const Gradient& gradient() const { return m_gradient; } + + ExceptionOr<void> addColorStop(double value, const String& color); + +private: + CanvasGradient(const FloatPoint& centerPoint, float angleInRadians, CanvasBase&); + + Ref<Gradient> m_gradient; + CanvasBase& m_canvas; +}; + +} diff --git a/src/javascript/jsc/bindings/webcore/CanvasImageData.idl b/src/javascript/jsc/bindings/webcore/CanvasImageData.idl new file mode 100644 index 000000000..ed9d37dd8 --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/CanvasImageData.idl @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2017-2021 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +// https://html.spec.whatwg.org/multipage/canvas.html#canvasimagedata +interface mixin CanvasImageData { + // pixel manipulation + ImageData createImageData([EnforceRange] long sw, [EnforceRange] long sh, optional ImageDataSettings settings); + ImageData createImageData(ImageData imagedata); + ImageData getImageData([EnforceRange] long sx, [EnforceRange] long sy, [EnforceRange] long sw, [EnforceRange] long sh, optional ImageDataSettings settings); + undefined putImageData(ImageData imagedata, [EnforceRange] long dx, [EnforceRange] long dy); + undefined putImageData(ImageData imagedata, [EnforceRange] long dx, [EnforceRange] long dy, [EnforceRange] long dirtyX, [EnforceRange] long dirtyY, [EnforceRange] long dirtyWidth, [EnforceRange] long dirtyHeight); +}; diff --git a/src/javascript/jsc/bindings/webcore/CanvasImageSmoothing.idl b/src/javascript/jsc/bindings/webcore/CanvasImageSmoothing.idl new file mode 100644 index 000000000..a6f92b5d2 --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/CanvasImageSmoothing.idl @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2017 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +// https://html.spec.whatwg.org/multipage/canvas.html#canvasimagesmoothing +interface mixin CanvasImageSmoothing { + // image smoothing + attribute boolean imageSmoothingEnabled; // (default true) + attribute ImageSmoothingQuality imageSmoothingQuality; // (default low) +}; diff --git a/src/javascript/jsc/bindings/webcore/CanvasLineCap.h b/src/javascript/jsc/bindings/webcore/CanvasLineCap.h new file mode 100644 index 000000000..dde887528 --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/CanvasLineCap.h @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2017 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#pragma once + +namespace WebCore { + +enum class CanvasLineCap { Butt, Round, Square }; + +} diff --git a/src/javascript/jsc/bindings/webcore/CanvasLineCap.idl b/src/javascript/jsc/bindings/webcore/CanvasLineCap.idl new file mode 100644 index 000000000..44ffc088a --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/CanvasLineCap.idl @@ -0,0 +1,26 @@ +/* + * Copyright (C) 2017 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +enum CanvasLineCap { "butt", "round", "square" }; diff --git a/src/javascript/jsc/bindings/webcore/CanvasLineJoin.h b/src/javascript/jsc/bindings/webcore/CanvasLineJoin.h new file mode 100644 index 000000000..4beb786ca --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/CanvasLineJoin.h @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2017 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#pragma once + +namespace WebCore { + +enum class CanvasLineJoin { Round, Bevel, Miter }; + +} diff --git a/src/javascript/jsc/bindings/webcore/CanvasLineJoin.idl b/src/javascript/jsc/bindings/webcore/CanvasLineJoin.idl new file mode 100644 index 000000000..e77e89aca --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/CanvasLineJoin.idl @@ -0,0 +1,26 @@ +/* + * Copyright (C) 2017 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +enum CanvasLineJoin { "round", "bevel", "miter" }; diff --git a/src/javascript/jsc/bindings/webcore/CanvasPath.cpp b/src/javascript/jsc/bindings/webcore/CanvasPath.cpp new file mode 100644 index 000000000..acac6f680 --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/CanvasPath.cpp @@ -0,0 +1,455 @@ +/* + * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. + * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies) + * Copyright (C) 2007 Alp Toker <alp@atoker.com> + * Copyright (C) 2008 Eric Seidel <eric@webkit.org> + * Copyright (C) 2008 Dirk Schulze <krit@webkit.org> + * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. + * Copyright (C) 2012 Intel Corporation. All rights reserved. + * Copyright (C) 2012, 2013 Adobe Systems Incorporated. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF + * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include "config.h" +#include "CanvasPath.h" + +// #include "AffineTransform.h" +#include "DOMPointInit.h" +// #include "FloatRect.h" +// #include "FloatRoundedRect.h" +// #include "FloatSize.h" +#include <algorithm> +#include <wtf/MathExtras.h> + +namespace WebCore { + +void CanvasPath::closePath() +{ + // if (m_path.isEmpty()) + // return; + + // FloatRect boundRect = m_path.fastBoundingRect(); + // if (boundRect.width() || boundRect.height()) + // m_path.closeSubpath(); +} + +void CanvasPath::moveTo(float x, float y) +{ + // if (!std::isfinite(x) || !std::isfinite(y)) + // return; + // if (!hasInvertibleTransform()) + // return; + // m_path.moveTo(FloatPoint(x, y)); +} + +// void CanvasPath::lineTo(FloatPoint point) +// { +// // lineTo(point.x(), point.y()); +// } + +void CanvasPath::lineTo(float x, float y) +{ + // if (!std::isfinite(x) || !std::isfinite(y)) + // return; + // if (!hasInvertibleTransform()) + // return; + + // FloatPoint p1 = FloatPoint(x, y); + // if (!m_path.hasCurrentPoint()) + // m_path.moveTo(p1); + // else if (p1 != m_path.currentPoint()) + // m_path.addLineTo(p1); +} + +void CanvasPath::quadraticCurveTo(float cpx, float cpy, float x, float y) +{ + // if (!std::isfinite(cpx) || !std::isfinite(cpy) || !std::isfinite(x) || !std::isfinite(y)) + // return; + // if (!hasInvertibleTransform()) + // return; + // if (!m_path.hasCurrentPoint()) + // m_path.moveTo(FloatPoint(cpx, cpy)); + + // FloatPoint p1 = FloatPoint(x, y); + // FloatPoint cp = FloatPoint(cpx, cpy); + // if (p1 != m_path.currentPoint() || p1 != cp) + // m_path.addQuadCurveTo(cp, p1); +} + +void CanvasPath::bezierCurveTo(float cp1x, float cp1y, float cp2x, float cp2y, float x, float y) +{ + // if (!std::isfinite(cp1x) || !std::isfinite(cp1y) || !std::isfinite(cp2x) || !std::isfinite(cp2y) || !std::isfinite(x) || !std::isfinite(y)) + // return; + // if (!hasInvertibleTransform()) + // return; + // if (!m_path.hasCurrentPoint()) + // m_path.moveTo(FloatPoint(cp1x, cp1y)); + + // FloatPoint p1 = FloatPoint(x, y); + // FloatPoint cp1 = FloatPoint(cp1x, cp1y); + // FloatPoint cp2 = FloatPoint(cp2x, cp2y); + // if (p1 != m_path.currentPoint() || p1 != cp1 || p1 != cp2) + // m_path.addBezierCurveTo(cp1, cp2, p1); +} + +ExceptionOr<void> CanvasPath::arcTo(float x1, float y1, float x2, float y2, float r) +{ + // if (!std::isfinite(x1) || !std::isfinite(y1) || !std::isfinite(x2) || !std::isfinite(y2) || !std::isfinite(r)) + // return {}; + + // if (r < 0) + // return Exception { IndexSizeError }; + + // if (!hasInvertibleTransform()) + // return {}; + + // FloatPoint p1 = FloatPoint(x1, y1); + // FloatPoint p2 = FloatPoint(x2, y2); + + // if (!m_path.hasCurrentPoint()) + // m_path.moveTo(p1); + // else if (p1 == m_path.currentPoint() || p1 == p2 || !r) + // lineTo(x1, y1); + // else + // m_path.addArcTo(p1, p2, r); + + // return {}; +} + +static void normalizeAngles(float& startAngle, float& endAngle, bool anticlockwise) +{ + // float newStartAngle = startAngle; + // if (newStartAngle < 0) + // newStartAngle = (2 * piFloat) + fmodf(newStartAngle, -(2 * piFloat)); + // else + // newStartAngle = fmodf(newStartAngle, 2 * piFloat); + + // float delta = newStartAngle - startAngle; + // startAngle = newStartAngle; + // endAngle = endAngle + delta; + // ASSERT(newStartAngle >= 0 && (newStartAngle < 2 * piFloat || WTF::areEssentiallyEqual<float>(newStartAngle, 2 * piFloat))); + + // if (anticlockwise && startAngle - endAngle >= 2 * piFloat) + // endAngle = startAngle - 2 * piFloat; + // else if (!anticlockwise && endAngle - startAngle >= 2 * piFloat) + // endAngle = startAngle + 2 * piFloat; +} + +ExceptionOr<void> CanvasPath::arc(float x, float y, float radius, float startAngle, float endAngle, bool anticlockwise) +{ + // if (!std::isfinite(x) || !std::isfinite(y) || !std::isfinite(radius) || !std::isfinite(startAngle) || !std::isfinite(endAngle)) + // return {}; + + // if (radius < 0) + // return Exception { IndexSizeError }; + + // if (!hasInvertibleTransform()) + // return {}; + + // normalizeAngles(startAngle, endAngle, anticlockwise); + + // if (!radius || startAngle == endAngle) { + // // The arc is empty but we still need to draw the connecting line. + // lineTo(x + radius * cosf(startAngle), y + radius * sinf(startAngle)); + // return {}; + // } + + // m_path.addArc(FloatPoint(x, y), radius, startAngle, endAngle, anticlockwise); + // return {}; +} + +ExceptionOr<void> CanvasPath::ellipse(float x, float y, float radiusX, float radiusY, float rotation, float startAngle, float endAngle, bool anticlockwise) +{ + // if (!std::isfinite(x) || !std::isfinite(y) || !std::isfinite(radiusX) || !std::isfinite(radiusY) || !std::isfinite(rotation) || !std::isfinite(startAngle) || !std::isfinite(endAngle)) + // return {}; + + // if (radiusX < 0 || radiusY < 0) + // return Exception { IndexSizeError }; + + // if (!hasInvertibleTransform()) + // return {}; + + // normalizeAngles(startAngle, endAngle, anticlockwise); + + // if ((!radiusX && !radiusY) || startAngle == endAngle) { + // AffineTransform transform; + // transform.translate(x, y).rotate(rad2deg(rotation)); + + // lineTo(transform.mapPoint(FloatPoint(radiusX * cosf(startAngle), radiusY * sinf(startAngle)))); + // return {}; + // } + + // if (!radiusX || !radiusY) { + // AffineTransform transform; + // transform.translate(x, y).rotate(rad2deg(rotation)); + + // lineTo(transform.mapPoint(FloatPoint(radiusX * cosf(startAngle), radiusY * sinf(startAngle)))); + + // if (!anticlockwise) { + // for (float angle = startAngle - fmodf(startAngle, piOverTwoFloat) + piOverTwoFloat; angle < endAngle; angle += piOverTwoFloat) + // lineTo(transform.mapPoint(FloatPoint(radiusX * cosf(angle), radiusY * sinf(angle)))); + // } else { + // for (float angle = startAngle - fmodf(startAngle, piOverTwoFloat); angle > endAngle; angle -= piOverTwoFloat) + // lineTo(transform.mapPoint(FloatPoint(radiusX * cosf(angle), radiusY * sinf(angle)))); + // } + + // lineTo(transform.mapPoint(FloatPoint(radiusX * cosf(endAngle), radiusY * sinf(endAngle)))); + // return {}; + // } + + // m_path.addEllipse(FloatPoint(x, y), radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise); + // return {}; +} + +void CanvasPath::rect(float x, float y, float width, float height) +{ + // if (!hasInvertibleTransform()) + // return; + + // if (!std::isfinite(x) || !std::isfinite(y) || !std::isfinite(width) || !std::isfinite(height)) + // return; + + // if (!width && !height) { + // m_path.moveTo(FloatPoint(x, y)); + // return; + // } + + // m_path.addRect(FloatRect(x, y, width, height)); +} + +ExceptionOr<void> CanvasPath::roundRect(float x, float y, float width, float height, const RadiusVariant& radii) +{ + // // return roundRect(x, y, width, height, Span { &radii, 1 }); +} + +ExceptionOr<void> CanvasPath::roundRect(float x, float y, float width, float height, const Span<const RadiusVariant>& radii) +{ + // // // Based on Nov 5th 2021 version of https://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-roundrect + // // // 1. If any of x, y, w, or h are infinite or NaN, then return. + + // // if (!std::isfinite(x) || !std::isfinite(y) || !std::isfinite(width) || !std::isfinite(height)) + // // return { }; + + // // // 2. If radii is not a list of size one, two, three, or four, then throw a RangeError. + // // if (radii.size() > 4 || radii.empty()) + // // return Exception { RangeError, makeString("radii must contain at least 1 element, up to 4. It contained ", radii.size(), " elements.") }; + + // // // 3. Let normalizedRadii be an empty list. + // // Vector<FloatPoint, 4> normalizedRadii; + + // // // 4. For each radius of radii: + // // for (auto& radius : radii) { + // // auto shouldReturnSilently = false; + // // auto exception = WTF::switchOn(radius, + // // // 4.1 If radius is a DOMPointInit: + // // [&normalizedRadii, &shouldReturnSilently](DOMPointInit point) -> ExceptionOr<void> { + // // // 4.1.1 If radius["x"] or radius["y"] is infinite or NaN, then return. + // // if (!std::isfinite(point.x) || !std::isfinite(point.y)) { + // // shouldReturnSilently = true; + // // return { }; + // // } + + // // // 4.1.2 If radius["x"] or radius["y"] is negative, then throw a RangeError. + // // if (point.x < 0 || point.y < 0) + // // return Exception { RangeError, makeString("radius point coordinates must be positive") }; + + // // // 4.1.3 Otherwise, append radius to normalizedRadii. + // // normalizedRadii.append({ static_cast<float>(point.x), static_cast<float>(point.y) }); + // // return { }; + // // }, + // // // 4.2 If radius is a unrestricted double: + // // [&normalizedRadii, &shouldReturnSilently](double radiusValue) -> ExceptionOr<void> { + + // // // 4.2.1 If radius is infinite or NaN, then return. + // // if (!std::isfinite(radiusValue)) { + // // shouldReturnSilently = true; + // // return { }; + // // } + + // // // 4.2.2 If radius is negative, then throw a RangeError. + // // if (radiusValue < 0) + // // return Exception { RangeError, makeString("radius value must be positive") }; + + // // // 4.2.3 Otherwise append «[ "x" → radius, "y" → radius ]» to normalizedRadii. + // // normalizedRadii.append({ static_cast<float>(radiusValue), static_cast<float>(radiusValue) }); + // // return { }; + // // } + // // ); + // // if (exception.hasException() || shouldReturnSilently) + // // return exception; + // // } + + // // // Degenerate case, fall back to regular rect. + // // // We do not do this before parsing the radii in order to make sure the Exceptions can be raised. + // // if (!width || !height) { + // // rect(x, y, width, height); + // // return { }; + // // } + + // // // 5. Let upperLeft, upperRight, lowerRight, and lowerLeft be null. + // // FloatPoint upperLeft, upperRight, lowerRight, lowerLeft; + + // // switch (normalizedRadii.size()) { + // // case 4: + // // // 6. If normalizedRadii's size is 4, then set upperLeft to normalizedRadii[0], set upperRight to normalizedRadii[1], set lowerRight to normalizedRadii[2], and set lowerLeft to normalizedRadii[3]. + // // upperLeft = normalizedRadii[0]; + // // upperRight = normalizedRadii[1]; + // // lowerRight = normalizedRadii[2]; + // // lowerLeft = normalizedRadii[3]; + // // break; + // // case 3: + // // // 7. If normalizedRadii's size is 3, then set upperLeft to normalizedRadii[0], set upperRight and lowerLeft to normalizedRadii[1], and set lowerRight to normalizedRadii[2]. + // // upperLeft = normalizedRadii[0]; + // // upperRight = normalizedRadii[1]; + // // lowerRight = normalizedRadii[2]; + // // lowerLeft = normalizedRadii[1]; + // // break; + // // case 2: + // // // 8. If normalizedRadii's size is 2, then set upperLeft and lowerRight to normalizedRadii[0] and set upperRight and lowerLeft to normalizedRadii[1]. + // // upperLeft = normalizedRadii[0]; + // // upperRight = normalizedRadii[1]; + // // lowerRight = normalizedRadii[0]; + // // lowerLeft = normalizedRadii[1]; + // // break; + // // case 1: + // // // 9. If normalizedRadii's size is 1, then set upperLeft, upperRight, lowerRight, and lowerLeft to normalizedRadii[0]. + // // upperLeft = normalizedRadii[0]; + // // upperRight = normalizedRadii[0]; + // // lowerRight = normalizedRadii[0]; + // // lowerLeft = normalizedRadii[0]; + // // break; + // // default: + // // RELEASE_ASSERT_NOT_REACHED(); + // // break; + // // } + + // // // Must handle clockwise and counter-clockwise directions properly so path winding works correctly. + // // bool clockwise = true; + // // if (width < 0) { + // // clockwise = !clockwise; + // // width = std::abs(width); + // // x -= width; + // // std::swap(upperLeft, upperRight); + // // std::swap(lowerLeft, lowerRight); + // // } + + // // if (height < 0) { + // // clockwise = !clockwise; + // // height = std::abs(height); + // // y -= height; + // // std::swap(upperLeft, lowerLeft); + // // std::swap(upperRight, lowerRight); + // // } + + // // // 10. Corner curves must not overlap. Scale all radii to prevent this: + + // // // 10.1 Let top be upperLeft["x"] + upperRight["x"]. + // // auto top = upperLeft.x() + upperRight.x(); + + // // // 10.2 Let right be upperRight["y"] + lowerRight["y"]. + // // auto right = upperRight.y() + lowerRight.y(); + + // // // 10.3 Let bottom be lowerRight["x"] + lowerLeft["x"]. + // // auto bottom = lowerRight.x() + lowerLeft.x(); + + // // // 10.4 Let left be upperLeft["y"] + lowerLeft["y"]. + // // auto left = upperLeft.y() + lowerLeft.y(); + + // // // 10.5 Let scale be the minimum value of the ratios w / top, h / right, w / bottom, h / left. + // // auto scale = std::min({ width / top, height / right, width / bottom, height / left }); + + // // // 10.6 If scale is less than 1, then set the x and y members of upperLeft, upperRight, lowerLeft, and lowerRight to their current values multiplied by scale. + // // if (scale < 1) { + // // upperLeft.scale(scale); + // // upperRight.scale(scale); + // // lowerLeft.scale(scale); + // // lowerRight.scale(scale); + // // } + + // // // 11. Create a new subpath: + // // m_path.moveTo({ x + upperLeft.x(), y }); + + // // // The 11.x clockwise substeps are handled by Path::addRoundedRect directly. + // // if (clockwise) { + // // m_path.addRoundedRect({ FloatRect(x, y, width, height), + // // { static_cast<float>(upperLeft.x()), static_cast<float>(upperLeft.y()) }, + // // { static_cast<float>(upperRight.x()), static_cast<float>(upperRight.y()) }, + // // { static_cast<float>(lowerLeft.x()), static_cast<float>(lowerLeft.y()) }, + // // { static_cast<float>(lowerRight.x()), static_cast<float>(lowerRight.y()) }, + // // }); + // // } else { + // // // Top Left corner + // // if (upperLeft.x() > 0 || upperLeft.y() > 0) { + // // m_path.addBezierCurveTo({ x + upperLeft.x() * m_path.circleControlPoint(), y }, + // // { x, y + upperLeft.y() * m_path.circleControlPoint() }, + // // { x, y + upperLeft.y() }); + // // } + // // // Left edge + // // m_path.addLineTo({ x, y + height - lowerLeft.y() }); + // // // Bottom left corner + // // if (lowerLeft.x() > 0 || lowerLeft.y() > 0) { + // // m_path.addBezierCurveTo({ x, y + height - lowerLeft.y() * m_path.circleControlPoint() }, + // // { x + lowerLeft.x() * m_path.circleControlPoint(), y + height }, + // // { x + lowerLeft.x(), y + height }); + // // } + // // // Bottom edge + // // m_path.addLineTo({ x + width - lowerRight.x(), y + height }); + // // // Bottom right corner + // // if (lowerRight.x() > 0 || lowerRight.y() > 0) { + // // m_path.addBezierCurveTo({ x + width - lowerRight.x() * m_path.circleControlPoint(), y + height }, + // // { x + width, y + height - lowerRight.y() * m_path.circleControlPoint() }, + // // { x + width, y + height - lowerRight.y() }); + // // } + // // // Right edge + // // m_path.addLineTo({ x + width, y + upperRight.y() }); + // // // Top right corner + // // if (upperRight.x() > 0 || upperRight.y() > 0) { + // // m_path.addBezierCurveTo({ x + width, y + upperRight.y() * m_path.circleControlPoint() }, + // // { x + width - upperRight.x() * m_path.circleControlPoint(), y }, + // // { x + width - upperRight.x(), y }); + // // } + // // // Top edge + // // m_path.addLineTo({ x + upperLeft.x(), y }); + // // } + + // // // 12. Mark the subpath as closed. + // // m_path.closeSubpath(); + + // // // 13. Create a new subpath with the point (x, y) as the only point in the subpath. + // // m_path.moveTo({ x, y }); + + // // return { }; +} + +float CanvasPath::currentX() const +{ + // return m_path.currentPoint().x(); +} + +float CanvasPath::currentY() const +{ + // return m_path.currentPoint().y(); +} +} diff --git a/src/javascript/jsc/bindings/webcore/CanvasPath.h b/src/javascript/jsc/bindings/webcore/CanvasPath.h new file mode 100644 index 000000000..afb565ec4 --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/CanvasPath.h @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2006, 2007, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. + * Copyright (C) 2012, 2013 Adobe Systems Incorporated. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF + * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#pragma once + +#include "ExceptionOr.h" +#include "WebCorePath.h" +#include <variant> +#include <wtf/Forward.h> + +namespace WebCore { + +struct DOMPointInit; + +class CanvasPath { +public: + using RadiusVariant = std::variant<double, DOMPointInit>; + virtual ~CanvasPath() = default; + + void closePath(); + void moveTo(float x, float y); + void lineTo(float x, float y); + void quadraticCurveTo(float cpx, float cpy, float x, float y); + void bezierCurveTo(float cp1x, float cp1y, float cp2x, float cp2y, float x, float y); + ExceptionOr<void> arcTo(float x0, float y0, float x1, float y1, float radius); + ExceptionOr<void> arc(float x, float y, float r, float sa, float ea, bool anticlockwise); + ExceptionOr<void> ellipse(float x, float y, float radiusX, float radiusY, float rotation, float startAngle, float endAngled, bool anticlockwise); + void rect(float x, float y, float width, float height); + ExceptionOr<void> roundRect(float x, float y, float width, float height, const RadiusVariant& radii); + ExceptionOr<void> roundRect(float x, float y, float width, float height, const Span<const RadiusVariant>& radii); + + float currentX() const; + float currentY() const; + +protected: + CanvasPath() = default; + CanvasPath(const Path& path) + : m_path(path) + { + } + + virtual bool hasInvertibleTransform() const { return true; } + + // void lineTo(FloatPoint); + + Path m_path; +}; + +} diff --git a/src/javascript/jsc/bindings/webcore/CanvasPath.idl b/src/javascript/jsc/bindings/webcore/CanvasPath.idl new file mode 100644 index 000000000..64818911b --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/CanvasPath.idl @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2016 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF + * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +// https://html.spec.whatwg.org/multipage/canvas.html#canvaspath +interface mixin CanvasPath { + // shared path API methods + undefined closePath(); + undefined moveTo(unrestricted double x, unrestricted double y); + undefined lineTo(unrestricted double x, unrestricted double y); + undefined quadraticCurveTo(unrestricted double cpx, unrestricted double cpy, unrestricted double x, unrestricted double y); + undefined bezierCurveTo(unrestricted double cp1x, unrestricted double cp1y, unrestricted double cp2x, unrestricted double cp2y, unrestricted double x, unrestricted double y); + undefined arcTo(unrestricted double x1, unrestricted double y1, unrestricted double x2, unrestricted double y2, unrestricted double radius); + // undefined arcTo(unrestricted double x1, unrestricted double y1, unrestricted double x2, unrestricted double y2, unrestricted double radiusX, unrestricted double radiusY, unrestricted double rotation); + undefined rect(unrestricted double x, unrestricted double y, unrestricted double w, unrestricted double h); + undefined roundRect(unrestricted double x, unrestricted double y, unrestricted double w, unrestricted double h, sequence<(unrestricted double or DOMPointInit)> radii); + undefined roundRect(unrestricted double x, unrestricted double y, unrestricted double w, unrestricted double h, (unrestricted double or DOMPointInit) radii); + undefined arc(unrestricted double x, unrestricted double y, unrestricted double radius, unrestricted double startAngle, unrestricted double endAngle, optional boolean anticlockwise = false); + undefined ellipse(unrestricted double x, unrestricted double y, unrestricted double radiusX, unrestricted double radiusY, unrestricted double rotation, unrestricted double startAngle, unrestricted double endAngle, optional boolean anticlockwise = false); + + [EnabledAtRuntime=InspectorAdditionsEnabled] readonly attribute float currentX; + [EnabledAtRuntime=InspectorAdditionsEnabled] readonly attribute float currentY; +}; diff --git a/src/javascript/jsc/bindings/webcore/CanvasPathDrawingStyles.idl b/src/javascript/jsc/bindings/webcore/CanvasPathDrawingStyles.idl new file mode 100644 index 000000000..77fc366a8 --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/CanvasPathDrawingStyles.idl @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2017 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +// https://html.spec.whatwg.org/multipage/canvas.html#canvaspathdrawingstyles +interface mixin CanvasPathDrawingStyles { + // line caps/joins + attribute unrestricted double lineWidth; // (default 1) + attribute CanvasLineCap lineCap; // (default "butt") + attribute CanvasLineJoin lineJoin; // (default "miter") + attribute unrestricted double miterLimit; // (default 10) + + // dashed lines + undefined setLineDash(sequence<unrestricted double> segments); // default empty + sequence<unrestricted double> getLineDash(); + attribute unrestricted double lineDashOffset; +}; diff --git a/src/javascript/jsc/bindings/webcore/CanvasPattern.cpp b/src/javascript/jsc/bindings/webcore/CanvasPattern.cpp new file mode 100644 index 000000000..b61eded3e --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/CanvasPattern.cpp @@ -0,0 +1,79 @@ +/* + * Copyright (C) 2006, 2008, 2017 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "CanvasPattern.h" + +#include "DOMMatrix2DInit.h" +// #include "DOMMatrixReadOnly.h" +// #include "NativeImage.h" +// #include "Pattern.h" +#include <wtf/text/WTFString.h> + +namespace WebCore { + +Ref<CanvasPattern> CanvasPattern::create(SourceImage&& image, bool repeatX, bool repeatY, bool originClean) +{ + return adoptRef(*new CanvasPattern(WTFMove(image), repeatX, repeatY, originClean)); +} + +CanvasPattern::CanvasPattern(SourceImage&& image, bool repeatX, bool repeatY, bool originClean) + // : m_pattern(Pattern::create(WTFMove(image), { repeatX, repeatY })) + : m_originClean(originClean) +{ +} + +CanvasPattern::~CanvasPattern() = default; + +bool CanvasPattern::parseRepetitionType(const String& type, bool& repeatX, bool& repeatY) +{ + // if (type.isEmpty() || type == "repeat") { + // repeatX = true; + // repeatY = true; + // return true; + // } + // if (type == "no-repeat") { + // repeatX = false; + // repeatY = false; + // return true; + // } + // if (type == "repeat-x") { + // repeatX = true; + // repeatY = false; + // return true; + // } + // if (type == "repeat-y") { + // repeatX = false; + // repeatY = true; + // return true; + // } + return false; +} + +ExceptionOr<void> CanvasPattern::setTransform(DOMMatrix2DInit&& matrixInit) +{ +} + +} // namespace WebCore diff --git a/src/javascript/jsc/bindings/webcore/CanvasPattern.h b/src/javascript/jsc/bindings/webcore/CanvasPattern.h new file mode 100644 index 000000000..5870bd8b6 --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/CanvasPattern.h @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2006, 2008, 2017 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#pragma once + +#include "ExceptionOr.h" +#include <wtf/Forward.h> +#include <wtf/Ref.h> +#include <wtf/RefCounted.h> +#include "SourceImage.h" + +namespace WebCore { + +// class Pattern; + +struct DOMMatrix2DInit; + +class CanvasPattern : public RefCounted<CanvasPattern> { +public: + static Ref<CanvasPattern> create(SourceImage&&, bool repeatX, bool repeatY, bool originClean); + ~CanvasPattern(); + + static bool parseRepetitionType(const String&, bool& repeatX, bool& repeatY); + + // Pattern& pattern() { return m_pattern; } + // const Pattern& pattern() const { return m_pattern; } + + bool originClean() const { return m_originClean; } + + ExceptionOr<void> setTransform(DOMMatrix2DInit&&); + +private: + CanvasPattern(SourceImage&&, bool repeatX, bool repeatY, bool originClean); + + // Ref<Pattern> m_pattern; + bool m_originClean; +}; + +} // namespace WebCore diff --git a/src/javascript/jsc/bindings/webcore/CanvasPattern.idl b/src/javascript/jsc/bindings/webcore/CanvasPattern.idl new file mode 100644 index 000000000..0b88254c1 --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/CanvasPattern.idl @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2006 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +[ + Exposed=(Window,Worker), +] interface CanvasPattern { + // opaque object + undefined setTransform(optional DOMMatrix2DInit transform); +}; diff --git a/src/javascript/jsc/bindings/webcore/CanvasRect.idl b/src/javascript/jsc/bindings/webcore/CanvasRect.idl new file mode 100644 index 000000000..1173972f8 --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/CanvasRect.idl @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2017 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +// https://html.spec.whatwg.org/multipage/canvas.html#canvasrect +interface mixin CanvasRect { + // rects + undefined clearRect(unrestricted double x, unrestricted double y, unrestricted double w, unrestricted double h); + undefined fillRect(unrestricted double x, unrestricted double y, unrestricted double w, unrestricted double h); + undefined strokeRect(unrestricted double x, unrestricted double y, unrestricted double w, unrestricted double h); +}; diff --git a/src/javascript/jsc/bindings/webcore/CanvasRenderingContext2DSettings.h b/src/javascript/jsc/bindings/webcore/CanvasRenderingContext2DSettings.h new file mode 100644 index 000000000..10a7884fc --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/CanvasRenderingContext2DSettings.h @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2021 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#pragma once + +// #include "PredefinedColorSpace.h" + +namespace WebCore { + +struct CanvasRenderingContext2DSettings { + bool desynchronized { false }; + // PredefinedColorSpace colorSpace { PredefinedColorSpace::SRGB }; +}; + +} // namespace WebCore diff --git a/src/javascript/jsc/bindings/webcore/CanvasRenderingContext2DSettings.idl b/src/javascript/jsc/bindings/webcore/CanvasRenderingContext2DSettings.idl new file mode 100644 index 000000000..ba7cf2f77 --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/CanvasRenderingContext2DSettings.idl @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2021 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +// https://html.spec.whatwg.org/multipage/canvas.html#canvasrenderingcontext2dsettings +[ + JSGenerateToJSObject, +] dictionary CanvasRenderingContext2DSettings { + // FIXME: Add support for 'alpha'. + // boolean alpha = true; + boolean desynchronized = false; + [EnabledBySetting=CanvasColorSpaceEnabled] PredefinedColorSpace colorSpace = "srgb"; +}; diff --git a/src/javascript/jsc/bindings/webcore/CanvasTextAlign.h b/src/javascript/jsc/bindings/webcore/CanvasTextAlign.h new file mode 100644 index 000000000..dc25bcf6b --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/CanvasTextAlign.h @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2017 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#pragma once + +namespace WebCore { + +enum class CanvasTextAlign { Start, End, Left, Right, Center }; + +} diff --git a/src/javascript/jsc/bindings/webcore/CanvasTextAlign.idl b/src/javascript/jsc/bindings/webcore/CanvasTextAlign.idl new file mode 100644 index 000000000..d6a4a39a8 --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/CanvasTextAlign.idl @@ -0,0 +1,26 @@ +/* + * Copyright (C) 2017 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +enum CanvasTextAlign { "start", "end", "left", "right", "center" }; diff --git a/src/javascript/jsc/bindings/webcore/CanvasTextBaseline.h b/src/javascript/jsc/bindings/webcore/CanvasTextBaseline.h new file mode 100644 index 000000000..b61274a3f --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/CanvasTextBaseline.h @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2017 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#pragma once + +namespace WebCore { + +enum class CanvasTextBaseline { Top, Hanging, Middle, Alphabetic, Ideographic, Bottom }; + +} diff --git a/src/javascript/jsc/bindings/webcore/CanvasTextBaseline.idl b/src/javascript/jsc/bindings/webcore/CanvasTextBaseline.idl new file mode 100644 index 000000000..0aa173807 --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/CanvasTextBaseline.idl @@ -0,0 +1,26 @@ +/* + * Copyright (C) 2017 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +enum CanvasTextBaseline { "top", "hanging", "middle", "alphabetic", "ideographic", "bottom" }; diff --git a/src/javascript/jsc/bindings/webcore/CanvasTextDrawingStyles.idl b/src/javascript/jsc/bindings/webcore/CanvasTextDrawingStyles.idl new file mode 100644 index 000000000..5e5857665 --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/CanvasTextDrawingStyles.idl @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2017 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +// https://html.spec.whatwg.org/multipage/canvas.html#canvastextdrawingstyles +interface mixin CanvasTextDrawingStyles { + // text + attribute DOMString font; // (default 10px sans-serif) + attribute CanvasTextAlign textAlign; // (default: "start") + attribute CanvasTextBaseline textBaseline; // (default: "alphabetic") + attribute CanvasDirection direction; // (default: "inherit") +}; diff --git a/src/javascript/jsc/bindings/webcore/DOMClientIsoSubspaces.h b/src/javascript/jsc/bindings/webcore/DOMClientIsoSubspaces.h index 6d779fccf..0f179f8f7 100644 --- a/src/javascript/jsc/bindings/webcore/DOMClientIsoSubspaces.h +++ b/src/javascript/jsc/bindings/webcore/DOMClientIsoSubspaces.h @@ -545,18 +545,18 @@ public: // std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForMediaController; // std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForMediaEncryptedEvent; // std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForMediaError; - // std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForOffscreenCanvas; + std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForOffscreenCanvas; // std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForRadioNodeList; // std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForSubmitEvent; - // std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForTextMetrics; + std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForTextMetrics; // std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForTimeRanges; // std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForURLSearchParams; // std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForURLSearchParamsIterator; // std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForValidityState; // std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWebKitMediaKeyError; // std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForANGLEInstancedArrays; - // std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCanvasGradient; - // std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCanvasPattern; + std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCanvasGradient; + std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCanvasPattern; // std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForCanvasRenderingContext2D; // std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForEXTBlendMinMax; // std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForEXTColorBufferFloat; @@ -577,9 +577,9 @@ public: // std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForOESTextureHalfFloat; // std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForOESTextureHalfFloatLinear; // std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForOESVertexArrayObject; - // std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForOffscreenCanvasRenderingContext2D; + std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForOffscreenCanvasRenderingContext2D; // std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForPaintRenderingContext2D; - // std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForPath2D; + std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForPath2D; // std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWebGL2RenderingContext; // std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWebGLActiveInfo; // std::unique_ptr<GCClient::IsoSubspace> m_clientSubspaceForWebGLBuffer; diff --git a/src/javascript/jsc/bindings/webcore/DOMIsoSubspaces.h b/src/javascript/jsc/bindings/webcore/DOMIsoSubspaces.h index 3c064cab3..537c78e04 100644 --- a/src/javascript/jsc/bindings/webcore/DOMIsoSubspaces.h +++ b/src/javascript/jsc/bindings/webcore/DOMIsoSubspaces.h @@ -536,18 +536,18 @@ public: // std::unique_ptr<IsoSubspace> m_subspaceForMediaController; // std::unique_ptr<IsoSubspace> m_subspaceForMediaEncryptedEvent; // std::unique_ptr<IsoSubspace> m_subspaceForMediaError; - // std::unique_ptr<IsoSubspace> m_subspaceForOffscreenCanvas; + std::unique_ptr<IsoSubspace> m_subspaceForOffscreenCanvas; // std::unique_ptr<IsoSubspace> m_subspaceForRadioNodeList; // std::unique_ptr<IsoSubspace> m_subspaceForSubmitEvent; - // std::unique_ptr<IsoSubspace> m_subspaceForTextMetrics; + std::unique_ptr<IsoSubspace> m_subspaceForTextMetrics; // std::unique_ptr<IsoSubspace> m_subspaceForTimeRanges; // std::unique_ptr<IsoSubspace> m_subspaceForURLSearchParams; // std::unique_ptr<IsoSubspace> m_subspaceForURLSearchParamsIterator; // std::unique_ptr<IsoSubspace> m_subspaceForValidityState; // std::unique_ptr<IsoSubspace> m_subspaceForWebKitMediaKeyError; // std::unique_ptr<IsoSubspace> m_subspaceForANGLEInstancedArrays; - // std::unique_ptr<IsoSubspace> m_subspaceForCanvasGradient; - // std::unique_ptr<IsoSubspace> m_subspaceForCanvasPattern; + std::unique_ptr<IsoSubspace> m_subspaceForCanvasGradient; + std::unique_ptr<IsoSubspace> m_subspaceForCanvasPattern; // std::unique_ptr<IsoSubspace> m_subspaceForCanvasRenderingContext2D; // std::unique_ptr<IsoSubspace> m_subspaceForEXTBlendMinMax; // std::unique_ptr<IsoSubspace> m_subspaceForEXTColorBufferFloat; @@ -568,9 +568,9 @@ public: // std::unique_ptr<IsoSubspace> m_subspaceForOESTextureHalfFloat; // std::unique_ptr<IsoSubspace> m_subspaceForOESTextureHalfFloatLinear; // std::unique_ptr<IsoSubspace> m_subspaceForOESVertexArrayObject; - // std::unique_ptr<IsoSubspace> m_subspaceForOffscreenCanvasRenderingContext2D; + std::unique_ptr<IsoSubspace> m_subspaceForOffscreenCanvasRenderingContext2D; // std::unique_ptr<IsoSubspace> m_subspaceForPaintRenderingContext2D; - // std::unique_ptr<IsoSubspace> m_subspaceForPath2D; + std::unique_ptr<IsoSubspace> m_subspaceForPath2D; // std::unique_ptr<IsoSubspace> m_subspaceForWebGL2RenderingContext; // std::unique_ptr<IsoSubspace> m_subspaceForWebGLActiveInfo; // std::unique_ptr<IsoSubspace> m_subspaceForWebGLBuffer; diff --git a/src/javascript/jsc/bindings/webcore/DOMMatrix2DInit.h b/src/javascript/jsc/bindings/webcore/DOMMatrix2DInit.h new file mode 100644 index 000000000..198d86401 --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/DOMMatrix2DInit.h @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2017 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#pragma once + +#include <optional> + +namespace WebCore { + +struct DOMMatrix2DInit { + std::optional<double> a; + std::optional<double> b; + std::optional<double> c; + std::optional<double> d; + std::optional<double> e; + std::optional<double> f; + std::optional<double> m11; + std::optional<double> m12; + std::optional<double> m21; + std::optional<double> m22; + std::optional<double> m41; + std::optional<double> m42; +}; + +} diff --git a/src/javascript/jsc/bindings/webcore/DOMMatrixInit.h b/src/javascript/jsc/bindings/webcore/DOMMatrixInit.h new file mode 100644 index 000000000..168db3d3b --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/DOMMatrixInit.h @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2017 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#pragma once + +#include "DOMMatrix2DInit.h" + +namespace WebCore { + +struct DOMMatrixInit : DOMMatrix2DInit { + double m13 { 0 }; + double m14 { 0 }; + double m23 { 0 }; + double m24 { 0 }; + double m31 { 0 }; + double m32 { 0 }; + double m33 { 1 }; + double m34 { 0 }; + double m43 { 0 }; + double m44 { 1 }; + std::optional<bool> is2D; +}; + +} // namespace WebCore diff --git a/src/javascript/jsc/bindings/webcore/DOMPointInit.h b/src/javascript/jsc/bindings/webcore/DOMPointInit.h new file mode 100644 index 000000000..119e42d42 --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/DOMPointInit.h @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2014 Adobe Systems Incorporated. All rights reserved. + * Copyright (C) 2016 Apple Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above + * copyright notice, this list of conditions and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#pragma once + +namespace WebCore { + +struct DOMPointInit { + double x { 0 }; + double y { 0 }; + double z { 0 }; + double w { 1 }; +}; + +} // namespace WebCore diff --git a/src/javascript/jsc/bindings/webcore/DOMPointInit.idl b/src/javascript/jsc/bindings/webcore/DOMPointInit.idl new file mode 100644 index 000000000..5f47f0701 --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/DOMPointInit.idl @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2014 Adobe Systems Incorporated. All rights reserved. + * Copyright (C) 2016 Apple Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above + * copyright notice, this list of conditions and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +dictionary DOMPointInit { + unrestricted double x = 0; + unrestricted double y = 0; + unrestricted double z = 0; + unrestricted double w = 1; +}; diff --git a/src/javascript/jsc/bindings/webcore/EventTargetFactory.cpp b/src/javascript/jsc/bindings/webcore/EventTargetFactory.cpp index 133ac17dc..be421b297 100644 --- a/src/javascript/jsc/bindings/webcore/EventTargetFactory.cpp +++ b/src/javascript/jsc/bindings/webcore/EventTargetFactory.cpp @@ -126,8 +126,8 @@ JSC::JSValue toJS(JSC::JSGlobalObject* state, JSDOMGlobalObject* globalObject, E // return toJS(state, globalObject, static_cast<Notification&>(impl)); // #endif // #if ENABLE(OFFSCREEN_CANVAS) - // case OffscreenCanvasEventTargetInterfaceType: - // return toJS(state, globalObject, static_cast<OffscreenCanvas&>(impl)); + case OffscreenCanvasEventTargetInterfaceType: + return toJS(state, globalObject, static_cast<OffscreenCanvas&>(impl)); // #endif // #if ENABLE(PAYMENT_REQUEST) // case PaymentRequestEventTargetInterfaceType: diff --git a/src/javascript/jsc/bindings/webcore/EventTargetHeaders.h b/src/javascript/jsc/bindings/webcore/EventTargetHeaders.h index 785ededd5..b6d8a8a95 100644 --- a/src/javascript/jsc/bindings/webcore/EventTargetHeaders.h +++ b/src/javascript/jsc/bindings/webcore/EventTargetHeaders.h @@ -115,8 +115,8 @@ // #include "Notification.h" // #endif // #if ENABLE(OFFSCREEN_CANVAS) -// #include "JSOffscreenCanvas.h" -// #include "OffscreenCanvas.h" +#include "JSOffscreenCanvas.h" +#include "OffscreenCanvas.h" // #endif // #if ENABLE(PAYMENT_REQUEST) // #include "JSPaymentRequest.h" diff --git a/src/javascript/jsc/bindings/webcore/EventTargetInterfaces.h b/src/javascript/jsc/bindings/webcore/EventTargetInterfaces.h index 0226d0c0e..34a19c92a 100644 --- a/src/javascript/jsc/bindings/webcore/EventTargetInterfaces.h +++ b/src/javascript/jsc/bindings/webcore/EventTargetInterfaces.h @@ -58,9 +58,9 @@ enum EventTargetInterface { #if ENABLE(NOTIFICATIONS) NotificationEventTargetInterfaceType = 12, #endif -#if ENABLE(OFFSCREEN_CANVAS) + // #if ENABLE(OFFSCREEN_CANVAS) OffscreenCanvasEventTargetInterfaceType = 13, -#endif +// #endif #if ENABLE(PAYMENT_REQUEST) PaymentRequestEventTargetInterfaceType = 14, PaymentResponseEventTargetInterfaceType = 15, diff --git a/src/javascript/jsc/bindings/webcore/FloatPoint.h b/src/javascript/jsc/bindings/webcore/FloatPoint.h new file mode 100644 index 000000000..eb522073c --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/FloatPoint.h @@ -0,0 +1,9 @@ +#pragma once + +namespace WebCore { +class FloatPoint { +public: + float x; + float y; +}; +}
\ No newline at end of file diff --git a/src/javascript/jsc/bindings/webcore/ImageSmoothingQuality.h b/src/javascript/jsc/bindings/webcore/ImageSmoothingQuality.h new file mode 100644 index 000000000..ffcb88bf6 --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/ImageSmoothingQuality.h @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2017 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#pragma once + +namespace WebCore { + +enum ImageSmoothingQuality { Low, Medium, High }; + +} diff --git a/src/javascript/jsc/bindings/webcore/JSCanvasDirection.h b/src/javascript/jsc/bindings/webcore/JSCanvasDirection.h new file mode 100644 index 000000000..03cbd1578 --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/JSCanvasDirection.h @@ -0,0 +1,34 @@ +/* + 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. +*/ + +#pragma once + +#include "CanvasDirection.h" +#include "JSDOMConvertEnumeration.h" + +namespace WebCore { + +String convertEnumerationToString(CanvasDirection); +template<> JSC::JSString* convertEnumerationToJS(JSC::JSGlobalObject&, CanvasDirection); + +template<> std::optional<CanvasDirection> parseEnumeration<CanvasDirection>(JSC::JSGlobalObject&, JSC::JSValue); +template<> const char* expectedEnumerationValues<CanvasDirection>(); + +} // namespace WebCore diff --git a/src/javascript/jsc/bindings/webcore/JSCanvasDrawImage.cpp b/src/javascript/jsc/bindings/webcore/JSCanvasDrawImage.cpp new file mode 100644 index 000000000..0bddee178 --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/JSCanvasDrawImage.cpp @@ -0,0 +1,5 @@ +/* + This file is generated to inform build scripts that JSCanvasDrawImage.h and + JSCanvasDrawImage.cpp were created for CanvasDrawImage.idl, and prevent the build + scripts from trying to regenerate JSCanvasDrawImage.h and JSCanvasDrawImage.cpp on every build. +*/ diff --git a/src/javascript/jsc/bindings/webcore/JSCanvasDrawImage.h b/src/javascript/jsc/bindings/webcore/JSCanvasDrawImage.h new file mode 100644 index 000000000..0bddee178 --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/JSCanvasDrawImage.h @@ -0,0 +1,5 @@ +/* + This file is generated to inform build scripts that JSCanvasDrawImage.h and + JSCanvasDrawImage.cpp were created for CanvasDrawImage.idl, and prevent the build + scripts from trying to regenerate JSCanvasDrawImage.h and JSCanvasDrawImage.cpp on every build. +*/ diff --git a/src/javascript/jsc/bindings/webcore/JSCanvasDrawPath.cpp b/src/javascript/jsc/bindings/webcore/JSCanvasDrawPath.cpp new file mode 100644 index 000000000..a32ecd5be --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/JSCanvasDrawPath.cpp @@ -0,0 +1,5 @@ +/* + This file is generated to inform build scripts that JSCanvasDrawPath.h and + JSCanvasDrawPath.cpp were created for CanvasDrawPath.idl, and prevent the build + scripts from trying to regenerate JSCanvasDrawPath.h and JSCanvasDrawPath.cpp on every build. +*/ diff --git a/src/javascript/jsc/bindings/webcore/JSCanvasDrawPath.h b/src/javascript/jsc/bindings/webcore/JSCanvasDrawPath.h new file mode 100644 index 000000000..a32ecd5be --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/JSCanvasDrawPath.h @@ -0,0 +1,5 @@ +/* + This file is generated to inform build scripts that JSCanvasDrawPath.h and + JSCanvasDrawPath.cpp were created for CanvasDrawPath.idl, and prevent the build + scripts from trying to regenerate JSCanvasDrawPath.h and JSCanvasDrawPath.cpp on every build. +*/ diff --git a/src/javascript/jsc/bindings/webcore/JSCanvasFillRule.cpp b/src/javascript/jsc/bindings/webcore/JSCanvasFillRule.cpp new file mode 100644 index 000000000..934dce85e --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/JSCanvasFillRule.cpp @@ -0,0 +1,64 @@ +/* + 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 "JSCanvasFillRule.h" + +#include <JavaScriptCore/JSCInlines.h> +#include <JavaScriptCore/JSString.h> +#include <wtf/NeverDestroyed.h> + + +namespace WebCore { +using namespace JSC; + +String convertEnumerationToString(CanvasFillRule enumerationValue) +{ + static const NeverDestroyed<String> values[] = { + MAKE_STATIC_STRING_IMPL("nonzero"), + MAKE_STATIC_STRING_IMPL("evenodd"), + }; + static_assert(static_cast<size_t>(CanvasFillRule::Nonzero) == 0, "CanvasFillRule::Nonzero is not 0 as expected"); + static_assert(static_cast<size_t>(CanvasFillRule::Evenodd) == 1, "CanvasFillRule::Evenodd is not 1 as expected"); + ASSERT(static_cast<size_t>(enumerationValue) < WTF_ARRAY_LENGTH(values)); + return values[static_cast<size_t>(enumerationValue)]; +} + +template<> JSString* convertEnumerationToJS(JSGlobalObject& lexicalGlobalObject, CanvasFillRule enumerationValue) +{ + return jsStringWithCache(lexicalGlobalObject.vm(), convertEnumerationToString(enumerationValue)); +} + +template<> std::optional<CanvasFillRule> parseEnumeration<CanvasFillRule>(JSGlobalObject& lexicalGlobalObject, JSValue value) +{ + auto stringValue = value.toWTFString(&lexicalGlobalObject); + if (stringValue == "nonzero") + return CanvasFillRule::Nonzero; + if (stringValue == "evenodd") + return CanvasFillRule::Evenodd; + return std::nullopt; +} + +template<> const char* expectedEnumerationValues<CanvasFillRule>() +{ + return "\"nonzero\", \"evenodd\""; +} + +} // namespace WebCore diff --git a/src/javascript/jsc/bindings/webcore/JSCanvasFillRule.h b/src/javascript/jsc/bindings/webcore/JSCanvasFillRule.h new file mode 100644 index 000000000..a2436e3f2 --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/JSCanvasFillRule.h @@ -0,0 +1,34 @@ +/* + 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. +*/ + +#pragma once + +#include "CanvasFillRule.h" +#include "JSDOMConvertEnumeration.h" + +namespace WebCore { + +String convertEnumerationToString(CanvasFillRule); +template<> JSC::JSString* convertEnumerationToJS(JSC::JSGlobalObject&, CanvasFillRule); + +template<> std::optional<CanvasFillRule> parseEnumeration<CanvasFillRule>(JSC::JSGlobalObject&, JSC::JSValue); +template<> const char* expectedEnumerationValues<CanvasFillRule>(); + +} // namespace WebCore diff --git a/src/javascript/jsc/bindings/webcore/JSCanvasFillStrokeStyles.cpp b/src/javascript/jsc/bindings/webcore/JSCanvasFillStrokeStyles.cpp new file mode 100644 index 000000000..611f6781b --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/JSCanvasFillStrokeStyles.cpp @@ -0,0 +1,5 @@ +/* + This file is generated to inform build scripts that JSCanvasFillStrokeStyles.h and + JSCanvasFillStrokeStyles.cpp were created for CanvasFillStrokeStyles.idl, and prevent the build + scripts from trying to regenerate JSCanvasFillStrokeStyles.h and JSCanvasFillStrokeStyles.cpp on every build. +*/ diff --git a/src/javascript/jsc/bindings/webcore/JSCanvasFillStrokeStyles.h b/src/javascript/jsc/bindings/webcore/JSCanvasFillStrokeStyles.h new file mode 100644 index 000000000..611f6781b --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/JSCanvasFillStrokeStyles.h @@ -0,0 +1,5 @@ +/* + This file is generated to inform build scripts that JSCanvasFillStrokeStyles.h and + JSCanvasFillStrokeStyles.cpp were created for CanvasFillStrokeStyles.idl, and prevent the build + scripts from trying to regenerate JSCanvasFillStrokeStyles.h and JSCanvasFillStrokeStyles.cpp on every build. +*/ diff --git a/src/javascript/jsc/bindings/webcore/JSCanvasFilters.cpp b/src/javascript/jsc/bindings/webcore/JSCanvasFilters.cpp new file mode 100644 index 000000000..d742b8864 --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/JSCanvasFilters.cpp @@ -0,0 +1,5 @@ +/* + This file is generated to inform build scripts that JSCanvasFilters.h and + JSCanvasFilters.cpp were created for CanvasFilters.idl, and prevent the build + scripts from trying to regenerate JSCanvasFilters.h and JSCanvasFilters.cpp on every build. +*/ diff --git a/src/javascript/jsc/bindings/webcore/JSCanvasFilters.h b/src/javascript/jsc/bindings/webcore/JSCanvasFilters.h new file mode 100644 index 000000000..d742b8864 --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/JSCanvasFilters.h @@ -0,0 +1,5 @@ +/* + This file is generated to inform build scripts that JSCanvasFilters.h and + JSCanvasFilters.cpp were created for CanvasFilters.idl, and prevent the build + scripts from trying to regenerate JSCanvasFilters.h and JSCanvasFilters.cpp on every build. +*/ diff --git a/src/javascript/jsc/bindings/webcore/JSCanvasGradient.cpp b/src/javascript/jsc/bindings/webcore/JSCanvasGradient.cpp new file mode 100644 index 000000000..14db8c948 --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/JSCanvasGradient.cpp @@ -0,0 +1,278 @@ +/* + 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 "JSCanvasGradient.h" + +#include "ActiveDOMObject.h" +#include "ExtendedDOMClientIsoSubspaces.h" +#include "ExtendedDOMIsoSubspaces.h" +#include "IDLTypes.h" +#include "JSDOMBinding.h" +#include "JSDOMConstructorNotConstructable.h" +#include "JSDOMConvertBase.h" +#include "JSDOMConvertNumbers.h" +#include "JSDOMConvertStrings.h" +#include "JSDOMExceptionHandling.h" +#include "JSDOMGlobalObjectInlines.h" +#include "JSDOMOperation.h" +#include "JSDOMWrapperCache.h" +#include "ScriptExecutionContext.h" +#include "WebCoreJSClientData.h" +#include <JavaScriptCore/FunctionPrototype.h> +#include <JavaScriptCore/HeapAnalyzer.h> +#include <JavaScriptCore/JSCInlines.h> +#include <JavaScriptCore/JSDestructibleObjectHeapCellType.h> +#include <JavaScriptCore/SlotVisitorMacros.h> +#include <JavaScriptCore/SubspaceInlines.h> +#include <wtf/GetPtr.h> +#include <wtf/PointerPreparations.h> +#include <wtf/URL.h> + +namespace WebCore { +using namespace JSC; + +// Functions + +static JSC_DECLARE_HOST_FUNCTION(jsCanvasGradientPrototypeFunction_addColorStop); + +// Attributes + +static JSC_DECLARE_CUSTOM_GETTER(jsCanvasGradientConstructor); + +class JSCanvasGradientPrototype final : public JSC::JSNonFinalObject { +public: + using Base = JSC::JSNonFinalObject; + static JSCanvasGradientPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) + { + JSCanvasGradientPrototype* ptr = new (NotNull, JSC::allocateCell<JSCanvasGradientPrototype>(vm)) JSCanvasGradientPrototype(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(JSCanvasGradientPrototype, 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: + JSCanvasGradientPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) + : JSC::JSNonFinalObject(vm, structure) + { + } + + void finishCreation(JSC::VM&); +}; +STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSCanvasGradientPrototype, JSCanvasGradientPrototype::Base); + +using JSCanvasGradientDOMConstructor = JSDOMConstructorNotConstructable<JSCanvasGradient>; + +template<> const ClassInfo JSCanvasGradientDOMConstructor::s_info = { "CanvasGradient"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSCanvasGradientDOMConstructor) }; + +template<> JSValue JSCanvasGradientDOMConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) +{ + UNUSED_PARAM(vm); + return globalObject.functionPrototype(); +} + +template<> void JSCanvasGradientDOMConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) +{ + putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); + JSString* nameString = jsNontrivialString(vm, "CanvasGradient"_s); + m_originalName.set(vm, this, nameString); + putDirect(vm, vm.propertyNames->name, nameString, JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); + putDirect(vm, vm.propertyNames->prototype, JSCanvasGradient::prototype(vm, globalObject), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum | JSC::PropertyAttribute::DontDelete); +} + +/* Hash table for prototype */ + +static const HashTableValue JSCanvasGradientPrototypeTableValues[] = { + { "constructor", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(jsCanvasGradientConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, + { "addColorStop", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(jsCanvasGradientPrototypeFunction_addColorStop), (intptr_t)(2) } }, +}; + +const ClassInfo JSCanvasGradientPrototype::s_info = { "CanvasGradient"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSCanvasGradientPrototype) }; + +void JSCanvasGradientPrototype::finishCreation(VM& vm) +{ + Base::finishCreation(vm); + reifyStaticProperties(vm, JSCanvasGradient::info(), JSCanvasGradientPrototypeTableValues, *this); + JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); +} + +const ClassInfo JSCanvasGradient::s_info = { "CanvasGradient"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSCanvasGradient) }; + +JSCanvasGradient::JSCanvasGradient(Structure* structure, JSDOMGlobalObject& globalObject, Ref<CanvasGradient>&& impl) + : JSDOMWrapper<CanvasGradient>(structure, globalObject, WTFMove(impl)) +{ +} + +void JSCanvasGradient::finishCreation(VM& vm) +{ + Base::finishCreation(vm); + ASSERT(inherits(vm, info())); + + // static_assert(!std::is_base_of<ActiveDOMObject, CanvasGradient>::value, "Interface is not marked as [ActiveDOMObject] even though implementation class subclasses ActiveDOMObject."); +} + +JSObject* JSCanvasGradient::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) +{ + return JSCanvasGradientPrototype::create(vm, &globalObject, JSCanvasGradientPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype())); +} + +JSObject* JSCanvasGradient::prototype(VM& vm, JSDOMGlobalObject& globalObject) +{ + return getDOMPrototype<JSCanvasGradient>(vm, globalObject); +} + +JSValue JSCanvasGradient::getConstructor(VM& vm, const JSGlobalObject* globalObject) +{ + return getDOMConstructor<JSCanvasGradientDOMConstructor, DOMConstructorID::CanvasGradient>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); +} + +void JSCanvasGradient::destroy(JSC::JSCell* cell) +{ + JSCanvasGradient* thisObject = static_cast<JSCanvasGradient*>(cell); + thisObject->JSCanvasGradient::~JSCanvasGradient(); +} + +JSC_DEFINE_CUSTOM_GETTER(jsCanvasGradientConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) +{ + VM& vm = JSC::getVM(lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto* prototype = jsDynamicCast<JSCanvasGradientPrototype*>(vm, JSValue::decode(thisValue)); + if (UNLIKELY(!prototype)) + return throwVMTypeError(lexicalGlobalObject, throwScope); + return JSValue::encode(JSCanvasGradient::getConstructor(JSC::getVM(lexicalGlobalObject), prototype->globalObject())); +} + +static inline JSC::EncodedJSValue jsCanvasGradientPrototypeFunction_addColorStopBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSCanvasGradient>::ClassParameter castedThis) +{ + return JSC::JSValue::encode(JSC::jsUndefined()); + // 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 offset = convert<IDLDouble>(*lexicalGlobalObject, argument0.value()); + // RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + // EnsureStillAliveScope argument1 = callFrame->uncheckedArgument(1); + // auto color = convert<IDLDOMString>(*lexicalGlobalObject, argument1.value()); + // RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + // RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS<IDLUndefined>(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.addColorStop(WTFMove(offset), WTFMove(color)); }))); +} + +JSC_DEFINE_HOST_FUNCTION(jsCanvasGradientPrototypeFunction_addColorStop, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + return IDLOperation<JSCanvasGradient>::call<jsCanvasGradientPrototypeFunction_addColorStopBody>(*lexicalGlobalObject, *callFrame, "addColorStop"); +} + +JSC::GCClient::IsoSubspace* JSCanvasGradient::subspaceForImpl(JSC::VM& vm) +{ + return WebCore::subspaceForImpl<JSCanvasGradient, UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForCanvasGradient.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForCanvasGradient = WTFMove(space); }, + [](auto& spaces) { return spaces.m_subspaceForCanvasGradient.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForCanvasGradient = WTFMove(space); }); +} + +void JSCanvasGradient::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) +{ + auto* thisObject = jsCast<JSCanvasGradient*>(cell); + analyzer.setWrappedObjectForCell(cell, &thisObject->wrapped()); + if (thisObject->scriptExecutionContext()) + analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); + Base::analyzeHeap(cell, analyzer); +} + +bool JSCanvasGradientOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, AbstractSlotVisitor& visitor, const char** reason) +{ + UNUSED_PARAM(handle); + UNUSED_PARAM(visitor); + UNUSED_PARAM(reason); + return false; +} + +void JSCanvasGradientOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) +{ + auto* jsCanvasGradient = static_cast<JSCanvasGradient*>(handle.slot()->asCell()); + auto& world = *static_cast<DOMWrapperWorld*>(context); + uncacheWrapper(world, &jsCanvasGradient->wrapped(), jsCanvasGradient); +} + +#if ENABLE(BINDING_INTEGRITY) +#if PLATFORM(WIN) +#pragma warning(disable : 4483) +extern "C" { +extern void (*const __identifier("??_7CanvasGradient@WebCore@@6B@")[])(); +} +#else +extern "C" { +extern void* _ZTVN7WebCore14CanvasGradientE[]; +} +#endif +#endif + +JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject*, JSDOMGlobalObject* globalObject, Ref<CanvasGradient>&& impl) +{ + + if constexpr (std::is_polymorphic_v<CanvasGradient>) { +#if ENABLE(BINDING_INTEGRITY) + const void* actualVTablePointer = getVTablePointer(impl.ptr()); +#if PLATFORM(WIN) + void* expectedVTablePointer = __identifier("??_7CanvasGradient@WebCore@@6B@"); +#else + void* expectedVTablePointer = &_ZTVN7WebCore14CanvasGradientE[2]; +#endif + + // If you hit this assertion you either have a use after free bug, or + // CanvasGradient has subclasses. If CanvasGradient has subclasses that get passed + // to toJS() we currently require CanvasGradient you to opt out of binding hardening + // by adding the SkipVTableValidation attribute to the interface IDL definition + RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer); +#endif + } + return createWrapper<CanvasGradient>(globalObject, WTFMove(impl)); +} + +JSC::JSValue toJS(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, CanvasGradient& impl) +{ + return wrap(lexicalGlobalObject, globalObject, impl); +} + +CanvasGradient* JSCanvasGradient::toWrapped(JSC::VM& vm, JSC::JSValue value) +{ + if (auto* wrapper = jsDynamicCast<JSCanvasGradient*>(vm, value)) + return &wrapper->wrapped(); + return nullptr; +} + +} diff --git a/src/javascript/jsc/bindings/webcore/JSCanvasGradient.dep b/src/javascript/jsc/bindings/webcore/JSCanvasGradient.dep new file mode 100644 index 000000000..c0fc91ef8 --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/JSCanvasGradient.dep @@ -0,0 +1 @@ +JSCanvasGradient.h : diff --git a/src/javascript/jsc/bindings/webcore/JSCanvasGradient.h b/src/javascript/jsc/bindings/webcore/JSCanvasGradient.h new file mode 100644 index 000000000..b2fe80263 --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/JSCanvasGradient.h @@ -0,0 +1,93 @@ +/* + 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. +*/ + +#pragma once + +#include "CanvasGradient.h" +#include "JSDOMWrapper.h" +#include <wtf/NeverDestroyed.h> + +namespace WebCore { + +class JSCanvasGradient : public JSDOMWrapper<CanvasGradient> { +public: + using Base = JSDOMWrapper<CanvasGradient>; + static JSCanvasGradient* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref<CanvasGradient>&& impl) + { + JSCanvasGradient* ptr = new (NotNull, JSC::allocateCell<JSCanvasGradient>(globalObject->vm())) JSCanvasGradient(structure, *globalObject, WTFMove(impl)); + ptr->finishCreation(globalObject->vm()); + return ptr; + } + + static JSC::JSObject* createPrototype(JSC::VM&, JSDOMGlobalObject&); + static JSC::JSObject* prototype(JSC::VM&, JSDOMGlobalObject&); + static CanvasGradient* toWrapped(JSC::VM&, JSC::JSValue); + static void destroy(JSC::JSCell*); + + DECLARE_INFO; + + 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(), JSC::NonArray); + } + + static JSC::JSValue getConstructor(JSC::VM&, const JSC::JSGlobalObject*); + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return subspaceForImpl(vm); + } + static JSC::GCClient::IsoSubspace* subspaceForImpl(JSC::VM& vm); + static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); +protected: + JSCanvasGradient(JSC::Structure*, JSDOMGlobalObject&, Ref<CanvasGradient>&&); + + void finishCreation(JSC::VM&); +}; + +class JSCanvasGradientOwner final : public JSC::WeakHandleOwner { +public: + bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::AbstractSlotVisitor&, const char**) final; + void finalize(JSC::Handle<JSC::Unknown>, void* context) final; +}; + +inline JSC::WeakHandleOwner* wrapperOwner(DOMWrapperWorld&, CanvasGradient*) +{ + static NeverDestroyed<JSCanvasGradientOwner> owner; + return &owner.get(); +} + +inline void* wrapperKey(CanvasGradient* wrappableObject) +{ + return wrappableObject; +} + +JSC::JSValue toJS(JSC::JSGlobalObject*, JSDOMGlobalObject*, CanvasGradient&); +inline JSC::JSValue toJS(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, CanvasGradient* impl) { return impl ? toJS(lexicalGlobalObject, globalObject, *impl) : JSC::jsNull(); } +JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject*, JSDOMGlobalObject*, Ref<CanvasGradient>&&); +inline JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, RefPtr<CanvasGradient>&& impl) { return impl ? toJSNewlyCreated(lexicalGlobalObject, globalObject, impl.releaseNonNull()) : JSC::jsNull(); } + +template<> struct JSDOMWrapperConverterTraits<CanvasGradient> { + using WrapperClass = JSCanvasGradient; + using ToWrappedReturnType = CanvasGradient*; +}; + +} // namespace WebCore diff --git a/src/javascript/jsc/bindings/webcore/JSCanvasImageData.cpp b/src/javascript/jsc/bindings/webcore/JSCanvasImageData.cpp new file mode 100644 index 000000000..79dd1eb3c --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/JSCanvasImageData.cpp @@ -0,0 +1,5 @@ +/* + This file is generated to inform build scripts that JSCanvasImageData.h and + JSCanvasImageData.cpp were created for CanvasImageData.idl, and prevent the build + scripts from trying to regenerate JSCanvasImageData.h and JSCanvasImageData.cpp on every build. +*/ diff --git a/src/javascript/jsc/bindings/webcore/JSCanvasImageData.h b/src/javascript/jsc/bindings/webcore/JSCanvasImageData.h new file mode 100644 index 000000000..79dd1eb3c --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/JSCanvasImageData.h @@ -0,0 +1,5 @@ +/* + This file is generated to inform build scripts that JSCanvasImageData.h and + JSCanvasImageData.cpp were created for CanvasImageData.idl, and prevent the build + scripts from trying to regenerate JSCanvasImageData.h and JSCanvasImageData.cpp on every build. +*/ diff --git a/src/javascript/jsc/bindings/webcore/JSCanvasImageSmoothing.cpp b/src/javascript/jsc/bindings/webcore/JSCanvasImageSmoothing.cpp new file mode 100644 index 000000000..75d65f5ad --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/JSCanvasImageSmoothing.cpp @@ -0,0 +1,5 @@ +/* + This file is generated to inform build scripts that JSCanvasImageSmoothing.h and + JSCanvasImageSmoothing.cpp were created for CanvasImageSmoothing.idl, and prevent the build + scripts from trying to regenerate JSCanvasImageSmoothing.h and JSCanvasImageSmoothing.cpp on every build. +*/ diff --git a/src/javascript/jsc/bindings/webcore/JSCanvasImageSmoothing.h b/src/javascript/jsc/bindings/webcore/JSCanvasImageSmoothing.h new file mode 100644 index 000000000..75d65f5ad --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/JSCanvasImageSmoothing.h @@ -0,0 +1,5 @@ +/* + This file is generated to inform build scripts that JSCanvasImageSmoothing.h and + JSCanvasImageSmoothing.cpp were created for CanvasImageSmoothing.idl, and prevent the build + scripts from trying to regenerate JSCanvasImageSmoothing.h and JSCanvasImageSmoothing.cpp on every build. +*/ diff --git a/src/javascript/jsc/bindings/webcore/JSCanvasLineCap.cpp b/src/javascript/jsc/bindings/webcore/JSCanvasLineCap.cpp new file mode 100644 index 000000000..d69770f7b --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/JSCanvasLineCap.cpp @@ -0,0 +1,68 @@ +/* + 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 "JSCanvasLineCap.h" + +#include <JavaScriptCore/JSCInlines.h> +#include <JavaScriptCore/JSString.h> +#include <wtf/NeverDestroyed.h> + + +namespace WebCore { +using namespace JSC; + +String convertEnumerationToString(CanvasLineCap enumerationValue) +{ + static const NeverDestroyed<String> values[] = { + MAKE_STATIC_STRING_IMPL("butt"), + MAKE_STATIC_STRING_IMPL("round"), + MAKE_STATIC_STRING_IMPL("square"), + }; + static_assert(static_cast<size_t>(CanvasLineCap::Butt) == 0, "CanvasLineCap::Butt is not 0 as expected"); + static_assert(static_cast<size_t>(CanvasLineCap::Round) == 1, "CanvasLineCap::Round is not 1 as expected"); + static_assert(static_cast<size_t>(CanvasLineCap::Square) == 2, "CanvasLineCap::Square is not 2 as expected"); + ASSERT(static_cast<size_t>(enumerationValue) < WTF_ARRAY_LENGTH(values)); + return values[static_cast<size_t>(enumerationValue)]; +} + +template<> JSString* convertEnumerationToJS(JSGlobalObject& lexicalGlobalObject, CanvasLineCap enumerationValue) +{ + return jsStringWithCache(lexicalGlobalObject.vm(), convertEnumerationToString(enumerationValue)); +} + +template<> std::optional<CanvasLineCap> parseEnumeration<CanvasLineCap>(JSGlobalObject& lexicalGlobalObject, JSValue value) +{ + auto stringValue = value.toWTFString(&lexicalGlobalObject); + if (stringValue == "butt") + return CanvasLineCap::Butt; + if (stringValue == "round") + return CanvasLineCap::Round; + if (stringValue == "square") + return CanvasLineCap::Square; + return std::nullopt; +} + +template<> const char* expectedEnumerationValues<CanvasLineCap>() +{ + return "\"butt\", \"round\", \"square\""; +} + +} // namespace WebCore diff --git a/src/javascript/jsc/bindings/webcore/JSCanvasLineCap.h b/src/javascript/jsc/bindings/webcore/JSCanvasLineCap.h new file mode 100644 index 000000000..8b41a6322 --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/JSCanvasLineCap.h @@ -0,0 +1,34 @@ +/* + 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. +*/ + +#pragma once + +#include "CanvasLineCap.h" +#include "JSDOMConvertEnumeration.h" + +namespace WebCore { + +String convertEnumerationToString(CanvasLineCap); +template<> JSC::JSString* convertEnumerationToJS(JSC::JSGlobalObject&, CanvasLineCap); + +template<> std::optional<CanvasLineCap> parseEnumeration<CanvasLineCap>(JSC::JSGlobalObject&, JSC::JSValue); +template<> const char* expectedEnumerationValues<CanvasLineCap>(); + +} // namespace WebCore diff --git a/src/javascript/jsc/bindings/webcore/JSCanvasLineJoin.cpp b/src/javascript/jsc/bindings/webcore/JSCanvasLineJoin.cpp new file mode 100644 index 000000000..bf80f1ac6 --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/JSCanvasLineJoin.cpp @@ -0,0 +1,68 @@ +/* + 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 "JSCanvasLineJoin.h" + +#include <JavaScriptCore/JSCInlines.h> +#include <JavaScriptCore/JSString.h> +#include <wtf/NeverDestroyed.h> + + +namespace WebCore { +using namespace JSC; + +String convertEnumerationToString(CanvasLineJoin enumerationValue) +{ + static const NeverDestroyed<String> values[] = { + MAKE_STATIC_STRING_IMPL("round"), + MAKE_STATIC_STRING_IMPL("bevel"), + MAKE_STATIC_STRING_IMPL("miter"), + }; + static_assert(static_cast<size_t>(CanvasLineJoin::Round) == 0, "CanvasLineJoin::Round is not 0 as expected"); + static_assert(static_cast<size_t>(CanvasLineJoin::Bevel) == 1, "CanvasLineJoin::Bevel is not 1 as expected"); + static_assert(static_cast<size_t>(CanvasLineJoin::Miter) == 2, "CanvasLineJoin::Miter is not 2 as expected"); + ASSERT(static_cast<size_t>(enumerationValue) < WTF_ARRAY_LENGTH(values)); + return values[static_cast<size_t>(enumerationValue)]; +} + +template<> JSString* convertEnumerationToJS(JSGlobalObject& lexicalGlobalObject, CanvasLineJoin enumerationValue) +{ + return jsStringWithCache(lexicalGlobalObject.vm(), convertEnumerationToString(enumerationValue)); +} + +template<> std::optional<CanvasLineJoin> parseEnumeration<CanvasLineJoin>(JSGlobalObject& lexicalGlobalObject, JSValue value) +{ + auto stringValue = value.toWTFString(&lexicalGlobalObject); + if (stringValue == "round") + return CanvasLineJoin::Round; + if (stringValue == "bevel") + return CanvasLineJoin::Bevel; + if (stringValue == "miter") + return CanvasLineJoin::Miter; + return std::nullopt; +} + +template<> const char* expectedEnumerationValues<CanvasLineJoin>() +{ + return "\"round\", \"bevel\", \"miter\""; +} + +} // namespace WebCore diff --git a/src/javascript/jsc/bindings/webcore/JSCanvasLineJoin.h b/src/javascript/jsc/bindings/webcore/JSCanvasLineJoin.h new file mode 100644 index 000000000..a6d2699dc --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/JSCanvasLineJoin.h @@ -0,0 +1,34 @@ +/* + 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. +*/ + +#pragma once + +#include "CanvasLineJoin.h" +#include "JSDOMConvertEnumeration.h" + +namespace WebCore { + +String convertEnumerationToString(CanvasLineJoin); +template<> JSC::JSString* convertEnumerationToJS(JSC::JSGlobalObject&, CanvasLineJoin); + +template<> std::optional<CanvasLineJoin> parseEnumeration<CanvasLineJoin>(JSC::JSGlobalObject&, JSC::JSValue); +template<> const char* expectedEnumerationValues<CanvasLineJoin>(); + +} // namespace WebCore diff --git a/src/javascript/jsc/bindings/webcore/JSCanvasPath.cpp b/src/javascript/jsc/bindings/webcore/JSCanvasPath.cpp new file mode 100644 index 000000000..767a766e0 --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/JSCanvasPath.cpp @@ -0,0 +1,5 @@ +/* + This file is generated to inform build scripts that JSCanvasPath.h and + JSCanvasPath.cpp were created for CanvasPath.idl, and prevent the build + scripts from trying to regenerate JSCanvasPath.h and JSCanvasPath.cpp on every build. +*/ diff --git a/src/javascript/jsc/bindings/webcore/JSCanvasPath.h b/src/javascript/jsc/bindings/webcore/JSCanvasPath.h new file mode 100644 index 000000000..767a766e0 --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/JSCanvasPath.h @@ -0,0 +1,5 @@ +/* + This file is generated to inform build scripts that JSCanvasPath.h and + JSCanvasPath.cpp were created for CanvasPath.idl, and prevent the build + scripts from trying to regenerate JSCanvasPath.h and JSCanvasPath.cpp on every build. +*/ diff --git a/src/javascript/jsc/bindings/webcore/JSCanvasPathDrawingStyles.cpp b/src/javascript/jsc/bindings/webcore/JSCanvasPathDrawingStyles.cpp new file mode 100644 index 000000000..0a0314748 --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/JSCanvasPathDrawingStyles.cpp @@ -0,0 +1,5 @@ +/* + This file is generated to inform build scripts that JSCanvasPathDrawingStyles.h and + JSCanvasPathDrawingStyles.cpp were created for CanvasPathDrawingStyles.idl, and prevent the build + scripts from trying to regenerate JSCanvasPathDrawingStyles.h and JSCanvasPathDrawingStyles.cpp on every build. +*/ diff --git a/src/javascript/jsc/bindings/webcore/JSCanvasPathDrawingStyles.h b/src/javascript/jsc/bindings/webcore/JSCanvasPathDrawingStyles.h new file mode 100644 index 000000000..0a0314748 --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/JSCanvasPathDrawingStyles.h @@ -0,0 +1,5 @@ +/* + This file is generated to inform build scripts that JSCanvasPathDrawingStyles.h and + JSCanvasPathDrawingStyles.cpp were created for CanvasPathDrawingStyles.idl, and prevent the build + scripts from trying to regenerate JSCanvasPathDrawingStyles.h and JSCanvasPathDrawingStyles.cpp on every build. +*/ diff --git a/src/javascript/jsc/bindings/webcore/JSCanvasPattern.cpp b/src/javascript/jsc/bindings/webcore/JSCanvasPattern.cpp new file mode 100644 index 000000000..9067959b0 --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/JSCanvasPattern.cpp @@ -0,0 +1,273 @@ +/* + 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 "JSCanvasPattern.h" + +#include "ActiveDOMObject.h" +#include "ExtendedDOMClientIsoSubspaces.h" +#include "ExtendedDOMIsoSubspaces.h" +#include "IDLTypes.h" +#include "JSDOMBinding.h" +#include "JSDOMConstructorNotConstructable.h" +#include "JSDOMConvertBase.h" +#include "JSDOMConvertDictionary.h" +#include "JSDOMExceptionHandling.h" +#include "JSDOMGlobalObjectInlines.h" +// #include "JSDOMMatrix2DInit.h" +#include "JSDOMOperation.h" +#include "JSDOMWrapperCache.h" +#include "ScriptExecutionContext.h" +#include "WebCoreJSClientData.h" +#include <JavaScriptCore/FunctionPrototype.h> +#include <JavaScriptCore/HeapAnalyzer.h> +#include <JavaScriptCore/JSCInlines.h> +#include <JavaScriptCore/JSDestructibleObjectHeapCellType.h> +#include <JavaScriptCore/SlotVisitorMacros.h> +#include <JavaScriptCore/SubspaceInlines.h> +#include <wtf/GetPtr.h> +#include <wtf/PointerPreparations.h> +#include <wtf/URL.h> + +namespace WebCore { +using namespace JSC; + +// Functions + +static JSC_DECLARE_HOST_FUNCTION(jsCanvasPatternPrototypeFunction_setTransform); + +// Attributes + +static JSC_DECLARE_CUSTOM_GETTER(jsCanvasPatternConstructor); + +class JSCanvasPatternPrototype final : public JSC::JSNonFinalObject { +public: + using Base = JSC::JSNonFinalObject; + static JSCanvasPatternPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) + { + JSCanvasPatternPrototype* ptr = new (NotNull, JSC::allocateCell<JSCanvasPatternPrototype>(vm)) JSCanvasPatternPrototype(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(JSCanvasPatternPrototype, 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: + JSCanvasPatternPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) + : JSC::JSNonFinalObject(vm, structure) + { + } + + void finishCreation(JSC::VM&); +}; +STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSCanvasPatternPrototype, JSCanvasPatternPrototype::Base); + +using JSCanvasPatternDOMConstructor = JSDOMConstructorNotConstructable<JSCanvasPattern>; + +template<> const ClassInfo JSCanvasPatternDOMConstructor::s_info = { "CanvasPattern"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSCanvasPatternDOMConstructor) }; + +template<> JSValue JSCanvasPatternDOMConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) +{ + UNUSED_PARAM(vm); + return globalObject.functionPrototype(); +} + +template<> void JSCanvasPatternDOMConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) +{ + putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); + JSString* nameString = jsNontrivialString(vm, "CanvasPattern"_s); + m_originalName.set(vm, this, nameString); + putDirect(vm, vm.propertyNames->name, nameString, JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); + putDirect(vm, vm.propertyNames->prototype, JSCanvasPattern::prototype(vm, globalObject), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum | JSC::PropertyAttribute::DontDelete); +} + +/* Hash table for prototype */ + +static const HashTableValue JSCanvasPatternPrototypeTableValues[] = { + { "constructor", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(jsCanvasPatternConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, + { "setTransform", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(jsCanvasPatternPrototypeFunction_setTransform), (intptr_t)(0) } }, +}; + +const ClassInfo JSCanvasPatternPrototype::s_info = { "CanvasPattern"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSCanvasPatternPrototype) }; + +void JSCanvasPatternPrototype::finishCreation(VM& vm) +{ + Base::finishCreation(vm); + reifyStaticProperties(vm, JSCanvasPattern::info(), JSCanvasPatternPrototypeTableValues, *this); + JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); +} + +const ClassInfo JSCanvasPattern::s_info = { "CanvasPattern"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSCanvasPattern) }; + +JSCanvasPattern::JSCanvasPattern(Structure* structure, JSDOMGlobalObject& globalObject, Ref<CanvasPattern>&& impl) + : JSDOMWrapper<CanvasPattern>(structure, globalObject, WTFMove(impl)) +{ +} + +void JSCanvasPattern::finishCreation(VM& vm) +{ + Base::finishCreation(vm); + ASSERT(inherits(vm, info())); + + // static_assert(!std::is_base_of<ActiveDOMObject, CanvasPattern>::value, "Interface is not marked as [ActiveDOMObject] even though implementation class subclasses ActiveDOMObject."); +} + +JSObject* JSCanvasPattern::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) +{ + return JSCanvasPatternPrototype::create(vm, &globalObject, JSCanvasPatternPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype())); +} + +JSObject* JSCanvasPattern::prototype(VM& vm, JSDOMGlobalObject& globalObject) +{ + return getDOMPrototype<JSCanvasPattern>(vm, globalObject); +} + +JSValue JSCanvasPattern::getConstructor(VM& vm, const JSGlobalObject* globalObject) +{ + return getDOMConstructor<JSCanvasPatternDOMConstructor, DOMConstructorID::CanvasPattern>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); +} + +void JSCanvasPattern::destroy(JSC::JSCell* cell) +{ + JSCanvasPattern* thisObject = static_cast<JSCanvasPattern*>(cell); + thisObject->JSCanvasPattern::~JSCanvasPattern(); +} + +JSC_DEFINE_CUSTOM_GETTER(jsCanvasPatternConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) +{ + VM& vm = JSC::getVM(lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto* prototype = jsDynamicCast<JSCanvasPatternPrototype*>(vm, JSValue::decode(thisValue)); + if (UNLIKELY(!prototype)) + return throwVMTypeError(lexicalGlobalObject, throwScope); + return JSValue::encode(JSCanvasPattern::getConstructor(JSC::getVM(lexicalGlobalObject), prototype->globalObject())); +} + +static inline JSC::EncodedJSValue jsCanvasPatternPrototypeFunction_setTransformBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSCanvasPattern>::ClassParameter castedThis) +{ + return JSC::JSValue::encode(JSC::jsUndefined()); + // auto& vm = JSC::getVM(lexicalGlobalObject); + // auto throwScope = DECLARE_THROW_SCOPE(vm); + // UNUSED_PARAM(throwScope); + // UNUSED_PARAM(callFrame); + // auto& impl = castedThis->wrapped(); + // EnsureStillAliveScope argument0 = callFrame->argument(0); + // auto transform = convert<IDLDictionary<DOMMatrix2DInit>>(*lexicalGlobalObject, argument0.value()); + // RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + // RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS<IDLUndefined>(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.setTransform(WTFMove(transform)); }))); +} + +JSC_DEFINE_HOST_FUNCTION(jsCanvasPatternPrototypeFunction_setTransform, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + return IDLOperation<JSCanvasPattern>::call<jsCanvasPatternPrototypeFunction_setTransformBody>(*lexicalGlobalObject, *callFrame, "setTransform"); +} + +JSC::GCClient::IsoSubspace* JSCanvasPattern::subspaceForImpl(JSC::VM& vm) +{ + return WebCore::subspaceForImpl<JSCanvasPattern, UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForCanvasPattern.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForCanvasPattern = WTFMove(space); }, + [](auto& spaces) { return spaces.m_subspaceForCanvasPattern.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForCanvasPattern = WTFMove(space); }); +} + +void JSCanvasPattern::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) +{ + auto* thisObject = jsCast<JSCanvasPattern*>(cell); + analyzer.setWrappedObjectForCell(cell, &thisObject->wrapped()); + if (thisObject->scriptExecutionContext()) + analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); + Base::analyzeHeap(cell, analyzer); +} + +bool JSCanvasPatternOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, AbstractSlotVisitor& visitor, const char** reason) +{ + UNUSED_PARAM(handle); + UNUSED_PARAM(visitor); + UNUSED_PARAM(reason); + return false; +} + +void JSCanvasPatternOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) +{ + auto* jsCanvasPattern = static_cast<JSCanvasPattern*>(handle.slot()->asCell()); + auto& world = *static_cast<DOMWrapperWorld*>(context); + uncacheWrapper(world, &jsCanvasPattern->wrapped(), jsCanvasPattern); +} + +#if ENABLE(BINDING_INTEGRITY) +#if PLATFORM(WIN) +#pragma warning(disable : 4483) +extern "C" { +extern void (*const __identifier("??_7CanvasPattern@WebCore@@6B@")[])(); +} +#else +extern "C" { +extern void* _ZTVN7WebCore13CanvasPatternE[]; +} +#endif +#endif + +JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject*, JSDOMGlobalObject* globalObject, Ref<CanvasPattern>&& impl) +{ + + // if constexpr (std::is_polymorphic_v<CanvasPattern>) { + // #if ENABLE(BINDING_INTEGRITY) + // const void* actualVTablePointer = getVTablePointer(impl.ptr()); + // #if PLATFORM(WIN) + // void* expectedVTablePointer = __identifier("??_7CanvasPattern@WebCore@@6B@"); + // #else + // void* expectedVTablePointer = &_ZTVN7WebCore13CanvasPatternE[2]; + // #endif + + // // If you hit this assertion you either have a use after free bug, or + // // CanvasPattern has subclasses. If CanvasPattern has subclasses that get passed + // // to toJS() we currently require CanvasPattern you to opt out of binding hardening + // // by adding the SkipVTableValidation attribute to the interface IDL definition + // RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer); + // #endif + // } + return createWrapper<CanvasPattern>(globalObject, WTFMove(impl)); +} + +JSC::JSValue toJS(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, CanvasPattern& impl) +{ + return wrap(lexicalGlobalObject, globalObject, impl); +} + +CanvasPattern* JSCanvasPattern::toWrapped(JSC::VM& vm, JSC::JSValue value) +{ + if (auto* wrapper = jsDynamicCast<JSCanvasPattern*>(vm, value)) + return &wrapper->wrapped(); + return nullptr; +} + +} diff --git a/src/javascript/jsc/bindings/webcore/JSCanvasPattern.dep b/src/javascript/jsc/bindings/webcore/JSCanvasPattern.dep new file mode 100644 index 000000000..83d0a8e90 --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/JSCanvasPattern.dep @@ -0,0 +1 @@ +JSCanvasPattern.h : diff --git a/src/javascript/jsc/bindings/webcore/JSCanvasPattern.h b/src/javascript/jsc/bindings/webcore/JSCanvasPattern.h new file mode 100644 index 000000000..c9c555b5d --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/JSCanvasPattern.h @@ -0,0 +1,93 @@ +/* + 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. +*/ + +#pragma once + +#include "CanvasPattern.h" +#include "JSDOMWrapper.h" +#include <wtf/NeverDestroyed.h> + +namespace WebCore { + +class JSCanvasPattern : public JSDOMWrapper<CanvasPattern> { +public: + using Base = JSDOMWrapper<CanvasPattern>; + static JSCanvasPattern* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref<CanvasPattern>&& impl) + { + JSCanvasPattern* ptr = new (NotNull, JSC::allocateCell<JSCanvasPattern>(globalObject->vm())) JSCanvasPattern(structure, *globalObject, WTFMove(impl)); + ptr->finishCreation(globalObject->vm()); + return ptr; + } + + static JSC::JSObject* createPrototype(JSC::VM&, JSDOMGlobalObject&); + static JSC::JSObject* prototype(JSC::VM&, JSDOMGlobalObject&); + static CanvasPattern* toWrapped(JSC::VM&, JSC::JSValue); + static void destroy(JSC::JSCell*); + + DECLARE_INFO; + + 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(), JSC::NonArray); + } + + static JSC::JSValue getConstructor(JSC::VM&, const JSC::JSGlobalObject*); + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return subspaceForImpl(vm); + } + static JSC::GCClient::IsoSubspace* subspaceForImpl(JSC::VM& vm); + static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); +protected: + JSCanvasPattern(JSC::Structure*, JSDOMGlobalObject&, Ref<CanvasPattern>&&); + + void finishCreation(JSC::VM&); +}; + +class JSCanvasPatternOwner final : public JSC::WeakHandleOwner { +public: + bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::AbstractSlotVisitor&, const char**) final; + void finalize(JSC::Handle<JSC::Unknown>, void* context) final; +}; + +inline JSC::WeakHandleOwner* wrapperOwner(DOMWrapperWorld&, CanvasPattern*) +{ + static NeverDestroyed<JSCanvasPatternOwner> owner; + return &owner.get(); +} + +inline void* wrapperKey(CanvasPattern* wrappableObject) +{ + return wrappableObject; +} + +JSC::JSValue toJS(JSC::JSGlobalObject*, JSDOMGlobalObject*, CanvasPattern&); +inline JSC::JSValue toJS(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, CanvasPattern* impl) { return impl ? toJS(lexicalGlobalObject, globalObject, *impl) : JSC::jsNull(); } +JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject*, JSDOMGlobalObject*, Ref<CanvasPattern>&&); +inline JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, RefPtr<CanvasPattern>&& impl) { return impl ? toJSNewlyCreated(lexicalGlobalObject, globalObject, impl.releaseNonNull()) : JSC::jsNull(); } + +template<> struct JSDOMWrapperConverterTraits<CanvasPattern> { + using WrapperClass = JSCanvasPattern; + using ToWrappedReturnType = CanvasPattern*; +}; + +} // namespace WebCore diff --git a/src/javascript/jsc/bindings/webcore/JSCanvasRect.cpp b/src/javascript/jsc/bindings/webcore/JSCanvasRect.cpp new file mode 100644 index 000000000..6a245d520 --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/JSCanvasRect.cpp @@ -0,0 +1,5 @@ +/* + This file is generated to inform build scripts that JSCanvasRect.h and + JSCanvasRect.cpp were created for CanvasRect.idl, and prevent the build + scripts from trying to regenerate JSCanvasRect.h and JSCanvasRect.cpp on every build. +*/ diff --git a/src/javascript/jsc/bindings/webcore/JSCanvasRect.h b/src/javascript/jsc/bindings/webcore/JSCanvasRect.h new file mode 100644 index 000000000..6a245d520 --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/JSCanvasRect.h @@ -0,0 +1,5 @@ +/* + This file is generated to inform build scripts that JSCanvasRect.h and + JSCanvasRect.cpp were created for CanvasRect.idl, and prevent the build + scripts from trying to regenerate JSCanvasRect.h and JSCanvasRect.cpp on every build. +*/ diff --git a/src/javascript/jsc/bindings/webcore/JSCanvasRenderingContext2DSettings.cpp b/src/javascript/jsc/bindings/webcore/JSCanvasRenderingContext2DSettings.cpp new file mode 100644 index 000000000..4b823ea95 --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/JSCanvasRenderingContext2DSettings.cpp @@ -0,0 +1,75 @@ +/* + 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 "JSCanvasRenderingContext2DSettings.h" + +#include "JSDOMConvertBoolean.h" +#include "JSDOMConvertEnumeration.h" +#include "JSDOMGlobalObject.h" +// #include "JSPredefinedColorSpace.h" +#include "ScriptExecutionContext.h" +#include <JavaScriptCore/JSCInlines.h> +#include <JavaScriptCore/ObjectConstructor.h> + +namespace WebCore { +using namespace JSC; + +template<> CanvasRenderingContext2DSettings convertDictionary<CanvasRenderingContext2DSettings>(JSGlobalObject& lexicalGlobalObject, JSValue value) +{ + VM& vm = JSC::getVM(&lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + bool isNullOrUndefined = value.isUndefinedOrNull(); + auto* object = isNullOrUndefined ? nullptr : value.getObject(); + if (UNLIKELY(!isNullOrUndefined && !object)) { + throwTypeError(&lexicalGlobalObject, throwScope); + return {}; + } + CanvasRenderingContext2DSettings result; + + JSValue desynchronizedValue; + if (isNullOrUndefined) + desynchronizedValue = jsUndefined(); + else { + desynchronizedValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "desynchronized"_s)); + RETURN_IF_EXCEPTION(throwScope, {}); + } + if (!desynchronizedValue.isUndefined()) { + result.desynchronized = convert<IDLBoolean>(lexicalGlobalObject, desynchronizedValue); + RETURN_IF_EXCEPTION(throwScope, {}); + } else + result.desynchronized = false; + return result; +} + +JSC::JSObject* convertDictionaryToJS(JSC::JSGlobalObject& lexicalGlobalObject, JSDOMGlobalObject& globalObject, const CanvasRenderingContext2DSettings& dictionary) +{ + auto& vm = JSC::getVM(&lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + + auto result = constructEmptyObject(&lexicalGlobalObject, globalObject.objectPrototype()); + + auto desynchronizedValue = toJS<IDLBoolean>(lexicalGlobalObject, throwScope, dictionary.desynchronized); + RETURN_IF_EXCEPTION(throwScope, {}); + result->putDirect(vm, JSC::Identifier::fromString(vm, "desynchronized"), desynchronizedValue); + return result; +} + +} // namespace WebCore diff --git a/src/javascript/jsc/bindings/webcore/JSCanvasRenderingContext2DSettings.dep b/src/javascript/jsc/bindings/webcore/JSCanvasRenderingContext2DSettings.dep new file mode 100644 index 000000000..55e31b26c --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/JSCanvasRenderingContext2DSettings.dep @@ -0,0 +1 @@ +CanvasRenderingContext2DSettings.h : diff --git a/src/javascript/jsc/bindings/webcore/JSCanvasRenderingContext2DSettings.h b/src/javascript/jsc/bindings/webcore/JSCanvasRenderingContext2DSettings.h new file mode 100644 index 000000000..2d8106f0b --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/JSCanvasRenderingContext2DSettings.h @@ -0,0 +1,32 @@ +/* + 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. +*/ + +#pragma once + +#include "CanvasRenderingContext2DSettings.h" +#include "JSDOMConvertDictionary.h" + +namespace WebCore { + +template<> CanvasRenderingContext2DSettings convertDictionary<CanvasRenderingContext2DSettings>(JSC::JSGlobalObject&, JSC::JSValue); + +JSC::JSObject* convertDictionaryToJS(JSC::JSGlobalObject&, JSDOMGlobalObject&, const CanvasRenderingContext2DSettings&); + +} // namespace WebCore diff --git a/src/javascript/jsc/bindings/webcore/JSCanvasShadowStyles.cpp b/src/javascript/jsc/bindings/webcore/JSCanvasShadowStyles.cpp new file mode 100644 index 000000000..41f8800dc --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/JSCanvasShadowStyles.cpp @@ -0,0 +1,5 @@ +/* + This file is generated to inform build scripts that JSCanvasShadowStyles.h and + JSCanvasShadowStyles.cpp were created for CanvasShadowStyles.idl, and prevent the build + scripts from trying to regenerate JSCanvasShadowStyles.h and JSCanvasShadowStyles.cpp on every build. +*/ diff --git a/src/javascript/jsc/bindings/webcore/JSCanvasShadowStyles.h b/src/javascript/jsc/bindings/webcore/JSCanvasShadowStyles.h new file mode 100644 index 000000000..41f8800dc --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/JSCanvasShadowStyles.h @@ -0,0 +1,5 @@ +/* + This file is generated to inform build scripts that JSCanvasShadowStyles.h and + JSCanvasShadowStyles.cpp were created for CanvasShadowStyles.idl, and prevent the build + scripts from trying to regenerate JSCanvasShadowStyles.h and JSCanvasShadowStyles.cpp on every build. +*/ diff --git a/src/javascript/jsc/bindings/webcore/JSCanvasState.cpp b/src/javascript/jsc/bindings/webcore/JSCanvasState.cpp new file mode 100644 index 000000000..e49e77a20 --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/JSCanvasState.cpp @@ -0,0 +1,5 @@ +/* + This file is generated to inform build scripts that JSCanvasState.h and + JSCanvasState.cpp were created for CanvasState.idl, and prevent the build + scripts from trying to regenerate JSCanvasState.h and JSCanvasState.cpp on every build. +*/ diff --git a/src/javascript/jsc/bindings/webcore/JSCanvasState.h b/src/javascript/jsc/bindings/webcore/JSCanvasState.h new file mode 100644 index 000000000..e49e77a20 --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/JSCanvasState.h @@ -0,0 +1,5 @@ +/* + This file is generated to inform build scripts that JSCanvasState.h and + JSCanvasState.cpp were created for CanvasState.idl, and prevent the build + scripts from trying to regenerate JSCanvasState.h and JSCanvasState.cpp on every build. +*/ diff --git a/src/javascript/jsc/bindings/webcore/JSCanvasText.cpp b/src/javascript/jsc/bindings/webcore/JSCanvasText.cpp new file mode 100644 index 000000000..2dec6a394 --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/JSCanvasText.cpp @@ -0,0 +1,5 @@ +/* + This file is generated to inform build scripts that JSCanvasText.h and + JSCanvasText.cpp were created for CanvasText.idl, and prevent the build + scripts from trying to regenerate JSCanvasText.h and JSCanvasText.cpp on every build. +*/ diff --git a/src/javascript/jsc/bindings/webcore/JSCanvasText.h b/src/javascript/jsc/bindings/webcore/JSCanvasText.h new file mode 100644 index 000000000..2dec6a394 --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/JSCanvasText.h @@ -0,0 +1,5 @@ +/* + This file is generated to inform build scripts that JSCanvasText.h and + JSCanvasText.cpp were created for CanvasText.idl, and prevent the build + scripts from trying to regenerate JSCanvasText.h and JSCanvasText.cpp on every build. +*/ diff --git a/src/javascript/jsc/bindings/webcore/JSCanvasTextAlign.cpp b/src/javascript/jsc/bindings/webcore/JSCanvasTextAlign.cpp new file mode 100644 index 000000000..25d23cc1c --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/JSCanvasTextAlign.cpp @@ -0,0 +1,76 @@ +/* + 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 "JSCanvasTextAlign.h" + +#include <JavaScriptCore/JSCInlines.h> +#include <JavaScriptCore/JSString.h> +#include <wtf/NeverDestroyed.h> + + +namespace WebCore { +using namespace JSC; + +String convertEnumerationToString(CanvasTextAlign enumerationValue) +{ + static const NeverDestroyed<String> values[] = { + MAKE_STATIC_STRING_IMPL("start"), + MAKE_STATIC_STRING_IMPL("end"), + MAKE_STATIC_STRING_IMPL("left"), + MAKE_STATIC_STRING_IMPL("right"), + MAKE_STATIC_STRING_IMPL("center"), + }; + static_assert(static_cast<size_t>(CanvasTextAlign::Start) == 0, "CanvasTextAlign::Start is not 0 as expected"); + static_assert(static_cast<size_t>(CanvasTextAlign::End) == 1, "CanvasTextAlign::End is not 1 as expected"); + static_assert(static_cast<size_t>(CanvasTextAlign::Left) == 2, "CanvasTextAlign::Left is not 2 as expected"); + static_assert(static_cast<size_t>(CanvasTextAlign::Right) == 3, "CanvasTextAlign::Right is not 3 as expected"); + static_assert(static_cast<size_t>(CanvasTextAlign::Center) == 4, "CanvasTextAlign::Center is not 4 as expected"); + ASSERT(static_cast<size_t>(enumerationValue) < WTF_ARRAY_LENGTH(values)); + return values[static_cast<size_t>(enumerationValue)]; +} + +template<> JSString* convertEnumerationToJS(JSGlobalObject& lexicalGlobalObject, CanvasTextAlign enumerationValue) +{ + return jsStringWithCache(lexicalGlobalObject.vm(), convertEnumerationToString(enumerationValue)); +} + +template<> std::optional<CanvasTextAlign> parseEnumeration<CanvasTextAlign>(JSGlobalObject& lexicalGlobalObject, JSValue value) +{ + auto stringValue = value.toWTFString(&lexicalGlobalObject); + if (stringValue == "start") + return CanvasTextAlign::Start; + if (stringValue == "end") + return CanvasTextAlign::End; + if (stringValue == "left") + return CanvasTextAlign::Left; + if (stringValue == "right") + return CanvasTextAlign::Right; + if (stringValue == "center") + return CanvasTextAlign::Center; + return std::nullopt; +} + +template<> const char* expectedEnumerationValues<CanvasTextAlign>() +{ + return "\"start\", \"end\", \"left\", \"right\", \"center\""; +} + +} // namespace WebCore diff --git a/src/javascript/jsc/bindings/webcore/JSCanvasTextAlign.h b/src/javascript/jsc/bindings/webcore/JSCanvasTextAlign.h new file mode 100644 index 000000000..7f387432b --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/JSCanvasTextAlign.h @@ -0,0 +1,34 @@ +/* + 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. +*/ + +#pragma once + +#include "CanvasTextAlign.h" +#include "JSDOMConvertEnumeration.h" + +namespace WebCore { + +String convertEnumerationToString(CanvasTextAlign); +template<> JSC::JSString* convertEnumerationToJS(JSC::JSGlobalObject&, CanvasTextAlign); + +template<> std::optional<CanvasTextAlign> parseEnumeration<CanvasTextAlign>(JSC::JSGlobalObject&, JSC::JSValue); +template<> const char* expectedEnumerationValues<CanvasTextAlign>(); + +} // namespace WebCore diff --git a/src/javascript/jsc/bindings/webcore/JSCanvasTextBaseline.cpp b/src/javascript/jsc/bindings/webcore/JSCanvasTextBaseline.cpp new file mode 100644 index 000000000..55003c11e --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/JSCanvasTextBaseline.cpp @@ -0,0 +1,80 @@ +/* + 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 "JSCanvasTextBaseline.h" + +#include <JavaScriptCore/JSCInlines.h> +#include <JavaScriptCore/JSString.h> +#include <wtf/NeverDestroyed.h> + + +namespace WebCore { +using namespace JSC; + +String convertEnumerationToString(CanvasTextBaseline enumerationValue) +{ + static const NeverDestroyed<String> values[] = { + MAKE_STATIC_STRING_IMPL("top"), + MAKE_STATIC_STRING_IMPL("hanging"), + MAKE_STATIC_STRING_IMPL("middle"), + MAKE_STATIC_STRING_IMPL("alphabetic"), + MAKE_STATIC_STRING_IMPL("ideographic"), + MAKE_STATIC_STRING_IMPL("bottom"), + }; + static_assert(static_cast<size_t>(CanvasTextBaseline::Top) == 0, "CanvasTextBaseline::Top is not 0 as expected"); + static_assert(static_cast<size_t>(CanvasTextBaseline::Hanging) == 1, "CanvasTextBaseline::Hanging is not 1 as expected"); + static_assert(static_cast<size_t>(CanvasTextBaseline::Middle) == 2, "CanvasTextBaseline::Middle is not 2 as expected"); + static_assert(static_cast<size_t>(CanvasTextBaseline::Alphabetic) == 3, "CanvasTextBaseline::Alphabetic is not 3 as expected"); + static_assert(static_cast<size_t>(CanvasTextBaseline::Ideographic) == 4, "CanvasTextBaseline::Ideographic is not 4 as expected"); + static_assert(static_cast<size_t>(CanvasTextBaseline::Bottom) == 5, "CanvasTextBaseline::Bottom is not 5 as expected"); + ASSERT(static_cast<size_t>(enumerationValue) < WTF_ARRAY_LENGTH(values)); + return values[static_cast<size_t>(enumerationValue)]; +} + +template<> JSString* convertEnumerationToJS(JSGlobalObject& lexicalGlobalObject, CanvasTextBaseline enumerationValue) +{ + return jsStringWithCache(lexicalGlobalObject.vm(), convertEnumerationToString(enumerationValue)); +} + +template<> std::optional<CanvasTextBaseline> parseEnumeration<CanvasTextBaseline>(JSGlobalObject& lexicalGlobalObject, JSValue value) +{ + auto stringValue = value.toWTFString(&lexicalGlobalObject); + if (stringValue == "top") + return CanvasTextBaseline::Top; + if (stringValue == "hanging") + return CanvasTextBaseline::Hanging; + if (stringValue == "middle") + return CanvasTextBaseline::Middle; + if (stringValue == "alphabetic") + return CanvasTextBaseline::Alphabetic; + if (stringValue == "ideographic") + return CanvasTextBaseline::Ideographic; + if (stringValue == "bottom") + return CanvasTextBaseline::Bottom; + return std::nullopt; +} + +template<> const char* expectedEnumerationValues<CanvasTextBaseline>() +{ + return "\"top\", \"hanging\", \"middle\", \"alphabetic\", \"ideographic\", \"bottom\""; +} + +} // namespace WebCore diff --git a/src/javascript/jsc/bindings/webcore/JSCanvasTextBaseline.h b/src/javascript/jsc/bindings/webcore/JSCanvasTextBaseline.h new file mode 100644 index 000000000..fdef7f283 --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/JSCanvasTextBaseline.h @@ -0,0 +1,34 @@ +/* + 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. +*/ + +#pragma once + +#include "CanvasTextBaseline.h" +#include "JSDOMConvertEnumeration.h" + +namespace WebCore { + +String convertEnumerationToString(CanvasTextBaseline); +template<> JSC::JSString* convertEnumerationToJS(JSC::JSGlobalObject&, CanvasTextBaseline); + +template<> std::optional<CanvasTextBaseline> parseEnumeration<CanvasTextBaseline>(JSC::JSGlobalObject&, JSC::JSValue); +template<> const char* expectedEnumerationValues<CanvasTextBaseline>(); + +} // namespace WebCore diff --git a/src/javascript/jsc/bindings/webcore/JSCanvasTextDrawingStyles.cpp b/src/javascript/jsc/bindings/webcore/JSCanvasTextDrawingStyles.cpp new file mode 100644 index 000000000..485ea4034 --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/JSCanvasTextDrawingStyles.cpp @@ -0,0 +1,5 @@ +/* + This file is generated to inform build scripts that JSCanvasTextDrawingStyles.h and + JSCanvasTextDrawingStyles.cpp were created for CanvasTextDrawingStyles.idl, and prevent the build + scripts from trying to regenerate JSCanvasTextDrawingStyles.h and JSCanvasTextDrawingStyles.cpp on every build. +*/ diff --git a/src/javascript/jsc/bindings/webcore/JSCanvasTextDrawingStyles.h b/src/javascript/jsc/bindings/webcore/JSCanvasTextDrawingStyles.h new file mode 100644 index 000000000..485ea4034 --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/JSCanvasTextDrawingStyles.h @@ -0,0 +1,5 @@ +/* + This file is generated to inform build scripts that JSCanvasTextDrawingStyles.h and + JSCanvasTextDrawingStyles.cpp were created for CanvasTextDrawingStyles.idl, and prevent the build + scripts from trying to regenerate JSCanvasTextDrawingStyles.h and JSCanvasTextDrawingStyles.cpp on every build. +*/ diff --git a/src/javascript/jsc/bindings/webcore/JSCanvasTransform.cpp b/src/javascript/jsc/bindings/webcore/JSCanvasTransform.cpp new file mode 100644 index 000000000..4ea9d3a9a --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/JSCanvasTransform.cpp @@ -0,0 +1,5 @@ +/* + This file is generated to inform build scripts that JSCanvasTransform.h and + JSCanvasTransform.cpp were created for CanvasTransform.idl, and prevent the build + scripts from trying to regenerate JSCanvasTransform.h and JSCanvasTransform.cpp on every build. +*/ diff --git a/src/javascript/jsc/bindings/webcore/JSCanvasTransform.h b/src/javascript/jsc/bindings/webcore/JSCanvasTransform.h new file mode 100644 index 000000000..4ea9d3a9a --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/JSCanvasTransform.h @@ -0,0 +1,5 @@ +/* + This file is generated to inform build scripts that JSCanvasTransform.h and + JSCanvasTransform.cpp were created for CanvasTransform.idl, and prevent the build + scripts from trying to regenerate JSCanvasTransform.h and JSCanvasTransform.cpp on every build. +*/ diff --git a/src/javascript/jsc/bindings/webcore/JSDOMMatrix2DInit.cpp b/src/javascript/jsc/bindings/webcore/JSDOMMatrix2DInit.cpp new file mode 100644 index 000000000..4d793f2d2 --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/JSDOMMatrix2DInit.cpp @@ -0,0 +1,177 @@ +/* + 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 "JSDOMMatrix2DInit.h" + +#include "JSDOMConvertNumbers.h" +#include <JavaScriptCore/JSCInlines.h> + + +namespace WebCore { +using namespace JSC; + +template<> DOMMatrix2DInit convertDictionary<DOMMatrix2DInit>(JSGlobalObject& lexicalGlobalObject, JSValue value) +{ + VM& vm = JSC::getVM(&lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + bool isNullOrUndefined = value.isUndefinedOrNull(); + auto* object = isNullOrUndefined ? nullptr : value.getObject(); + if (UNLIKELY(!isNullOrUndefined && !object)) { + throwTypeError(&lexicalGlobalObject, throwScope); + return { }; + } + DOMMatrix2DInit result; + JSValue aValue; + if (isNullOrUndefined) + aValue = jsUndefined(); + else { + aValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "a")); + RETURN_IF_EXCEPTION(throwScope, { }); + } + if (!aValue.isUndefined()) { + result.a = convert<IDLUnrestrictedDouble>(lexicalGlobalObject, aValue); + RETURN_IF_EXCEPTION(throwScope, { }); + } + JSValue bValue; + if (isNullOrUndefined) + bValue = jsUndefined(); + else { + bValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "b")); + RETURN_IF_EXCEPTION(throwScope, { }); + } + if (!bValue.isUndefined()) { + result.b = convert<IDLUnrestrictedDouble>(lexicalGlobalObject, bValue); + RETURN_IF_EXCEPTION(throwScope, { }); + } + JSValue cValue; + if (isNullOrUndefined) + cValue = jsUndefined(); + else { + cValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "c")); + RETURN_IF_EXCEPTION(throwScope, { }); + } + if (!cValue.isUndefined()) { + result.c = convert<IDLUnrestrictedDouble>(lexicalGlobalObject, cValue); + RETURN_IF_EXCEPTION(throwScope, { }); + } + JSValue dValue; + if (isNullOrUndefined) + dValue = jsUndefined(); + else { + dValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "d")); + RETURN_IF_EXCEPTION(throwScope, { }); + } + if (!dValue.isUndefined()) { + result.d = convert<IDLUnrestrictedDouble>(lexicalGlobalObject, dValue); + RETURN_IF_EXCEPTION(throwScope, { }); + } + JSValue eValue; + if (isNullOrUndefined) + eValue = jsUndefined(); + else { + eValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "e")); + RETURN_IF_EXCEPTION(throwScope, { }); + } + if (!eValue.isUndefined()) { + result.e = convert<IDLUnrestrictedDouble>(lexicalGlobalObject, eValue); + RETURN_IF_EXCEPTION(throwScope, { }); + } + JSValue fValue; + if (isNullOrUndefined) + fValue = jsUndefined(); + else { + fValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "f")); + RETURN_IF_EXCEPTION(throwScope, { }); + } + if (!fValue.isUndefined()) { + result.f = convert<IDLUnrestrictedDouble>(lexicalGlobalObject, fValue); + RETURN_IF_EXCEPTION(throwScope, { }); + } + JSValue m11Value; + if (isNullOrUndefined) + m11Value = jsUndefined(); + else { + m11Value = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "m11")); + RETURN_IF_EXCEPTION(throwScope, { }); + } + if (!m11Value.isUndefined()) { + result.m11 = convert<IDLUnrestrictedDouble>(lexicalGlobalObject, m11Value); + RETURN_IF_EXCEPTION(throwScope, { }); + } + JSValue m12Value; + if (isNullOrUndefined) + m12Value = jsUndefined(); + else { + m12Value = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "m12")); + RETURN_IF_EXCEPTION(throwScope, { }); + } + if (!m12Value.isUndefined()) { + result.m12 = convert<IDLUnrestrictedDouble>(lexicalGlobalObject, m12Value); + RETURN_IF_EXCEPTION(throwScope, { }); + } + JSValue m21Value; + if (isNullOrUndefined) + m21Value = jsUndefined(); + else { + m21Value = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "m21")); + RETURN_IF_EXCEPTION(throwScope, { }); + } + if (!m21Value.isUndefined()) { + result.m21 = convert<IDLUnrestrictedDouble>(lexicalGlobalObject, m21Value); + RETURN_IF_EXCEPTION(throwScope, { }); + } + JSValue m22Value; + if (isNullOrUndefined) + m22Value = jsUndefined(); + else { + m22Value = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "m22")); + RETURN_IF_EXCEPTION(throwScope, { }); + } + if (!m22Value.isUndefined()) { + result.m22 = convert<IDLUnrestrictedDouble>(lexicalGlobalObject, m22Value); + RETURN_IF_EXCEPTION(throwScope, { }); + } + JSValue m41Value; + if (isNullOrUndefined) + m41Value = jsUndefined(); + else { + m41Value = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "m41")); + RETURN_IF_EXCEPTION(throwScope, { }); + } + if (!m41Value.isUndefined()) { + result.m41 = convert<IDLUnrestrictedDouble>(lexicalGlobalObject, m41Value); + RETURN_IF_EXCEPTION(throwScope, { }); + } + JSValue m42Value; + if (isNullOrUndefined) + m42Value = jsUndefined(); + else { + m42Value = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "m42")); + RETURN_IF_EXCEPTION(throwScope, { }); + } + if (!m42Value.isUndefined()) { + result.m42 = convert<IDLUnrestrictedDouble>(lexicalGlobalObject, m42Value); + RETURN_IF_EXCEPTION(throwScope, { }); + } + return result; +} + +} // namespace WebCore diff --git a/src/javascript/jsc/bindings/webcore/JSDOMMatrix2DInit.dep b/src/javascript/jsc/bindings/webcore/JSDOMMatrix2DInit.dep new file mode 100644 index 000000000..68b576dbc --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/JSDOMMatrix2DInit.dep @@ -0,0 +1 @@ +DOMMatrix2DInit.h : diff --git a/src/javascript/jsc/bindings/webcore/JSDOMMatrix2DInit.h b/src/javascript/jsc/bindings/webcore/JSDOMMatrix2DInit.h new file mode 100644 index 000000000..6e8cfb661 --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/JSDOMMatrix2DInit.h @@ -0,0 +1,30 @@ +/* + 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. +*/ + +#pragma once + +#include "DOMMatrix2DInit.h" +#include "JSDOMConvertDictionary.h" + +namespace WebCore { + +template<> DOMMatrix2DInit convertDictionary<DOMMatrix2DInit>(JSC::JSGlobalObject&, JSC::JSValue); + +} // namespace WebCore diff --git a/src/javascript/jsc/bindings/webcore/JSDOMPointInit.cpp b/src/javascript/jsc/bindings/webcore/JSDOMPointInit.cpp new file mode 100644 index 000000000..57a670863 --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/JSDOMPointInit.cpp @@ -0,0 +1,93 @@ +/* + 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 "JSDOMPointInit.h" + +#include "JSDOMConvertNumbers.h" +#include <JavaScriptCore/JSCInlines.h> + + +namespace WebCore { +using namespace JSC; + +template<> DOMPointInit convertDictionary<DOMPointInit>(JSGlobalObject& lexicalGlobalObject, JSValue value) +{ + VM& vm = JSC::getVM(&lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + bool isNullOrUndefined = value.isUndefinedOrNull(); + auto* object = isNullOrUndefined ? nullptr : value.getObject(); + if (UNLIKELY(!isNullOrUndefined && !object)) { + throwTypeError(&lexicalGlobalObject, throwScope); + return { }; + } + DOMPointInit result; + JSValue wValue; + if (isNullOrUndefined) + wValue = jsUndefined(); + else { + wValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "w")); + RETURN_IF_EXCEPTION(throwScope, { }); + } + if (!wValue.isUndefined()) { + result.w = convert<IDLUnrestrictedDouble>(lexicalGlobalObject, wValue); + RETURN_IF_EXCEPTION(throwScope, { }); + } else + result.w = 1; + JSValue xValue; + if (isNullOrUndefined) + xValue = jsUndefined(); + else { + xValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "x")); + RETURN_IF_EXCEPTION(throwScope, { }); + } + if (!xValue.isUndefined()) { + result.x = convert<IDLUnrestrictedDouble>(lexicalGlobalObject, xValue); + RETURN_IF_EXCEPTION(throwScope, { }); + } else + result.x = 0; + JSValue yValue; + if (isNullOrUndefined) + yValue = jsUndefined(); + else { + yValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "y")); + RETURN_IF_EXCEPTION(throwScope, { }); + } + if (!yValue.isUndefined()) { + result.y = convert<IDLUnrestrictedDouble>(lexicalGlobalObject, yValue); + RETURN_IF_EXCEPTION(throwScope, { }); + } else + result.y = 0; + JSValue zValue; + if (isNullOrUndefined) + zValue = jsUndefined(); + else { + zValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "z")); + RETURN_IF_EXCEPTION(throwScope, { }); + } + if (!zValue.isUndefined()) { + result.z = convert<IDLUnrestrictedDouble>(lexicalGlobalObject, zValue); + RETURN_IF_EXCEPTION(throwScope, { }); + } else + result.z = 0; + return result; +} + +} // namespace WebCore diff --git a/src/javascript/jsc/bindings/webcore/JSDOMPointInit.dep b/src/javascript/jsc/bindings/webcore/JSDOMPointInit.dep new file mode 100644 index 000000000..fa214034b --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/JSDOMPointInit.dep @@ -0,0 +1 @@ +DOMPointInit.h : diff --git a/src/javascript/jsc/bindings/webcore/JSDOMPointInit.h b/src/javascript/jsc/bindings/webcore/JSDOMPointInit.h new file mode 100644 index 000000000..caf5cadca --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/JSDOMPointInit.h @@ -0,0 +1,30 @@ +/* + 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. +*/ + +#pragma once + +#include "DOMPointInit.h" +#include "JSDOMConvertDictionary.h" + +namespace WebCore { + +template<> DOMPointInit convertDictionary<DOMPointInit>(JSC::JSGlobalObject&, JSC::JSValue); + +} // namespace WebCore diff --git a/src/javascript/jsc/bindings/webcore/JSEventTargetCustom.cpp b/src/javascript/jsc/bindings/webcore/JSEventTargetCustom.cpp index cc63b0c0c..2856b2377 100644 --- a/src/javascript/jsc/bindings/webcore/JSEventTargetCustom.cpp +++ b/src/javascript/jsc/bindings/webcore/JSEventTargetCustom.cpp @@ -37,9 +37,9 @@ // #include "JSWorkerGlobalScope.h" // #include "WorkerGlobalScope.h" -#if ENABLE(OFFSCREEN_CANVAS) +// #if ENABLE(OFFSCREEN_CANVAS) #include "OffscreenCanvas.h" -#endif +// #endif namespace WebCore { using namespace JSC; diff --git a/src/javascript/jsc/bindings/webcore/JSImageSmoothingQuality.cpp b/src/javascript/jsc/bindings/webcore/JSImageSmoothingQuality.cpp new file mode 100644 index 000000000..ba1238421 --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/JSImageSmoothingQuality.cpp @@ -0,0 +1,68 @@ +/* + 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 "JSImageSmoothingQuality.h" + +#include <JavaScriptCore/JSCInlines.h> +#include <JavaScriptCore/JSString.h> +#include <wtf/NeverDestroyed.h> + + +namespace WebCore { +using namespace JSC; + +String convertEnumerationToString(ImageSmoothingQuality enumerationValue) +{ + static const NeverDestroyed<String> values[] = { + MAKE_STATIC_STRING_IMPL("low"), + MAKE_STATIC_STRING_IMPL("medium"), + MAKE_STATIC_STRING_IMPL("high"), + }; + static_assert(static_cast<size_t>(ImageSmoothingQuality::Low) == 0, "ImageSmoothingQuality::Low is not 0 as expected"); + static_assert(static_cast<size_t>(ImageSmoothingQuality::Medium) == 1, "ImageSmoothingQuality::Medium is not 1 as expected"); + static_assert(static_cast<size_t>(ImageSmoothingQuality::High) == 2, "ImageSmoothingQuality::High is not 2 as expected"); + ASSERT(static_cast<size_t>(enumerationValue) < WTF_ARRAY_LENGTH(values)); + return values[static_cast<size_t>(enumerationValue)]; +} + +template<> JSString* convertEnumerationToJS(JSGlobalObject& lexicalGlobalObject, ImageSmoothingQuality enumerationValue) +{ + return jsStringWithCache(lexicalGlobalObject.vm(), convertEnumerationToString(enumerationValue)); +} + +template<> std::optional<ImageSmoothingQuality> parseEnumeration<ImageSmoothingQuality>(JSGlobalObject& lexicalGlobalObject, JSValue value) +{ + auto stringValue = value.toWTFString(&lexicalGlobalObject); + if (stringValue == "low") + return ImageSmoothingQuality::Low; + if (stringValue == "medium") + return ImageSmoothingQuality::Medium; + if (stringValue == "high") + return ImageSmoothingQuality::High; + return std::nullopt; +} + +template<> const char* expectedEnumerationValues<ImageSmoothingQuality>() +{ + return "\"low\", \"medium\", \"high\""; +} + +} // namespace WebCore diff --git a/src/javascript/jsc/bindings/webcore/JSImageSmoothingQuality.h b/src/javascript/jsc/bindings/webcore/JSImageSmoothingQuality.h new file mode 100644 index 000000000..92b922ef1 --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/JSImageSmoothingQuality.h @@ -0,0 +1,34 @@ +/* + 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. +*/ + +#pragma once + +#include "ImageSmoothingQuality.h" +#include "JSDOMConvertEnumeration.h" + +namespace WebCore { + +String convertEnumerationToString(ImageSmoothingQuality); +template<> JSC::JSString* convertEnumerationToJS(JSC::JSGlobalObject&, ImageSmoothingQuality); + +template<> std::optional<ImageSmoothingQuality> parseEnumeration<ImageSmoothingQuality>(JSC::JSGlobalObject&, JSC::JSValue); +template<> const char* expectedEnumerationValues<ImageSmoothingQuality>(); + +} // namespace WebCore diff --git a/src/javascript/jsc/bindings/webcore/JSOffscreenCanvas.cpp b/src/javascript/jsc/bindings/webcore/JSOffscreenCanvas.cpp new file mode 100644 index 000000000..36f6ce2b3 --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/JSOffscreenCanvas.cpp @@ -0,0 +1,497 @@ +/* + 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 "JSOffscreenCanvas.h" + +#include "ActiveDOMObject.h" +// #include "DOMPromiseProxy.h" +#include "ExtendedDOMClientIsoSubspaces.h" +#include "ExtendedDOMIsoSubspaces.h" +// #include "JSBlob.h" +#include "JSDOMAttribute.h" +#include "JSDOMBinding.h" +#include "JSDOMConstructor.h" +#include "JSDOMConvertAny.h" +#include "JSDOMConvertInterface.h" +#include "JSDOMConvertNullable.h" +#include "JSDOMConvertNumbers.h" +// #include "JSDOMConvertPromise.h" +#include "JSDOMConvertStrings.h" +#include "JSDOMConvertUnion.h" +#include "JSDOMConvertVariadic.h" +#include "JSDOMExceptionHandling.h" +#include "JSDOMGlobalObject.h" +#include "JSDOMGlobalObjectInlines.h" +#include "JSDOMOperation.h" +// #include "JSDOMOperationReturningPromise.h" +#include "JSDOMWrapperCache.h" +// #include "JSImageBitmap.h" +#include "JSOffscreenCanvasRenderingContext2D.h" +// #include "JSWebGL2RenderingContext.h" +// #include "JSWebGLRenderingContext.h" +#include "ScriptExecutionContext.h" +#include "WebCoreJSClientData.h" +#include <JavaScriptCore/HeapAnalyzer.h> +#include <JavaScriptCore/JSCInlines.h> +#include <JavaScriptCore/JSDestructibleObjectHeapCellType.h> +#include <JavaScriptCore/JSString.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; + +String convertEnumerationToString(OffscreenCanvas::RenderingContextType enumerationValue) +{ + static const NeverDestroyed<String> values[] = { + MAKE_STATIC_STRING_IMPL("2d"), + // MAKE_STATIC_STRING_IMPL("webgl"), + // MAKE_STATIC_STRING_IMPL("webgl2"), + }; + static_assert(static_cast<size_t>(OffscreenCanvas::RenderingContextType::_2d) == 0, "OffscreenCanvas::RenderingContextType::_2d is not 0 as expected"); + // static_assert(static_cast<size_t>(OffscreenCanvas::RenderingContextType::Webgl) == 1, "OffscreenCanvas::RenderingContextType::Webgl is not 1 as expected"); + // static_assert(static_cast<size_t>(OffscreenCanvas::RenderingContextType::Webgl2) == 2, "OffscreenCanvas::RenderingContextType::Webgl2 is not 2 as expected"); + ASSERT(static_cast<size_t>(enumerationValue) < WTF_ARRAY_LENGTH(values)); + return values[static_cast<size_t>(enumerationValue)]; +} + +template<> JSString* convertEnumerationToJS(JSGlobalObject& lexicalGlobalObject, OffscreenCanvas::RenderingContextType enumerationValue) +{ + return jsStringWithCache(lexicalGlobalObject.vm(), convertEnumerationToString(enumerationValue)); +} + +template<> std::optional<OffscreenCanvas::RenderingContextType> parseEnumeration<OffscreenCanvas::RenderingContextType>(JSGlobalObject& lexicalGlobalObject, JSValue value) +{ + auto stringValue = value.toWTFString(&lexicalGlobalObject); + if (stringValue == "2d") + return OffscreenCanvas::RenderingContextType::_2d; + if (stringValue == "webgl") + return OffscreenCanvas::RenderingContextType::Webgl; + if (stringValue == "webgl2") + return OffscreenCanvas::RenderingContextType::Webgl2; + return std::nullopt; +} + +template<> const char* expectedEnumerationValues<OffscreenCanvas::RenderingContextType>() +{ + return "\"2d\", \"webgl\", \"webgl2\""; +} + +template<> OffscreenCanvas::ImageEncodeOptions convertDictionary<OffscreenCanvas::ImageEncodeOptions>(JSGlobalObject& lexicalGlobalObject, JSValue value) +{ + VM& vm = JSC::getVM(&lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + bool isNullOrUndefined = value.isUndefinedOrNull(); + auto* object = isNullOrUndefined ? nullptr : value.getObject(); + if (UNLIKELY(!isNullOrUndefined && !object)) { + throwTypeError(&lexicalGlobalObject, throwScope); + return {}; + } + OffscreenCanvas::ImageEncodeOptions result; + JSValue qualityValue; + if (isNullOrUndefined) + qualityValue = jsUndefined(); + else { + qualityValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "quality")); + RETURN_IF_EXCEPTION(throwScope, {}); + } + if (!qualityValue.isUndefined()) { + result.quality = convert<IDLUnrestrictedDouble>(lexicalGlobalObject, qualityValue); + RETURN_IF_EXCEPTION(throwScope, {}); + } else + result.quality = 1.0; + JSValue typeValue; + if (isNullOrUndefined) + typeValue = jsUndefined(); + else { + typeValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "type")); + RETURN_IF_EXCEPTION(throwScope, {}); + } + if (!typeValue.isUndefined()) { + result.type = convert<IDLDOMString>(lexicalGlobalObject, typeValue); + RETURN_IF_EXCEPTION(throwScope, {}); + } else + result.type = "image/png"_s; + return result; +} + +// Functions + +static JSC_DECLARE_HOST_FUNCTION(jsOffscreenCanvasPrototypeFunction_getContext); +static JSC_DECLARE_HOST_FUNCTION(jsOffscreenCanvasPrototypeFunction_transferToImageBitmap); +static JSC_DECLARE_HOST_FUNCTION(jsOffscreenCanvasPrototypeFunction_convertToBlob); + +// Attributes + +static JSC_DECLARE_CUSTOM_GETTER(jsOffscreenCanvasConstructor); +static JSC_DECLARE_CUSTOM_GETTER(jsOffscreenCanvas_width); +static JSC_DECLARE_CUSTOM_SETTER(setJSOffscreenCanvas_width); +static JSC_DECLARE_CUSTOM_GETTER(jsOffscreenCanvas_height); +static JSC_DECLARE_CUSTOM_SETTER(setJSOffscreenCanvas_height); + +class JSOffscreenCanvasPrototype final : public JSC::JSNonFinalObject { +public: + using Base = JSC::JSNonFinalObject; + static JSOffscreenCanvasPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) + { + JSOffscreenCanvasPrototype* ptr = new (NotNull, JSC::allocateCell<JSOffscreenCanvasPrototype>(vm)) JSOffscreenCanvasPrototype(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(JSOffscreenCanvasPrototype, 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: + JSOffscreenCanvasPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) + : JSC::JSNonFinalObject(vm, structure) + { + } + + void finishCreation(JSC::VM&); +}; +STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSOffscreenCanvasPrototype, JSOffscreenCanvasPrototype::Base); + +using JSOffscreenCanvasDOMConstructor = JSDOMConstructor<JSOffscreenCanvas>; + +template<> EncodedJSValue JSC_HOST_CALL_ATTRIBUTES JSOffscreenCanvasDOMConstructor::construct(JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame) +{ + VM& vm = lexicalGlobalObject->vm(); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto* castedThis = jsCast<JSOffscreenCanvasDOMConstructor*>(callFrame->jsCallee()); + ASSERT(castedThis); + if (UNLIKELY(callFrame->argumentCount() < 2)) + return throwVMError(lexicalGlobalObject, throwScope, createNotEnoughArgumentsError(lexicalGlobalObject)); + auto* context = castedThis->scriptExecutionContext(); + if (UNLIKELY(!context)) + return throwConstructorScriptExecutionContextUnavailableError(*lexicalGlobalObject, throwScope, "OffscreenCanvas"); + EnsureStillAliveScope argument0 = callFrame->uncheckedArgument(0); + auto width = convert<IDLEnforceRangeAdaptor<IDLUnsignedLong>>(*lexicalGlobalObject, argument0.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument1 = callFrame->uncheckedArgument(1); + auto height = convert<IDLEnforceRangeAdaptor<IDLUnsignedLong>>(*lexicalGlobalObject, argument1.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + auto object = OffscreenCanvas::create(*context, WTFMove(width), WTFMove(height)); + if constexpr (IsExceptionOr<decltype(object)>) + RETURN_IF_EXCEPTION(throwScope, {}); + static_assert(TypeOrExceptionOrUnderlyingType<decltype(object)>::isRef); + auto jsValue = toJSNewlyCreated<IDLInterface<OffscreenCanvas>>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, WTFMove(object)); + if constexpr (IsExceptionOr<decltype(object)>) + RETURN_IF_EXCEPTION(throwScope, {}); + setSubclassStructureIfNeeded<OffscreenCanvas>(lexicalGlobalObject, callFrame, asObject(jsValue)); + RETURN_IF_EXCEPTION(throwScope, {}); + return JSValue::encode(jsValue); +} +JSC_ANNOTATE_HOST_FUNCTION(JSOffscreenCanvasDOMConstructorConstruct, JSOffscreenCanvasDOMConstructor::construct); + +template<> const ClassInfo JSOffscreenCanvasDOMConstructor::s_info = { "OffscreenCanvas"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSOffscreenCanvasDOMConstructor) }; + +template<> JSValue JSOffscreenCanvasDOMConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) +{ + return JSEventTarget::getConstructor(vm, &globalObject); +} + +template<> void JSOffscreenCanvasDOMConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) +{ + putDirect(vm, vm.propertyNames->length, jsNumber(2), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); + JSString* nameString = jsNontrivialString(vm, "OffscreenCanvas"_s); + m_originalName.set(vm, this, nameString); + putDirect(vm, vm.propertyNames->name, nameString, JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); + putDirect(vm, vm.propertyNames->prototype, JSOffscreenCanvas::prototype(vm, globalObject), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum | JSC::PropertyAttribute::DontDelete); +} + +/* Hash table for prototype */ + +static const HashTableValue JSOffscreenCanvasPrototypeTableValues[] = { + { "constructor", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(jsOffscreenCanvasConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, + { "width", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(jsOffscreenCanvas_width), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSOffscreenCanvas_width) } }, + { "height", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(jsOffscreenCanvas_height), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSOffscreenCanvas_height) } }, + { "getContext", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(jsOffscreenCanvasPrototypeFunction_getContext), (intptr_t)(1) } }, + // { "transferToImageBitmap", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(jsOffscreenCanvasPrototypeFunction_transferToImageBitmap), (intptr_t)(0) } }, + // { "convertToBlob", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(jsOffscreenCanvasPrototypeFunction_convertToBlob), (intptr_t)(0) } }, +}; + +const ClassInfo JSOffscreenCanvasPrototype::s_info = { "OffscreenCanvas"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSOffscreenCanvasPrototype) }; + +void JSOffscreenCanvasPrototype::finishCreation(VM& vm) +{ + Base::finishCreation(vm); + reifyStaticProperties(vm, JSOffscreenCanvas::info(), JSOffscreenCanvasPrototypeTableValues, *this); + JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); +} + +const ClassInfo JSOffscreenCanvas::s_info = { "OffscreenCanvas"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSOffscreenCanvas) }; + +JSOffscreenCanvas::JSOffscreenCanvas(Structure* structure, JSDOMGlobalObject& globalObject, Ref<OffscreenCanvas>&& impl) + : JSEventTarget(structure, globalObject, WTFMove(impl)) +{ +} + +void JSOffscreenCanvas::finishCreation(VM& vm) +{ + Base::finishCreation(vm); + ASSERT(inherits(vm, info())); + + // static_assert(!std::is_base_of<ActiveDOMObject, OffscreenCanvas>::value, "Interface is not marked as [ActiveDOMObject] even though implementation class subclasses ActiveDOMObject."); +} + +JSObject* JSOffscreenCanvas::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) +{ + return JSOffscreenCanvasPrototype::create(vm, &globalObject, JSOffscreenCanvasPrototype::createStructure(vm, &globalObject, JSEventTarget::prototype(vm, globalObject))); +} + +JSObject* JSOffscreenCanvas::prototype(VM& vm, JSDOMGlobalObject& globalObject) +{ + return getDOMPrototype<JSOffscreenCanvas>(vm, globalObject); +} + +JSValue JSOffscreenCanvas::getConstructor(VM& vm, const JSGlobalObject* globalObject) +{ + return getDOMConstructor<JSOffscreenCanvasDOMConstructor, DOMConstructorID::OffscreenCanvas>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); +} + +JSC_DEFINE_CUSTOM_GETTER(jsOffscreenCanvasConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) +{ + VM& vm = JSC::getVM(lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto* prototype = jsDynamicCast<JSOffscreenCanvasPrototype*>(vm, JSValue::decode(thisValue)); + if (UNLIKELY(!prototype)) + return throwVMTypeError(lexicalGlobalObject, throwScope); + return JSValue::encode(JSOffscreenCanvas::getConstructor(JSC::getVM(lexicalGlobalObject), prototype->globalObject())); +} + +static inline JSValue jsOffscreenCanvas_widthGetter(JSGlobalObject& lexicalGlobalObject, JSOffscreenCanvas& thisObject) +{ + auto& vm = JSC::getVM(&lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto& impl = thisObject.wrapped(); + RELEASE_AND_RETURN(throwScope, (toJS<IDLEnforceRangeAdaptor<IDLUnsignedLong>>(lexicalGlobalObject, throwScope, impl.width()))); +} + +JSC_DEFINE_CUSTOM_GETTER(jsOffscreenCanvas_width, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +{ + return IDLAttribute<JSOffscreenCanvas>::get<jsOffscreenCanvas_widthGetter, CastedThisErrorBehavior::Assert>(*lexicalGlobalObject, thisValue, attributeName); +} + +static inline bool setJSOffscreenCanvas_widthSetter(JSGlobalObject& lexicalGlobalObject, JSOffscreenCanvas& thisObject, JSValue value) +{ + auto& vm = JSC::getVM(&lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto& impl = thisObject.wrapped(); + auto nativeValue = convert<IDLEnforceRangeAdaptor<IDLUnsignedLong>>(lexicalGlobalObject, value); + RETURN_IF_EXCEPTION(throwScope, false); + invokeFunctorPropagatingExceptionIfNecessary(lexicalGlobalObject, throwScope, [&] { + return impl.setWidth(WTFMove(nativeValue)); + }); + return true; +} + +JSC_DEFINE_CUSTOM_SETTER(setJSOffscreenCanvas_width, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue, PropertyName attributeName)) +{ + return IDLAttribute<JSOffscreenCanvas>::set<setJSOffscreenCanvas_widthSetter>(*lexicalGlobalObject, thisValue, encodedValue, attributeName); +} + +static inline JSValue jsOffscreenCanvas_heightGetter(JSGlobalObject& lexicalGlobalObject, JSOffscreenCanvas& thisObject) +{ + auto& vm = JSC::getVM(&lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto& impl = thisObject.wrapped(); + RELEASE_AND_RETURN(throwScope, (toJS<IDLEnforceRangeAdaptor<IDLUnsignedLong>>(lexicalGlobalObject, throwScope, impl.height()))); +} + +JSC_DEFINE_CUSTOM_GETTER(jsOffscreenCanvas_height, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +{ + return IDLAttribute<JSOffscreenCanvas>::get<jsOffscreenCanvas_heightGetter, CastedThisErrorBehavior::Assert>(*lexicalGlobalObject, thisValue, attributeName); +} + +static inline bool setJSOffscreenCanvas_heightSetter(JSGlobalObject& lexicalGlobalObject, JSOffscreenCanvas& thisObject, JSValue value) +{ + auto& vm = JSC::getVM(&lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto& impl = thisObject.wrapped(); + auto nativeValue = convert<IDLEnforceRangeAdaptor<IDLUnsignedLong>>(lexicalGlobalObject, value); + RETURN_IF_EXCEPTION(throwScope, false); + invokeFunctorPropagatingExceptionIfNecessary(lexicalGlobalObject, throwScope, [&] { + return impl.setHeight(WTFMove(nativeValue)); + }); + return true; +} + +JSC_DEFINE_CUSTOM_SETTER(setJSOffscreenCanvas_height, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue, PropertyName attributeName)) +{ + return IDLAttribute<JSOffscreenCanvas>::set<setJSOffscreenCanvas_heightSetter>(*lexicalGlobalObject, thisValue, encodedValue, attributeName); +} + +static inline JSC::EncodedJSValue jsOffscreenCanvasPrototypeFunction_getContextBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSOffscreenCanvas>::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 contextType = convert<IDLEnumeration<OffscreenCanvas::RenderingContextType>>(*lexicalGlobalObject, argument0.value(), [](JSC::JSGlobalObject& lexicalGlobalObject, JSC::ThrowScope& scope) { throwArgumentMustBeEnumError(lexicalGlobalObject, scope, 0, "contextType", "OffscreenCanvas", "getContext", expectedEnumerationValues<OffscreenCanvas::RenderingContextType>()); }); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + auto context = impl.getContext(*jsCast<JSDOMGlobalObject*>(lexicalGlobalObject), WTFMove(contextType)); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS<IDLNullable<IDLUnion<IDLInterface<OffscreenCanvasRenderingContext2D>>>>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, context.releaseReturnValue()))); +} + +JSC_DEFINE_HOST_FUNCTION(jsOffscreenCanvasPrototypeFunction_getContext, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + return IDLOperation<JSOffscreenCanvas>::call<jsOffscreenCanvasPrototypeFunction_getContextBody>(*lexicalGlobalObject, *callFrame, "getContext"); +} + +// static inline JSC::EncodedJSValue jsOffscreenCanvasPrototypeFunction_transferToImageBitmapBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSOffscreenCanvas>::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<IDLInterface<ImageBitmap>>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, impl.transferToImageBitmap()))); +// } + +// JSC_DEFINE_HOST_FUNCTION(jsOffscreenCanvasPrototypeFunction_transferToImageBitmap, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +// { +// return IDLOperation<JSOffscreenCanvas>::call<jsOffscreenCanvasPrototypeFunction_transferToImageBitmapBody>(*lexicalGlobalObject, *callFrame, "transferToImageBitmap"); +// } + +// static inline JSC::EncodedJSValue jsOffscreenCanvasPrototypeFunction_convertToBlobBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperationReturningPromise<JSOffscreenCanvas>::ClassParameter castedThis, Ref<DeferredPromise>&& promise) +// { +// auto& vm = JSC::getVM(lexicalGlobalObject); +// auto throwScope = DECLARE_THROW_SCOPE(vm); +// UNUSED_PARAM(throwScope); +// UNUSED_PARAM(callFrame); +// auto& impl = castedThis->wrapped(); +// EnsureStillAliveScope argument0 = callFrame->argument(0); +// auto options = convert<IDLDictionary<OffscreenCanvas::ImageEncodeOptions>>(*lexicalGlobalObject, argument0.value()); +// RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); +// RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS<IDLPromise<IDLInterface<Blob>>>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, [&]() -> decltype(auto) { return impl.convertToBlob(WTFMove(options), WTFMove(promise)); }))); +// } + +// JSC_DEFINE_HOST_FUNCTION(jsOffscreenCanvasPrototypeFunction_convertToBlob, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +// { +// return IDLOperationReturningPromise<JSOffscreenCanvas>::call<jsOffscreenCanvasPrototypeFunction_convertToBlobBody>(*lexicalGlobalObject, *callFrame, "convertToBlob"); +// } + +JSC::GCClient::IsoSubspace* JSOffscreenCanvas::subspaceForImpl(JSC::VM& vm) +{ + return WebCore::subspaceForImpl<JSOffscreenCanvas, UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForOffscreenCanvas.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForOffscreenCanvas = WTFMove(space); }, + [](auto& spaces) { return spaces.m_subspaceForOffscreenCanvas.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForOffscreenCanvas = WTFMove(space); }); +} + +void JSOffscreenCanvas::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) +{ + auto* thisObject = jsCast<JSOffscreenCanvas*>(cell); + analyzer.setWrappedObjectForCell(cell, &thisObject->wrapped()); + if (thisObject->scriptExecutionContext()) + analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); + Base::analyzeHeap(cell, analyzer); +} + +bool JSOffscreenCanvasOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, AbstractSlotVisitor& visitor, const char** reason) +{ + auto* jsOffscreenCanvas = jsCast<JSOffscreenCanvas*>(handle.slot()->asCell()); + if (jsOffscreenCanvas->wrapped().isFiringEventListeners()) { + if (UNLIKELY(reason)) + *reason = "EventTarget firing event listeners"; + return true; + } + OffscreenCanvas* root = &jsOffscreenCanvas->wrapped(); + if (UNLIKELY(reason)) + *reason = "Reachable from OffscreenCanvas"; + return visitor.containsOpaqueRoot(root); +} + +void JSOffscreenCanvasOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) +{ + auto* jsOffscreenCanvas = static_cast<JSOffscreenCanvas*>(handle.slot()->asCell()); + auto& world = *static_cast<DOMWrapperWorld*>(context); + uncacheWrapper(world, &jsOffscreenCanvas->wrapped(), jsOffscreenCanvas); +} + +// #if ENABLE(BINDING_INTEGRITY) +// #if PLATFORM(WIN) +// #pragma warning(disable : 4483) +// extern "C" { +// extern void (*const __identifier("??_7OffscreenCanvas@WebCore@@6B@")[])(); +// } +// #else +// extern "C" { +// extern void* _ZTVN7WebCore15OffscreenCanvasE[]; +// } +// #endif +// #endif + +JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject*, JSDOMGlobalObject* globalObject, Ref<OffscreenCanvas>&& impl) +{ + + // if constexpr (std::is_polymorphic_v<OffscreenCanvas>) { + // #if ENABLE(BINDING_INTEGRITY) + // const void* actualVTablePointer = getVTablePointer(impl.ptr()); + // #if PLATFORM(WIN) + // void* expectedVTablePointer = __identifier("??_7OffscreenCanvas@WebCore@@6B@"); + // #else + // void* expectedVTablePointer = &_ZTVN7WebCore15OffscreenCanvasE[2]; + // #endif + + // // If you hit this assertion you either have a use after free bug, or + // // OffscreenCanvas has subclasses. If OffscreenCanvas has subclasses that get passed + // // to toJS() we currently require OffscreenCanvas you to opt out of binding hardening + // // by adding the SkipVTableValidation attribute to the interface IDL definition + // RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer); + // #endif + + return createWrapper<OffscreenCanvas>(globalObject, WTFMove(impl)); +} + +JSC::JSValue toJS(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, OffscreenCanvas& impl) +{ + return wrap(lexicalGlobalObject, globalObject, impl); +} + +OffscreenCanvas* JSOffscreenCanvas::toWrapped(JSC::VM& vm, JSC::JSValue value) +{ + if (auto* wrapper = jsDynamicCast<JSOffscreenCanvas*>(vm, value)) + return &wrapper->wrapped(); + return nullptr; +} +}
\ No newline at end of file diff --git a/src/javascript/jsc/bindings/webcore/JSOffscreenCanvas.dep b/src/javascript/jsc/bindings/webcore/JSOffscreenCanvas.dep new file mode 100644 index 000000000..9543cc98f --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/JSOffscreenCanvas.dep @@ -0,0 +1,2 @@ +JSOffscreenCanvas.h : EventTarget.idl +EventTarget.idl : diff --git a/src/javascript/jsc/bindings/webcore/JSOffscreenCanvas.h b/src/javascript/jsc/bindings/webcore/JSOffscreenCanvas.h new file mode 100644 index 000000000..119049539 --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/JSOffscreenCanvas.h @@ -0,0 +1,110 @@ +/* + 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. +*/ + +#pragma once + +#include "root.h" + +#include "JSDOMConvertDictionary.h" +#include "JSDOMConvertEnumeration.h" +#include "JSDOMWrapper.h" +#include "JSEventTarget.h" +#include "OffscreenCanvas.h" +#include <wtf/NeverDestroyed.h> + +namespace WebCore { + +class JSOffscreenCanvas : public JSEventTarget { +public: + using Base = JSEventTarget; + using DOMWrapped = OffscreenCanvas; + static JSOffscreenCanvas* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref<OffscreenCanvas>&& impl) + { + JSOffscreenCanvas* ptr = new (NotNull, JSC::allocateCell<JSOffscreenCanvas>(globalObject->vm())) JSOffscreenCanvas(structure, *globalObject, WTFMove(impl)); + ptr->finishCreation(globalObject->vm()); + return ptr; + } + + static JSC::JSObject* createPrototype(JSC::VM&, JSDOMGlobalObject&); + static JSC::JSObject* prototype(JSC::VM&, JSDOMGlobalObject&); + static OffscreenCanvas* toWrapped(JSC::VM&, JSC::JSValue); + + DECLARE_INFO; + + 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(), JSC::NonArray); + } + + static JSC::JSValue getConstructor(JSC::VM&, const JSC::JSGlobalObject*); + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return subspaceForImpl(vm); + } + static JSC::GCClient::IsoSubspace* subspaceForImpl(JSC::VM& vm); + static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); + OffscreenCanvas& wrapped() const + { + return static_cast<OffscreenCanvas&>(Base::wrapped()); + } + +protected: + JSOffscreenCanvas(JSC::Structure*, JSDOMGlobalObject&, Ref<OffscreenCanvas>&&); + + void finishCreation(JSC::VM&); +}; + +class JSOffscreenCanvasOwner final : public JSC::WeakHandleOwner { +public: + bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::AbstractSlotVisitor&, const char**) final; + void finalize(JSC::Handle<JSC::Unknown>, void* context) final; +}; + +inline JSC::WeakHandleOwner* wrapperOwner(DOMWrapperWorld&, OffscreenCanvas*) +{ + static NeverDestroyed<JSOffscreenCanvasOwner> owner; + return &owner.get(); +} + +inline void* wrapperKey(OffscreenCanvas* wrappableObject) +{ + return wrappableObject; +} + +JSC::JSValue toJS(JSC::JSGlobalObject*, JSDOMGlobalObject*, OffscreenCanvas&); +inline JSC::JSValue toJS(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, OffscreenCanvas* impl) { return impl ? toJS(lexicalGlobalObject, globalObject, *impl) : JSC::jsNull(); } +JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject*, JSDOMGlobalObject*, Ref<OffscreenCanvas>&&); +inline JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, RefPtr<OffscreenCanvas>&& impl) { return impl ? toJSNewlyCreated(lexicalGlobalObject, globalObject, impl.releaseNonNull()) : JSC::jsNull(); } + +template<> struct JSDOMWrapperConverterTraits<OffscreenCanvas> { + using WrapperClass = JSOffscreenCanvas; + using ToWrappedReturnType = OffscreenCanvas*; +}; +String convertEnumerationToString(OffscreenCanvas::RenderingContextType); +template<> JSC::JSString* convertEnumerationToJS(JSC::JSGlobalObject&, OffscreenCanvas::RenderingContextType); + +template<> std::optional<OffscreenCanvas::RenderingContextType> parseEnumeration<OffscreenCanvas::RenderingContextType>(JSC::JSGlobalObject&, JSC::JSValue); +template<> const char* expectedEnumerationValues<OffscreenCanvas::RenderingContextType>(); + +template<> OffscreenCanvas::ImageEncodeOptions convertDictionary<OffscreenCanvas::ImageEncodeOptions>(JSC::JSGlobalObject&, JSC::JSValue); + +} // namespace WebCore diff --git a/src/javascript/jsc/bindings/webcore/JSOffscreenCanvasRenderingContext2D.cpp b/src/javascript/jsc/bindings/webcore/JSOffscreenCanvasRenderingContext2D.cpp new file mode 100644 index 000000000..3d60e2c39 --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/JSOffscreenCanvasRenderingContext2D.cpp @@ -0,0 +1,2574 @@ +/* + 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 "JSOffscreenCanvasRenderingContext2D.h" +#include "OffscreenCanvasRenderingContext2D.h" + +#include "ActiveDOMObject.h" +#include "ExtendedDOMClientIsoSubspaces.h" +#include "ExtendedDOMIsoSubspaces.h" +#include "IDLTypes.h" +// #include "JSCSSStyleImageValue.h" +#include "JSCanvasDirection.h" +#include "JSCanvasFillRule.h" +#include "JSCanvasGradient.h" +#include "JSCanvasLineCap.h" +#include "JSCanvasLineJoin.h" +#include "JSCanvasPattern.h" +#include "JSCanvasTextAlign.h" +#include "JSCanvasTextBaseline.h" +#include "JSDOMAttribute.h" +#include "JSDOMBinding.h" +#include "JSDOMConstructorNotConstructable.h" +#include "JSDOMConvertBase.h" +#include "JSDOMConvertBoolean.h" +#include "JSDOMConvertDictionary.h" +#include "JSDOMConvertEnumeration.h" +#include "JSDOMConvertInterface.h" +#include "JSDOMConvertNullable.h" +#include "JSDOMConvertNumbers.h" +#include "JSDOMConvertSequences.h" +#include "JSDOMConvertStrings.h" +#include "JSDOMConvertUnion.h" +#include "JSDOMExceptionHandling.h" +#include "JSDOMGlobalObject.h" +#include "JSDOMGlobalObjectInlines.h" +// #include "JSDOMMatrix.h" +#include "JSDOMMatrix2DInit.h" +#include "JSDOMOperation.h" +#include "JSDOMPointInit.h" +#include "JSDOMWrapperCache.h" +// #include "JSHTMLCanvasElement.h" +// #include "JSHTMLImageElement.h" +// #include "JSHTMLVideoElement.h" +// #include "JSImageBitmap.h" +#include "JSImageData.h" +// #include "JSImageDataSettings.h" +#include "JSImageSmoothingQuality.h" +#include "JSOffscreenCanvas.h" +#include "JSPath2D.h" +#include "JSTextMetrics.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(jsOffscreenCanvasRenderingContext2DPrototypeFunction_commit); +static JSC_DECLARE_HOST_FUNCTION(jsOffscreenCanvasRenderingContext2DPrototypeFunction_drawImage); +static JSC_DECLARE_HOST_FUNCTION(jsOffscreenCanvasRenderingContext2DPrototypeFunction_beginPath); +static JSC_DECLARE_HOST_FUNCTION(jsOffscreenCanvasRenderingContext2DPrototypeFunction_fill); +static JSC_DECLARE_HOST_FUNCTION(jsOffscreenCanvasRenderingContext2DPrototypeFunction_stroke); +static JSC_DECLARE_HOST_FUNCTION(jsOffscreenCanvasRenderingContext2DPrototypeFunction_clip); +static JSC_DECLARE_HOST_FUNCTION(jsOffscreenCanvasRenderingContext2DPrototypeFunction_isPointInPath); +static JSC_DECLARE_HOST_FUNCTION(jsOffscreenCanvasRenderingContext2DPrototypeFunction_isPointInStroke); +static JSC_DECLARE_HOST_FUNCTION(jsOffscreenCanvasRenderingContext2DPrototypeFunction_createLinearGradient); +static JSC_DECLARE_HOST_FUNCTION(jsOffscreenCanvasRenderingContext2DPrototypeFunction_createRadialGradient); +static JSC_DECLARE_HOST_FUNCTION(jsOffscreenCanvasRenderingContext2DPrototypeFunction_createConicGradient); +static JSC_DECLARE_HOST_FUNCTION(jsOffscreenCanvasRenderingContext2DPrototypeFunction_createPattern); +static JSC_DECLARE_HOST_FUNCTION(jsOffscreenCanvasRenderingContext2DPrototypeFunction_createImageData); +static JSC_DECLARE_HOST_FUNCTION(jsOffscreenCanvasRenderingContext2DPrototypeFunction_getImageData); +static JSC_DECLARE_HOST_FUNCTION(jsOffscreenCanvasRenderingContext2DPrototypeFunction_putImageData); +static JSC_DECLARE_HOST_FUNCTION(jsOffscreenCanvasRenderingContext2DPrototypeFunction_closePath); +static JSC_DECLARE_HOST_FUNCTION(jsOffscreenCanvasRenderingContext2DPrototypeFunction_moveTo); +static JSC_DECLARE_HOST_FUNCTION(jsOffscreenCanvasRenderingContext2DPrototypeFunction_lineTo); +static JSC_DECLARE_HOST_FUNCTION(jsOffscreenCanvasRenderingContext2DPrototypeFunction_quadraticCurveTo); +static JSC_DECLARE_HOST_FUNCTION(jsOffscreenCanvasRenderingContext2DPrototypeFunction_bezierCurveTo); +static JSC_DECLARE_HOST_FUNCTION(jsOffscreenCanvasRenderingContext2DPrototypeFunction_arcTo); +static JSC_DECLARE_HOST_FUNCTION(jsOffscreenCanvasRenderingContext2DPrototypeFunction_rect); +static JSC_DECLARE_HOST_FUNCTION(jsOffscreenCanvasRenderingContext2DPrototypeFunction_roundRect); +static JSC_DECLARE_HOST_FUNCTION(jsOffscreenCanvasRenderingContext2DPrototypeFunction_arc); +static JSC_DECLARE_HOST_FUNCTION(jsOffscreenCanvasRenderingContext2DPrototypeFunction_ellipse); +static JSC_DECLARE_HOST_FUNCTION(jsOffscreenCanvasRenderingContext2DPrototypeFunction_setLineDash); +static JSC_DECLARE_HOST_FUNCTION(jsOffscreenCanvasRenderingContext2DPrototypeFunction_getLineDash); +static JSC_DECLARE_HOST_FUNCTION(jsOffscreenCanvasRenderingContext2DPrototypeFunction_clearRect); +static JSC_DECLARE_HOST_FUNCTION(jsOffscreenCanvasRenderingContext2DPrototypeFunction_fillRect); +static JSC_DECLARE_HOST_FUNCTION(jsOffscreenCanvasRenderingContext2DPrototypeFunction_strokeRect); +static JSC_DECLARE_HOST_FUNCTION(jsOffscreenCanvasRenderingContext2DPrototypeFunction_save); +static JSC_DECLARE_HOST_FUNCTION(jsOffscreenCanvasRenderingContext2DPrototypeFunction_restore); +static JSC_DECLARE_HOST_FUNCTION(jsOffscreenCanvasRenderingContext2DPrototypeFunction_fillText); +static JSC_DECLARE_HOST_FUNCTION(jsOffscreenCanvasRenderingContext2DPrototypeFunction_strokeText); +static JSC_DECLARE_HOST_FUNCTION(jsOffscreenCanvasRenderingContext2DPrototypeFunction_measureText); +static JSC_DECLARE_HOST_FUNCTION(jsOffscreenCanvasRenderingContext2DPrototypeFunction_scale); +static JSC_DECLARE_HOST_FUNCTION(jsOffscreenCanvasRenderingContext2DPrototypeFunction_rotate); +static JSC_DECLARE_HOST_FUNCTION(jsOffscreenCanvasRenderingContext2DPrototypeFunction_translate); +static JSC_DECLARE_HOST_FUNCTION(jsOffscreenCanvasRenderingContext2DPrototypeFunction_transform); +static JSC_DECLARE_HOST_FUNCTION(jsOffscreenCanvasRenderingContext2DPrototypeFunction_getTransform); +static JSC_DECLARE_HOST_FUNCTION(jsOffscreenCanvasRenderingContext2DPrototypeFunction_setTransform); +static JSC_DECLARE_HOST_FUNCTION(jsOffscreenCanvasRenderingContext2DPrototypeFunction_resetTransform); + +// Attributes + +static JSC_DECLARE_CUSTOM_GETTER(jsOffscreenCanvasRenderingContext2DConstructor); +static JSC_DECLARE_CUSTOM_GETTER(jsOffscreenCanvasRenderingContext2D_canvas); +static JSC_DECLARE_CUSTOM_GETTER(jsOffscreenCanvasRenderingContext2D_globalAlpha); +static JSC_DECLARE_CUSTOM_SETTER(setJSOffscreenCanvasRenderingContext2D_globalAlpha); +static JSC_DECLARE_CUSTOM_GETTER(jsOffscreenCanvasRenderingContext2D_globalCompositeOperation); +static JSC_DECLARE_CUSTOM_SETTER(setJSOffscreenCanvasRenderingContext2D_globalCompositeOperation); +static JSC_DECLARE_CUSTOM_GETTER(jsOffscreenCanvasRenderingContext2D_strokeStyle); +static JSC_DECLARE_CUSTOM_SETTER(setJSOffscreenCanvasRenderingContext2D_strokeStyle); +static JSC_DECLARE_CUSTOM_GETTER(jsOffscreenCanvasRenderingContext2D_fillStyle); +static JSC_DECLARE_CUSTOM_SETTER(setJSOffscreenCanvasRenderingContext2D_fillStyle); +static JSC_DECLARE_CUSTOM_GETTER(jsOffscreenCanvasRenderingContext2D_imageSmoothingEnabled); +static JSC_DECLARE_CUSTOM_SETTER(setJSOffscreenCanvasRenderingContext2D_imageSmoothingEnabled); +static JSC_DECLARE_CUSTOM_GETTER(jsOffscreenCanvasRenderingContext2D_imageSmoothingQuality); +static JSC_DECLARE_CUSTOM_SETTER(setJSOffscreenCanvasRenderingContext2D_imageSmoothingQuality); +static JSC_DECLARE_CUSTOM_GETTER(jsOffscreenCanvasRenderingContext2D_currentX); +static JSC_DECLARE_CUSTOM_GETTER(jsOffscreenCanvasRenderingContext2D_currentY); +static JSC_DECLARE_CUSTOM_GETTER(jsOffscreenCanvasRenderingContext2D_lineWidth); +static JSC_DECLARE_CUSTOM_SETTER(setJSOffscreenCanvasRenderingContext2D_lineWidth); +static JSC_DECLARE_CUSTOM_GETTER(jsOffscreenCanvasRenderingContext2D_lineCap); +static JSC_DECLARE_CUSTOM_SETTER(setJSOffscreenCanvasRenderingContext2D_lineCap); +static JSC_DECLARE_CUSTOM_GETTER(jsOffscreenCanvasRenderingContext2D_lineJoin); +static JSC_DECLARE_CUSTOM_SETTER(setJSOffscreenCanvasRenderingContext2D_lineJoin); +static JSC_DECLARE_CUSTOM_GETTER(jsOffscreenCanvasRenderingContext2D_miterLimit); +static JSC_DECLARE_CUSTOM_SETTER(setJSOffscreenCanvasRenderingContext2D_miterLimit); +static JSC_DECLARE_CUSTOM_GETTER(jsOffscreenCanvasRenderingContext2D_lineDashOffset); +static JSC_DECLARE_CUSTOM_SETTER(setJSOffscreenCanvasRenderingContext2D_lineDashOffset); +static JSC_DECLARE_CUSTOM_GETTER(jsOffscreenCanvasRenderingContext2D_shadowOffsetX); +static JSC_DECLARE_CUSTOM_SETTER(setJSOffscreenCanvasRenderingContext2D_shadowOffsetX); +static JSC_DECLARE_CUSTOM_GETTER(jsOffscreenCanvasRenderingContext2D_shadowOffsetY); +static JSC_DECLARE_CUSTOM_SETTER(setJSOffscreenCanvasRenderingContext2D_shadowOffsetY); +static JSC_DECLARE_CUSTOM_GETTER(jsOffscreenCanvasRenderingContext2D_shadowBlur); +static JSC_DECLARE_CUSTOM_SETTER(setJSOffscreenCanvasRenderingContext2D_shadowBlur); +static JSC_DECLARE_CUSTOM_GETTER(jsOffscreenCanvasRenderingContext2D_shadowColor); +static JSC_DECLARE_CUSTOM_SETTER(setJSOffscreenCanvasRenderingContext2D_shadowColor); +static JSC_DECLARE_CUSTOM_GETTER(jsOffscreenCanvasRenderingContext2D_font); +static JSC_DECLARE_CUSTOM_SETTER(setJSOffscreenCanvasRenderingContext2D_font); +static JSC_DECLARE_CUSTOM_GETTER(jsOffscreenCanvasRenderingContext2D_textAlign); +static JSC_DECLARE_CUSTOM_SETTER(setJSOffscreenCanvasRenderingContext2D_textAlign); +static JSC_DECLARE_CUSTOM_GETTER(jsOffscreenCanvasRenderingContext2D_textBaseline); +static JSC_DECLARE_CUSTOM_SETTER(setJSOffscreenCanvasRenderingContext2D_textBaseline); +static JSC_DECLARE_CUSTOM_GETTER(jsOffscreenCanvasRenderingContext2D_direction); +static JSC_DECLARE_CUSTOM_SETTER(setJSOffscreenCanvasRenderingContext2D_direction); + +class JSOffscreenCanvasRenderingContext2DPrototype final : public JSC::JSNonFinalObject { +public: + using Base = JSC::JSNonFinalObject; + static JSOffscreenCanvasRenderingContext2DPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) + { + JSOffscreenCanvasRenderingContext2DPrototype* ptr = new (NotNull, JSC::allocateCell<JSOffscreenCanvasRenderingContext2DPrototype>(vm)) JSOffscreenCanvasRenderingContext2DPrototype(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(JSOffscreenCanvasRenderingContext2DPrototype, 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: + JSOffscreenCanvasRenderingContext2DPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) + : JSC::JSNonFinalObject(vm, structure) + { + } + + void finishCreation(JSC::VM&); +}; +STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSOffscreenCanvasRenderingContext2DPrototype, JSOffscreenCanvasRenderingContext2DPrototype::Base); + +using JSOffscreenCanvasRenderingContext2DDOMConstructor = JSDOMConstructorNotConstructable<JSOffscreenCanvasRenderingContext2D>; + +template<> const ClassInfo JSOffscreenCanvasRenderingContext2DDOMConstructor::s_info = { "OffscreenCanvasRenderingContext2D"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSOffscreenCanvasRenderingContext2DDOMConstructor) }; + +template<> JSValue JSOffscreenCanvasRenderingContext2DDOMConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) +{ + UNUSED_PARAM(vm); + return globalObject.functionPrototype(); +} + +template<> void JSOffscreenCanvasRenderingContext2DDOMConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) +{ + putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); + JSString* nameString = jsNontrivialString(vm, "OffscreenCanvasRenderingContext2D"_s); + m_originalName.set(vm, this, nameString); + putDirect(vm, vm.propertyNames->name, nameString, JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); + putDirect(vm, vm.propertyNames->prototype, JSOffscreenCanvasRenderingContext2D::prototype(vm, globalObject), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum | JSC::PropertyAttribute::DontDelete); +} + +/* Hash table for prototype */ + +static const HashTableValue JSOffscreenCanvasRenderingContext2DPrototypeTableValues[] = { + { "constructor", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(jsOffscreenCanvasRenderingContext2DConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, + { "canvas", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(jsOffscreenCanvasRenderingContext2D_canvas), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, + { "globalAlpha", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(jsOffscreenCanvasRenderingContext2D_globalAlpha), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSOffscreenCanvasRenderingContext2D_globalAlpha) } }, + { "globalCompositeOperation", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(jsOffscreenCanvasRenderingContext2D_globalCompositeOperation), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSOffscreenCanvasRenderingContext2D_globalCompositeOperation) } }, + { "strokeStyle", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(jsOffscreenCanvasRenderingContext2D_strokeStyle), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSOffscreenCanvasRenderingContext2D_strokeStyle) } }, + { "fillStyle", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(jsOffscreenCanvasRenderingContext2D_fillStyle), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSOffscreenCanvasRenderingContext2D_fillStyle) } }, + { "imageSmoothingEnabled", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(jsOffscreenCanvasRenderingContext2D_imageSmoothingEnabled), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSOffscreenCanvasRenderingContext2D_imageSmoothingEnabled) } }, + { "imageSmoothingQuality", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(jsOffscreenCanvasRenderingContext2D_imageSmoothingQuality), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSOffscreenCanvasRenderingContext2D_imageSmoothingQuality) } }, + { "currentX", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(jsOffscreenCanvasRenderingContext2D_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>(jsOffscreenCanvasRenderingContext2D_currentY), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, + { "lineWidth", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(jsOffscreenCanvasRenderingContext2D_lineWidth), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSOffscreenCanvasRenderingContext2D_lineWidth) } }, + { "lineCap", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(jsOffscreenCanvasRenderingContext2D_lineCap), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSOffscreenCanvasRenderingContext2D_lineCap) } }, + { "lineJoin", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(jsOffscreenCanvasRenderingContext2D_lineJoin), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSOffscreenCanvasRenderingContext2D_lineJoin) } }, + { "miterLimit", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(jsOffscreenCanvasRenderingContext2D_miterLimit), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSOffscreenCanvasRenderingContext2D_miterLimit) } }, + { "lineDashOffset", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(jsOffscreenCanvasRenderingContext2D_lineDashOffset), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSOffscreenCanvasRenderingContext2D_lineDashOffset) } }, + { "shadowOffsetX", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(jsOffscreenCanvasRenderingContext2D_shadowOffsetX), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSOffscreenCanvasRenderingContext2D_shadowOffsetX) } }, + { "shadowOffsetY", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(jsOffscreenCanvasRenderingContext2D_shadowOffsetY), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSOffscreenCanvasRenderingContext2D_shadowOffsetY) } }, + { "shadowBlur", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(jsOffscreenCanvasRenderingContext2D_shadowBlur), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSOffscreenCanvasRenderingContext2D_shadowBlur) } }, + { "shadowColor", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(jsOffscreenCanvasRenderingContext2D_shadowColor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSOffscreenCanvasRenderingContext2D_shadowColor) } }, + { "font", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(jsOffscreenCanvasRenderingContext2D_font), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSOffscreenCanvasRenderingContext2D_font) } }, + { "textAlign", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(jsOffscreenCanvasRenderingContext2D_textAlign), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSOffscreenCanvasRenderingContext2D_textAlign) } }, + { "textBaseline", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(jsOffscreenCanvasRenderingContext2D_textBaseline), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSOffscreenCanvasRenderingContext2D_textBaseline) } }, + { "direction", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(jsOffscreenCanvasRenderingContext2D_direction), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSOffscreenCanvasRenderingContext2D_direction) } }, + { "commit", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(jsOffscreenCanvasRenderingContext2DPrototypeFunction_commit), (intptr_t)(0) } }, + { "drawImage", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(jsOffscreenCanvasRenderingContext2DPrototypeFunction_drawImage), (intptr_t)(3) } }, + { "beginPath", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(jsOffscreenCanvasRenderingContext2DPrototypeFunction_beginPath), (intptr_t)(0) } }, + { "fill", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(jsOffscreenCanvasRenderingContext2DPrototypeFunction_fill), (intptr_t)(0) } }, + { "stroke", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(jsOffscreenCanvasRenderingContext2DPrototypeFunction_stroke), (intptr_t)(0) } }, + { "clip", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(jsOffscreenCanvasRenderingContext2DPrototypeFunction_clip), (intptr_t)(0) } }, + { "isPointInPath", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(jsOffscreenCanvasRenderingContext2DPrototypeFunction_isPointInPath), (intptr_t)(2) } }, + { "isPointInStroke", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(jsOffscreenCanvasRenderingContext2DPrototypeFunction_isPointInStroke), (intptr_t)(2) } }, + { "createLinearGradient", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(jsOffscreenCanvasRenderingContext2DPrototypeFunction_createLinearGradient), (intptr_t)(4) } }, + { "createRadialGradient", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(jsOffscreenCanvasRenderingContext2DPrototypeFunction_createRadialGradient), (intptr_t)(6) } }, + { "createConicGradient", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(jsOffscreenCanvasRenderingContext2DPrototypeFunction_createConicGradient), (intptr_t)(3) } }, + { "createPattern", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(jsOffscreenCanvasRenderingContext2DPrototypeFunction_createPattern), (intptr_t)(2) } }, + { "createImageData", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(jsOffscreenCanvasRenderingContext2DPrototypeFunction_createImageData), (intptr_t)(1) } }, + { "getImageData", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(jsOffscreenCanvasRenderingContext2DPrototypeFunction_getImageData), (intptr_t)(4) } }, + { "putImageData", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(jsOffscreenCanvasRenderingContext2DPrototypeFunction_putImageData), (intptr_t)(3) } }, + { "closePath", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(jsOffscreenCanvasRenderingContext2DPrototypeFunction_closePath), (intptr_t)(0) } }, + { "moveTo", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(jsOffscreenCanvasRenderingContext2DPrototypeFunction_moveTo), (intptr_t)(2) } }, + { "lineTo", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(jsOffscreenCanvasRenderingContext2DPrototypeFunction_lineTo), (intptr_t)(2) } }, + { "quadraticCurveTo", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(jsOffscreenCanvasRenderingContext2DPrototypeFunction_quadraticCurveTo), (intptr_t)(4) } }, + { "bezierCurveTo", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(jsOffscreenCanvasRenderingContext2DPrototypeFunction_bezierCurveTo), (intptr_t)(6) } }, + { "arcTo", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(jsOffscreenCanvasRenderingContext2DPrototypeFunction_arcTo), (intptr_t)(5) } }, + { "rect", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(jsOffscreenCanvasRenderingContext2DPrototypeFunction_rect), (intptr_t)(4) } }, + { "roundRect", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(jsOffscreenCanvasRenderingContext2DPrototypeFunction_roundRect), (intptr_t)(5) } }, + { "arc", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(jsOffscreenCanvasRenderingContext2DPrototypeFunction_arc), (intptr_t)(5) } }, + { "ellipse", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(jsOffscreenCanvasRenderingContext2DPrototypeFunction_ellipse), (intptr_t)(7) } }, + { "setLineDash", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(jsOffscreenCanvasRenderingContext2DPrototypeFunction_setLineDash), (intptr_t)(1) } }, + { "getLineDash", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(jsOffscreenCanvasRenderingContext2DPrototypeFunction_getLineDash), (intptr_t)(0) } }, + { "clearRect", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(jsOffscreenCanvasRenderingContext2DPrototypeFunction_clearRect), (intptr_t)(4) } }, + { "fillRect", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(jsOffscreenCanvasRenderingContext2DPrototypeFunction_fillRect), (intptr_t)(4) } }, + { "strokeRect", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(jsOffscreenCanvasRenderingContext2DPrototypeFunction_strokeRect), (intptr_t)(4) } }, + { "save", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(jsOffscreenCanvasRenderingContext2DPrototypeFunction_save), (intptr_t)(0) } }, + { "restore", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(jsOffscreenCanvasRenderingContext2DPrototypeFunction_restore), (intptr_t)(0) } }, + { "fillText", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(jsOffscreenCanvasRenderingContext2DPrototypeFunction_fillText), (intptr_t)(3) } }, + { "strokeText", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(jsOffscreenCanvasRenderingContext2DPrototypeFunction_strokeText), (intptr_t)(3) } }, + { "measureText", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(jsOffscreenCanvasRenderingContext2DPrototypeFunction_measureText), (intptr_t)(1) } }, + { "scale", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(jsOffscreenCanvasRenderingContext2DPrototypeFunction_scale), (intptr_t)(2) } }, + { "rotate", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(jsOffscreenCanvasRenderingContext2DPrototypeFunction_rotate), (intptr_t)(1) } }, + { "translate", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(jsOffscreenCanvasRenderingContext2DPrototypeFunction_translate), (intptr_t)(2) } }, + { "transform", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(jsOffscreenCanvasRenderingContext2DPrototypeFunction_transform), (intptr_t)(6) } }, + { "getTransform", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(jsOffscreenCanvasRenderingContext2DPrototypeFunction_getTransform), (intptr_t)(0) } }, + { "setTransform", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(jsOffscreenCanvasRenderingContext2DPrototypeFunction_setTransform), (intptr_t)(0) } }, + { "resetTransform", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t) static_cast<RawNativeFunction>(jsOffscreenCanvasRenderingContext2DPrototypeFunction_resetTransform), (intptr_t)(0) } }, +}; + +const ClassInfo JSOffscreenCanvasRenderingContext2DPrototype::s_info = { "OffscreenCanvasRenderingContext2D"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSOffscreenCanvasRenderingContext2DPrototype) }; + +void JSOffscreenCanvasRenderingContext2DPrototype::finishCreation(VM& vm) +{ + Base::finishCreation(vm); + reifyStaticProperties(vm, JSOffscreenCanvasRenderingContext2D::info(), JSOffscreenCanvasRenderingContext2DPrototypeTableValues, *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 JSOffscreenCanvasRenderingContext2D::s_info = { "OffscreenCanvasRenderingContext2D"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSOffscreenCanvasRenderingContext2D) }; + +JSOffscreenCanvasRenderingContext2D::JSOffscreenCanvasRenderingContext2D(Structure* structure, JSDOMGlobalObject& globalObject, Ref<OffscreenCanvasRenderingContext2D>&& impl) + : JSDOMWrapper<OffscreenCanvasRenderingContext2D, SignedPtrTraits<OffscreenCanvasRenderingContext2D, OffscreenCanvasRenderingContext2DPtrTag>>(structure, globalObject, WTFMove(impl)) +{ +} + +void JSOffscreenCanvasRenderingContext2D::finishCreation(VM& vm) +{ + Base::finishCreation(vm); + ASSERT(inherits(vm, info())); +} + +JSObject* JSOffscreenCanvasRenderingContext2D::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) +{ + return JSOffscreenCanvasRenderingContext2DPrototype::create(vm, &globalObject, JSOffscreenCanvasRenderingContext2DPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype())); +} + +JSObject* JSOffscreenCanvasRenderingContext2D::prototype(VM& vm, JSDOMGlobalObject& globalObject) +{ + return getDOMPrototype<JSOffscreenCanvasRenderingContext2D>(vm, globalObject); +} + +JSValue JSOffscreenCanvasRenderingContext2D::getConstructor(VM& vm, const JSGlobalObject* globalObject) +{ + return getDOMConstructor<JSOffscreenCanvasRenderingContext2DDOMConstructor, DOMConstructorID::OffscreenCanvasRenderingContext2D>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); +} + +void JSOffscreenCanvasRenderingContext2D::destroy(JSC::JSCell* cell) +{ + JSOffscreenCanvasRenderingContext2D* thisObject = static_cast<JSOffscreenCanvasRenderingContext2D*>(cell); + thisObject->JSOffscreenCanvasRenderingContext2D::~JSOffscreenCanvasRenderingContext2D(); +} + +JSC_DEFINE_CUSTOM_GETTER(jsOffscreenCanvasRenderingContext2DConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) +{ + VM& vm = JSC::getVM(lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto* prototype = jsDynamicCast<JSOffscreenCanvasRenderingContext2DPrototype*>(vm, JSValue::decode(thisValue)); + if (UNLIKELY(!prototype)) + return throwVMTypeError(lexicalGlobalObject, throwScope); + return JSValue::encode(JSOffscreenCanvasRenderingContext2D::getConstructor(JSC::getVM(lexicalGlobalObject), prototype->globalObject())); +} + +static inline JSValue jsOffscreenCanvasRenderingContext2D_canvasGetter(JSGlobalObject& lexicalGlobalObject, JSOffscreenCanvasRenderingContext2D& thisObject) +{ + auto& vm = JSC::getVM(&lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto& impl = thisObject.wrapped(); + RELEASE_AND_RETURN(throwScope, (toJS<IDLInterface<OffscreenCanvas>>(lexicalGlobalObject, *thisObject.globalObject(), throwScope, impl.canvas()))); +} + +JSC_DEFINE_CUSTOM_GETTER(jsOffscreenCanvasRenderingContext2D_canvas, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +{ + return IDLAttribute<JSOffscreenCanvasRenderingContext2D>::get<jsOffscreenCanvasRenderingContext2D_canvasGetter, CastedThisErrorBehavior::Assert>(*lexicalGlobalObject, thisValue, attributeName); +} + +static inline JSValue jsOffscreenCanvasRenderingContext2D_globalAlphaGetter(JSGlobalObject& lexicalGlobalObject, JSOffscreenCanvasRenderingContext2D& thisObject) +{ + auto& vm = JSC::getVM(&lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto& impl = thisObject.wrapped(); + RELEASE_AND_RETURN(throwScope, (toJS<IDLUnrestrictedDouble>(lexicalGlobalObject, throwScope, impl.globalAlpha()))); +} + +JSC_DEFINE_CUSTOM_GETTER(jsOffscreenCanvasRenderingContext2D_globalAlpha, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +{ + return IDLAttribute<JSOffscreenCanvasRenderingContext2D>::get<jsOffscreenCanvasRenderingContext2D_globalAlphaGetter, CastedThisErrorBehavior::Assert>(*lexicalGlobalObject, thisValue, attributeName); +} + +static inline bool setJSOffscreenCanvasRenderingContext2D_globalAlphaSetter(JSGlobalObject& lexicalGlobalObject, JSOffscreenCanvasRenderingContext2D& thisObject, JSValue value) +{ + auto& vm = JSC::getVM(&lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto& impl = thisObject.wrapped(); + auto nativeValue = convert<IDLUnrestrictedDouble>(lexicalGlobalObject, value); + RETURN_IF_EXCEPTION(throwScope, false); + invokeFunctorPropagatingExceptionIfNecessary(lexicalGlobalObject, throwScope, [&] { + return impl.setGlobalAlpha(WTFMove(nativeValue)); + }); + return true; +} + +JSC_DEFINE_CUSTOM_SETTER(setJSOffscreenCanvasRenderingContext2D_globalAlpha, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue, PropertyName attributeName)) +{ + return IDLAttribute<JSOffscreenCanvasRenderingContext2D>::set<setJSOffscreenCanvasRenderingContext2D_globalAlphaSetter>(*lexicalGlobalObject, thisValue, encodedValue, attributeName); +} + +static inline JSValue jsOffscreenCanvasRenderingContext2D_globalCompositeOperationGetter(JSGlobalObject& lexicalGlobalObject, JSOffscreenCanvasRenderingContext2D& thisObject) +{ + auto& vm = JSC::getVM(&lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto& impl = thisObject.wrapped(); + RELEASE_AND_RETURN(throwScope, (toJS<IDLDOMString>(lexicalGlobalObject, throwScope, impl.globalCompositeOperation()))); +} + +JSC_DEFINE_CUSTOM_GETTER(jsOffscreenCanvasRenderingContext2D_globalCompositeOperation, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +{ + return IDLAttribute<JSOffscreenCanvasRenderingContext2D>::get<jsOffscreenCanvasRenderingContext2D_globalCompositeOperationGetter, CastedThisErrorBehavior::Assert>(*lexicalGlobalObject, thisValue, attributeName); +} + +static inline bool setJSOffscreenCanvasRenderingContext2D_globalCompositeOperationSetter(JSGlobalObject& lexicalGlobalObject, JSOffscreenCanvasRenderingContext2D& thisObject, JSValue value) +{ + auto& vm = JSC::getVM(&lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto& impl = thisObject.wrapped(); + auto nativeValue = convert<IDLDOMString>(lexicalGlobalObject, value); + RETURN_IF_EXCEPTION(throwScope, false); + invokeFunctorPropagatingExceptionIfNecessary(lexicalGlobalObject, throwScope, [&] { + return impl.setGlobalCompositeOperation(WTFMove(nativeValue)); + }); + return true; +} + +JSC_DEFINE_CUSTOM_SETTER(setJSOffscreenCanvasRenderingContext2D_globalCompositeOperation, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue, PropertyName attributeName)) +{ + return IDLAttribute<JSOffscreenCanvasRenderingContext2D>::set<setJSOffscreenCanvasRenderingContext2D_globalCompositeOperationSetter>(*lexicalGlobalObject, thisValue, encodedValue, attributeName); +} + +static inline JSValue jsOffscreenCanvasRenderingContext2D_strokeStyleGetter(JSGlobalObject& lexicalGlobalObject, JSOffscreenCanvasRenderingContext2D& thisObject) +{ + auto& vm = JSC::getVM(&lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto& impl = thisObject.wrapped(); + RELEASE_AND_RETURN(throwScope, (toJS<IDLUnion<IDLDOMString, IDLInterface<CanvasGradient>, IDLInterface<CanvasPattern>>>(lexicalGlobalObject, *thisObject.globalObject(), throwScope, impl.strokeStyle()))); +} + +JSC_DEFINE_CUSTOM_GETTER(jsOffscreenCanvasRenderingContext2D_strokeStyle, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +{ + return IDLAttribute<JSOffscreenCanvasRenderingContext2D>::get<jsOffscreenCanvasRenderingContext2D_strokeStyleGetter, CastedThisErrorBehavior::Assert>(*lexicalGlobalObject, thisValue, attributeName); +} + +static inline bool setJSOffscreenCanvasRenderingContext2D_strokeStyleSetter(JSGlobalObject& lexicalGlobalObject, JSOffscreenCanvasRenderingContext2D& thisObject, JSValue value) +{ + auto& vm = JSC::getVM(&lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto& impl = thisObject.wrapped(); + auto nativeValue = convert<IDLUnion<IDLDOMString, IDLInterface<CanvasGradient>, IDLInterface<CanvasPattern>>>(lexicalGlobalObject, value); + RETURN_IF_EXCEPTION(throwScope, false); + invokeFunctorPropagatingExceptionIfNecessary(lexicalGlobalObject, throwScope, [&] { + return impl.setStrokeStyle(WTFMove(nativeValue)); + }); + return true; +} + +JSC_DEFINE_CUSTOM_SETTER(setJSOffscreenCanvasRenderingContext2D_strokeStyle, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue, PropertyName attributeName)) +{ + return IDLAttribute<JSOffscreenCanvasRenderingContext2D>::set<setJSOffscreenCanvasRenderingContext2D_strokeStyleSetter>(*lexicalGlobalObject, thisValue, encodedValue, attributeName); +} + +static inline JSValue jsOffscreenCanvasRenderingContext2D_fillStyleGetter(JSGlobalObject& lexicalGlobalObject, JSOffscreenCanvasRenderingContext2D& thisObject) +{ + auto& vm = JSC::getVM(&lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto& impl = thisObject.wrapped(); + RELEASE_AND_RETURN(throwScope, (toJS<IDLUnion<IDLDOMString, IDLInterface<CanvasGradient>, IDLInterface<CanvasPattern>>>(lexicalGlobalObject, *thisObject.globalObject(), throwScope, impl.fillStyle()))); +} + +JSC_DEFINE_CUSTOM_GETTER(jsOffscreenCanvasRenderingContext2D_fillStyle, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +{ + return IDLAttribute<JSOffscreenCanvasRenderingContext2D>::get<jsOffscreenCanvasRenderingContext2D_fillStyleGetter, CastedThisErrorBehavior::Assert>(*lexicalGlobalObject, thisValue, attributeName); +} + +static inline bool setJSOffscreenCanvasRenderingContext2D_fillStyleSetter(JSGlobalObject& lexicalGlobalObject, JSOffscreenCanvasRenderingContext2D& thisObject, JSValue value) +{ + auto& vm = JSC::getVM(&lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto& impl = thisObject.wrapped(); + auto nativeValue = convert<IDLUnion<IDLDOMString, IDLInterface<CanvasGradient>, IDLInterface<CanvasPattern>>>(lexicalGlobalObject, value); + RETURN_IF_EXCEPTION(throwScope, false); + invokeFunctorPropagatingExceptionIfNecessary(lexicalGlobalObject, throwScope, [&] { + return impl.setFillStyle(WTFMove(nativeValue)); + }); + return true; +} + +JSC_DEFINE_CUSTOM_SETTER(setJSOffscreenCanvasRenderingContext2D_fillStyle, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue, PropertyName attributeName)) +{ + return IDLAttribute<JSOffscreenCanvasRenderingContext2D>::set<setJSOffscreenCanvasRenderingContext2D_fillStyleSetter>(*lexicalGlobalObject, thisValue, encodedValue, attributeName); +} + +static inline JSValue jsOffscreenCanvasRenderingContext2D_imageSmoothingEnabledGetter(JSGlobalObject& lexicalGlobalObject, JSOffscreenCanvasRenderingContext2D& thisObject) +{ + auto& vm = JSC::getVM(&lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto& impl = thisObject.wrapped(); + RELEASE_AND_RETURN(throwScope, (toJS<IDLBoolean>(lexicalGlobalObject, throwScope, impl.imageSmoothingEnabled()))); +} + +JSC_DEFINE_CUSTOM_GETTER(jsOffscreenCanvasRenderingContext2D_imageSmoothingEnabled, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +{ + return IDLAttribute<JSOffscreenCanvasRenderingContext2D>::get<jsOffscreenCanvasRenderingContext2D_imageSmoothingEnabledGetter, CastedThisErrorBehavior::Assert>(*lexicalGlobalObject, thisValue, attributeName); +} + +static inline bool setJSOffscreenCanvasRenderingContext2D_imageSmoothingEnabledSetter(JSGlobalObject& lexicalGlobalObject, JSOffscreenCanvasRenderingContext2D& thisObject, JSValue value) +{ + auto& vm = JSC::getVM(&lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto& impl = thisObject.wrapped(); + auto nativeValue = convert<IDLBoolean>(lexicalGlobalObject, value); + RETURN_IF_EXCEPTION(throwScope, false); + invokeFunctorPropagatingExceptionIfNecessary(lexicalGlobalObject, throwScope, [&] { + return impl.setImageSmoothingEnabled(WTFMove(nativeValue)); + }); + return true; +} + +JSC_DEFINE_CUSTOM_SETTER(setJSOffscreenCanvasRenderingContext2D_imageSmoothingEnabled, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue, PropertyName attributeName)) +{ + return IDLAttribute<JSOffscreenCanvasRenderingContext2D>::set<setJSOffscreenCanvasRenderingContext2D_imageSmoothingEnabledSetter>(*lexicalGlobalObject, thisValue, encodedValue, attributeName); +} + +static inline JSValue jsOffscreenCanvasRenderingContext2D_imageSmoothingQualityGetter(JSGlobalObject& lexicalGlobalObject, JSOffscreenCanvasRenderingContext2D& thisObject) +{ + auto& vm = JSC::getVM(&lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto& impl = thisObject.wrapped(); + RELEASE_AND_RETURN(throwScope, (toJS<IDLEnumeration<ImageSmoothingQuality>>(lexicalGlobalObject, throwScope, impl.imageSmoothingQuality()))); +} + +JSC_DEFINE_CUSTOM_GETTER(jsOffscreenCanvasRenderingContext2D_imageSmoothingQuality, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +{ + return IDLAttribute<JSOffscreenCanvasRenderingContext2D>::get<jsOffscreenCanvasRenderingContext2D_imageSmoothingQualityGetter, CastedThisErrorBehavior::Assert>(*lexicalGlobalObject, thisValue, attributeName); +} + +static inline bool setJSOffscreenCanvasRenderingContext2D_imageSmoothingQualitySetter(JSGlobalObject& lexicalGlobalObject, JSOffscreenCanvasRenderingContext2D& thisObject, JSValue value) +{ + auto& vm = JSC::getVM(&lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto& impl = thisObject.wrapped(); + auto optionalNativeValue = parseEnumeration<ImageSmoothingQuality>(lexicalGlobalObject, value); + RETURN_IF_EXCEPTION(throwScope, false); + if (UNLIKELY(!optionalNativeValue)) + return false; + auto nativeValue = optionalNativeValue.value(); + invokeFunctorPropagatingExceptionIfNecessary(lexicalGlobalObject, throwScope, [&] { + return impl.setImageSmoothingQuality(WTFMove(nativeValue)); + }); + return true; +} + +JSC_DEFINE_CUSTOM_SETTER(setJSOffscreenCanvasRenderingContext2D_imageSmoothingQuality, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue, PropertyName attributeName)) +{ + return IDLAttribute<JSOffscreenCanvasRenderingContext2D>::set<setJSOffscreenCanvasRenderingContext2D_imageSmoothingQualitySetter>(*lexicalGlobalObject, thisValue, encodedValue, attributeName); +} + +static inline JSValue jsOffscreenCanvasRenderingContext2D_currentXGetter(JSGlobalObject& lexicalGlobalObject, JSOffscreenCanvasRenderingContext2D& 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(jsOffscreenCanvasRenderingContext2D_currentX, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +{ + return IDLAttribute<JSOffscreenCanvasRenderingContext2D>::get<jsOffscreenCanvasRenderingContext2D_currentXGetter, CastedThisErrorBehavior::Assert>(*lexicalGlobalObject, thisValue, attributeName); +} + +static inline JSValue jsOffscreenCanvasRenderingContext2D_currentYGetter(JSGlobalObject& lexicalGlobalObject, JSOffscreenCanvasRenderingContext2D& 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(jsOffscreenCanvasRenderingContext2D_currentY, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +{ + return IDLAttribute<JSOffscreenCanvasRenderingContext2D>::get<jsOffscreenCanvasRenderingContext2D_currentYGetter, CastedThisErrorBehavior::Assert>(*lexicalGlobalObject, thisValue, attributeName); +} + +static inline JSValue jsOffscreenCanvasRenderingContext2D_lineWidthGetter(JSGlobalObject& lexicalGlobalObject, JSOffscreenCanvasRenderingContext2D& thisObject) +{ + auto& vm = JSC::getVM(&lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto& impl = thisObject.wrapped(); + RELEASE_AND_RETURN(throwScope, (toJS<IDLUnrestrictedDouble>(lexicalGlobalObject, throwScope, impl.lineWidth()))); +} + +JSC_DEFINE_CUSTOM_GETTER(jsOffscreenCanvasRenderingContext2D_lineWidth, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +{ + return IDLAttribute<JSOffscreenCanvasRenderingContext2D>::get<jsOffscreenCanvasRenderingContext2D_lineWidthGetter, CastedThisErrorBehavior::Assert>(*lexicalGlobalObject, thisValue, attributeName); +} + +static inline bool setJSOffscreenCanvasRenderingContext2D_lineWidthSetter(JSGlobalObject& lexicalGlobalObject, JSOffscreenCanvasRenderingContext2D& thisObject, JSValue value) +{ + auto& vm = JSC::getVM(&lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto& impl = thisObject.wrapped(); + auto nativeValue = convert<IDLUnrestrictedDouble>(lexicalGlobalObject, value); + RETURN_IF_EXCEPTION(throwScope, false); + invokeFunctorPropagatingExceptionIfNecessary(lexicalGlobalObject, throwScope, [&] { + return impl.setLineWidth(WTFMove(nativeValue)); + }); + return true; +} + +JSC_DEFINE_CUSTOM_SETTER(setJSOffscreenCanvasRenderingContext2D_lineWidth, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue, PropertyName attributeName)) +{ + return IDLAttribute<JSOffscreenCanvasRenderingContext2D>::set<setJSOffscreenCanvasRenderingContext2D_lineWidthSetter>(*lexicalGlobalObject, thisValue, encodedValue, attributeName); +} + +static inline JSValue jsOffscreenCanvasRenderingContext2D_lineCapGetter(JSGlobalObject& lexicalGlobalObject, JSOffscreenCanvasRenderingContext2D& thisObject) +{ + auto& vm = JSC::getVM(&lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto& impl = thisObject.wrapped(); + RELEASE_AND_RETURN(throwScope, (toJS<IDLEnumeration<CanvasLineCap>>(lexicalGlobalObject, throwScope, impl.lineCap()))); +} + +JSC_DEFINE_CUSTOM_GETTER(jsOffscreenCanvasRenderingContext2D_lineCap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +{ + return IDLAttribute<JSOffscreenCanvasRenderingContext2D>::get<jsOffscreenCanvasRenderingContext2D_lineCapGetter, CastedThisErrorBehavior::Assert>(*lexicalGlobalObject, thisValue, attributeName); +} + +static inline bool setJSOffscreenCanvasRenderingContext2D_lineCapSetter(JSGlobalObject& lexicalGlobalObject, JSOffscreenCanvasRenderingContext2D& thisObject, JSValue value) +{ + auto& vm = JSC::getVM(&lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto& impl = thisObject.wrapped(); + auto optionalNativeValue = parseEnumeration<CanvasLineCap>(lexicalGlobalObject, value); + RETURN_IF_EXCEPTION(throwScope, false); + if (UNLIKELY(!optionalNativeValue)) + return false; + auto nativeValue = optionalNativeValue.value(); + invokeFunctorPropagatingExceptionIfNecessary(lexicalGlobalObject, throwScope, [&] { + return impl.setLineCap(WTFMove(nativeValue)); + }); + return true; +} + +JSC_DEFINE_CUSTOM_SETTER(setJSOffscreenCanvasRenderingContext2D_lineCap, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue, PropertyName attributeName)) +{ + return IDLAttribute<JSOffscreenCanvasRenderingContext2D>::set<setJSOffscreenCanvasRenderingContext2D_lineCapSetter>(*lexicalGlobalObject, thisValue, encodedValue, attributeName); +} + +static inline JSValue jsOffscreenCanvasRenderingContext2D_lineJoinGetter(JSGlobalObject& lexicalGlobalObject, JSOffscreenCanvasRenderingContext2D& thisObject) +{ + auto& vm = JSC::getVM(&lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto& impl = thisObject.wrapped(); + RELEASE_AND_RETURN(throwScope, (toJS<IDLEnumeration<CanvasLineJoin>>(lexicalGlobalObject, throwScope, impl.lineJoin()))); +} + +JSC_DEFINE_CUSTOM_GETTER(jsOffscreenCanvasRenderingContext2D_lineJoin, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +{ + return IDLAttribute<JSOffscreenCanvasRenderingContext2D>::get<jsOffscreenCanvasRenderingContext2D_lineJoinGetter, CastedThisErrorBehavior::Assert>(*lexicalGlobalObject, thisValue, attributeName); +} + +static inline bool setJSOffscreenCanvasRenderingContext2D_lineJoinSetter(JSGlobalObject& lexicalGlobalObject, JSOffscreenCanvasRenderingContext2D& thisObject, JSValue value) +{ + auto& vm = JSC::getVM(&lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto& impl = thisObject.wrapped(); + auto optionalNativeValue = parseEnumeration<CanvasLineJoin>(lexicalGlobalObject, value); + RETURN_IF_EXCEPTION(throwScope, false); + if (UNLIKELY(!optionalNativeValue)) + return false; + auto nativeValue = optionalNativeValue.value(); + invokeFunctorPropagatingExceptionIfNecessary(lexicalGlobalObject, throwScope, [&] { + return impl.setLineJoin(WTFMove(nativeValue)); + }); + return true; +} + +JSC_DEFINE_CUSTOM_SETTER(setJSOffscreenCanvasRenderingContext2D_lineJoin, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue, PropertyName attributeName)) +{ + return IDLAttribute<JSOffscreenCanvasRenderingContext2D>::set<setJSOffscreenCanvasRenderingContext2D_lineJoinSetter>(*lexicalGlobalObject, thisValue, encodedValue, attributeName); +} + +static inline JSValue jsOffscreenCanvasRenderingContext2D_miterLimitGetter(JSGlobalObject& lexicalGlobalObject, JSOffscreenCanvasRenderingContext2D& thisObject) +{ + auto& vm = JSC::getVM(&lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto& impl = thisObject.wrapped(); + RELEASE_AND_RETURN(throwScope, (toJS<IDLUnrestrictedDouble>(lexicalGlobalObject, throwScope, impl.miterLimit()))); +} + +JSC_DEFINE_CUSTOM_GETTER(jsOffscreenCanvasRenderingContext2D_miterLimit, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +{ + return IDLAttribute<JSOffscreenCanvasRenderingContext2D>::get<jsOffscreenCanvasRenderingContext2D_miterLimitGetter, CastedThisErrorBehavior::Assert>(*lexicalGlobalObject, thisValue, attributeName); +} + +static inline bool setJSOffscreenCanvasRenderingContext2D_miterLimitSetter(JSGlobalObject& lexicalGlobalObject, JSOffscreenCanvasRenderingContext2D& thisObject, JSValue value) +{ + auto& vm = JSC::getVM(&lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto& impl = thisObject.wrapped(); + auto nativeValue = convert<IDLUnrestrictedDouble>(lexicalGlobalObject, value); + RETURN_IF_EXCEPTION(throwScope, false); + invokeFunctorPropagatingExceptionIfNecessary(lexicalGlobalObject, throwScope, [&] { + return impl.setMiterLimit(WTFMove(nativeValue)); + }); + return true; +} + +JSC_DEFINE_CUSTOM_SETTER(setJSOffscreenCanvasRenderingContext2D_miterLimit, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue, PropertyName attributeName)) +{ + return IDLAttribute<JSOffscreenCanvasRenderingContext2D>::set<setJSOffscreenCanvasRenderingContext2D_miterLimitSetter>(*lexicalGlobalObject, thisValue, encodedValue, attributeName); +} + +static inline JSValue jsOffscreenCanvasRenderingContext2D_lineDashOffsetGetter(JSGlobalObject& lexicalGlobalObject, JSOffscreenCanvasRenderingContext2D& thisObject) +{ + auto& vm = JSC::getVM(&lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto& impl = thisObject.wrapped(); + RELEASE_AND_RETURN(throwScope, (toJS<IDLUnrestrictedDouble>(lexicalGlobalObject, throwScope, impl.lineDashOffset()))); +} + +JSC_DEFINE_CUSTOM_GETTER(jsOffscreenCanvasRenderingContext2D_lineDashOffset, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +{ + return IDLAttribute<JSOffscreenCanvasRenderingContext2D>::get<jsOffscreenCanvasRenderingContext2D_lineDashOffsetGetter, CastedThisErrorBehavior::Assert>(*lexicalGlobalObject, thisValue, attributeName); +} + +static inline bool setJSOffscreenCanvasRenderingContext2D_lineDashOffsetSetter(JSGlobalObject& lexicalGlobalObject, JSOffscreenCanvasRenderingContext2D& thisObject, JSValue value) +{ + auto& vm = JSC::getVM(&lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto& impl = thisObject.wrapped(); + auto nativeValue = convert<IDLUnrestrictedDouble>(lexicalGlobalObject, value); + RETURN_IF_EXCEPTION(throwScope, false); + invokeFunctorPropagatingExceptionIfNecessary(lexicalGlobalObject, throwScope, [&] { + return impl.setLineDashOffset(WTFMove(nativeValue)); + }); + return true; +} + +JSC_DEFINE_CUSTOM_SETTER(setJSOffscreenCanvasRenderingContext2D_lineDashOffset, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue, PropertyName attributeName)) +{ + return IDLAttribute<JSOffscreenCanvasRenderingContext2D>::set<setJSOffscreenCanvasRenderingContext2D_lineDashOffsetSetter>(*lexicalGlobalObject, thisValue, encodedValue, attributeName); +} + +static inline JSValue jsOffscreenCanvasRenderingContext2D_shadowOffsetXGetter(JSGlobalObject& lexicalGlobalObject, JSOffscreenCanvasRenderingContext2D& thisObject) +{ + auto& vm = JSC::getVM(&lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto& impl = thisObject.wrapped(); + RELEASE_AND_RETURN(throwScope, (toJS<IDLUnrestrictedDouble>(lexicalGlobalObject, throwScope, impl.shadowOffsetX()))); +} + +JSC_DEFINE_CUSTOM_GETTER(jsOffscreenCanvasRenderingContext2D_shadowOffsetX, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +{ + return IDLAttribute<JSOffscreenCanvasRenderingContext2D>::get<jsOffscreenCanvasRenderingContext2D_shadowOffsetXGetter, CastedThisErrorBehavior::Assert>(*lexicalGlobalObject, thisValue, attributeName); +} + +static inline bool setJSOffscreenCanvasRenderingContext2D_shadowOffsetXSetter(JSGlobalObject& lexicalGlobalObject, JSOffscreenCanvasRenderingContext2D& thisObject, JSValue value) +{ + auto& vm = JSC::getVM(&lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto& impl = thisObject.wrapped(); + auto nativeValue = convert<IDLUnrestrictedDouble>(lexicalGlobalObject, value); + RETURN_IF_EXCEPTION(throwScope, false); + invokeFunctorPropagatingExceptionIfNecessary(lexicalGlobalObject, throwScope, [&] { + return impl.setShadowOffsetX(WTFMove(nativeValue)); + }); + return true; +} + +JSC_DEFINE_CUSTOM_SETTER(setJSOffscreenCanvasRenderingContext2D_shadowOffsetX, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue, PropertyName attributeName)) +{ + return IDLAttribute<JSOffscreenCanvasRenderingContext2D>::set<setJSOffscreenCanvasRenderingContext2D_shadowOffsetXSetter>(*lexicalGlobalObject, thisValue, encodedValue, attributeName); +} + +static inline JSValue jsOffscreenCanvasRenderingContext2D_shadowOffsetYGetter(JSGlobalObject& lexicalGlobalObject, JSOffscreenCanvasRenderingContext2D& thisObject) +{ + auto& vm = JSC::getVM(&lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto& impl = thisObject.wrapped(); + RELEASE_AND_RETURN(throwScope, (toJS<IDLUnrestrictedDouble>(lexicalGlobalObject, throwScope, impl.shadowOffsetY()))); +} + +JSC_DEFINE_CUSTOM_GETTER(jsOffscreenCanvasRenderingContext2D_shadowOffsetY, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +{ + return IDLAttribute<JSOffscreenCanvasRenderingContext2D>::get<jsOffscreenCanvasRenderingContext2D_shadowOffsetYGetter, CastedThisErrorBehavior::Assert>(*lexicalGlobalObject, thisValue, attributeName); +} + +static inline bool setJSOffscreenCanvasRenderingContext2D_shadowOffsetYSetter(JSGlobalObject& lexicalGlobalObject, JSOffscreenCanvasRenderingContext2D& thisObject, JSValue value) +{ + auto& vm = JSC::getVM(&lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto& impl = thisObject.wrapped(); + auto nativeValue = convert<IDLUnrestrictedDouble>(lexicalGlobalObject, value); + RETURN_IF_EXCEPTION(throwScope, false); + invokeFunctorPropagatingExceptionIfNecessary(lexicalGlobalObject, throwScope, [&] { + return impl.setShadowOffsetY(WTFMove(nativeValue)); + }); + return true; +} + +JSC_DEFINE_CUSTOM_SETTER(setJSOffscreenCanvasRenderingContext2D_shadowOffsetY, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue, PropertyName attributeName)) +{ + return IDLAttribute<JSOffscreenCanvasRenderingContext2D>::set<setJSOffscreenCanvasRenderingContext2D_shadowOffsetYSetter>(*lexicalGlobalObject, thisValue, encodedValue, attributeName); +} + +static inline JSValue jsOffscreenCanvasRenderingContext2D_shadowBlurGetter(JSGlobalObject& lexicalGlobalObject, JSOffscreenCanvasRenderingContext2D& thisObject) +{ + auto& vm = JSC::getVM(&lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto& impl = thisObject.wrapped(); + RELEASE_AND_RETURN(throwScope, (toJS<IDLUnrestrictedDouble>(lexicalGlobalObject, throwScope, impl.shadowBlur()))); +} + +JSC_DEFINE_CUSTOM_GETTER(jsOffscreenCanvasRenderingContext2D_shadowBlur, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +{ + return IDLAttribute<JSOffscreenCanvasRenderingContext2D>::get<jsOffscreenCanvasRenderingContext2D_shadowBlurGetter, CastedThisErrorBehavior::Assert>(*lexicalGlobalObject, thisValue, attributeName); +} + +static inline bool setJSOffscreenCanvasRenderingContext2D_shadowBlurSetter(JSGlobalObject& lexicalGlobalObject, JSOffscreenCanvasRenderingContext2D& thisObject, JSValue value) +{ + auto& vm = JSC::getVM(&lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto& impl = thisObject.wrapped(); + auto nativeValue = convert<IDLUnrestrictedDouble>(lexicalGlobalObject, value); + RETURN_IF_EXCEPTION(throwScope, false); + invokeFunctorPropagatingExceptionIfNecessary(lexicalGlobalObject, throwScope, [&] { + return impl.setShadowBlur(WTFMove(nativeValue)); + }); + return true; +} + +JSC_DEFINE_CUSTOM_SETTER(setJSOffscreenCanvasRenderingContext2D_shadowBlur, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue, PropertyName attributeName)) +{ + return IDLAttribute<JSOffscreenCanvasRenderingContext2D>::set<setJSOffscreenCanvasRenderingContext2D_shadowBlurSetter>(*lexicalGlobalObject, thisValue, encodedValue, attributeName); +} + +static inline JSValue jsOffscreenCanvasRenderingContext2D_shadowColorGetter(JSGlobalObject& lexicalGlobalObject, JSOffscreenCanvasRenderingContext2D& thisObject) +{ + auto& vm = JSC::getVM(&lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto& impl = thisObject.wrapped(); + RELEASE_AND_RETURN(throwScope, (toJS<IDLDOMString>(lexicalGlobalObject, throwScope, impl.shadowColor()))); +} + +JSC_DEFINE_CUSTOM_GETTER(jsOffscreenCanvasRenderingContext2D_shadowColor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +{ + return IDLAttribute<JSOffscreenCanvasRenderingContext2D>::get<jsOffscreenCanvasRenderingContext2D_shadowColorGetter, CastedThisErrorBehavior::Assert>(*lexicalGlobalObject, thisValue, attributeName); +} + +static inline bool setJSOffscreenCanvasRenderingContext2D_shadowColorSetter(JSGlobalObject& lexicalGlobalObject, JSOffscreenCanvasRenderingContext2D& thisObject, JSValue value) +{ + auto& vm = JSC::getVM(&lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto& impl = thisObject.wrapped(); + auto nativeValue = convert<IDLDOMString>(lexicalGlobalObject, value); + RETURN_IF_EXCEPTION(throwScope, false); + invokeFunctorPropagatingExceptionIfNecessary(lexicalGlobalObject, throwScope, [&] { + return impl.setShadowColor(WTFMove(nativeValue)); + }); + return true; +} + +JSC_DEFINE_CUSTOM_SETTER(setJSOffscreenCanvasRenderingContext2D_shadowColor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue, PropertyName attributeName)) +{ + return IDLAttribute<JSOffscreenCanvasRenderingContext2D>::set<setJSOffscreenCanvasRenderingContext2D_shadowColorSetter>(*lexicalGlobalObject, thisValue, encodedValue, attributeName); +} + +static inline JSValue jsOffscreenCanvasRenderingContext2D_fontGetter(JSGlobalObject& lexicalGlobalObject, JSOffscreenCanvasRenderingContext2D& thisObject) +{ + auto& vm = JSC::getVM(&lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto& impl = thisObject.wrapped(); + RELEASE_AND_RETURN(throwScope, (toJS<IDLDOMString>(lexicalGlobalObject, throwScope, impl.font()))); +} + +JSC_DEFINE_CUSTOM_GETTER(jsOffscreenCanvasRenderingContext2D_font, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +{ + return IDLAttribute<JSOffscreenCanvasRenderingContext2D>::get<jsOffscreenCanvasRenderingContext2D_fontGetter, CastedThisErrorBehavior::Assert>(*lexicalGlobalObject, thisValue, attributeName); +} + +static inline bool setJSOffscreenCanvasRenderingContext2D_fontSetter(JSGlobalObject& lexicalGlobalObject, JSOffscreenCanvasRenderingContext2D& thisObject, JSValue value) +{ + auto& vm = JSC::getVM(&lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto& impl = thisObject.wrapped(); + auto nativeValue = convert<IDLDOMString>(lexicalGlobalObject, value); + RETURN_IF_EXCEPTION(throwScope, false); + invokeFunctorPropagatingExceptionIfNecessary(lexicalGlobalObject, throwScope, [&] { + return impl.setFont(WTFMove(nativeValue)); + }); + return true; +} + +JSC_DEFINE_CUSTOM_SETTER(setJSOffscreenCanvasRenderingContext2D_font, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue, PropertyName attributeName)) +{ + return IDLAttribute<JSOffscreenCanvasRenderingContext2D>::set<setJSOffscreenCanvasRenderingContext2D_fontSetter>(*lexicalGlobalObject, thisValue, encodedValue, attributeName); +} + +static inline JSValue jsOffscreenCanvasRenderingContext2D_textAlignGetter(JSGlobalObject& lexicalGlobalObject, JSOffscreenCanvasRenderingContext2D& thisObject) +{ + auto& vm = JSC::getVM(&lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto& impl = thisObject.wrapped(); + RELEASE_AND_RETURN(throwScope, (toJS<IDLEnumeration<CanvasTextAlign>>(lexicalGlobalObject, throwScope, impl.textAlign()))); +} + +JSC_DEFINE_CUSTOM_GETTER(jsOffscreenCanvasRenderingContext2D_textAlign, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +{ + return IDLAttribute<JSOffscreenCanvasRenderingContext2D>::get<jsOffscreenCanvasRenderingContext2D_textAlignGetter, CastedThisErrorBehavior::Assert>(*lexicalGlobalObject, thisValue, attributeName); +} + +static inline bool setJSOffscreenCanvasRenderingContext2D_textAlignSetter(JSGlobalObject& lexicalGlobalObject, JSOffscreenCanvasRenderingContext2D& thisObject, JSValue value) +{ + auto& vm = JSC::getVM(&lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto& impl = thisObject.wrapped(); + auto optionalNativeValue = parseEnumeration<CanvasTextAlign>(lexicalGlobalObject, value); + RETURN_IF_EXCEPTION(throwScope, false); + if (UNLIKELY(!optionalNativeValue)) + return false; + auto nativeValue = optionalNativeValue.value(); + invokeFunctorPropagatingExceptionIfNecessary(lexicalGlobalObject, throwScope, [&] { + return impl.setTextAlign(WTFMove(nativeValue)); + }); + return true; +} + +JSC_DEFINE_CUSTOM_SETTER(setJSOffscreenCanvasRenderingContext2D_textAlign, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue, PropertyName attributeName)) +{ + return IDLAttribute<JSOffscreenCanvasRenderingContext2D>::set<setJSOffscreenCanvasRenderingContext2D_textAlignSetter>(*lexicalGlobalObject, thisValue, encodedValue, attributeName); +} + +static inline JSValue jsOffscreenCanvasRenderingContext2D_textBaselineGetter(JSGlobalObject& lexicalGlobalObject, JSOffscreenCanvasRenderingContext2D& thisObject) +{ + auto& vm = JSC::getVM(&lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto& impl = thisObject.wrapped(); + RELEASE_AND_RETURN(throwScope, (toJS<IDLEnumeration<CanvasTextBaseline>>(lexicalGlobalObject, throwScope, impl.textBaseline()))); +} + +JSC_DEFINE_CUSTOM_GETTER(jsOffscreenCanvasRenderingContext2D_textBaseline, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +{ + return IDLAttribute<JSOffscreenCanvasRenderingContext2D>::get<jsOffscreenCanvasRenderingContext2D_textBaselineGetter, CastedThisErrorBehavior::Assert>(*lexicalGlobalObject, thisValue, attributeName); +} + +static inline bool setJSOffscreenCanvasRenderingContext2D_textBaselineSetter(JSGlobalObject& lexicalGlobalObject, JSOffscreenCanvasRenderingContext2D& thisObject, JSValue value) +{ + auto& vm = JSC::getVM(&lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto& impl = thisObject.wrapped(); + auto optionalNativeValue = parseEnumeration<CanvasTextBaseline>(lexicalGlobalObject, value); + RETURN_IF_EXCEPTION(throwScope, false); + if (UNLIKELY(!optionalNativeValue)) + return false; + auto nativeValue = optionalNativeValue.value(); + invokeFunctorPropagatingExceptionIfNecessary(lexicalGlobalObject, throwScope, [&] { + return impl.setTextBaseline(WTFMove(nativeValue)); + }); + return true; +} + +JSC_DEFINE_CUSTOM_SETTER(setJSOffscreenCanvasRenderingContext2D_textBaseline, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue, PropertyName attributeName)) +{ + return IDLAttribute<JSOffscreenCanvasRenderingContext2D>::set<setJSOffscreenCanvasRenderingContext2D_textBaselineSetter>(*lexicalGlobalObject, thisValue, encodedValue, attributeName); +} + +static inline JSValue jsOffscreenCanvasRenderingContext2D_directionGetter(JSGlobalObject& lexicalGlobalObject, JSOffscreenCanvasRenderingContext2D& thisObject) +{ + auto& vm = JSC::getVM(&lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto& impl = thisObject.wrapped(); + RELEASE_AND_RETURN(throwScope, (toJS<IDLEnumeration<CanvasDirection>>(lexicalGlobalObject, throwScope, impl.direction()))); +} + +JSC_DEFINE_CUSTOM_GETTER(jsOffscreenCanvasRenderingContext2D_direction, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +{ + return IDLAttribute<JSOffscreenCanvasRenderingContext2D>::get<jsOffscreenCanvasRenderingContext2D_directionGetter, CastedThisErrorBehavior::Assert>(*lexicalGlobalObject, thisValue, attributeName); +} + +static inline bool setJSOffscreenCanvasRenderingContext2D_directionSetter(JSGlobalObject& lexicalGlobalObject, JSOffscreenCanvasRenderingContext2D& thisObject, JSValue value) +{ + auto& vm = JSC::getVM(&lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto& impl = thisObject.wrapped(); + auto optionalNativeValue = parseEnumeration<CanvasDirection>(lexicalGlobalObject, value); + RETURN_IF_EXCEPTION(throwScope, false); + if (UNLIKELY(!optionalNativeValue)) + return false; + auto nativeValue = optionalNativeValue.value(); + invokeFunctorPropagatingExceptionIfNecessary(lexicalGlobalObject, throwScope, [&] { + return impl.setDirection(WTFMove(nativeValue)); + }); + return true; +} + +JSC_DEFINE_CUSTOM_SETTER(setJSOffscreenCanvasRenderingContext2D_direction, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue, PropertyName attributeName)) +{ + return IDLAttribute<JSOffscreenCanvasRenderingContext2D>::set<setJSOffscreenCanvasRenderingContext2D_directionSetter>(*lexicalGlobalObject, thisValue, encodedValue, attributeName); +} + +static inline JSC::EncodedJSValue jsOffscreenCanvasRenderingContext2DPrototypeFunction_commitBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSOffscreenCanvasRenderingContext2D>::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.commit(); }))); +} + +JSC_DEFINE_HOST_FUNCTION(jsOffscreenCanvasRenderingContext2DPrototypeFunction_commit, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + return IDLOperation<JSOffscreenCanvasRenderingContext2D>::call<jsOffscreenCanvasRenderingContext2DPrototypeFunction_commitBody>(*lexicalGlobalObject, *callFrame, "commit"); +} + +// static inline JSC::EncodedJSValue jsOffscreenCanvasRenderingContext2DPrototypeFunction_drawImage1Body(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSOffscreenCanvasRenderingContext2D>::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 image = convert<IDLUnion<IDLInterface<HTMLImageElement>, IDLInterface<HTMLCanvasElement>, IDLInterface<ImageBitmap>, IDLInterface<CSSStyleImageValue>, IDLInterface<HTMLVideoElement>>>(*lexicalGlobalObject, argument0.value()); +// RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); +// EnsureStillAliveScope argument1 = callFrame->uncheckedArgument(1); +// auto dx = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument1.value()); +// RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); +// EnsureStillAliveScope argument2 = callFrame->uncheckedArgument(2); +// auto dy = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument2.value()); +// RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); +// RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS<IDLUndefined>(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.drawImage(WTFMove(image), WTFMove(dx), WTFMove(dy)); }))); +// } + +// static inline JSC::EncodedJSValue jsOffscreenCanvasRenderingContext2DPrototypeFunction_drawImage2Body(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSOffscreenCanvasRenderingContext2D>::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 image = convert<IDLUnion<IDLInterface<HTMLImageElement>, IDLInterface<HTMLCanvasElement>, IDLInterface<ImageBitmap>, IDLInterface<CSSStyleImageValue>, IDLInterface<HTMLVideoElement>>>(*lexicalGlobalObject, argument0.value()); +// RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); +// EnsureStillAliveScope argument1 = callFrame->uncheckedArgument(1); +// auto dx = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument1.value()); +// RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); +// EnsureStillAliveScope argument2 = callFrame->uncheckedArgument(2); +// auto dy = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument2.value()); +// RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); +// EnsureStillAliveScope argument3 = callFrame->uncheckedArgument(3); +// auto dw = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument3.value()); +// RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); +// EnsureStillAliveScope argument4 = callFrame->uncheckedArgument(4); +// auto dh = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument4.value()); +// RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); +// RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS<IDLUndefined>(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.drawImage(WTFMove(image), WTFMove(dx), WTFMove(dy), WTFMove(dw), WTFMove(dh)); }))); +// } + +// static inline JSC::EncodedJSValue jsOffscreenCanvasRenderingContext2DPrototypeFunction_drawImage3Body(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSOffscreenCanvasRenderingContext2D>::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 image = convert<IDLUnion<IDLInterface<HTMLImageElement>, IDLInterface<HTMLCanvasElement>, IDLInterface<ImageBitmap>, IDLInterface<CSSStyleImageValue>, IDLInterface<HTMLVideoElement>>>(*lexicalGlobalObject, argument0.value()); +// RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); +// EnsureStillAliveScope argument1 = callFrame->uncheckedArgument(1); +// auto sx = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument1.value()); +// RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); +// EnsureStillAliveScope argument2 = callFrame->uncheckedArgument(2); +// auto sy = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument2.value()); +// RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); +// EnsureStillAliveScope argument3 = callFrame->uncheckedArgument(3); +// auto sw = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument3.value()); +// RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); +// EnsureStillAliveScope argument4 = callFrame->uncheckedArgument(4); +// auto sh = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument4.value()); +// RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); +// EnsureStillAliveScope argument5 = callFrame->uncheckedArgument(5); +// auto dx = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument5.value()); +// RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); +// EnsureStillAliveScope argument6 = callFrame->uncheckedArgument(6); +// auto dy = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument6.value()); +// RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); +// EnsureStillAliveScope argument7 = callFrame->uncheckedArgument(7); +// auto dw = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument7.value()); +// RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); +// EnsureStillAliveScope argument8 = callFrame->uncheckedArgument(8); +// auto dh = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument8.value()); +// RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); +// RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS<IDLUndefined>(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.drawImage(WTFMove(image), WTFMove(sx), WTFMove(sy), WTFMove(sw), WTFMove(sh), WTFMove(dx), WTFMove(dy), WTFMove(dw), WTFMove(dh)); }))); +// } + +// static inline JSC::EncodedJSValue jsOffscreenCanvasRenderingContext2DPrototypeFunction_drawImageOverloadDispatcher(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSOffscreenCanvasRenderingContext2D>::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>(9, callFrame->argumentCount()); +// if (argsCount == 3) { +// RELEASE_AND_RETURN(throwScope, (jsOffscreenCanvasRenderingContext2DPrototypeFunction_drawImage1Body(lexicalGlobalObject, callFrame, castedThis))); +// } +// if (argsCount == 5) { +// RELEASE_AND_RETURN(throwScope, (jsOffscreenCanvasRenderingContext2DPrototypeFunction_drawImage2Body(lexicalGlobalObject, callFrame, castedThis))); +// } +// if (argsCount == 9) { +// RELEASE_AND_RETURN(throwScope, (jsOffscreenCanvasRenderingContext2DPrototypeFunction_drawImage3Body(lexicalGlobalObject, callFrame, castedThis))); +// } +// return argsCount < 3 ? throwVMError(lexicalGlobalObject, throwScope, createNotEnoughArgumentsError(lexicalGlobalObject)) : throwVMTypeError(lexicalGlobalObject, throwScope); +// } + +JSC_DEFINE_HOST_FUNCTION(jsOffscreenCanvasRenderingContext2DPrototypeFunction_drawImage, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + return JSC::JSValue::encode(JSC::jsUndefined()); + // return IDLOperation<JSOffscreenCanvasRenderingContext2D>::call<jsOffscreenCanvasRenderingContext2DPrototypeFunction_drawImageOverloadDispatcher>(*lexicalGlobalObject, *callFrame, "drawImage"); +} + +static inline JSC::EncodedJSValue jsOffscreenCanvasRenderingContext2DPrototypeFunction_beginPathBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSOffscreenCanvasRenderingContext2D>::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.beginPath(); }))); +} + +JSC_DEFINE_HOST_FUNCTION(jsOffscreenCanvasRenderingContext2DPrototypeFunction_beginPath, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + return IDLOperation<JSOffscreenCanvasRenderingContext2D>::call<jsOffscreenCanvasRenderingContext2DPrototypeFunction_beginPathBody>(*lexicalGlobalObject, *callFrame, "beginPath"); +} + +static inline JSC::EncodedJSValue jsOffscreenCanvasRenderingContext2DPrototypeFunction_fill1Body(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSOffscreenCanvasRenderingContext2D>::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->argument(0); + auto fillRule = argument0.value().isUndefined() ? CanvasFillRule::Nonzero : convert<IDLEnumeration<CanvasFillRule>>(*lexicalGlobalObject, argument0.value(), [](JSC::JSGlobalObject& lexicalGlobalObject, JSC::ThrowScope& scope) { throwArgumentMustBeEnumError(lexicalGlobalObject, scope, 0, "fillRule", "OffscreenCanvasRenderingContext2D", "fill", expectedEnumerationValues<CanvasFillRule>()); }); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS<IDLUndefined>(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.fill(WTFMove(fillRule)); }))); +} + +static inline JSC::EncodedJSValue jsOffscreenCanvasRenderingContext2DPrototypeFunction_fill2Body(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSOffscreenCanvasRenderingContext2D>::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 path = convert<IDLInterface<Path2D>>(*lexicalGlobalObject, argument0.value(), [](JSC::JSGlobalObject& lexicalGlobalObject, JSC::ThrowScope& scope) { throwArgumentTypeError(lexicalGlobalObject, scope, 0, "path", "OffscreenCanvasRenderingContext2D", "fill", "Path2D"); }); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument1 = callFrame->argument(1); + auto fillRule = argument1.value().isUndefined() ? CanvasFillRule::Nonzero : convert<IDLEnumeration<CanvasFillRule>>(*lexicalGlobalObject, argument1.value(), [](JSC::JSGlobalObject& lexicalGlobalObject, JSC::ThrowScope& scope) { throwArgumentMustBeEnumError(lexicalGlobalObject, scope, 1, "fillRule", "OffscreenCanvasRenderingContext2D", "fill", expectedEnumerationValues<CanvasFillRule>()); }); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS<IDLUndefined>(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.fill(*path, WTFMove(fillRule)); }))); +} + +static inline JSC::EncodedJSValue jsOffscreenCanvasRenderingContext2DPrototypeFunction_fillOverloadDispatcher(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSOffscreenCanvasRenderingContext2D>::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>(2, callFrame->argumentCount()); + if (argsCount == 0) { + RELEASE_AND_RETURN(throwScope, (jsOffscreenCanvasRenderingContext2DPrototypeFunction_fill1Body(lexicalGlobalObject, callFrame, castedThis))); + } + if (argsCount == 1) { + JSValue distinguishingArg = callFrame->uncheckedArgument(0); + if (distinguishingArg.isUndefined()) + RELEASE_AND_RETURN(throwScope, (jsOffscreenCanvasRenderingContext2DPrototypeFunction_fill1Body(lexicalGlobalObject, callFrame, castedThis))); + if (distinguishingArg.isObject() && asObject(distinguishingArg)->inherits<JSPath2D>(vm)) + RELEASE_AND_RETURN(throwScope, (jsOffscreenCanvasRenderingContext2DPrototypeFunction_fill2Body(lexicalGlobalObject, callFrame, castedThis))); + RELEASE_AND_RETURN(throwScope, (jsOffscreenCanvasRenderingContext2DPrototypeFunction_fill1Body(lexicalGlobalObject, callFrame, castedThis))); + } + if (argsCount == 2) { + RELEASE_AND_RETURN(throwScope, (jsOffscreenCanvasRenderingContext2DPrototypeFunction_fill2Body(lexicalGlobalObject, callFrame, castedThis))); + } + return throwVMTypeError(lexicalGlobalObject, throwScope); +} + +JSC_DEFINE_HOST_FUNCTION(jsOffscreenCanvasRenderingContext2DPrototypeFunction_fill, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + return IDLOperation<JSOffscreenCanvasRenderingContext2D>::call<jsOffscreenCanvasRenderingContext2DPrototypeFunction_fillOverloadDispatcher>(*lexicalGlobalObject, *callFrame, "fill"); +} + +static inline JSC::EncodedJSValue jsOffscreenCanvasRenderingContext2DPrototypeFunction_stroke1Body(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSOffscreenCanvasRenderingContext2D>::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.stroke(); }))); +} + +static inline JSC::EncodedJSValue jsOffscreenCanvasRenderingContext2DPrototypeFunction_stroke2Body(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSOffscreenCanvasRenderingContext2D>::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 path = convert<IDLInterface<Path2D>>(*lexicalGlobalObject, argument0.value(), [](JSC::JSGlobalObject& lexicalGlobalObject, JSC::ThrowScope& scope) { throwArgumentTypeError(lexicalGlobalObject, scope, 0, "path", "OffscreenCanvasRenderingContext2D", "stroke", "Path2D"); }); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS<IDLUndefined>(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.stroke(*path); }))); +} + +static inline JSC::EncodedJSValue jsOffscreenCanvasRenderingContext2DPrototypeFunction_strokeOverloadDispatcher(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSOffscreenCanvasRenderingContext2D>::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>(1, callFrame->argumentCount()); + if (argsCount == 0) { + RELEASE_AND_RETURN(throwScope, (jsOffscreenCanvasRenderingContext2DPrototypeFunction_stroke1Body(lexicalGlobalObject, callFrame, castedThis))); + } + if (argsCount == 1) { + RELEASE_AND_RETURN(throwScope, (jsOffscreenCanvasRenderingContext2DPrototypeFunction_stroke2Body(lexicalGlobalObject, callFrame, castedThis))); + } + return throwVMTypeError(lexicalGlobalObject, throwScope); +} + +JSC_DEFINE_HOST_FUNCTION(jsOffscreenCanvasRenderingContext2DPrototypeFunction_stroke, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + return IDLOperation<JSOffscreenCanvasRenderingContext2D>::call<jsOffscreenCanvasRenderingContext2DPrototypeFunction_strokeOverloadDispatcher>(*lexicalGlobalObject, *callFrame, "stroke"); +} + +static inline JSC::EncodedJSValue jsOffscreenCanvasRenderingContext2DPrototypeFunction_clip1Body(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSOffscreenCanvasRenderingContext2D>::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->argument(0); + auto fillRule = argument0.value().isUndefined() ? CanvasFillRule::Nonzero : convert<IDLEnumeration<CanvasFillRule>>(*lexicalGlobalObject, argument0.value(), [](JSC::JSGlobalObject& lexicalGlobalObject, JSC::ThrowScope& scope) { throwArgumentMustBeEnumError(lexicalGlobalObject, scope, 0, "fillRule", "OffscreenCanvasRenderingContext2D", "clip", expectedEnumerationValues<CanvasFillRule>()); }); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS<IDLUndefined>(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.clip(WTFMove(fillRule)); }))); +} + +static inline JSC::EncodedJSValue jsOffscreenCanvasRenderingContext2DPrototypeFunction_clip2Body(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSOffscreenCanvasRenderingContext2D>::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 path = convert<IDLInterface<Path2D>>(*lexicalGlobalObject, argument0.value(), [](JSC::JSGlobalObject& lexicalGlobalObject, JSC::ThrowScope& scope) { throwArgumentTypeError(lexicalGlobalObject, scope, 0, "path", "OffscreenCanvasRenderingContext2D", "clip", "Path2D"); }); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument1 = callFrame->argument(1); + auto fillRule = argument1.value().isUndefined() ? CanvasFillRule::Nonzero : convert<IDLEnumeration<CanvasFillRule>>(*lexicalGlobalObject, argument1.value(), [](JSC::JSGlobalObject& lexicalGlobalObject, JSC::ThrowScope& scope) { throwArgumentMustBeEnumError(lexicalGlobalObject, scope, 1, "fillRule", "OffscreenCanvasRenderingContext2D", "clip", expectedEnumerationValues<CanvasFillRule>()); }); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS<IDLUndefined>(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.clip(*path, WTFMove(fillRule)); }))); +} + +static inline JSC::EncodedJSValue jsOffscreenCanvasRenderingContext2DPrototypeFunction_clipOverloadDispatcher(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSOffscreenCanvasRenderingContext2D>::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>(2, callFrame->argumentCount()); + if (argsCount == 0) { + RELEASE_AND_RETURN(throwScope, (jsOffscreenCanvasRenderingContext2DPrototypeFunction_clip1Body(lexicalGlobalObject, callFrame, castedThis))); + } + if (argsCount == 1) { + JSValue distinguishingArg = callFrame->uncheckedArgument(0); + if (distinguishingArg.isUndefined()) + RELEASE_AND_RETURN(throwScope, (jsOffscreenCanvasRenderingContext2DPrototypeFunction_clip1Body(lexicalGlobalObject, callFrame, castedThis))); + if (distinguishingArg.isObject() && asObject(distinguishingArg)->inherits<JSPath2D>(vm)) + RELEASE_AND_RETURN(throwScope, (jsOffscreenCanvasRenderingContext2DPrototypeFunction_clip2Body(lexicalGlobalObject, callFrame, castedThis))); + RELEASE_AND_RETURN(throwScope, (jsOffscreenCanvasRenderingContext2DPrototypeFunction_clip1Body(lexicalGlobalObject, callFrame, castedThis))); + } + if (argsCount == 2) { + RELEASE_AND_RETURN(throwScope, (jsOffscreenCanvasRenderingContext2DPrototypeFunction_clip2Body(lexicalGlobalObject, callFrame, castedThis))); + } + return throwVMTypeError(lexicalGlobalObject, throwScope); +} + +JSC_DEFINE_HOST_FUNCTION(jsOffscreenCanvasRenderingContext2DPrototypeFunction_clip, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + return IDLOperation<JSOffscreenCanvasRenderingContext2D>::call<jsOffscreenCanvasRenderingContext2DPrototypeFunction_clipOverloadDispatcher>(*lexicalGlobalObject, *callFrame, "clip"); +} + +static inline JSC::EncodedJSValue jsOffscreenCanvasRenderingContext2DPrototypeFunction_isPointInPath1Body(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSOffscreenCanvasRenderingContext2D>::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->argument(2); + auto fillRule = argument2.value().isUndefined() ? CanvasFillRule::Nonzero : convert<IDLEnumeration<CanvasFillRule>>(*lexicalGlobalObject, argument2.value(), [](JSC::JSGlobalObject& lexicalGlobalObject, JSC::ThrowScope& scope) { throwArgumentMustBeEnumError(lexicalGlobalObject, scope, 2, "fillRule", "OffscreenCanvasRenderingContext2D", "isPointInPath", expectedEnumerationValues<CanvasFillRule>()); }); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS<IDLBoolean>(*lexicalGlobalObject, throwScope, impl.isPointInPath(WTFMove(x), WTFMove(y), WTFMove(fillRule))))); +} + +static inline JSC::EncodedJSValue jsOffscreenCanvasRenderingContext2DPrototypeFunction_isPointInPath2Body(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSOffscreenCanvasRenderingContext2D>::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 path = convert<IDLInterface<Path2D>>(*lexicalGlobalObject, argument0.value(), [](JSC::JSGlobalObject& lexicalGlobalObject, JSC::ThrowScope& scope) { throwArgumentTypeError(lexicalGlobalObject, scope, 0, "path", "OffscreenCanvasRenderingContext2D", "isPointInPath", "Path2D"); }); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument1 = callFrame->uncheckedArgument(1); + auto x = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument1.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument2 = callFrame->uncheckedArgument(2); + auto y = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument2.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument3 = callFrame->argument(3); + auto fillRule = argument3.value().isUndefined() ? CanvasFillRule::Nonzero : convert<IDLEnumeration<CanvasFillRule>>(*lexicalGlobalObject, argument3.value(), [](JSC::JSGlobalObject& lexicalGlobalObject, JSC::ThrowScope& scope) { throwArgumentMustBeEnumError(lexicalGlobalObject, scope, 3, "fillRule", "OffscreenCanvasRenderingContext2D", "isPointInPath", expectedEnumerationValues<CanvasFillRule>()); }); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS<IDLBoolean>(*lexicalGlobalObject, throwScope, impl.isPointInPath(*path, WTFMove(x), WTFMove(y), WTFMove(fillRule))))); +} + +static inline JSC::EncodedJSValue jsOffscreenCanvasRenderingContext2DPrototypeFunction_isPointInPathOverloadDispatcher(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSOffscreenCanvasRenderingContext2D>::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>(4, callFrame->argumentCount()); + if (argsCount == 2) { + RELEASE_AND_RETURN(throwScope, (jsOffscreenCanvasRenderingContext2DPrototypeFunction_isPointInPath1Body(lexicalGlobalObject, callFrame, castedThis))); + } + if (argsCount == 3) { + JSValue distinguishingArg = callFrame->uncheckedArgument(0); + if (distinguishingArg.isObject() && asObject(distinguishingArg)->inherits<JSPath2D>(vm)) + RELEASE_AND_RETURN(throwScope, (jsOffscreenCanvasRenderingContext2DPrototypeFunction_isPointInPath2Body(lexicalGlobalObject, callFrame, castedThis))); + if (distinguishingArg.isNumber()) + RELEASE_AND_RETURN(throwScope, (jsOffscreenCanvasRenderingContext2DPrototypeFunction_isPointInPath1Body(lexicalGlobalObject, callFrame, castedThis))); + RELEASE_AND_RETURN(throwScope, (jsOffscreenCanvasRenderingContext2DPrototypeFunction_isPointInPath1Body(lexicalGlobalObject, callFrame, castedThis))); + } + if (argsCount == 4) { + RELEASE_AND_RETURN(throwScope, (jsOffscreenCanvasRenderingContext2DPrototypeFunction_isPointInPath2Body(lexicalGlobalObject, callFrame, castedThis))); + } + return argsCount < 2 ? throwVMError(lexicalGlobalObject, throwScope, createNotEnoughArgumentsError(lexicalGlobalObject)) : throwVMTypeError(lexicalGlobalObject, throwScope); +} + +JSC_DEFINE_HOST_FUNCTION(jsOffscreenCanvasRenderingContext2DPrototypeFunction_isPointInPath, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + return IDLOperation<JSOffscreenCanvasRenderingContext2D>::call<jsOffscreenCanvasRenderingContext2DPrototypeFunction_isPointInPathOverloadDispatcher>(*lexicalGlobalObject, *callFrame, "isPointInPath"); +} + +static inline JSC::EncodedJSValue jsOffscreenCanvasRenderingContext2DPrototypeFunction_isPointInStroke1Body(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSOffscreenCanvasRenderingContext2D>::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()); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS<IDLBoolean>(*lexicalGlobalObject, throwScope, impl.isPointInStroke(WTFMove(x), WTFMove(y))))); +} + +static inline JSC::EncodedJSValue jsOffscreenCanvasRenderingContext2DPrototypeFunction_isPointInStroke2Body(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSOffscreenCanvasRenderingContext2D>::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 path = convert<IDLInterface<Path2D>>(*lexicalGlobalObject, argument0.value(), [](JSC::JSGlobalObject& lexicalGlobalObject, JSC::ThrowScope& scope) { throwArgumentTypeError(lexicalGlobalObject, scope, 0, "path", "OffscreenCanvasRenderingContext2D", "isPointInStroke", "Path2D"); }); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument1 = callFrame->uncheckedArgument(1); + auto x = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument1.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument2 = callFrame->uncheckedArgument(2); + auto y = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument2.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS<IDLBoolean>(*lexicalGlobalObject, throwScope, impl.isPointInStroke(*path, WTFMove(x), WTFMove(y))))); +} + +static inline JSC::EncodedJSValue jsOffscreenCanvasRenderingContext2DPrototypeFunction_isPointInStrokeOverloadDispatcher(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSOffscreenCanvasRenderingContext2D>::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>(3, callFrame->argumentCount()); + if (argsCount == 2) { + RELEASE_AND_RETURN(throwScope, (jsOffscreenCanvasRenderingContext2DPrototypeFunction_isPointInStroke1Body(lexicalGlobalObject, callFrame, castedThis))); + } + if (argsCount == 3) { + RELEASE_AND_RETURN(throwScope, (jsOffscreenCanvasRenderingContext2DPrototypeFunction_isPointInStroke2Body(lexicalGlobalObject, callFrame, castedThis))); + } + return argsCount < 2 ? throwVMError(lexicalGlobalObject, throwScope, createNotEnoughArgumentsError(lexicalGlobalObject)) : throwVMTypeError(lexicalGlobalObject, throwScope); +} + +JSC_DEFINE_HOST_FUNCTION(jsOffscreenCanvasRenderingContext2DPrototypeFunction_isPointInStroke, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + return IDLOperation<JSOffscreenCanvasRenderingContext2D>::call<jsOffscreenCanvasRenderingContext2DPrototypeFunction_isPointInStrokeOverloadDispatcher>(*lexicalGlobalObject, *callFrame, "isPointInStroke"); +} + +static inline JSC::EncodedJSValue jsOffscreenCanvasRenderingContext2DPrototypeFunction_createLinearGradientBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSOffscreenCanvasRenderingContext2D>::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 x0 = convert<IDLDouble>(*lexicalGlobalObject, argument0.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument1 = callFrame->uncheckedArgument(1); + auto y0 = convert<IDLDouble>(*lexicalGlobalObject, argument1.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument2 = callFrame->uncheckedArgument(2); + auto x1 = convert<IDLDouble>(*lexicalGlobalObject, argument2.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument3 = callFrame->uncheckedArgument(3); + auto y1 = convert<IDLDouble>(*lexicalGlobalObject, argument3.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS<IDLInterface<CanvasGradient>>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, impl.createLinearGradient(WTFMove(x0), WTFMove(y0), WTFMove(x1), WTFMove(y1))))); +} + +JSC_DEFINE_HOST_FUNCTION(jsOffscreenCanvasRenderingContext2DPrototypeFunction_createLinearGradient, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + return IDLOperation<JSOffscreenCanvasRenderingContext2D>::call<jsOffscreenCanvasRenderingContext2DPrototypeFunction_createLinearGradientBody>(*lexicalGlobalObject, *callFrame, "createLinearGradient"); +} + +static inline JSC::EncodedJSValue jsOffscreenCanvasRenderingContext2DPrototypeFunction_createRadialGradientBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSOffscreenCanvasRenderingContext2D>::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 x0 = convert<IDLDouble>(*lexicalGlobalObject, argument0.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument1 = callFrame->uncheckedArgument(1); + auto y0 = convert<IDLDouble>(*lexicalGlobalObject, argument1.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument2 = callFrame->uncheckedArgument(2); + auto r0 = convert<IDLDouble>(*lexicalGlobalObject, argument2.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument3 = callFrame->uncheckedArgument(3); + auto x1 = convert<IDLDouble>(*lexicalGlobalObject, argument3.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument4 = callFrame->uncheckedArgument(4); + auto y1 = convert<IDLDouble>(*lexicalGlobalObject, argument4.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument5 = callFrame->uncheckedArgument(5); + auto r1 = convert<IDLDouble>(*lexicalGlobalObject, argument5.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS<IDLInterface<CanvasGradient>>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, impl.createRadialGradient(WTFMove(x0), WTFMove(y0), WTFMove(r0), WTFMove(x1), WTFMove(y1), WTFMove(r1))))); +} + +JSC_DEFINE_HOST_FUNCTION(jsOffscreenCanvasRenderingContext2DPrototypeFunction_createRadialGradient, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + return IDLOperation<JSOffscreenCanvasRenderingContext2D>::call<jsOffscreenCanvasRenderingContext2DPrototypeFunction_createRadialGradientBody>(*lexicalGlobalObject, *callFrame, "createRadialGradient"); +} + +static inline JSC::EncodedJSValue jsOffscreenCanvasRenderingContext2DPrototypeFunction_createConicGradientBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSOffscreenCanvasRenderingContext2D>::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() < 3)) + return throwVMError(lexicalGlobalObject, throwScope, createNotEnoughArgumentsError(lexicalGlobalObject)); + EnsureStillAliveScope argument0 = callFrame->uncheckedArgument(0); + auto angle = convert<IDLDouble>(*lexicalGlobalObject, argument0.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument1 = callFrame->uncheckedArgument(1); + auto x = convert<IDLDouble>(*lexicalGlobalObject, argument1.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument2 = callFrame->uncheckedArgument(2); + auto y = convert<IDLDouble>(*lexicalGlobalObject, argument2.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS<IDLInterface<CanvasGradient>>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, impl.createConicGradient(WTFMove(angle), WTFMove(x), WTFMove(y))))); +} + +JSC_DEFINE_HOST_FUNCTION(jsOffscreenCanvasRenderingContext2DPrototypeFunction_createConicGradient, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + return IDLOperation<JSOffscreenCanvasRenderingContext2D>::call<jsOffscreenCanvasRenderingContext2DPrototypeFunction_createConicGradientBody>(*lexicalGlobalObject, *callFrame, "createConicGradient"); +} + +static inline JSC::EncodedJSValue jsOffscreenCanvasRenderingContext2DPrototypeFunction_createPatternBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSOffscreenCanvasRenderingContext2D>::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 image = convert<IDLUnion<IDLInterface<HTMLImageElement>, IDLInterface<HTMLCanvasElement>, IDLInterface<ImageBitmap>, IDLInterface<CSSStyleImageValue>, IDLInterface<HTMLVideoElement>>>(*lexicalGlobalObject, argument0.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument1 = callFrame->uncheckedArgument(1); + auto repetition = convert<IDLLegacyNullToEmptyStringAdaptor<IDLDOMString>>(*lexicalGlobalObject, argument1.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS<IDLNullable<IDLInterface<CanvasPattern>>>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, impl.createPattern(WTFMove(image), WTFMove(repetition))))); +} + +JSC_DEFINE_HOST_FUNCTION(jsOffscreenCanvasRenderingContext2DPrototypeFunction_createPattern, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + return IDLOperation<JSOffscreenCanvasRenderingContext2D>::call<jsOffscreenCanvasRenderingContext2DPrototypeFunction_createPatternBody>(*lexicalGlobalObject, *callFrame, "createPattern"); +} + +static inline JSC::EncodedJSValue jsOffscreenCanvasRenderingContext2DPrototypeFunction_createImageData1Body(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSOffscreenCanvasRenderingContext2D>::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 sw = convert<IDLEnforceRangeAdaptor<IDLLong>>(*lexicalGlobalObject, argument0.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument1 = callFrame->uncheckedArgument(1); + auto sh = convert<IDLEnforceRangeAdaptor<IDLLong>>(*lexicalGlobalObject, argument1.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument2 = callFrame->argument(2); + // auto settings = convert<IDLDictionary<ImageDataSettings>>(*lexicalGlobalObject, argument2.value()); + // RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS<IDLInterface<ImageData>>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, impl.createImageData(WTFMove(sw), WTFMove(sh))))); +} + +static inline JSC::EncodedJSValue jsOffscreenCanvasRenderingContext2DPrototypeFunction_createImageData2Body(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSOffscreenCanvasRenderingContext2D>::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 imagedata = convert<IDLInterface<ImageData>>(*lexicalGlobalObject, argument0.value(), [](JSC::JSGlobalObject& lexicalGlobalObject, JSC::ThrowScope& scope) { throwArgumentTypeError(lexicalGlobalObject, scope, 0, "imagedata", "OffscreenCanvasRenderingContext2D", "createImageData", "ImageData"); }); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS<IDLInterface<ImageData>>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, impl.createImageData(*imagedata)))); +} + +static inline JSC::EncodedJSValue jsOffscreenCanvasRenderingContext2DPrototypeFunction_createImageDataOverloadDispatcher(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSOffscreenCanvasRenderingContext2D>::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>(3, callFrame->argumentCount()); + if (argsCount == 1) { + RELEASE_AND_RETURN(throwScope, (jsOffscreenCanvasRenderingContext2DPrototypeFunction_createImageData2Body(lexicalGlobalObject, callFrame, castedThis))); + } + if (argsCount == 2) { + RELEASE_AND_RETURN(throwScope, (jsOffscreenCanvasRenderingContext2DPrototypeFunction_createImageData1Body(lexicalGlobalObject, callFrame, castedThis))); + } + if (argsCount == 3) { + RELEASE_AND_RETURN(throwScope, (jsOffscreenCanvasRenderingContext2DPrototypeFunction_createImageData1Body(lexicalGlobalObject, callFrame, castedThis))); + } + return argsCount < 1 ? throwVMError(lexicalGlobalObject, throwScope, createNotEnoughArgumentsError(lexicalGlobalObject)) : throwVMTypeError(lexicalGlobalObject, throwScope); +} + +JSC_DEFINE_HOST_FUNCTION(jsOffscreenCanvasRenderingContext2DPrototypeFunction_createImageData, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + return IDLOperation<JSOffscreenCanvasRenderingContext2D>::call<jsOffscreenCanvasRenderingContext2DPrototypeFunction_createImageDataOverloadDispatcher>(*lexicalGlobalObject, *callFrame, "createImageData"); +} + +static inline JSC::EncodedJSValue jsOffscreenCanvasRenderingContext2DPrototypeFunction_getImageDataBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSOffscreenCanvasRenderingContext2D>::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 sx = convert<IDLEnforceRangeAdaptor<IDLLong>>(*lexicalGlobalObject, argument0.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument1 = callFrame->uncheckedArgument(1); + auto sy = convert<IDLEnforceRangeAdaptor<IDLLong>>(*lexicalGlobalObject, argument1.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument2 = callFrame->uncheckedArgument(2); + auto sw = convert<IDLEnforceRangeAdaptor<IDLLong>>(*lexicalGlobalObject, argument2.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument3 = callFrame->uncheckedArgument(3); + auto sh = convert<IDLEnforceRangeAdaptor<IDLLong>>(*lexicalGlobalObject, argument3.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + // EnsureStillAliveScope argument4 = callFrame->argument(4); + // auto settings = convert<IDLDictionary<ImageDataSettings>>(*lexicalGlobalObject, argument4.value()); + // RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS<IDLInterface<ImageData>>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, impl.getImageData(WTFMove(sx), WTFMove(sy), WTFMove(sw), WTFMove(sh))))); +} + +JSC_DEFINE_HOST_FUNCTION(jsOffscreenCanvasRenderingContext2DPrototypeFunction_getImageData, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + return IDLOperation<JSOffscreenCanvasRenderingContext2D>::call<jsOffscreenCanvasRenderingContext2DPrototypeFunction_getImageDataBody>(*lexicalGlobalObject, *callFrame, "getImageData"); +} + +static inline JSC::EncodedJSValue jsOffscreenCanvasRenderingContext2DPrototypeFunction_putImageData1Body(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSOffscreenCanvasRenderingContext2D>::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 imagedata = convert<IDLInterface<ImageData>>(*lexicalGlobalObject, argument0.value(), [](JSC::JSGlobalObject& lexicalGlobalObject, JSC::ThrowScope& scope) { throwArgumentTypeError(lexicalGlobalObject, scope, 0, "imagedata", "OffscreenCanvasRenderingContext2D", "putImageData", "ImageData"); }); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument1 = callFrame->uncheckedArgument(1); + auto dx = convert<IDLEnforceRangeAdaptor<IDLLong>>(*lexicalGlobalObject, argument1.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument2 = callFrame->uncheckedArgument(2); + auto dy = convert<IDLEnforceRangeAdaptor<IDLLong>>(*lexicalGlobalObject, argument2.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS<IDLUndefined>(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.putImageData(*imagedata, WTFMove(dx), WTFMove(dy)); }))); +} + +static inline JSC::EncodedJSValue jsOffscreenCanvasRenderingContext2DPrototypeFunction_putImageData2Body(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSOffscreenCanvasRenderingContext2D>::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 imagedata = convert<IDLInterface<ImageData>>(*lexicalGlobalObject, argument0.value(), [](JSC::JSGlobalObject& lexicalGlobalObject, JSC::ThrowScope& scope) { throwArgumentTypeError(lexicalGlobalObject, scope, 0, "imagedata", "OffscreenCanvasRenderingContext2D", "putImageData", "ImageData"); }); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument1 = callFrame->uncheckedArgument(1); + auto dx = convert<IDLEnforceRangeAdaptor<IDLLong>>(*lexicalGlobalObject, argument1.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument2 = callFrame->uncheckedArgument(2); + auto dy = convert<IDLEnforceRangeAdaptor<IDLLong>>(*lexicalGlobalObject, argument2.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument3 = callFrame->uncheckedArgument(3); + auto dirtyX = convert<IDLEnforceRangeAdaptor<IDLLong>>(*lexicalGlobalObject, argument3.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument4 = callFrame->uncheckedArgument(4); + auto dirtyY = convert<IDLEnforceRangeAdaptor<IDLLong>>(*lexicalGlobalObject, argument4.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument5 = callFrame->uncheckedArgument(5); + auto dirtyWidth = convert<IDLEnforceRangeAdaptor<IDLLong>>(*lexicalGlobalObject, argument5.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument6 = callFrame->uncheckedArgument(6); + auto dirtyHeight = convert<IDLEnforceRangeAdaptor<IDLLong>>(*lexicalGlobalObject, argument6.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS<IDLUndefined>(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.putImageData(*imagedata, WTFMove(dx), WTFMove(dy), WTFMove(dirtyX), WTFMove(dirtyY), WTFMove(dirtyWidth), WTFMove(dirtyHeight)); }))); +} + +static inline JSC::EncodedJSValue jsOffscreenCanvasRenderingContext2DPrototypeFunction_putImageDataOverloadDispatcher(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSOffscreenCanvasRenderingContext2D>::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>(7, callFrame->argumentCount()); + if (argsCount == 3) { + RELEASE_AND_RETURN(throwScope, (jsOffscreenCanvasRenderingContext2DPrototypeFunction_putImageData1Body(lexicalGlobalObject, callFrame, castedThis))); + } + if (argsCount == 7) { + RELEASE_AND_RETURN(throwScope, (jsOffscreenCanvasRenderingContext2DPrototypeFunction_putImageData2Body(lexicalGlobalObject, callFrame, castedThis))); + } + return argsCount < 3 ? throwVMError(lexicalGlobalObject, throwScope, createNotEnoughArgumentsError(lexicalGlobalObject)) : throwVMTypeError(lexicalGlobalObject, throwScope); +} + +JSC_DEFINE_HOST_FUNCTION(jsOffscreenCanvasRenderingContext2DPrototypeFunction_putImageData, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + return IDLOperation<JSOffscreenCanvasRenderingContext2D>::call<jsOffscreenCanvasRenderingContext2DPrototypeFunction_putImageDataOverloadDispatcher>(*lexicalGlobalObject, *callFrame, "putImageData"); +} + +static inline JSC::EncodedJSValue jsOffscreenCanvasRenderingContext2DPrototypeFunction_closePathBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSOffscreenCanvasRenderingContext2D>::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(jsOffscreenCanvasRenderingContext2DPrototypeFunction_closePath, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + return IDLOperation<JSOffscreenCanvasRenderingContext2D>::call<jsOffscreenCanvasRenderingContext2DPrototypeFunction_closePathBody>(*lexicalGlobalObject, *callFrame, "closePath"); +} + +static inline JSC::EncodedJSValue jsOffscreenCanvasRenderingContext2DPrototypeFunction_moveToBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSOffscreenCanvasRenderingContext2D>::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(jsOffscreenCanvasRenderingContext2DPrototypeFunction_moveTo, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + return IDLOperation<JSOffscreenCanvasRenderingContext2D>::call<jsOffscreenCanvasRenderingContext2DPrototypeFunction_moveToBody>(*lexicalGlobalObject, *callFrame, "moveTo"); +} + +static inline JSC::EncodedJSValue jsOffscreenCanvasRenderingContext2DPrototypeFunction_lineToBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSOffscreenCanvasRenderingContext2D>::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(jsOffscreenCanvasRenderingContext2DPrototypeFunction_lineTo, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + return IDLOperation<JSOffscreenCanvasRenderingContext2D>::call<jsOffscreenCanvasRenderingContext2DPrototypeFunction_lineToBody>(*lexicalGlobalObject, *callFrame, "lineTo"); +} + +static inline JSC::EncodedJSValue jsOffscreenCanvasRenderingContext2DPrototypeFunction_quadraticCurveToBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSOffscreenCanvasRenderingContext2D>::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(jsOffscreenCanvasRenderingContext2DPrototypeFunction_quadraticCurveTo, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + return IDLOperation<JSOffscreenCanvasRenderingContext2D>::call<jsOffscreenCanvasRenderingContext2DPrototypeFunction_quadraticCurveToBody>(*lexicalGlobalObject, *callFrame, "quadraticCurveTo"); +} + +static inline JSC::EncodedJSValue jsOffscreenCanvasRenderingContext2DPrototypeFunction_bezierCurveToBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSOffscreenCanvasRenderingContext2D>::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(jsOffscreenCanvasRenderingContext2DPrototypeFunction_bezierCurveTo, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + return IDLOperation<JSOffscreenCanvasRenderingContext2D>::call<jsOffscreenCanvasRenderingContext2DPrototypeFunction_bezierCurveToBody>(*lexicalGlobalObject, *callFrame, "bezierCurveTo"); +} + +static inline JSC::EncodedJSValue jsOffscreenCanvasRenderingContext2DPrototypeFunction_arcToBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSOffscreenCanvasRenderingContext2D>::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(jsOffscreenCanvasRenderingContext2DPrototypeFunction_arcTo, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + return IDLOperation<JSOffscreenCanvasRenderingContext2D>::call<jsOffscreenCanvasRenderingContext2DPrototypeFunction_arcToBody>(*lexicalGlobalObject, *callFrame, "arcTo"); +} + +static inline JSC::EncodedJSValue jsOffscreenCanvasRenderingContext2DPrototypeFunction_rectBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSOffscreenCanvasRenderingContext2D>::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(jsOffscreenCanvasRenderingContext2DPrototypeFunction_rect, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + return IDLOperation<JSOffscreenCanvasRenderingContext2D>::call<jsOffscreenCanvasRenderingContext2DPrototypeFunction_rectBody>(*lexicalGlobalObject, *callFrame, "rect"); +} + +static inline JSC::EncodedJSValue jsOffscreenCanvasRenderingContext2DPrototypeFunction_roundRect1Body(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSOffscreenCanvasRenderingContext2D>::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 jsOffscreenCanvasRenderingContext2DPrototypeFunction_roundRect2Body(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSOffscreenCanvasRenderingContext2D>::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 jsOffscreenCanvasRenderingContext2DPrototypeFunction_roundRectOverloadDispatcher(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSOffscreenCanvasRenderingContext2D>::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, (jsOffscreenCanvasRenderingContext2DPrototypeFunction_roundRect2Body(lexicalGlobalObject, callFrame, castedThis))); + { + bool success = hasIteratorMethod(lexicalGlobalObject, distinguishingArg); + RETURN_IF_EXCEPTION(throwScope, {}); + if (success) + RELEASE_AND_RETURN(throwScope, (jsOffscreenCanvasRenderingContext2DPrototypeFunction_roundRect1Body(lexicalGlobalObject, callFrame, castedThis))); + } + if (distinguishingArg.isObject()) + RELEASE_AND_RETURN(throwScope, (jsOffscreenCanvasRenderingContext2DPrototypeFunction_roundRect2Body(lexicalGlobalObject, callFrame, castedThis))); + if (distinguishingArg.isNumber()) + RELEASE_AND_RETURN(throwScope, (jsOffscreenCanvasRenderingContext2DPrototypeFunction_roundRect2Body(lexicalGlobalObject, callFrame, castedThis))); + RELEASE_AND_RETURN(throwScope, (jsOffscreenCanvasRenderingContext2DPrototypeFunction_roundRect2Body(lexicalGlobalObject, callFrame, castedThis))); + } + return argsCount < 5 ? throwVMError(lexicalGlobalObject, throwScope, createNotEnoughArgumentsError(lexicalGlobalObject)) : throwVMTypeError(lexicalGlobalObject, throwScope); +} + +JSC_DEFINE_HOST_FUNCTION(jsOffscreenCanvasRenderingContext2DPrototypeFunction_roundRect, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + return IDLOperation<JSOffscreenCanvasRenderingContext2D>::call<jsOffscreenCanvasRenderingContext2DPrototypeFunction_roundRectOverloadDispatcher>(*lexicalGlobalObject, *callFrame, "roundRect"); +} + +static inline JSC::EncodedJSValue jsOffscreenCanvasRenderingContext2DPrototypeFunction_arcBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSOffscreenCanvasRenderingContext2D>::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(jsOffscreenCanvasRenderingContext2DPrototypeFunction_arc, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + return IDLOperation<JSOffscreenCanvasRenderingContext2D>::call<jsOffscreenCanvasRenderingContext2DPrototypeFunction_arcBody>(*lexicalGlobalObject, *callFrame, "arc"); +} + +static inline JSC::EncodedJSValue jsOffscreenCanvasRenderingContext2DPrototypeFunction_ellipseBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSOffscreenCanvasRenderingContext2D>::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(jsOffscreenCanvasRenderingContext2DPrototypeFunction_ellipse, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + return IDLOperation<JSOffscreenCanvasRenderingContext2D>::call<jsOffscreenCanvasRenderingContext2DPrototypeFunction_ellipseBody>(*lexicalGlobalObject, *callFrame, "ellipse"); +} + +static inline JSC::EncodedJSValue jsOffscreenCanvasRenderingContext2DPrototypeFunction_setLineDashBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSOffscreenCanvasRenderingContext2D>::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 segments = convert<IDLSequence<IDLUnrestrictedDouble>>(*lexicalGlobalObject, argument0.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS<IDLUndefined>(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.setLineDash(WTFMove(segments)); }))); +} + +JSC_DEFINE_HOST_FUNCTION(jsOffscreenCanvasRenderingContext2DPrototypeFunction_setLineDash, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + return IDLOperation<JSOffscreenCanvasRenderingContext2D>::call<jsOffscreenCanvasRenderingContext2DPrototypeFunction_setLineDashBody>(*lexicalGlobalObject, *callFrame, "setLineDash"); +} + +static inline JSC::EncodedJSValue jsOffscreenCanvasRenderingContext2DPrototypeFunction_getLineDashBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSOffscreenCanvasRenderingContext2D>::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<IDLSequence<IDLUnrestrictedDouble>>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, impl.getLineDash()))); +} + +JSC_DEFINE_HOST_FUNCTION(jsOffscreenCanvasRenderingContext2DPrototypeFunction_getLineDash, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + return IDLOperation<JSOffscreenCanvasRenderingContext2D>::call<jsOffscreenCanvasRenderingContext2DPrototypeFunction_getLineDashBody>(*lexicalGlobalObject, *callFrame, "getLineDash"); +} + +static inline JSC::EncodedJSValue jsOffscreenCanvasRenderingContext2DPrototypeFunction_clearRectBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSOffscreenCanvasRenderingContext2D>::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.clearRect(WTFMove(x), WTFMove(y), WTFMove(w), WTFMove(h)); }))); +} + +JSC_DEFINE_HOST_FUNCTION(jsOffscreenCanvasRenderingContext2DPrototypeFunction_clearRect, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + return IDLOperation<JSOffscreenCanvasRenderingContext2D>::call<jsOffscreenCanvasRenderingContext2DPrototypeFunction_clearRectBody>(*lexicalGlobalObject, *callFrame, "clearRect"); +} + +static inline JSC::EncodedJSValue jsOffscreenCanvasRenderingContext2DPrototypeFunction_fillRectBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSOffscreenCanvasRenderingContext2D>::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.fillRect(WTFMove(x), WTFMove(y), WTFMove(w), WTFMove(h)); }))); +} + +JSC_DEFINE_HOST_FUNCTION(jsOffscreenCanvasRenderingContext2DPrototypeFunction_fillRect, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + return IDLOperation<JSOffscreenCanvasRenderingContext2D>::call<jsOffscreenCanvasRenderingContext2DPrototypeFunction_fillRectBody>(*lexicalGlobalObject, *callFrame, "fillRect"); +} + +static inline JSC::EncodedJSValue jsOffscreenCanvasRenderingContext2DPrototypeFunction_strokeRectBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSOffscreenCanvasRenderingContext2D>::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.strokeRect(WTFMove(x), WTFMove(y), WTFMove(w), WTFMove(h)); }))); +} + +JSC_DEFINE_HOST_FUNCTION(jsOffscreenCanvasRenderingContext2DPrototypeFunction_strokeRect, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + return IDLOperation<JSOffscreenCanvasRenderingContext2D>::call<jsOffscreenCanvasRenderingContext2DPrototypeFunction_strokeRectBody>(*lexicalGlobalObject, *callFrame, "strokeRect"); +} + +static inline JSC::EncodedJSValue jsOffscreenCanvasRenderingContext2DPrototypeFunction_saveBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSOffscreenCanvasRenderingContext2D>::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.save(); }))); +} + +JSC_DEFINE_HOST_FUNCTION(jsOffscreenCanvasRenderingContext2DPrototypeFunction_save, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + return IDLOperation<JSOffscreenCanvasRenderingContext2D>::call<jsOffscreenCanvasRenderingContext2DPrototypeFunction_saveBody>(*lexicalGlobalObject, *callFrame, "save"); +} + +static inline JSC::EncodedJSValue jsOffscreenCanvasRenderingContext2DPrototypeFunction_restoreBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSOffscreenCanvasRenderingContext2D>::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.restore(); }))); +} + +JSC_DEFINE_HOST_FUNCTION(jsOffscreenCanvasRenderingContext2DPrototypeFunction_restore, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + return IDLOperation<JSOffscreenCanvasRenderingContext2D>::call<jsOffscreenCanvasRenderingContext2DPrototypeFunction_restoreBody>(*lexicalGlobalObject, *callFrame, "restore"); +} + +static inline JSC::EncodedJSValue jsOffscreenCanvasRenderingContext2DPrototypeFunction_fillTextBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSOffscreenCanvasRenderingContext2D>::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() < 3)) + return throwVMError(lexicalGlobalObject, throwScope, createNotEnoughArgumentsError(lexicalGlobalObject)); + EnsureStillAliveScope argument0 = callFrame->uncheckedArgument(0); + auto text = convert<IDLDOMString>(*lexicalGlobalObject, argument0.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument1 = callFrame->uncheckedArgument(1); + auto x = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument1.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument2 = callFrame->uncheckedArgument(2); + auto y = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument2.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument3 = callFrame->argument(3); + auto maxWidth = argument3.value().isUndefined() ? std::optional<Converter<IDLUnrestrictedDouble>::ReturnType>() : std::optional<Converter<IDLUnrestrictedDouble>::ReturnType>(convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument3.value())); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS<IDLUndefined>(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.fillText(WTFMove(text), WTFMove(x), WTFMove(y), WTFMove(maxWidth)); }))); +} + +JSC_DEFINE_HOST_FUNCTION(jsOffscreenCanvasRenderingContext2DPrototypeFunction_fillText, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + return IDLOperation<JSOffscreenCanvasRenderingContext2D>::call<jsOffscreenCanvasRenderingContext2DPrototypeFunction_fillTextBody>(*lexicalGlobalObject, *callFrame, "fillText"); +} + +static inline JSC::EncodedJSValue jsOffscreenCanvasRenderingContext2DPrototypeFunction_strokeTextBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSOffscreenCanvasRenderingContext2D>::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() < 3)) + return throwVMError(lexicalGlobalObject, throwScope, createNotEnoughArgumentsError(lexicalGlobalObject)); + EnsureStillAliveScope argument0 = callFrame->uncheckedArgument(0); + auto text = convert<IDLDOMString>(*lexicalGlobalObject, argument0.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument1 = callFrame->uncheckedArgument(1); + auto x = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument1.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument2 = callFrame->uncheckedArgument(2); + auto y = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument2.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument3 = callFrame->argument(3); + auto maxWidth = argument3.value().isUndefined() ? std::optional<Converter<IDLUnrestrictedDouble>::ReturnType>() : std::optional<Converter<IDLUnrestrictedDouble>::ReturnType>(convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument3.value())); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS<IDLUndefined>(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.strokeText(WTFMove(text), WTFMove(x), WTFMove(y), WTFMove(maxWidth)); }))); +} + +JSC_DEFINE_HOST_FUNCTION(jsOffscreenCanvasRenderingContext2DPrototypeFunction_strokeText, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + return IDLOperation<JSOffscreenCanvasRenderingContext2D>::call<jsOffscreenCanvasRenderingContext2DPrototypeFunction_strokeTextBody>(*lexicalGlobalObject, *callFrame, "strokeText"); +} + +static inline JSC::EncodedJSValue jsOffscreenCanvasRenderingContext2DPrototypeFunction_measureTextBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSOffscreenCanvasRenderingContext2D>::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 text = convert<IDLDOMString>(*lexicalGlobalObject, argument0.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS<IDLInterface<TextMetrics>>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, impl.measureText(WTFMove(text))))); +} + +JSC_DEFINE_HOST_FUNCTION(jsOffscreenCanvasRenderingContext2DPrototypeFunction_measureText, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + return IDLOperation<JSOffscreenCanvasRenderingContext2D>::call<jsOffscreenCanvasRenderingContext2DPrototypeFunction_measureTextBody>(*lexicalGlobalObject, *callFrame, "measureText"); +} + +static inline JSC::EncodedJSValue jsOffscreenCanvasRenderingContext2DPrototypeFunction_scaleBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSOffscreenCanvasRenderingContext2D>::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.scale(WTFMove(x), WTFMove(y)); }))); +} + +JSC_DEFINE_HOST_FUNCTION(jsOffscreenCanvasRenderingContext2DPrototypeFunction_scale, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + return IDLOperation<JSOffscreenCanvasRenderingContext2D>::call<jsOffscreenCanvasRenderingContext2DPrototypeFunction_scaleBody>(*lexicalGlobalObject, *callFrame, "scale"); +} + +static inline JSC::EncodedJSValue jsOffscreenCanvasRenderingContext2DPrototypeFunction_rotateBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSOffscreenCanvasRenderingContext2D>::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 angle = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument0.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS<IDLUndefined>(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.rotate(WTFMove(angle)); }))); +} + +JSC_DEFINE_HOST_FUNCTION(jsOffscreenCanvasRenderingContext2DPrototypeFunction_rotate, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + return IDLOperation<JSOffscreenCanvasRenderingContext2D>::call<jsOffscreenCanvasRenderingContext2DPrototypeFunction_rotateBody>(*lexicalGlobalObject, *callFrame, "rotate"); +} + +static inline JSC::EncodedJSValue jsOffscreenCanvasRenderingContext2DPrototypeFunction_translateBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSOffscreenCanvasRenderingContext2D>::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.translate(WTFMove(x), WTFMove(y)); }))); +} + +JSC_DEFINE_HOST_FUNCTION(jsOffscreenCanvasRenderingContext2DPrototypeFunction_translate, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + return IDLOperation<JSOffscreenCanvasRenderingContext2D>::call<jsOffscreenCanvasRenderingContext2DPrototypeFunction_translateBody>(*lexicalGlobalObject, *callFrame, "translate"); +} + +static inline JSC::EncodedJSValue jsOffscreenCanvasRenderingContext2DPrototypeFunction_transformBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSOffscreenCanvasRenderingContext2D>::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 a = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument0.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument1 = callFrame->uncheckedArgument(1); + auto b = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument1.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument2 = callFrame->uncheckedArgument(2); + auto c = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument2.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument3 = callFrame->uncheckedArgument(3); + auto d = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument3.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument4 = callFrame->uncheckedArgument(4); + auto e = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument4.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument5 = callFrame->uncheckedArgument(5); + auto f = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument5.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS<IDLUndefined>(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.transform(WTFMove(a), WTFMove(b), WTFMove(c), WTFMove(d), WTFMove(e), WTFMove(f)); }))); +} + +JSC_DEFINE_HOST_FUNCTION(jsOffscreenCanvasRenderingContext2DPrototypeFunction_transform, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + return IDLOperation<JSOffscreenCanvasRenderingContext2D>::call<jsOffscreenCanvasRenderingContext2DPrototypeFunction_transformBody>(*lexicalGlobalObject, *callFrame, "transform"); +} + +static inline JSC::EncodedJSValue jsOffscreenCanvasRenderingContext2DPrototypeFunction_getTransformBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSOffscreenCanvasRenderingContext2D>::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(toJSNewlyCreated<IDLInterface<DOMMatrix>>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, impl.getTransform()))); +} + +JSC_DEFINE_HOST_FUNCTION(jsOffscreenCanvasRenderingContext2DPrototypeFunction_getTransform, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + return IDLOperation<JSOffscreenCanvasRenderingContext2D>::call<jsOffscreenCanvasRenderingContext2DPrototypeFunction_getTransformBody>(*lexicalGlobalObject, *callFrame, "getTransform"); +} + +static inline JSC::EncodedJSValue jsOffscreenCanvasRenderingContext2DPrototypeFunction_setTransform1Body(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSOffscreenCanvasRenderingContext2D>::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 a = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument0.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument1 = callFrame->uncheckedArgument(1); + auto b = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument1.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument2 = callFrame->uncheckedArgument(2); + auto c = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument2.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument3 = callFrame->uncheckedArgument(3); + auto d = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument3.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument4 = callFrame->uncheckedArgument(4); + auto e = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument4.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + EnsureStillAliveScope argument5 = callFrame->uncheckedArgument(5); + auto f = convert<IDLUnrestrictedDouble>(*lexicalGlobalObject, argument5.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS<IDLUndefined>(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.setTransform(WTFMove(a), WTFMove(b), WTFMove(c), WTFMove(d), WTFMove(e), WTFMove(f)); }))); +} + +static inline JSC::EncodedJSValue jsOffscreenCanvasRenderingContext2DPrototypeFunction_setTransform2Body(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSOffscreenCanvasRenderingContext2D>::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->argument(0); + auto transform = convert<IDLDictionary<DOMMatrix2DInit>>(*lexicalGlobalObject, argument0.value()); + RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); + RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS<IDLUndefined>(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.setTransform(WTFMove(transform)); }))); +} + +static inline JSC::EncodedJSValue jsOffscreenCanvasRenderingContext2DPrototypeFunction_setTransformOverloadDispatcher(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSOffscreenCanvasRenderingContext2D>::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>(6, callFrame->argumentCount()); + if (argsCount == 0) { + RELEASE_AND_RETURN(throwScope, (jsOffscreenCanvasRenderingContext2DPrototypeFunction_setTransform2Body(lexicalGlobalObject, callFrame, castedThis))); + } + if (argsCount == 1) { + RELEASE_AND_RETURN(throwScope, (jsOffscreenCanvasRenderingContext2DPrototypeFunction_setTransform2Body(lexicalGlobalObject, callFrame, castedThis))); + } + if (argsCount == 6) { + RELEASE_AND_RETURN(throwScope, (jsOffscreenCanvasRenderingContext2DPrototypeFunction_setTransform1Body(lexicalGlobalObject, callFrame, castedThis))); + } + return throwVMTypeError(lexicalGlobalObject, throwScope); +} + +JSC_DEFINE_HOST_FUNCTION(jsOffscreenCanvasRenderingContext2DPrototypeFunction_setTransform, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + return IDLOperation<JSOffscreenCanvasRenderingContext2D>::call<jsOffscreenCanvasRenderingContext2DPrototypeFunction_setTransformOverloadDispatcher>(*lexicalGlobalObject, *callFrame, "setTransform"); +} + +static inline JSC::EncodedJSValue jsOffscreenCanvasRenderingContext2DPrototypeFunction_resetTransformBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSOffscreenCanvasRenderingContext2D>::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.resetTransform(); }))); +} + +JSC_DEFINE_HOST_FUNCTION(jsOffscreenCanvasRenderingContext2DPrototypeFunction_resetTransform, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame)) +{ + return IDLOperation<JSOffscreenCanvasRenderingContext2D>::call<jsOffscreenCanvasRenderingContext2DPrototypeFunction_resetTransformBody>(*lexicalGlobalObject, *callFrame, "resetTransform"); +} + +JSC::GCClient::IsoSubspace* JSOffscreenCanvasRenderingContext2D::subspaceForImpl(JSC::VM& vm) +{ + return WebCore::subspaceForImpl<JSOffscreenCanvasRenderingContext2D, UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForOffscreenCanvasRenderingContext2D.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForOffscreenCanvasRenderingContext2D = WTFMove(space); }, + [](auto& spaces) { return spaces.m_subspaceForOffscreenCanvasRenderingContext2D.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForOffscreenCanvasRenderingContext2D = WTFMove(space); }); +} + +template<typename Visitor> +void JSOffscreenCanvasRenderingContext2D::visitChildrenImpl(JSCell* cell, Visitor& visitor) +{ + auto* thisObject = jsCast<JSOffscreenCanvasRenderingContext2D*>(cell); + ASSERT_GC_OBJECT_INHERITS(thisObject, info()); + Base::visitChildren(thisObject, visitor); + thisObject->visitAdditionalChildren(visitor); +} + +DEFINE_VISIT_CHILDREN(JSOffscreenCanvasRenderingContext2D); + +template<typename Visitor> +void JSOffscreenCanvasRenderingContext2D::visitOutputConstraints(JSCell* cell, Visitor& visitor) +{ + auto* thisObject = jsCast<JSOffscreenCanvasRenderingContext2D*>(cell); + ASSERT_GC_OBJECT_INHERITS(thisObject, info()); + Base::visitOutputConstraints(thisObject, visitor); + thisObject->visitAdditionalChildren(visitor); +} + +template void JSOffscreenCanvasRenderingContext2D::visitOutputConstraints(JSCell*, AbstractSlotVisitor&); +template void JSOffscreenCanvasRenderingContext2D::visitOutputConstraints(JSCell*, SlotVisitor&); +void JSOffscreenCanvasRenderingContext2D::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) +{ + auto* thisObject = jsCast<JSOffscreenCanvasRenderingContext2D*>(cell); + analyzer.setWrappedObjectForCell(cell, &thisObject->wrapped()); + if (thisObject->scriptExecutionContext()) + analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); + Base::analyzeHeap(cell, analyzer); +} + +void JSOffscreenCanvasRenderingContext2DOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) +{ + auto* jsOffscreenCanvasRenderingContext2D = static_cast<JSOffscreenCanvasRenderingContext2D*>(handle.slot()->asCell()); + auto& world = *static_cast<DOMWrapperWorld*>(context); + uncacheWrapper(world, &jsOffscreenCanvasRenderingContext2D->wrapped(), jsOffscreenCanvasRenderingContext2D); +} + +#if ENABLE(BINDING_INTEGRITY) +#if PLATFORM(WIN) +#pragma warning(disable : 4483) +extern "C" { +extern void (*const __identifier("??_7OffscreenCanvasRenderingContext2D@WebCore@@6B@")[])(); +} +#else +extern "C" { +extern void* _ZTVN7WebCore33OffscreenCanvasRenderingContext2DE[]; +} +#endif +#endif + +JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject*, JSDOMGlobalObject* globalObject, Ref<OffscreenCanvasRenderingContext2D>&& impl) +{ + + if constexpr (std::is_polymorphic_v<OffscreenCanvasRenderingContext2D>) { +#if ENABLE(BINDING_INTEGRITY) + const void* actualVTablePointer = getVTablePointer(impl.ptr()); +#if PLATFORM(WIN) + void* expectedVTablePointer = __identifier("??_7OffscreenCanvasRenderingContext2D@WebCore@@6B@"); +#else + void* expectedVTablePointer = &_ZTVN7WebCore33OffscreenCanvasRenderingContext2DE[2]; +#endif + + // If you hit this assertion you either have a use after free bug, or + // OffscreenCanvasRenderingContext2D has subclasses. If OffscreenCanvasRenderingContext2D has subclasses that get passed + // to toJS() we currently require OffscreenCanvasRenderingContext2D you to opt out of binding hardening + // by adding the SkipVTableValidation attribute to the interface IDL definition + RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer); +#endif + } + return createWrapper<OffscreenCanvasRenderingContext2D>(globalObject, WTFMove(impl)); +} + +JSC::JSValue toJS(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, OffscreenCanvasRenderingContext2D& impl) +{ + return wrap(lexicalGlobalObject, globalObject, impl); +} + +OffscreenCanvasRenderingContext2D* JSOffscreenCanvasRenderingContext2D::toWrapped(JSC::VM& vm, JSC::JSValue value) +{ + if (auto* wrapper = jsDynamicCast<JSOffscreenCanvasRenderingContext2D*>(vm, value)) + return &wrapper->wrapped(); + return nullptr; +} + +} diff --git a/src/javascript/jsc/bindings/webcore/JSOffscreenCanvasRenderingContext2D.dep b/src/javascript/jsc/bindings/webcore/JSOffscreenCanvasRenderingContext2D.dep new file mode 100644 index 000000000..42b0716b3 --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/JSOffscreenCanvasRenderingContext2D.dep @@ -0,0 +1 @@ +JSOffscreenCanvasRenderingContext2D.h : diff --git a/src/javascript/jsc/bindings/webcore/JSOffscreenCanvasRenderingContext2D.h b/src/javascript/jsc/bindings/webcore/JSOffscreenCanvasRenderingContext2D.h new file mode 100644 index 000000000..1a57e9b23 --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/JSOffscreenCanvasRenderingContext2D.h @@ -0,0 +1,99 @@ +/* + 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. +*/ + +#pragma once + +#include "JSDOMWrapper.h" +#include "OffscreenCanvasRenderingContext2D.h" +#include <wtf/NeverDestroyed.h> + +namespace WebCore { + +WTF_DECLARE_PTRTAG(OffscreenCanvasRenderingContext2DPtrTag) +class JSOffscreenCanvasRenderingContext2D : public JSDOMWrapper<OffscreenCanvasRenderingContext2D, SignedPtrTraits<OffscreenCanvasRenderingContext2D, OffscreenCanvasRenderingContext2DPtrTag>> { +public: + using Base = JSDOMWrapper<OffscreenCanvasRenderingContext2D, SignedPtrTraits<OffscreenCanvasRenderingContext2D, OffscreenCanvasRenderingContext2DPtrTag>>; + static JSOffscreenCanvasRenderingContext2D* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref<OffscreenCanvasRenderingContext2D>&& impl) + { + JSOffscreenCanvasRenderingContext2D* ptr = new (NotNull, JSC::allocateCell<JSOffscreenCanvasRenderingContext2D>(globalObject->vm())) JSOffscreenCanvasRenderingContext2D(structure, *globalObject, WTFMove(impl)); + ptr->finishCreation(globalObject->vm()); + return ptr; + } + + static JSC::JSObject* createPrototype(JSC::VM&, JSDOMGlobalObject&); + static JSC::JSObject* prototype(JSC::VM&, JSDOMGlobalObject&); + static OffscreenCanvasRenderingContext2D* toWrapped(JSC::VM&, JSC::JSValue); + static void destroy(JSC::JSCell*); + + DECLARE_INFO; + + 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(), JSC::NonArray); + } + + static JSC::JSValue getConstructor(JSC::VM&, const JSC::JSGlobalObject*); + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return subspaceForImpl(vm); + } + static JSC::GCClient::IsoSubspace* subspaceForImpl(JSC::VM& vm); + DECLARE_VISIT_CHILDREN; + template<typename Visitor> void visitAdditionalChildren(Visitor&); + + template<typename Visitor> static void visitOutputConstraints(JSCell*, Visitor&); + static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); + +protected: + JSOffscreenCanvasRenderingContext2D(JSC::Structure*, JSDOMGlobalObject&, Ref<OffscreenCanvasRenderingContext2D>&&); + + void finishCreation(JSC::VM&); +}; + +class JSOffscreenCanvasRenderingContext2DOwner final : public JSC::WeakHandleOwner { +public: + bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::AbstractSlotVisitor&, const char**) final; + void finalize(JSC::Handle<JSC::Unknown>, void* context) final; +}; + +inline JSC::WeakHandleOwner* wrapperOwner(DOMWrapperWorld&, OffscreenCanvasRenderingContext2D*) +{ + static NeverDestroyed<JSOffscreenCanvasRenderingContext2DOwner> owner; + return &owner.get(); +} + +inline void* wrapperKey(OffscreenCanvasRenderingContext2D* wrappableObject) +{ + return wrappableObject; +} + +JSC::JSValue toJS(JSC::JSGlobalObject*, JSDOMGlobalObject*, OffscreenCanvasRenderingContext2D&); +inline JSC::JSValue toJS(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, OffscreenCanvasRenderingContext2D* impl) { return impl ? toJS(lexicalGlobalObject, globalObject, *impl) : JSC::jsNull(); } +JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject*, JSDOMGlobalObject*, Ref<OffscreenCanvasRenderingContext2D>&&); +inline JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, RefPtr<OffscreenCanvasRenderingContext2D>&& impl) { return impl ? toJSNewlyCreated(lexicalGlobalObject, globalObject, impl.releaseNonNull()) : JSC::jsNull(); } + +template<> struct JSDOMWrapperConverterTraits<OffscreenCanvasRenderingContext2D> { + using WrapperClass = JSOffscreenCanvasRenderingContext2D; + using ToWrappedReturnType = OffscreenCanvasRenderingContext2D*; +}; + +} // namespace WebCore 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; +} + +} diff --git a/src/javascript/jsc/bindings/webcore/JSPath2D.dep b/src/javascript/jsc/bindings/webcore/JSPath2D.dep new file mode 100644 index 000000000..f9707881f --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/JSPath2D.dep @@ -0,0 +1 @@ +JSPath2D.h : diff --git a/src/javascript/jsc/bindings/webcore/JSPath2D.h b/src/javascript/jsc/bindings/webcore/JSPath2D.h new file mode 100644 index 000000000..8f6e6d023 --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/JSPath2D.h @@ -0,0 +1,93 @@ +/* + 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. +*/ + +#pragma once + +#include "JSDOMWrapper.h" +#include "Path2D.h" +#include <wtf/NeverDestroyed.h> + +namespace WebCore { + +class WEBCORE_EXPORT JSPath2D : public JSDOMWrapper<Path2D> { +public: + using Base = JSDOMWrapper<Path2D>; + static JSPath2D* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref<Path2D>&& impl) + { + JSPath2D* ptr = new (NotNull, JSC::allocateCell<JSPath2D>(globalObject->vm())) JSPath2D(structure, *globalObject, WTFMove(impl)); + ptr->finishCreation(globalObject->vm()); + return ptr; + } + + static JSC::JSObject* createPrototype(JSC::VM&, JSDOMGlobalObject&); + static JSC::JSObject* prototype(JSC::VM&, JSDOMGlobalObject&); + static Path2D* toWrapped(JSC::VM&, JSC::JSValue); + static void destroy(JSC::JSCell*); + + DECLARE_INFO; + + 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(), JSC::NonArray); + } + + static JSC::JSValue getConstructor(JSC::VM&, const JSC::JSGlobalObject*); + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return subspaceForImpl(vm); + } + static JSC::GCClient::IsoSubspace* subspaceForImpl(JSC::VM& vm); + static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); +protected: + JSPath2D(JSC::Structure*, JSDOMGlobalObject&, Ref<Path2D>&&); + + void finishCreation(JSC::VM&); +}; + +class WEBCORE_EXPORT JSPath2DOwner final : public JSC::WeakHandleOwner { +public: + bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::AbstractSlotVisitor&, const char**) final; + void finalize(JSC::Handle<JSC::Unknown>, void* context) final; +}; + +inline JSC::WeakHandleOwner* wrapperOwner(DOMWrapperWorld&, Path2D*) +{ + static NeverDestroyed<JSPath2DOwner> owner; + return &owner.get(); +} + +inline void* wrapperKey(Path2D* wrappableObject) +{ + return wrappableObject; +} + +WEBCORE_EXPORT JSC::JSValue toJS(JSC::JSGlobalObject*, JSDOMGlobalObject*, Path2D&); +inline JSC::JSValue toJS(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, Path2D* impl) { return impl ? toJS(lexicalGlobalObject, globalObject, *impl) : JSC::jsNull(); } +JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject*, JSDOMGlobalObject*, Ref<Path2D>&&); +inline JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, RefPtr<Path2D>&& impl) { return impl ? toJSNewlyCreated(lexicalGlobalObject, globalObject, impl.releaseNonNull()) : JSC::jsNull(); } + +template<> struct JSDOMWrapperConverterTraits<Path2D> { + using WrapperClass = JSPath2D; + using ToWrappedReturnType = Path2D*; +}; + +} // namespace WebCore diff --git a/src/javascript/jsc/bindings/webcore/JSTextMetrics.cpp b/src/javascript/jsc/bindings/webcore/JSTextMetrics.cpp new file mode 100644 index 000000000..5984ecc09 --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/JSTextMetrics.cpp @@ -0,0 +1,426 @@ +/* + 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 "JSTextMetrics.h" + +#include "ActiveDOMObject.h" +#include "ExtendedDOMClientIsoSubspaces.h" +#include "ExtendedDOMIsoSubspaces.h" +#include "JSDOMAttribute.h" +#include "JSDOMBinding.h" +#include "JSDOMConstructorNotConstructable.h" +#include "JSDOMConvertNumbers.h" +#include "JSDOMExceptionHandling.h" +#include "JSDOMGlobalObjectInlines.h" +#include "JSDOMWrapperCache.h" +#include "ScriptExecutionContext.h" +#include "WebCoreJSClientData.h" +#include <JavaScriptCore/FunctionPrototype.h> +#include <JavaScriptCore/HeapAnalyzer.h> +#include <JavaScriptCore/JSCInlines.h> +#include <JavaScriptCore/JSDestructibleObjectHeapCellType.h> +#include <JavaScriptCore/SlotVisitorMacros.h> +#include <JavaScriptCore/SubspaceInlines.h> +#include <wtf/GetPtr.h> +#include <wtf/PointerPreparations.h> +#include <wtf/URL.h> + +namespace WebCore { +using namespace JSC; + +// Attributes + +static JSC_DECLARE_CUSTOM_GETTER(jsTextMetricsConstructor); +static JSC_DECLARE_CUSTOM_GETTER(jsTextMetrics_width); +static JSC_DECLARE_CUSTOM_GETTER(jsTextMetrics_actualBoundingBoxLeft); +static JSC_DECLARE_CUSTOM_GETTER(jsTextMetrics_actualBoundingBoxRight); +static JSC_DECLARE_CUSTOM_GETTER(jsTextMetrics_fontBoundingBoxAscent); +static JSC_DECLARE_CUSTOM_GETTER(jsTextMetrics_fontBoundingBoxDescent); +static JSC_DECLARE_CUSTOM_GETTER(jsTextMetrics_actualBoundingBoxAscent); +static JSC_DECLARE_CUSTOM_GETTER(jsTextMetrics_actualBoundingBoxDescent); +static JSC_DECLARE_CUSTOM_GETTER(jsTextMetrics_emHeightAscent); +static JSC_DECLARE_CUSTOM_GETTER(jsTextMetrics_emHeightDescent); +static JSC_DECLARE_CUSTOM_GETTER(jsTextMetrics_hangingBaseline); +static JSC_DECLARE_CUSTOM_GETTER(jsTextMetrics_alphabeticBaseline); +static JSC_DECLARE_CUSTOM_GETTER(jsTextMetrics_ideographicBaseline); + +class JSTextMetricsPrototype final : public JSC::JSNonFinalObject { +public: + using Base = JSC::JSNonFinalObject; + static JSTextMetricsPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) + { + JSTextMetricsPrototype* ptr = new (NotNull, JSC::allocateCell<JSTextMetricsPrototype>(vm)) JSTextMetricsPrototype(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(JSTextMetricsPrototype, 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: + JSTextMetricsPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) + : JSC::JSNonFinalObject(vm, structure) + { + } + + void finishCreation(JSC::VM&); +}; +STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSTextMetricsPrototype, JSTextMetricsPrototype::Base); + +using JSTextMetricsDOMConstructor = JSDOMConstructorNotConstructable<JSTextMetrics>; + +template<> const ClassInfo JSTextMetricsDOMConstructor::s_info = { "TextMetrics"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTextMetricsDOMConstructor) }; + +template<> JSValue JSTextMetricsDOMConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) +{ + UNUSED_PARAM(vm); + return globalObject.functionPrototype(); +} + +template<> void JSTextMetricsDOMConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) +{ + putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); + JSString* nameString = jsNontrivialString(vm, "TextMetrics"_s); + m_originalName.set(vm, this, nameString); + putDirect(vm, vm.propertyNames->name, nameString, JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); + putDirect(vm, vm.propertyNames->prototype, JSTextMetrics::prototype(vm, globalObject), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum | JSC::PropertyAttribute::DontDelete); +} + +/* Hash table for prototype */ + +static const HashTableValue JSTextMetricsPrototypeTableValues[] = { + { "constructor", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(jsTextMetricsConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, + { "width", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(jsTextMetrics_width), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, + { "actualBoundingBoxLeft", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(jsTextMetrics_actualBoundingBoxLeft), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, + { "actualBoundingBoxRight", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(jsTextMetrics_actualBoundingBoxRight), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, + { "fontBoundingBoxAscent", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(jsTextMetrics_fontBoundingBoxAscent), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, + { "fontBoundingBoxDescent", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(jsTextMetrics_fontBoundingBoxDescent), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, + { "actualBoundingBoxAscent", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(jsTextMetrics_actualBoundingBoxAscent), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, + { "actualBoundingBoxDescent", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(jsTextMetrics_actualBoundingBoxDescent), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, + { "emHeightAscent", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(jsTextMetrics_emHeightAscent), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, + { "emHeightDescent", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(jsTextMetrics_emHeightDescent), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, + { "hangingBaseline", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(jsTextMetrics_hangingBaseline), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, + { "alphabeticBaseline", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(jsTextMetrics_alphabeticBaseline), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, + { "ideographicBaseline", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t) static_cast<PropertySlot::GetValueFunc>(jsTextMetrics_ideographicBaseline), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, +}; + +const ClassInfo JSTextMetricsPrototype::s_info = { "TextMetrics"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTextMetricsPrototype) }; + +void JSTextMetricsPrototype::finishCreation(VM& vm) +{ + Base::finishCreation(vm); + reifyStaticProperties(vm, JSTextMetrics::info(), JSTextMetricsPrototypeTableValues, *this); + JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); +} + +const ClassInfo JSTextMetrics::s_info = { "TextMetrics"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTextMetrics) }; + +JSTextMetrics::JSTextMetrics(Structure* structure, JSDOMGlobalObject& globalObject, Ref<TextMetrics>&& impl) + : JSDOMWrapper<TextMetrics>(structure, globalObject, WTFMove(impl)) +{ +} + +void JSTextMetrics::finishCreation(VM& vm) +{ + Base::finishCreation(vm); + ASSERT(inherits(vm, info())); + + // static_assert(!std::is_base_of<ActiveDOMObject, TextMetrics>::value, "Interface is not marked as [ActiveDOMObject] even though implementation class subclasses ActiveDOMObject."); +} + +JSObject* JSTextMetrics::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) +{ + return JSTextMetricsPrototype::create(vm, &globalObject, JSTextMetricsPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype())); +} + +JSObject* JSTextMetrics::prototype(VM& vm, JSDOMGlobalObject& globalObject) +{ + return getDOMPrototype<JSTextMetrics>(vm, globalObject); +} + +JSValue JSTextMetrics::getConstructor(VM& vm, const JSGlobalObject* globalObject) +{ + return getDOMConstructor<JSTextMetricsDOMConstructor, DOMConstructorID::TextMetrics>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); +} + +void JSTextMetrics::destroy(JSC::JSCell* cell) +{ + JSTextMetrics* thisObject = static_cast<JSTextMetrics*>(cell); + thisObject->JSTextMetrics::~JSTextMetrics(); +} + +JSC_DEFINE_CUSTOM_GETTER(jsTextMetricsConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) +{ + VM& vm = JSC::getVM(lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto* prototype = jsDynamicCast<JSTextMetricsPrototype*>(vm, JSValue::decode(thisValue)); + if (UNLIKELY(!prototype)) + return throwVMTypeError(lexicalGlobalObject, throwScope); + return JSValue::encode(JSTextMetrics::getConstructor(JSC::getVM(lexicalGlobalObject), prototype->globalObject())); +} + +static inline JSValue jsTextMetrics_widthGetter(JSGlobalObject& lexicalGlobalObject, JSTextMetrics& thisObject) +{ + auto& vm = JSC::getVM(&lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto& impl = thisObject.wrapped(); + RELEASE_AND_RETURN(throwScope, (toJS<IDLUnrestrictedFloat>(lexicalGlobalObject, throwScope, impl.width()))); +} + +JSC_DEFINE_CUSTOM_GETTER(jsTextMetrics_width, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +{ + return IDLAttribute<JSTextMetrics>::get<jsTextMetrics_widthGetter, CastedThisErrorBehavior::Assert>(*lexicalGlobalObject, thisValue, attributeName); +} + +static inline JSValue jsTextMetrics_actualBoundingBoxLeftGetter(JSGlobalObject& lexicalGlobalObject, JSTextMetrics& thisObject) +{ + auto& vm = JSC::getVM(&lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto& impl = thisObject.wrapped(); + RELEASE_AND_RETURN(throwScope, (toJS<IDLUnrestrictedFloat>(lexicalGlobalObject, throwScope, impl.actualBoundingBoxLeft()))); +} + +JSC_DEFINE_CUSTOM_GETTER(jsTextMetrics_actualBoundingBoxLeft, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +{ + return IDLAttribute<JSTextMetrics>::get<jsTextMetrics_actualBoundingBoxLeftGetter, CastedThisErrorBehavior::Assert>(*lexicalGlobalObject, thisValue, attributeName); +} + +static inline JSValue jsTextMetrics_actualBoundingBoxRightGetter(JSGlobalObject& lexicalGlobalObject, JSTextMetrics& thisObject) +{ + auto& vm = JSC::getVM(&lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto& impl = thisObject.wrapped(); + RELEASE_AND_RETURN(throwScope, (toJS<IDLUnrestrictedFloat>(lexicalGlobalObject, throwScope, impl.actualBoundingBoxRight()))); +} + +JSC_DEFINE_CUSTOM_GETTER(jsTextMetrics_actualBoundingBoxRight, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +{ + return IDLAttribute<JSTextMetrics>::get<jsTextMetrics_actualBoundingBoxRightGetter, CastedThisErrorBehavior::Assert>(*lexicalGlobalObject, thisValue, attributeName); +} + +static inline JSValue jsTextMetrics_fontBoundingBoxAscentGetter(JSGlobalObject& lexicalGlobalObject, JSTextMetrics& thisObject) +{ + auto& vm = JSC::getVM(&lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto& impl = thisObject.wrapped(); + RELEASE_AND_RETURN(throwScope, (toJS<IDLUnrestrictedFloat>(lexicalGlobalObject, throwScope, impl.fontBoundingBoxAscent()))); +} + +JSC_DEFINE_CUSTOM_GETTER(jsTextMetrics_fontBoundingBoxAscent, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +{ + return IDLAttribute<JSTextMetrics>::get<jsTextMetrics_fontBoundingBoxAscentGetter, CastedThisErrorBehavior::Assert>(*lexicalGlobalObject, thisValue, attributeName); +} + +static inline JSValue jsTextMetrics_fontBoundingBoxDescentGetter(JSGlobalObject& lexicalGlobalObject, JSTextMetrics& thisObject) +{ + auto& vm = JSC::getVM(&lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto& impl = thisObject.wrapped(); + RELEASE_AND_RETURN(throwScope, (toJS<IDLUnrestrictedFloat>(lexicalGlobalObject, throwScope, impl.fontBoundingBoxDescent()))); +} + +JSC_DEFINE_CUSTOM_GETTER(jsTextMetrics_fontBoundingBoxDescent, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +{ + return IDLAttribute<JSTextMetrics>::get<jsTextMetrics_fontBoundingBoxDescentGetter, CastedThisErrorBehavior::Assert>(*lexicalGlobalObject, thisValue, attributeName); +} + +static inline JSValue jsTextMetrics_actualBoundingBoxAscentGetter(JSGlobalObject& lexicalGlobalObject, JSTextMetrics& thisObject) +{ + auto& vm = JSC::getVM(&lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto& impl = thisObject.wrapped(); + RELEASE_AND_RETURN(throwScope, (toJS<IDLUnrestrictedFloat>(lexicalGlobalObject, throwScope, impl.actualBoundingBoxAscent()))); +} + +JSC_DEFINE_CUSTOM_GETTER(jsTextMetrics_actualBoundingBoxAscent, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +{ + return IDLAttribute<JSTextMetrics>::get<jsTextMetrics_actualBoundingBoxAscentGetter, CastedThisErrorBehavior::Assert>(*lexicalGlobalObject, thisValue, attributeName); +} + +static inline JSValue jsTextMetrics_actualBoundingBoxDescentGetter(JSGlobalObject& lexicalGlobalObject, JSTextMetrics& thisObject) +{ + auto& vm = JSC::getVM(&lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto& impl = thisObject.wrapped(); + RELEASE_AND_RETURN(throwScope, (toJS<IDLUnrestrictedFloat>(lexicalGlobalObject, throwScope, impl.actualBoundingBoxDescent()))); +} + +JSC_DEFINE_CUSTOM_GETTER(jsTextMetrics_actualBoundingBoxDescent, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +{ + return IDLAttribute<JSTextMetrics>::get<jsTextMetrics_actualBoundingBoxDescentGetter, CastedThisErrorBehavior::Assert>(*lexicalGlobalObject, thisValue, attributeName); +} + +static inline JSValue jsTextMetrics_emHeightAscentGetter(JSGlobalObject& lexicalGlobalObject, JSTextMetrics& thisObject) +{ + auto& vm = JSC::getVM(&lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto& impl = thisObject.wrapped(); + RELEASE_AND_RETURN(throwScope, (toJS<IDLUnrestrictedFloat>(lexicalGlobalObject, throwScope, impl.emHeightAscent()))); +} + +JSC_DEFINE_CUSTOM_GETTER(jsTextMetrics_emHeightAscent, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +{ + return IDLAttribute<JSTextMetrics>::get<jsTextMetrics_emHeightAscentGetter, CastedThisErrorBehavior::Assert>(*lexicalGlobalObject, thisValue, attributeName); +} + +static inline JSValue jsTextMetrics_emHeightDescentGetter(JSGlobalObject& lexicalGlobalObject, JSTextMetrics& thisObject) +{ + auto& vm = JSC::getVM(&lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto& impl = thisObject.wrapped(); + RELEASE_AND_RETURN(throwScope, (toJS<IDLUnrestrictedFloat>(lexicalGlobalObject, throwScope, impl.emHeightDescent()))); +} + +JSC_DEFINE_CUSTOM_GETTER(jsTextMetrics_emHeightDescent, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +{ + return IDLAttribute<JSTextMetrics>::get<jsTextMetrics_emHeightDescentGetter, CastedThisErrorBehavior::Assert>(*lexicalGlobalObject, thisValue, attributeName); +} + +static inline JSValue jsTextMetrics_hangingBaselineGetter(JSGlobalObject& lexicalGlobalObject, JSTextMetrics& thisObject) +{ + auto& vm = JSC::getVM(&lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto& impl = thisObject.wrapped(); + RELEASE_AND_RETURN(throwScope, (toJS<IDLUnrestrictedFloat>(lexicalGlobalObject, throwScope, impl.hangingBaseline()))); +} + +JSC_DEFINE_CUSTOM_GETTER(jsTextMetrics_hangingBaseline, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +{ + return IDLAttribute<JSTextMetrics>::get<jsTextMetrics_hangingBaselineGetter, CastedThisErrorBehavior::Assert>(*lexicalGlobalObject, thisValue, attributeName); +} + +static inline JSValue jsTextMetrics_alphabeticBaselineGetter(JSGlobalObject& lexicalGlobalObject, JSTextMetrics& thisObject) +{ + auto& vm = JSC::getVM(&lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto& impl = thisObject.wrapped(); + RELEASE_AND_RETURN(throwScope, (toJS<IDLUnrestrictedFloat>(lexicalGlobalObject, throwScope, impl.alphabeticBaseline()))); +} + +JSC_DEFINE_CUSTOM_GETTER(jsTextMetrics_alphabeticBaseline, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +{ + return IDLAttribute<JSTextMetrics>::get<jsTextMetrics_alphabeticBaselineGetter, CastedThisErrorBehavior::Assert>(*lexicalGlobalObject, thisValue, attributeName); +} + +static inline JSValue jsTextMetrics_ideographicBaselineGetter(JSGlobalObject& lexicalGlobalObject, JSTextMetrics& thisObject) +{ + auto& vm = JSC::getVM(&lexicalGlobalObject); + auto throwScope = DECLARE_THROW_SCOPE(vm); + auto& impl = thisObject.wrapped(); + RELEASE_AND_RETURN(throwScope, (toJS<IDLUnrestrictedFloat>(lexicalGlobalObject, throwScope, impl.ideographicBaseline()))); +} + +JSC_DEFINE_CUSTOM_GETTER(jsTextMetrics_ideographicBaseline, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) +{ + return IDLAttribute<JSTextMetrics>::get<jsTextMetrics_ideographicBaselineGetter, CastedThisErrorBehavior::Assert>(*lexicalGlobalObject, thisValue, attributeName); +} + +JSC::GCClient::IsoSubspace* JSTextMetrics::subspaceForImpl(JSC::VM& vm) +{ + return WebCore::subspaceForImpl<JSTextMetrics, UseCustomHeapCellType::No>( + vm, + [](auto& spaces) { return spaces.m_clientSubspaceForTextMetrics.get(); }, + [](auto& spaces, auto&& space) { spaces.m_clientSubspaceForTextMetrics = WTFMove(space); }, + [](auto& spaces) { return spaces.m_subspaceForTextMetrics.get(); }, + [](auto& spaces, auto&& space) { spaces.m_subspaceForTextMetrics = WTFMove(space); }); +} + +void JSTextMetrics::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) +{ + auto* thisObject = jsCast<JSTextMetrics*>(cell); + analyzer.setWrappedObjectForCell(cell, &thisObject->wrapped()); + if (thisObject->scriptExecutionContext()) + analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); + Base::analyzeHeap(cell, analyzer); +} + +bool JSTextMetricsOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, AbstractSlotVisitor& visitor, const char** reason) +{ + UNUSED_PARAM(handle); + UNUSED_PARAM(visitor); + UNUSED_PARAM(reason); + return false; +} + +void JSTextMetricsOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) +{ + auto* jsTextMetrics = static_cast<JSTextMetrics*>(handle.slot()->asCell()); + auto& world = *static_cast<DOMWrapperWorld*>(context); + uncacheWrapper(world, &jsTextMetrics->wrapped(), jsTextMetrics); +} + +#if ENABLE(BINDING_INTEGRITY) +#if PLATFORM(WIN) +#pragma warning(disable : 4483) +extern "C" { +extern void (*const __identifier("??_7TextMetrics@WebCore@@6B@")[])(); +} +#else +extern "C" { +extern void* _ZTVN7WebCore11TextMetricsE[]; +} +#endif +#endif + +JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject*, JSDOMGlobalObject* globalObject, Ref<TextMetrics>&& impl) +{ + + if constexpr (std::is_polymorphic_v<TextMetrics>) { +#if ENABLE(BINDING_INTEGRITY) + const void* actualVTablePointer = getVTablePointer(impl.ptr()); +#if PLATFORM(WIN) + void* expectedVTablePointer = __identifier("??_7TextMetrics@WebCore@@6B@"); +#else + void* expectedVTablePointer = &_ZTVN7WebCore11TextMetricsE[2]; +#endif + + // If you hit this assertion you either have a use after free bug, or + // TextMetrics has subclasses. If TextMetrics has subclasses that get passed + // to toJS() we currently require TextMetrics you to opt out of binding hardening + // by adding the SkipVTableValidation attribute to the interface IDL definition + RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer); +#endif + } + return createWrapper<TextMetrics>(globalObject, WTFMove(impl)); +} + +JSC::JSValue toJS(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, TextMetrics& impl) +{ + return wrap(lexicalGlobalObject, globalObject, impl); +} + +TextMetrics* JSTextMetrics::toWrapped(JSC::VM& vm, JSC::JSValue value) +{ + if (auto* wrapper = jsDynamicCast<JSTextMetrics*>(vm, value)) + return &wrapper->wrapped(); + return nullptr; +} + +} diff --git a/src/javascript/jsc/bindings/webcore/JSTextMetrics.dep b/src/javascript/jsc/bindings/webcore/JSTextMetrics.dep new file mode 100644 index 000000000..3fe0bbca4 --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/JSTextMetrics.dep @@ -0,0 +1 @@ +JSTextMetrics.h : diff --git a/src/javascript/jsc/bindings/webcore/JSTextMetrics.h b/src/javascript/jsc/bindings/webcore/JSTextMetrics.h new file mode 100644 index 000000000..0ba5f5674 --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/JSTextMetrics.h @@ -0,0 +1,93 @@ +/* + 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. +*/ + +#pragma once + +#include "JSDOMWrapper.h" +#include "TextMetrics.h" +#include <wtf/NeverDestroyed.h> + +namespace WebCore { + +class JSTextMetrics : public JSDOMWrapper<TextMetrics> { +public: + using Base = JSDOMWrapper<TextMetrics>; + static JSTextMetrics* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref<TextMetrics>&& impl) + { + JSTextMetrics* ptr = new (NotNull, JSC::allocateCell<JSTextMetrics>(globalObject->vm())) JSTextMetrics(structure, *globalObject, WTFMove(impl)); + ptr->finishCreation(globalObject->vm()); + return ptr; + } + + static JSC::JSObject* createPrototype(JSC::VM&, JSDOMGlobalObject&); + static JSC::JSObject* prototype(JSC::VM&, JSDOMGlobalObject&); + static TextMetrics* toWrapped(JSC::VM&, JSC::JSValue); + static void destroy(JSC::JSCell*); + + DECLARE_INFO; + + 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(), JSC::NonArray); + } + + static JSC::JSValue getConstructor(JSC::VM&, const JSC::JSGlobalObject*); + template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) + { + if constexpr (mode == JSC::SubspaceAccess::Concurrently) + return nullptr; + return subspaceForImpl(vm); + } + static JSC::GCClient::IsoSubspace* subspaceForImpl(JSC::VM& vm); + static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&); +protected: + JSTextMetrics(JSC::Structure*, JSDOMGlobalObject&, Ref<TextMetrics>&&); + + void finishCreation(JSC::VM&); +}; + +class JSTextMetricsOwner final : public JSC::WeakHandleOwner { +public: + bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::AbstractSlotVisitor&, const char**) final; + void finalize(JSC::Handle<JSC::Unknown>, void* context) final; +}; + +inline JSC::WeakHandleOwner* wrapperOwner(DOMWrapperWorld&, TextMetrics*) +{ + static NeverDestroyed<JSTextMetricsOwner> owner; + return &owner.get(); +} + +inline void* wrapperKey(TextMetrics* wrappableObject) +{ + return wrappableObject; +} + +JSC::JSValue toJS(JSC::JSGlobalObject*, JSDOMGlobalObject*, TextMetrics&); +inline JSC::JSValue toJS(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, TextMetrics* impl) { return impl ? toJS(lexicalGlobalObject, globalObject, *impl) : JSC::jsNull(); } +JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject*, JSDOMGlobalObject*, Ref<TextMetrics>&&); +inline JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, RefPtr<TextMetrics>&& impl) { return impl ? toJSNewlyCreated(lexicalGlobalObject, globalObject, impl.releaseNonNull()) : JSC::jsNull(); } + +template<> struct JSDOMWrapperConverterTraits<TextMetrics> { + using WrapperClass = JSTextMetrics; + using ToWrappedReturnType = TextMetrics*; +}; + +} // namespace WebCore diff --git a/src/javascript/jsc/bindings/webcore/OffscreenCanvas.cpp b/src/javascript/jsc/bindings/webcore/OffscreenCanvas.cpp new file mode 100644 index 000000000..9bdde8205 --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/OffscreenCanvas.cpp @@ -0,0 +1,26 @@ + +#include "root.h" + +#include "OffscreenCanvas.h" +#include "OffscreenCanvasRenderingContext2D.h" + +namespace WebCore { + +OffscreenCanvas::OffscreenCanvas(ScriptExecutionContext& scriptExecutionContext, unsigned width, unsigned height) + : ContextDestructionObserver(&scriptExecutionContext) +{ + m_width = width; + m_height = height; +} + +Ref<OffscreenCanvas> OffscreenCanvas::create(ScriptExecutionContext& scriptExecutionContext, unsigned width, unsigned height) +{ + return adoptRef(*new OffscreenCanvas(scriptExecutionContext, width, height)); +} + +ExceptionOr<std::optional<OffscreenCanvas::OffscreenRenderingContext>> getContext(JSC::JSGlobalObject&, OffscreenCanvas::RenderingContextType) +{ + return Exception { TypeError, "Not implemented yet"_s }; +} + +}
\ No newline at end of file diff --git a/src/javascript/jsc/bindings/webcore/OffscreenCanvas.h b/src/javascript/jsc/bindings/webcore/OffscreenCanvas.h new file mode 100644 index 000000000..464a22275 --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/OffscreenCanvas.h @@ -0,0 +1,91 @@ +#pragma once + +#include "root.h" + +#include "ContextDestructionObserver.h" +#include "EventTarget.h" +#include "ExceptionOr.h" +#include "IDLTypes.h" +// #include "ImageBuffer.h" +// #include "ImageBufferPipe.h" +// #include "IntSize.h" +#include "ScriptWrappable.h" +#include <wtf/FixedVector.h> +#include <wtf/Forward.h> +#include <wtf/RefCounted.h> +#include <wtf/ThreadSafeRefCounted.h> +#include <wtf/WeakPtr.h> +#include <wtf/text/WTFString.h> + +namespace WebCore { +class OffscreenCanvasRenderingContext2D; +class OffscreenCanvas : public RefCounted<OffscreenCanvas>, public EventTargetWithInlineData, private ContextDestructionObserver { + WTF_MAKE_ISO_ALLOCATED(OffscreenCanvas); + +public: + struct ImageEncodeOptions { + String type = "image/png"; + double quality = 1.0; + }; + + enum class RenderingContextType { + _2d, + Webgl, + Webgl2 + }; + using OffscreenRenderingContext = std::variant< +#if ENABLE(WEBGL) + RefPtr<WebGLRenderingContext>, +#endif +#if ENABLE(WEBGL2) + RefPtr<WebGL2RenderingContext>, +#endif + RefPtr<OffscreenCanvasRenderingContext2D>>; + + inline unsigned width() + { + return m_width; + } + inline unsigned height() + { + return m_height; + } + void setWidth(unsigned dimension) + { + m_width = dimension; + } + void setHeight(unsigned dimension) + { + m_height = dimension; + } + + ExceptionOr<std::optional<OffscreenRenderingContext>> getContext(JSC::JSGlobalObject&, RenderingContextType); + + using RefCounted::deref; + using RefCounted::ref; + + static Ref<OffscreenCanvas> create(ScriptExecutionContext&, unsigned width, unsigned height); + + ~OffscreenCanvas(); + +private: + OffscreenCanvas(ScriptExecutionContext& ctx, unsigned width, unsigned height); + + bool isOffscreenCanvas() const { return true; } + + ScriptExecutionContext* scriptExecutionContext() const { return ContextDestructionObserver::scriptExecutionContext(); } + ScriptExecutionContext* canvasBaseScriptExecutionContext() const { return ContextDestructionObserver::scriptExecutionContext(); } + + EventTargetInterface eventTargetInterface() const { return OffscreenCanvasEventTargetInterfaceType; } + void refEventTarget() { ref(); } + void derefEventTarget() { deref(); } + + void refCanvasBase() { ref(); } + void derefCanvasBase() { deref(); } + + // void setSize(const IntSize&) final; + unsigned m_width; + unsigned m_height; +}; + +}
\ No newline at end of file diff --git a/src/javascript/jsc/bindings/webcore/OffscreenCanvasRenderingContext2D.cpp b/src/javascript/jsc/bindings/webcore/OffscreenCanvasRenderingContext2D.cpp new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/OffscreenCanvasRenderingContext2D.cpp diff --git a/src/javascript/jsc/bindings/webcore/OffscreenCanvasRenderingContext2D.h b/src/javascript/jsc/bindings/webcore/OffscreenCanvasRenderingContext2D.h new file mode 100644 index 000000000..cdf5fa78a --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/OffscreenCanvasRenderingContext2D.h @@ -0,0 +1,179 @@ +#pragma once + +#include "root.h" + +#include "OffscreenCanvas.h" +#include "TextMetrics.h" +#include "CanvasRenderingContext2DSettings.h" +#include "CanvasDirection.h" +#include "CanvasPath.h" + +namespace WebCore { + +class OffscreenCanvasRenderingContext2D : public RefCounted<OffscreenCanvasRenderingContext2D>, public CanvasPath { + WTF_MAKE_ISO_ALLOCATED(OffscreenCanvasRenderingContext2D); + +public: + static bool enabledForContext(ScriptExecutionContext&); + + OffscreenCanvasRenderingContext2D(OffscreenCanvas&, CanvasRenderingContext2DSettings&&); + virtual ~OffscreenCanvasRenderingContext2D(); + + OffscreenCanvas& canvas() const { return m_canvas; } + + void commit(); + + void setFont(const String&); + CanvasDirection direction() const; + void fillText(const String& text, double x, double y, std::optional<double> maxWidth = std::nullopt); + void strokeText(const String& text, double x, double y, std::optional<double> maxWidth = std::nullopt); + Ref<TextMetrics> measureText(const String& text); + + double lineWidth() const { return state().lineWidth; } + void setLineWidth(double); + + CanvasLineCap lineCap() const { return state().canvasLineCap(); } + void setLineCap(CanvasLineCap); + void setLineCap(const String&); + + CanvasLineJoin lineJoin() const { return state().canvasLineJoin(); } + void setLineJoin(CanvasLineJoin); + void setLineJoin(const String&); + + double miterLimit() const { return state().miterLimit; } + void setMiterLimit(double); + + const Vector<double>& getLineDash() const { return state().lineDash; } + void setLineDash(const Vector<double>&); + + const Vector<double>& webkitLineDash() const { return getLineDash(); } + void setWebkitLineDash(const Vector<double>&); + + double lineDashOffset() const { return state().lineDashOffset; } + void setLineDashOffset(double); + + float shadowOffsetX() const { return state().shadowOffset.width(); } + void setShadowOffsetX(float); + + float shadowOffsetY() const { return state().shadowOffset.height(); } + void setShadowOffsetY(float); + + float shadowBlur() const { return state().shadowBlur; } + void setShadowBlur(float); + + String shadowColor() const { return state().shadowColorString(); } + void setShadowColor(const String&); + + double globalAlpha() const { return state().globalAlpha; } + void setGlobalAlpha(double); + + String globalCompositeOperation() const { return state().globalCompositeOperationString(); } + void setGlobalCompositeOperation(const String&); + + void save() { ++m_unrealizedSaveCount; } + void restore(); + + void scale(double sx, double sy); + void rotate(double angleInRadians); + void translate(double tx, double ty); + void transform(double m11, double m12, double m21, double m22, double dx, double dy); + + Ref<DOMMatrix> getTransform() const; + void setTransform(double m11, double m12, double m21, double m22, double dx, double dy); + ExceptionOr<void> setTransform(DOMMatrix2DInit&&); + void resetTransform(); + + void setStrokeColor(const String& color, std::optional<float> alpha = std::nullopt); + void setStrokeColor(float grayLevel, float alpha = 1.0); + void setStrokeColor(float r, float g, float b, float a); + + void setFillColor(const String& color, std::optional<float> alpha = std::nullopt); + void setFillColor(float grayLevel, float alpha = 1.0f); + void setFillColor(float r, float g, float b, float a); + + void beginPath(); + + void fill(CanvasFillRule = CanvasFillRule::Nonzero); + void stroke(); + void clip(CanvasFillRule = CanvasFillRule::Nonzero); + + void fill(Path2D&, CanvasFillRule = CanvasFillRule::Nonzero); + void stroke(Path2D&); + void clip(Path2D&, CanvasFillRule = CanvasFillRule::Nonzero); + + bool isPointInPath(double x, double y, CanvasFillRule = CanvasFillRule::Nonzero); + bool isPointInStroke(double x, double y); + + bool isPointInPath(Path2D&, double x, double y, CanvasFillRule = CanvasFillRule::Nonzero); + bool isPointInStroke(Path2D&, double x, double y); + + void clearRect(double x, double y, double width, double height); + void fillRect(double x, double y, double width, double height); + void strokeRect(double x, double y, double width, double height); + + void setShadow(float width, float height, float blur, const String& color = String(), std::optional<float> alpha = std::nullopt); + void setShadow(float width, float height, float blur, float grayLevel, float alpha = 1.0); + void setShadow(float width, float height, float blur, float r, float g, float b, float a); + + void clearShadow(); + + ExceptionOr<void> drawImage(CanvasImageSource&&, float dx, float dy); + ExceptionOr<void> drawImage(CanvasImageSource&&, float dx, float dy, float dw, float dh); + ExceptionOr<void> drawImage(CanvasImageSource&&, float sx, float sy, float sw, float sh, float dx, float dy, float dw, float dh); + + void drawImageFromRect(HTMLImageElement&, float sx = 0, float sy = 0, float sw = 0, float sh = 0, float dx = 0, float dy = 0, float dw = 0, float dh = 0, const String& compositeOperation = emptyString()); + void clearCanvas(); + + using StyleVariant = std::variant<String, RefPtr<CanvasGradient>, RefPtr<CanvasPattern>>; + StyleVariant strokeStyle() const; + void setStrokeStyle(StyleVariant&&); + StyleVariant fillStyle() const; + void setFillStyle(StyleVariant&&); + + ExceptionOr<Ref<CanvasGradient>> createLinearGradient(float x0, float y0, float x1, float y1); + ExceptionOr<Ref<CanvasGradient>> createRadialGradient(float x0, float y0, float r0, float x1, float y1, float r1); + ExceptionOr<Ref<CanvasGradient>> createConicGradient(float angleInRadians, float x, float y); + ExceptionOr<RefPtr<CanvasPattern>> createPattern(CanvasImageSource&&, const String& repetition); + + ExceptionOr<Ref<ImageData>> createImageData(ImageData&) const; + ExceptionOr<Ref<ImageData>> createImageData(int width, int height, std::optional<ImageDataSettings>) const; + ExceptionOr<Ref<ImageData>> getImageData(int sx, int sy, int sw, int sh, std::optional<ImageDataSettings>) const; + void putImageData(ImageData&, int dx, int dy); + void putImageData(ImageData&, int dx, int dy, int dirtyX, int dirtyY, int dirtyWidth, int dirtyHeight); + + static constexpr float webkitBackingStorePixelRatio() { return 1; } + + void reset(); + + bool imageSmoothingEnabled() const { return state().imageSmoothingEnabled; } + void setImageSmoothingEnabled(bool); + + ImageSmoothingQuality imageSmoothingQuality() const { return state().imageSmoothingQuality; } + void setImageSmoothingQuality(ImageSmoothingQuality); + + void setPath(Path2D&); + Ref<Path2D> getPath() const; + + void setUsesDisplayListDrawing(bool flag) { m_usesDisplayListDrawing = flag; }; + + String font() const { return state().fontString(); } + + CanvasTextAlign textAlign() const { return state().canvasTextAlign(); } + void setTextAlign(CanvasTextAlign); + + CanvasTextBaseline textBaseline() const { return state().canvasTextBaseline(); } + void setTextBaseline(CanvasTextBaseline); + + using Direction = CanvasDirection; + void setDirection(Direction); + +private: + bool isOffscreen2d() const { return true; } + // const FontProxy* fontProxy() final; + + Ref<OffscreenCanvas> m_canvas; +}; + +} // namespace WebCore + +// SPECIALIZE_TYPE_TRAITS_CANVASRENDERINGCONTEXT(WebCore::OffscreenCanvasRenderingContext2D, isOffscreen2d()) diff --git a/src/javascript/jsc/bindings/webcore/Path2D.cpp b/src/javascript/jsc/bindings/webcore/Path2D.cpp new file mode 100644 index 000000000..d47d44730 --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/Path2D.cpp @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2015 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF + * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include "config.h" +#include "Path2D.h" + +#include "DOMMatrix2DInit.h" + +namespace WebCore { + +Path2D::~Path2D() = default; + +ExceptionOr<void> Path2D::addPath(Path2D& path, DOMMatrix2DInit&& matrixInit) +{ + // auto checkValid = DOMMatrixReadOnly::validateAndFixup(matrixInit); + // if (checkValid.hasException()) + // return checkValid.releaseException(); + + m_path.addPath(path.path(), { matrixInit.a.value_or(1), matrixInit.b.value_or(0), matrixInit.c.value_or(0), matrixInit.d.value_or(1), matrixInit.e.value_or(0), matrixInit.f.value_or(0) }); + return {}; +} + +} diff --git a/src/javascript/jsc/bindings/webcore/Path2D.h b/src/javascript/jsc/bindings/webcore/Path2D.h new file mode 100644 index 000000000..6738df600 --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/Path2D.h @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2012, 2013 Adobe Systems Incorporated. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF + * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#pragma once + +#include "CanvasPath.h" +// #include "SVGPathUtilities.h" +#include "WebCorePath.h" +#include <wtf/RefCounted.h> + +namespace WebCore { + +struct DOMMatrix2DInit; + +class WEBCORE_EXPORT Path2D final : public RefCounted<Path2D>, public CanvasPath { + WTF_MAKE_FAST_ALLOCATED; + +public: + virtual ~Path2D(); + + static Ref<Path2D> create() + { + return adoptRef(*new Path2D); + } + + static Ref<Path2D> create(const Path& path) + { + return adoptRef(*new Path2D(path)); + } + + static Ref<Path2D> create(const Path2D& path) + { + return create(path.path()); + } + + static Ref<Path2D> create(const String& pathData) + { + // return create(buildPathFromString(pathData)); + return create(); + } + + ExceptionOr<void> addPath(Path2D&, DOMMatrix2DInit&&); + + const Path& path() const { return m_path; } + +private: + Path2D() = default; + Path2D(const Path& path) + : CanvasPath(path) + { + } +}; + +} // namespace WebCore diff --git a/src/javascript/jsc/bindings/webcore/Path2D.idl b/src/javascript/jsc/bindings/webcore/Path2D.idl new file mode 100644 index 000000000..b8fa6f738 --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/Path2D.idl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2006 Apple Inc. All rights reserved. + * Copyright (C) 2012, 2013 Adobe Systems Incorporated. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF + * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +[ + Exposed=(Window,Worker), + ExportMacro=WEBCORE_EXPORT +] interface Path2D { + constructor(); + constructor(Path2D path); + // FIXME: Implement missing constructor. + // constructor(sequence<Path2D> paths, optional CanvasFillRule fillRule = "nonzero"); + constructor(DOMString d); + + undefined addPath(Path2D path, optional DOMMatrix2DInit transform); +}; + +Path2D includes CanvasPath; diff --git a/src/javascript/jsc/bindings/webcore/SourceImage.h b/src/javascript/jsc/bindings/webcore/SourceImage.h new file mode 100644 index 000000000..f3b07d9af --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/SourceImage.h @@ -0,0 +1,6 @@ +#pragma once + +namespace WebCore { +class SourceImage { +}; +}
\ No newline at end of file diff --git a/src/javascript/jsc/bindings/webcore/TextMetrics.h b/src/javascript/jsc/bindings/webcore/TextMetrics.h new file mode 100644 index 000000000..0fccffe76 --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/TextMetrics.h @@ -0,0 +1,88 @@ +/* + * Copyright (C) 2008 Apple Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#pragma once + +#include <wtf/Ref.h> +#include <wtf/RefCounted.h> + +namespace WebCore { + +class TextMetrics : public RefCounted<TextMetrics> { +public: + static Ref<TextMetrics> create() { return adoptRef(*new TextMetrics); } + + float width() const { return m_width; } + void setWidth(float w) { m_width = w; } + + float actualBoundingBoxLeft() const { return m_actualBoundingBoxLeft; } + void setActualBoundingBoxLeft(float value) { m_actualBoundingBoxLeft = value; } + + float actualBoundingBoxRight() const { return m_actualBoundingBoxRight; } + void setActualBoundingBoxRight(float value) { m_actualBoundingBoxRight = value; } + + float fontBoundingBoxAscent() const { return m_fontBoundingBoxAscent; } + void setFontBoundingBoxAscent(float value) { m_fontBoundingBoxAscent = value; } + + float fontBoundingBoxDescent() const { return m_fontBoundingBoxDescent; } + void setFontBoundingBoxDescent(float value) { m_fontBoundingBoxDescent = value; } + + float actualBoundingBoxAscent() const { return m_actualBoundingBoxAscent; } + void setActualBoundingBoxAscent(float value) { m_actualBoundingBoxAscent = value; } + + float actualBoundingBoxDescent() const { return m_actualBoundingBoxDescent; } + void setActualBoundingBoxDescent(float value) { m_actualBoundingBoxDescent = value; } + + float emHeightAscent() const { return m_emHeightAscent; } + void setEmHeightAscent(float value) { m_emHeightAscent = value; } + + float emHeightDescent() const { return m_emHeightDescent; } + void setEmHeightDescent(float value) { m_emHeightDescent = value; } + + float hangingBaseline() const { return m_hangingBaseline; } + void setHangingBaseline(float value) { m_hangingBaseline = value; } + + float alphabeticBaseline() const { return m_alphabeticBaseline; } + void setAlphabeticBaseline(float value) { m_alphabeticBaseline = value; } + + float ideographicBaseline() const { return m_ideographicBaseline; } + void setIdeographicBaseline(float value) { m_ideographicBaseline = value; } + +private: + float m_width { 0 }; + float m_actualBoundingBoxLeft { 0 }; + float m_actualBoundingBoxRight { 0 }; + float m_fontBoundingBoxAscent { 0 }; + float m_fontBoundingBoxDescent { 0 }; + float m_actualBoundingBoxAscent { 0 }; + float m_actualBoundingBoxDescent { 0 }; + float m_emHeightAscent { 0 }; + float m_emHeightDescent { 0 }; + float m_hangingBaseline { 0 }; + float m_alphabeticBaseline { 0 }; + float m_ideographicBaseline { 0 }; +}; + +} // namespace WebCore diff --git a/src/javascript/jsc/bindings/webcore/TextMetrics.idl b/src/javascript/jsc/bindings/webcore/TextMetrics.idl new file mode 100644 index 000000000..c6a1bf310 --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/TextMetrics.idl @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2008 Apple Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +[ + Exposed=(Window,Worker), +] interface TextMetrics { + // FIXME: All the unrestricted float attributes below should be doubles. + + // x-direction + readonly attribute unrestricted float width; // advance width + readonly attribute unrestricted float actualBoundingBoxLeft; + readonly attribute unrestricted float actualBoundingBoxRight; + + // y-direction + readonly attribute unrestricted float fontBoundingBoxAscent; + readonly attribute unrestricted float fontBoundingBoxDescent; + readonly attribute unrestricted float actualBoundingBoxAscent; + readonly attribute unrestricted float actualBoundingBoxDescent; + readonly attribute unrestricted float emHeightAscent; + readonly attribute unrestricted float emHeightDescent; + readonly attribute unrestricted float hangingBaseline; + readonly attribute unrestricted float alphabeticBaseline; + readonly attribute unrestricted float ideographicBaseline; +}; + diff --git a/src/javascript/jsc/bindings/webcore/WebCorePath.cpp b/src/javascript/jsc/bindings/webcore/WebCorePath.cpp new file mode 100644 index 000000000..68903de11 --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/WebCorePath.cpp @@ -0,0 +1,11 @@ +#include "WebCorePath.h" + +namespace WebCore { + +Path::Path() +{ +} +Path::~Path() +{ +} +}
\ No newline at end of file diff --git a/src/javascript/jsc/bindings/webcore/WebCorePath.h b/src/javascript/jsc/bindings/webcore/WebCorePath.h new file mode 100644 index 000000000..9d071b5cb --- /dev/null +++ b/src/javascript/jsc/bindings/webcore/WebCorePath.h @@ -0,0 +1,14 @@ +#include "root.h" + +#pragma once + +namespace WebCore { +class Path { + WTF_MAKE_FAST_ALLOCATED; + +public: + WEBCORE_EXPORT Path(); + WEBCORE_EXPORT ~Path(); +}; + +}
\ No newline at end of file |