zimmermann | f049820 | 2006-12-22 09:30:51 +0000 | [diff] [blame] | 1 | /* |
| 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 |
ddkilzer | c8eccec | 2007-09-26 02:29:57 +0000 | [diff] [blame] | 16 | * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 17 | * Boston, MA 02110-1301, USA. |
zimmermann | f049820 | 2006-12-22 09:30:51 +0000 | [diff] [blame] | 18 | */ |
| 19 | |
| 20 | #include "config.h" |
zimmermann | f049820 | 2006-12-22 09:30:51 +0000 | [diff] [blame] | 21 | #include "JSSVGPathSeg.h" |
zimmermann@webkit.org | 93c2d04 | 2010-01-22 02:23:34 +0000 | [diff] [blame] | 22 | |
| 23 | #include "JSDOMBinding.h" |
zimmermann | f049820 | 2006-12-22 09:30:51 +0000 | [diff] [blame] | 24 | #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" |
zimmermann | f049820 | 2006-12-22 09:30:51 +0000 | [diff] [blame] | 43 | #include "SVGPathSeg.h" |
zimmermann | f049820 | 2006-12-22 09:30:51 +0000 | [diff] [blame] | 44 | |
| 45 | namespace WebCore { |
keith_miller@apple.com | ce64b73 | 2017-10-17 07:10:58 +0000 | [diff] [blame] | 46 | using namespace JSC; |
zimmermann | f049820 | 2006-12-22 09:30:51 +0000 | [diff] [blame] | 47 | |
ysuzuki@apple.com | 52e98bb | 2019-10-22 09:24:48 +0000 | [diff] [blame] | 48 | JSValue toJSNewlyCreated(JSGlobalObject*, JSDOMGlobalObject* globalObject, Ref<SVGPathSeg>&& object) |
zimmermann | f049820 | 2006-12-22 09:30:51 +0000 | [diff] [blame] | 49 | { |
youenn.fablet@crf.canon.fr | bc7f985 | 2016-05-19 07:32:48 +0000 | [diff] [blame] | 50 | switch (object->pathSegType()) { |
zimmermann | f049820 | 2006-12-22 09:30:51 +0000 | [diff] [blame] | 51 | case SVGPathSeg::PATHSEG_CLOSEPATH: |
weinig@apple.com | 91ac06e | 2016-09-05 03:11:55 +0000 | [diff] [blame] | 52 | return createWrapper<SVGPathSegClosePath>(globalObject, WTFMove(object)); |
zimmermann | f049820 | 2006-12-22 09:30:51 +0000 | [diff] [blame] | 53 | case SVGPathSeg::PATHSEG_MOVETO_ABS: |
weinig@apple.com | 91ac06e | 2016-09-05 03:11:55 +0000 | [diff] [blame] | 54 | return createWrapper<SVGPathSegMovetoAbs>(globalObject, WTFMove(object)); |
zimmermann | f049820 | 2006-12-22 09:30:51 +0000 | [diff] [blame] | 55 | case SVGPathSeg::PATHSEG_MOVETO_REL: |
weinig@apple.com | 91ac06e | 2016-09-05 03:11:55 +0000 | [diff] [blame] | 56 | return createWrapper<SVGPathSegMovetoRel>(globalObject, WTFMove(object)); |
zimmermann | f049820 | 2006-12-22 09:30:51 +0000 | [diff] [blame] | 57 | case SVGPathSeg::PATHSEG_LINETO_ABS: |
weinig@apple.com | 91ac06e | 2016-09-05 03:11:55 +0000 | [diff] [blame] | 58 | return createWrapper<SVGPathSegLinetoAbs>(globalObject, WTFMove(object)); |
zimmermann | f049820 | 2006-12-22 09:30:51 +0000 | [diff] [blame] | 59 | case SVGPathSeg::PATHSEG_LINETO_REL: |
weinig@apple.com | 91ac06e | 2016-09-05 03:11:55 +0000 | [diff] [blame] | 60 | return createWrapper<SVGPathSegLinetoRel>(globalObject, WTFMove(object)); |
zimmermann | f049820 | 2006-12-22 09:30:51 +0000 | [diff] [blame] | 61 | case SVGPathSeg::PATHSEG_CURVETO_CUBIC_ABS: |
weinig@apple.com | 91ac06e | 2016-09-05 03:11:55 +0000 | [diff] [blame] | 62 | return createWrapper<SVGPathSegCurvetoCubicAbs>(globalObject, WTFMove(object)); |
zimmermann | f049820 | 2006-12-22 09:30:51 +0000 | [diff] [blame] | 63 | case SVGPathSeg::PATHSEG_CURVETO_CUBIC_REL: |
weinig@apple.com | 91ac06e | 2016-09-05 03:11:55 +0000 | [diff] [blame] | 64 | return createWrapper<SVGPathSegCurvetoCubicRel>(globalObject, WTFMove(object)); |
zimmermann | f049820 | 2006-12-22 09:30:51 +0000 | [diff] [blame] | 65 | case SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_ABS: |
weinig@apple.com | 91ac06e | 2016-09-05 03:11:55 +0000 | [diff] [blame] | 66 | return createWrapper<SVGPathSegCurvetoQuadraticAbs>(globalObject, WTFMove(object)); |
zimmermann | f049820 | 2006-12-22 09:30:51 +0000 | [diff] [blame] | 67 | case SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_REL: |
weinig@apple.com | 91ac06e | 2016-09-05 03:11:55 +0000 | [diff] [blame] | 68 | return createWrapper<SVGPathSegCurvetoQuadraticRel>(globalObject, WTFMove(object)); |
zimmermann | f049820 | 2006-12-22 09:30:51 +0000 | [diff] [blame] | 69 | case SVGPathSeg::PATHSEG_ARC_ABS: |
weinig@apple.com | 91ac06e | 2016-09-05 03:11:55 +0000 | [diff] [blame] | 70 | return createWrapper<SVGPathSegArcAbs>(globalObject, WTFMove(object)); |
zimmermann | f049820 | 2006-12-22 09:30:51 +0000 | [diff] [blame] | 71 | case SVGPathSeg::PATHSEG_ARC_REL: |
weinig@apple.com | 91ac06e | 2016-09-05 03:11:55 +0000 | [diff] [blame] | 72 | return createWrapper<SVGPathSegArcRel>(globalObject, WTFMove(object)); |
zimmermann | f049820 | 2006-12-22 09:30:51 +0000 | [diff] [blame] | 73 | case SVGPathSeg::PATHSEG_LINETO_HORIZONTAL_ABS: |
weinig@apple.com | 91ac06e | 2016-09-05 03:11:55 +0000 | [diff] [blame] | 74 | return createWrapper<SVGPathSegLinetoHorizontalAbs>(globalObject, WTFMove(object)); |
zimmermann | f049820 | 2006-12-22 09:30:51 +0000 | [diff] [blame] | 75 | case SVGPathSeg::PATHSEG_LINETO_HORIZONTAL_REL: |
weinig@apple.com | 91ac06e | 2016-09-05 03:11:55 +0000 | [diff] [blame] | 76 | return createWrapper<SVGPathSegLinetoHorizontalRel>(globalObject, WTFMove(object)); |
zimmermann | f049820 | 2006-12-22 09:30:51 +0000 | [diff] [blame] | 77 | case SVGPathSeg::PATHSEG_LINETO_VERTICAL_ABS: |
weinig@apple.com | 91ac06e | 2016-09-05 03:11:55 +0000 | [diff] [blame] | 78 | return createWrapper<SVGPathSegLinetoVerticalAbs>(globalObject, WTFMove(object)); |
zimmermann | f049820 | 2006-12-22 09:30:51 +0000 | [diff] [blame] | 79 | case SVGPathSeg::PATHSEG_LINETO_VERTICAL_REL: |
weinig@apple.com | 91ac06e | 2016-09-05 03:11:55 +0000 | [diff] [blame] | 80 | return createWrapper<SVGPathSegLinetoVerticalRel>(globalObject, WTFMove(object)); |
zimmermann | f049820 | 2006-12-22 09:30:51 +0000 | [diff] [blame] | 81 | case SVGPathSeg::PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: |
weinig@apple.com | 91ac06e | 2016-09-05 03:11:55 +0000 | [diff] [blame] | 82 | return createWrapper<SVGPathSegCurvetoCubicSmoothAbs>(globalObject, WTFMove(object)); |
zimmermann | f049820 | 2006-12-22 09:30:51 +0000 | [diff] [blame] | 83 | case SVGPathSeg::PATHSEG_CURVETO_CUBIC_SMOOTH_REL: |
weinig@apple.com | 91ac06e | 2016-09-05 03:11:55 +0000 | [diff] [blame] | 84 | return createWrapper<SVGPathSegCurvetoCubicSmoothRel>(globalObject, WTFMove(object)); |
zimmermann | f049820 | 2006-12-22 09:30:51 +0000 | [diff] [blame] | 85 | case SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: |
weinig@apple.com | 91ac06e | 2016-09-05 03:11:55 +0000 | [diff] [blame] | 86 | return createWrapper<SVGPathSegCurvetoQuadraticSmoothAbs>(globalObject, WTFMove(object)); |
zimmermann | f049820 | 2006-12-22 09:30:51 +0000 | [diff] [blame] | 87 | case SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: |
weinig@apple.com | 91ac06e | 2016-09-05 03:11:55 +0000 | [diff] [blame] | 88 | return createWrapper<SVGPathSegCurvetoQuadraticSmoothRel>(globalObject, WTFMove(object)); |
zimmermann | f049820 | 2006-12-22 09:30:51 +0000 | [diff] [blame] | 89 | case SVGPathSeg::PATHSEG_UNKNOWN: |
| 90 | default: |
weinig@apple.com | 91ac06e | 2016-09-05 03:11:55 +0000 | [diff] [blame] | 91 | return createWrapper<SVGPathSeg>(globalObject, WTFMove(object)); |
zimmermann | f049820 | 2006-12-22 09:30:51 +0000 | [diff] [blame] | 92 | } |
| 93 | } |
| 94 | |
ysuzuki@apple.com | 52e98bb | 2019-10-22 09:24:48 +0000 | [diff] [blame] | 95 | JSValue toJS(JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, SVGPathSeg& object) |
youenn.fablet@crf.canon.fr | bc7f985 | 2016-05-19 07:32:48 +0000 | [diff] [blame] | 96 | { |
ysuzuki@apple.com | 52e98bb | 2019-10-22 09:24:48 +0000 | [diff] [blame] | 97 | return wrap(lexicalGlobalObject, globalObject, object); |
youenn.fablet@crf.canon.fr | bc7f985 | 2016-05-19 07:32:48 +0000 | [diff] [blame] | 98 | } |
| 99 | |
zimmermann | f049820 | 2006-12-22 09:30:51 +0000 | [diff] [blame] | 100 | } |