| 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 |
| 16 | * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 17 | * Boston, MA 02110-1301, USA. |
| 18 | */ |
| 19 | |
| 20 | #include "config.h" |
| 21 | #include "JSSVGPathSeg.h" |
| 22 | |
| 23 | #include "JSDOMBinding.h" |
| 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" |
| 43 | #include "SVGPathSeg.h" |
| 44 | |
| 45 | namespace WebCore { |
| 46 | using namespace JSC; |
| 47 | |
| 48 | JSValue toJSNewlyCreated(ExecState*, JSDOMGlobalObject* globalObject, Ref<SVGPathSeg>&& object) |
| 49 | { |
| 50 | switch (object->pathSegType()) { |
| 51 | case SVGPathSeg::PATHSEG_CLOSEPATH: |
| 52 | return createWrapper<SVGPathSegClosePath>(globalObject, WTFMove(object)); |
| 53 | case SVGPathSeg::PATHSEG_MOVETO_ABS: |
| 54 | return createWrapper<SVGPathSegMovetoAbs>(globalObject, WTFMove(object)); |
| 55 | case SVGPathSeg::PATHSEG_MOVETO_REL: |
| 56 | return createWrapper<SVGPathSegMovetoRel>(globalObject, WTFMove(object)); |
| 57 | case SVGPathSeg::PATHSEG_LINETO_ABS: |
| 58 | return createWrapper<SVGPathSegLinetoAbs>(globalObject, WTFMove(object)); |
| 59 | case SVGPathSeg::PATHSEG_LINETO_REL: |
| 60 | return createWrapper<SVGPathSegLinetoRel>(globalObject, WTFMove(object)); |
| 61 | case SVGPathSeg::PATHSEG_CURVETO_CUBIC_ABS: |
| 62 | return createWrapper<SVGPathSegCurvetoCubicAbs>(globalObject, WTFMove(object)); |
| 63 | case SVGPathSeg::PATHSEG_CURVETO_CUBIC_REL: |
| 64 | return createWrapper<SVGPathSegCurvetoCubicRel>(globalObject, WTFMove(object)); |
| 65 | case SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_ABS: |
| 66 | return createWrapper<SVGPathSegCurvetoQuadraticAbs>(globalObject, WTFMove(object)); |
| 67 | case SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_REL: |
| 68 | return createWrapper<SVGPathSegCurvetoQuadraticRel>(globalObject, WTFMove(object)); |
| 69 | case SVGPathSeg::PATHSEG_ARC_ABS: |
| 70 | return createWrapper<SVGPathSegArcAbs>(globalObject, WTFMove(object)); |
| 71 | case SVGPathSeg::PATHSEG_ARC_REL: |
| 72 | return createWrapper<SVGPathSegArcRel>(globalObject, WTFMove(object)); |
| 73 | case SVGPathSeg::PATHSEG_LINETO_HORIZONTAL_ABS: |
| 74 | return createWrapper<SVGPathSegLinetoHorizontalAbs>(globalObject, WTFMove(object)); |
| 75 | case SVGPathSeg::PATHSEG_LINETO_HORIZONTAL_REL: |
| 76 | return createWrapper<SVGPathSegLinetoHorizontalRel>(globalObject, WTFMove(object)); |
| 77 | case SVGPathSeg::PATHSEG_LINETO_VERTICAL_ABS: |
| 78 | return createWrapper<SVGPathSegLinetoVerticalAbs>(globalObject, WTFMove(object)); |
| 79 | case SVGPathSeg::PATHSEG_LINETO_VERTICAL_REL: |
| 80 | return createWrapper<SVGPathSegLinetoVerticalRel>(globalObject, WTFMove(object)); |
| 81 | case SVGPathSeg::PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: |
| 82 | return createWrapper<SVGPathSegCurvetoCubicSmoothAbs>(globalObject, WTFMove(object)); |
| 83 | case SVGPathSeg::PATHSEG_CURVETO_CUBIC_SMOOTH_REL: |
| 84 | return createWrapper<SVGPathSegCurvetoCubicSmoothRel>(globalObject, WTFMove(object)); |
| 85 | case SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: |
| 86 | return createWrapper<SVGPathSegCurvetoQuadraticSmoothAbs>(globalObject, WTFMove(object)); |
| 87 | case SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: |
| 88 | return createWrapper<SVGPathSegCurvetoQuadraticSmoothRel>(globalObject, WTFMove(object)); |
| 89 | case SVGPathSeg::PATHSEG_UNKNOWN: |
| 90 | default: |
| 91 | return createWrapper<SVGPathSeg>(globalObject, WTFMove(object)); |
| 92 | } |
| 93 | } |
| 94 | |
| 95 | JSValue toJS(ExecState* state, JSDOMGlobalObject* globalObject, SVGPathSeg& object) |
| 96 | { |
| 97 | return wrap(state, globalObject, object); |
| 98 | } |
| 99 | |
| 100 | } |
| 101 | |