2 * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
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.
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.
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.
21 #include "wtf/Platform.h"
24 #include "JSSVGPathSeg.h"
25 #include "JSSVGPathSegArcAbs.h"
26 #include "JSSVGPathSegArcRel.h"
27 #include "JSSVGPathSegClosePath.h"
28 #include "JSSVGPathSegCurvetoCubicAbs.h"
29 #include "JSSVGPathSegCurvetoCubicRel.h"
30 #include "JSSVGPathSegCurvetoCubicSmoothAbs.h"
31 #include "JSSVGPathSegCurvetoCubicSmoothRel.h"
32 #include "JSSVGPathSegCurvetoQuadraticAbs.h"
33 #include "JSSVGPathSegCurvetoQuadraticRel.h"
34 #include "JSSVGPathSegCurvetoQuadraticSmoothAbs.h"
35 #include "JSSVGPathSegCurvetoQuadraticSmoothRel.h"
36 #include "JSSVGPathSegLinetoAbs.h"
37 #include "JSSVGPathSegLinetoRel.h"
38 #include "JSSVGPathSegLinetoHorizontalAbs.h"
39 #include "JSSVGPathSegLinetoHorizontalRel.h"
40 #include "JSSVGPathSegLinetoVerticalAbs.h"
41 #include "JSSVGPathSegLinetoVerticalRel.h"
42 #include "JSSVGPathSegMovetoAbs.h"
43 #include "JSSVGPathSegMovetoRel.h"
45 #include "kjs_binding.h"
47 #include "SVGPathSeg.h"
48 #include "SVGPathSegArc.h"
49 #include "SVGPathSegClosePath.h"
50 #include "SVGPathSegCurvetoCubic.h"
51 #include "SVGPathSegCurvetoCubicSmooth.h"
52 #include "SVGPathSegCurvetoQuadratic.h"
53 #include "SVGPathSegCurvetoQuadraticSmooth.h"
54 #include "SVGPathSegLineto.h"
55 #include "SVGPathSegLinetoHorizontal.h"
56 #include "SVGPathSegLinetoVertical.h"
57 #include "SVGPathSegMoveto.h"
63 JSValue
* toJS(ExecState
* exec
, SVGPathSeg
* obj
, SVGElement
* context
)
68 switch (obj
->pathSegType()) {
69 case SVGPathSeg::PATHSEG_CLOSEPATH
:
70 return cacheSVGDOMObject
<SVGPathSegClosePath
, JSSVGPathSegClosePath
, JSSVGPathSegClosePathPrototype
>(exec
, static_cast<SVGPathSegClosePath
*>(obj
), context
);
71 case SVGPathSeg::PATHSEG_MOVETO_ABS
:
72 return cacheSVGDOMObject
<SVGPathSegMovetoAbs
, JSSVGPathSegMovetoAbs
, JSSVGPathSegMovetoAbsPrototype
>(exec
, static_cast<SVGPathSegMovetoAbs
*>(obj
), context
);
73 case SVGPathSeg::PATHSEG_MOVETO_REL
:
74 return cacheSVGDOMObject
<SVGPathSegMovetoRel
, JSSVGPathSegMovetoRel
, JSSVGPathSegMovetoRelPrototype
>(exec
, static_cast<SVGPathSegMovetoRel
*>(obj
), context
);
75 case SVGPathSeg::PATHSEG_LINETO_ABS
:
76 return cacheSVGDOMObject
<SVGPathSegLinetoAbs
, JSSVGPathSegLinetoAbs
, JSSVGPathSegLinetoAbsPrototype
>(exec
, static_cast<SVGPathSegLinetoAbs
*>(obj
), context
);
77 case SVGPathSeg::PATHSEG_LINETO_REL
:
78 return cacheSVGDOMObject
<SVGPathSegLinetoRel
, JSSVGPathSegLinetoRel
, JSSVGPathSegLinetoRelPrototype
>(exec
, static_cast<SVGPathSegLinetoRel
*>(obj
), context
);
79 case SVGPathSeg::PATHSEG_CURVETO_CUBIC_ABS
:
80 return cacheSVGDOMObject
<SVGPathSegCurvetoCubicAbs
, JSSVGPathSegCurvetoCubicAbs
, JSSVGPathSegCurvetoCubicAbsPrototype
>(exec
, static_cast<SVGPathSegCurvetoCubicAbs
*>(obj
), context
);
81 case SVGPathSeg::PATHSEG_CURVETO_CUBIC_REL
:
82 return cacheSVGDOMObject
<SVGPathSegCurvetoCubicRel
, JSSVGPathSegCurvetoCubicRel
, JSSVGPathSegCurvetoCubicRelPrototype
>(exec
, static_cast<SVGPathSegCurvetoCubicRel
*>(obj
), context
);
83 case SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_ABS
:
84 return cacheSVGDOMObject
<SVGPathSegCurvetoQuadraticAbs
, JSSVGPathSegCurvetoQuadraticAbs
, JSSVGPathSegCurvetoQuadraticAbsPrototype
>(exec
, static_cast<SVGPathSegCurvetoQuadraticAbs
*>(obj
), context
);
85 case SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_REL
:
86 return cacheSVGDOMObject
<SVGPathSegCurvetoQuadraticRel
, JSSVGPathSegCurvetoQuadraticRel
, JSSVGPathSegCurvetoQuadraticRelPrototype
>(exec
, static_cast<SVGPathSegCurvetoQuadraticRel
*>(obj
), context
);
87 case SVGPathSeg::PATHSEG_ARC_ABS
:
88 return cacheSVGDOMObject
<SVGPathSegArcAbs
, JSSVGPathSegArcAbs
, JSSVGPathSegArcAbsPrototype
>(exec
, static_cast<SVGPathSegArcAbs
*>(obj
), context
);
89 case SVGPathSeg::PATHSEG_ARC_REL
:
90 return cacheSVGDOMObject
<SVGPathSegArcRel
, JSSVGPathSegArcRel
, JSSVGPathSegArcRelPrototype
>(exec
, static_cast<SVGPathSegArcRel
*>(obj
), context
);
91 case SVGPathSeg::PATHSEG_LINETO_HORIZONTAL_ABS
:
92 return cacheSVGDOMObject
<SVGPathSegLinetoHorizontalAbs
, JSSVGPathSegLinetoHorizontalAbs
, JSSVGPathSegLinetoHorizontalAbsPrototype
>(exec
, static_cast<SVGPathSegLinetoHorizontalAbs
*>(obj
), context
);
93 case SVGPathSeg::PATHSEG_LINETO_HORIZONTAL_REL
:
94 return cacheSVGDOMObject
<SVGPathSegLinetoHorizontalRel
, JSSVGPathSegLinetoHorizontalRel
, JSSVGPathSegLinetoHorizontalRelPrototype
>(exec
, static_cast<SVGPathSegLinetoHorizontalRel
*>(obj
), context
);
95 case SVGPathSeg::PATHSEG_LINETO_VERTICAL_ABS
:
96 return cacheSVGDOMObject
<SVGPathSegLinetoVerticalAbs
, JSSVGPathSegLinetoVerticalAbs
, JSSVGPathSegLinetoVerticalAbsPrototype
>(exec
, static_cast<SVGPathSegLinetoVerticalAbs
*>(obj
), context
);
97 case SVGPathSeg::PATHSEG_LINETO_VERTICAL_REL
:
98 return cacheSVGDOMObject
<SVGPathSegLinetoVerticalRel
, JSSVGPathSegLinetoVerticalRel
, JSSVGPathSegLinetoVerticalRelPrototype
>(exec
, static_cast<SVGPathSegLinetoVerticalRel
*>(obj
), context
);
99 case SVGPathSeg::PATHSEG_CURVETO_CUBIC_SMOOTH_ABS
:
100 return cacheSVGDOMObject
<SVGPathSegCurvetoCubicSmoothAbs
, JSSVGPathSegCurvetoCubicSmoothAbs
, JSSVGPathSegCurvetoCubicSmoothAbsPrototype
>(exec
, static_cast<SVGPathSegCurvetoCubicSmoothAbs
*>(obj
), context
);
101 case SVGPathSeg::PATHSEG_CURVETO_CUBIC_SMOOTH_REL
:
102 return cacheSVGDOMObject
<SVGPathSegCurvetoCubicSmoothRel
, JSSVGPathSegCurvetoCubicSmoothRel
, JSSVGPathSegCurvetoCubicSmoothRelPrototype
>(exec
, static_cast<SVGPathSegCurvetoCubicSmoothRel
*>(obj
), context
);
103 case SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS
:
104 return cacheSVGDOMObject
<SVGPathSegCurvetoQuadraticSmoothAbs
, JSSVGPathSegCurvetoQuadraticSmoothAbs
, JSSVGPathSegCurvetoQuadraticSmoothAbsPrototype
>(exec
, static_cast<SVGPathSegCurvetoQuadraticSmoothAbs
*>(obj
), context
);
105 case SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL
:
106 return cacheSVGDOMObject
<SVGPathSegCurvetoQuadraticSmoothRel
, JSSVGPathSegCurvetoQuadraticSmoothRel
, JSSVGPathSegCurvetoQuadraticSmoothRelPrototype
>(exec
, static_cast<SVGPathSegCurvetoQuadraticSmoothRel
*>(obj
), context
);
107 case SVGPathSeg::PATHSEG_UNKNOWN
:
109 return cacheSVGDOMObject
<SVGPathSeg
, JSSVGPathSeg
, JSSVGPathSegPrototype
>(exec
, obj
, context
);
115 #endif // ENABLE(SVG)