blob: 1699475e6e61a908bb2fdeede31800ce969a054f [file] [log] [blame]
zimmermannf0498202006-12-22 09:30:51 +00001/*
2 * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
13 *
14 * You should have received a copy of the GNU Library General Public License
15 * along with this library; see the file COPYING.LIB. If not, write to
ddkilzerc8eccec2007-09-26 02:29:57 +000016 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
zimmermannf0498202006-12-22 09:30:51 +000018 */
19
20#include "config.h"
zimmermannf0498202006-12-22 09:30:51 +000021#include "JSSVGPathSeg.h"
zimmermann@webkit.org93c2d042010-01-22 02:23:34 +000022
23#include "JSDOMBinding.h"
zimmermannf0498202006-12-22 09:30:51 +000024#include "JSSVGPathSegArcAbs.h"
25#include "JSSVGPathSegArcRel.h"
26#include "JSSVGPathSegClosePath.h"
27#include "JSSVGPathSegCurvetoCubicAbs.h"
28#include "JSSVGPathSegCurvetoCubicRel.h"
29#include "JSSVGPathSegCurvetoCubicSmoothAbs.h"
30#include "JSSVGPathSegCurvetoCubicSmoothRel.h"
31#include "JSSVGPathSegCurvetoQuadraticAbs.h"
32#include "JSSVGPathSegCurvetoQuadraticRel.h"
33#include "JSSVGPathSegCurvetoQuadraticSmoothAbs.h"
34#include "JSSVGPathSegCurvetoQuadraticSmoothRel.h"
35#include "JSSVGPathSegLinetoAbs.h"
36#include "JSSVGPathSegLinetoRel.h"
37#include "JSSVGPathSegLinetoHorizontalAbs.h"
38#include "JSSVGPathSegLinetoHorizontalRel.h"
39#include "JSSVGPathSegLinetoVerticalAbs.h"
40#include "JSSVGPathSegLinetoVerticalRel.h"
41#include "JSSVGPathSegMovetoAbs.h"
42#include "JSSVGPathSegMovetoRel.h"
zimmermannf0498202006-12-22 09:30:51 +000043#include "SVGPathSeg.h"
zimmermannf0498202006-12-22 09:30:51 +000044
45namespace WebCore {
keith_miller@apple.comce64b732017-10-17 07:10:58 +000046using namespace JSC;
zimmermannf0498202006-12-22 09:30:51 +000047
ysuzuki@apple.com52e98bb2019-10-22 09:24:48 +000048JSValue toJSNewlyCreated(JSGlobalObject*, JSDOMGlobalObject* globalObject, Ref<SVGPathSeg>&& object)
zimmermannf0498202006-12-22 09:30:51 +000049{
youenn.fablet@crf.canon.frbc7f9852016-05-19 07:32:48 +000050 switch (object->pathSegType()) {
zimmermannf0498202006-12-22 09:30:51 +000051 case SVGPathSeg::PATHSEG_CLOSEPATH:
weinig@apple.com91ac06e2016-09-05 03:11:55 +000052 return createWrapper<SVGPathSegClosePath>(globalObject, WTFMove(object));
zimmermannf0498202006-12-22 09:30:51 +000053 case SVGPathSeg::PATHSEG_MOVETO_ABS:
weinig@apple.com91ac06e2016-09-05 03:11:55 +000054 return createWrapper<SVGPathSegMovetoAbs>(globalObject, WTFMove(object));
zimmermannf0498202006-12-22 09:30:51 +000055 case SVGPathSeg::PATHSEG_MOVETO_REL:
weinig@apple.com91ac06e2016-09-05 03:11:55 +000056 return createWrapper<SVGPathSegMovetoRel>(globalObject, WTFMove(object));
zimmermannf0498202006-12-22 09:30:51 +000057 case SVGPathSeg::PATHSEG_LINETO_ABS:
weinig@apple.com91ac06e2016-09-05 03:11:55 +000058 return createWrapper<SVGPathSegLinetoAbs>(globalObject, WTFMove(object));
zimmermannf0498202006-12-22 09:30:51 +000059 case SVGPathSeg::PATHSEG_LINETO_REL:
weinig@apple.com91ac06e2016-09-05 03:11:55 +000060 return createWrapper<SVGPathSegLinetoRel>(globalObject, WTFMove(object));
zimmermannf0498202006-12-22 09:30:51 +000061 case SVGPathSeg::PATHSEG_CURVETO_CUBIC_ABS:
weinig@apple.com91ac06e2016-09-05 03:11:55 +000062 return createWrapper<SVGPathSegCurvetoCubicAbs>(globalObject, WTFMove(object));
zimmermannf0498202006-12-22 09:30:51 +000063 case SVGPathSeg::PATHSEG_CURVETO_CUBIC_REL:
weinig@apple.com91ac06e2016-09-05 03:11:55 +000064 return createWrapper<SVGPathSegCurvetoCubicRel>(globalObject, WTFMove(object));
zimmermannf0498202006-12-22 09:30:51 +000065 case SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_ABS:
weinig@apple.com91ac06e2016-09-05 03:11:55 +000066 return createWrapper<SVGPathSegCurvetoQuadraticAbs>(globalObject, WTFMove(object));
zimmermannf0498202006-12-22 09:30:51 +000067 case SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_REL:
weinig@apple.com91ac06e2016-09-05 03:11:55 +000068 return createWrapper<SVGPathSegCurvetoQuadraticRel>(globalObject, WTFMove(object));
zimmermannf0498202006-12-22 09:30:51 +000069 case SVGPathSeg::PATHSEG_ARC_ABS:
weinig@apple.com91ac06e2016-09-05 03:11:55 +000070 return createWrapper<SVGPathSegArcAbs>(globalObject, WTFMove(object));
zimmermannf0498202006-12-22 09:30:51 +000071 case SVGPathSeg::PATHSEG_ARC_REL:
weinig@apple.com91ac06e2016-09-05 03:11:55 +000072 return createWrapper<SVGPathSegArcRel>(globalObject, WTFMove(object));
zimmermannf0498202006-12-22 09:30:51 +000073 case SVGPathSeg::PATHSEG_LINETO_HORIZONTAL_ABS:
weinig@apple.com91ac06e2016-09-05 03:11:55 +000074 return createWrapper<SVGPathSegLinetoHorizontalAbs>(globalObject, WTFMove(object));
zimmermannf0498202006-12-22 09:30:51 +000075 case SVGPathSeg::PATHSEG_LINETO_HORIZONTAL_REL:
weinig@apple.com91ac06e2016-09-05 03:11:55 +000076 return createWrapper<SVGPathSegLinetoHorizontalRel>(globalObject, WTFMove(object));
zimmermannf0498202006-12-22 09:30:51 +000077 case SVGPathSeg::PATHSEG_LINETO_VERTICAL_ABS:
weinig@apple.com91ac06e2016-09-05 03:11:55 +000078 return createWrapper<SVGPathSegLinetoVerticalAbs>(globalObject, WTFMove(object));
zimmermannf0498202006-12-22 09:30:51 +000079 case SVGPathSeg::PATHSEG_LINETO_VERTICAL_REL:
weinig@apple.com91ac06e2016-09-05 03:11:55 +000080 return createWrapper<SVGPathSegLinetoVerticalRel>(globalObject, WTFMove(object));
zimmermannf0498202006-12-22 09:30:51 +000081 case SVGPathSeg::PATHSEG_CURVETO_CUBIC_SMOOTH_ABS:
weinig@apple.com91ac06e2016-09-05 03:11:55 +000082 return createWrapper<SVGPathSegCurvetoCubicSmoothAbs>(globalObject, WTFMove(object));
zimmermannf0498202006-12-22 09:30:51 +000083 case SVGPathSeg::PATHSEG_CURVETO_CUBIC_SMOOTH_REL:
weinig@apple.com91ac06e2016-09-05 03:11:55 +000084 return createWrapper<SVGPathSegCurvetoCubicSmoothRel>(globalObject, WTFMove(object));
zimmermannf0498202006-12-22 09:30:51 +000085 case SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS:
weinig@apple.com91ac06e2016-09-05 03:11:55 +000086 return createWrapper<SVGPathSegCurvetoQuadraticSmoothAbs>(globalObject, WTFMove(object));
zimmermannf0498202006-12-22 09:30:51 +000087 case SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL:
weinig@apple.com91ac06e2016-09-05 03:11:55 +000088 return createWrapper<SVGPathSegCurvetoQuadraticSmoothRel>(globalObject, WTFMove(object));
zimmermannf0498202006-12-22 09:30:51 +000089 case SVGPathSeg::PATHSEG_UNKNOWN:
90 default:
weinig@apple.com91ac06e2016-09-05 03:11:55 +000091 return createWrapper<SVGPathSeg>(globalObject, WTFMove(object));
zimmermannf0498202006-12-22 09:30:51 +000092 }
93}
94
ysuzuki@apple.com52e98bb2019-10-22 09:24:48 +000095JSValue toJS(JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, SVGPathSeg& object)
youenn.fablet@crf.canon.frbc7f9852016-05-19 07:32:48 +000096{
ysuzuki@apple.com52e98bb2019-10-22 09:24:48 +000097 return wrap(lexicalGlobalObject, globalObject, object);
youenn.fablet@crf.canon.frbc7f9852016-05-19 07:32:48 +000098}
99
zimmermannf0498202006-12-22 09:30:51 +0000100}