KHtml

JSSVGPathSegCustom.cpp
1 /*
2  * Copyright (C) 2006 Nikolas Zimmermann <[email protected]>
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 "wtf/Platform.h"
21 
22 #if ENABLE(SVG)
23 #include "JSSVGPathSeg.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 
44 #include "kjs_binding.h"
45 
46 #include "SVGPathSeg.h"
47 #include "SVGPathSegArc.h"
48 #include "SVGPathSegClosePath.h"
49 #include "SVGPathSegCurvetoCubic.h"
50 #include "SVGPathSegCurvetoCubicSmooth.h"
51 #include "SVGPathSegCurvetoQuadratic.h"
52 #include "SVGPathSegCurvetoQuadraticSmooth.h"
53 #include "SVGPathSegLineto.h"
54 #include "SVGPathSegLinetoHorizontal.h"
55 #include "SVGPathSegLinetoVertical.h"
56 #include "SVGPathSegMoveto.h"
57 
58 using namespace KJS;
59 
60 namespace khtml
61 {
62 
63 JSValue *toJS(ExecState *exec, SVGPathSeg *obj, SVGElement *context)
64 {
65  if (!obj) {
66  return jsNull();
67  }
68 
69  switch (obj->pathSegType()) {
70  case SVGPathSeg::PATHSEG_CLOSEPATH:
71  return cacheSVGDOMObject<SVGPathSegClosePath, JSSVGPathSegClosePath, JSSVGPathSegClosePathPrototype>(exec, static_cast<SVGPathSegClosePath *>(obj), context);
72  case SVGPathSeg::PATHSEG_MOVETO_ABS:
73  return cacheSVGDOMObject<SVGPathSegMovetoAbs, JSSVGPathSegMovetoAbs, JSSVGPathSegMovetoAbsPrototype>(exec, static_cast<SVGPathSegMovetoAbs *>(obj), context);
74  case SVGPathSeg::PATHSEG_MOVETO_REL:
75  return cacheSVGDOMObject<SVGPathSegMovetoRel, JSSVGPathSegMovetoRel, JSSVGPathSegMovetoRelPrototype>(exec, static_cast<SVGPathSegMovetoRel *>(obj), context);
76  case SVGPathSeg::PATHSEG_LINETO_ABS:
77  return cacheSVGDOMObject<SVGPathSegLinetoAbs, JSSVGPathSegLinetoAbs, JSSVGPathSegLinetoAbsPrototype>(exec, static_cast<SVGPathSegLinetoAbs *>(obj), context);
78  case SVGPathSeg::PATHSEG_LINETO_REL:
79  return cacheSVGDOMObject<SVGPathSegLinetoRel, JSSVGPathSegLinetoRel, JSSVGPathSegLinetoRelPrototype>(exec, static_cast<SVGPathSegLinetoRel *>(obj), context);
80  case SVGPathSeg::PATHSEG_CURVETO_CUBIC_ABS:
81  return cacheSVGDOMObject<SVGPathSegCurvetoCubicAbs, JSSVGPathSegCurvetoCubicAbs, JSSVGPathSegCurvetoCubicAbsPrototype>(exec, static_cast<SVGPathSegCurvetoCubicAbs *>(obj), context);
82  case SVGPathSeg::PATHSEG_CURVETO_CUBIC_REL:
83  return cacheSVGDOMObject<SVGPathSegCurvetoCubicRel, JSSVGPathSegCurvetoCubicRel, JSSVGPathSegCurvetoCubicRelPrototype>(exec, static_cast<SVGPathSegCurvetoCubicRel *>(obj), context);
84  case SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_ABS:
85  return cacheSVGDOMObject<SVGPathSegCurvetoQuadraticAbs, JSSVGPathSegCurvetoQuadraticAbs, JSSVGPathSegCurvetoQuadraticAbsPrototype>(exec, static_cast<SVGPathSegCurvetoQuadraticAbs *>(obj), context);
86  case SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_REL:
87  return cacheSVGDOMObject<SVGPathSegCurvetoQuadraticRel, JSSVGPathSegCurvetoQuadraticRel, JSSVGPathSegCurvetoQuadraticRelPrototype>(exec, static_cast<SVGPathSegCurvetoQuadraticRel *>(obj), context);
88  case SVGPathSeg::PATHSEG_ARC_ABS:
89  return cacheSVGDOMObject<SVGPathSegArcAbs, JSSVGPathSegArcAbs, JSSVGPathSegArcAbsPrototype>(exec, static_cast<SVGPathSegArcAbs *>(obj), context);
90  case SVGPathSeg::PATHSEG_ARC_REL:
91  return cacheSVGDOMObject<SVGPathSegArcRel, JSSVGPathSegArcRel, JSSVGPathSegArcRelPrototype>(exec, static_cast<SVGPathSegArcRel *>(obj), context);
92  case SVGPathSeg::PATHSEG_LINETO_HORIZONTAL_ABS:
93  return cacheSVGDOMObject<SVGPathSegLinetoHorizontalAbs, JSSVGPathSegLinetoHorizontalAbs, JSSVGPathSegLinetoHorizontalAbsPrototype>(exec, static_cast<SVGPathSegLinetoHorizontalAbs *>(obj), context);
94  case SVGPathSeg::PATHSEG_LINETO_HORIZONTAL_REL:
95  return cacheSVGDOMObject<SVGPathSegLinetoHorizontalRel, JSSVGPathSegLinetoHorizontalRel, JSSVGPathSegLinetoHorizontalRelPrototype>(exec, static_cast<SVGPathSegLinetoHorizontalRel *>(obj), context);
96  case SVGPathSeg::PATHSEG_LINETO_VERTICAL_ABS:
97  return cacheSVGDOMObject<SVGPathSegLinetoVerticalAbs, JSSVGPathSegLinetoVerticalAbs, JSSVGPathSegLinetoVerticalAbsPrototype>(exec, static_cast<SVGPathSegLinetoVerticalAbs *>(obj), context);
98  case SVGPathSeg::PATHSEG_LINETO_VERTICAL_REL:
99  return cacheSVGDOMObject<SVGPathSegLinetoVerticalRel, JSSVGPathSegLinetoVerticalRel, JSSVGPathSegLinetoVerticalRelPrototype>(exec, static_cast<SVGPathSegLinetoVerticalRel *>(obj), context);
100  case SVGPathSeg::PATHSEG_CURVETO_CUBIC_SMOOTH_ABS:
101  return cacheSVGDOMObject<SVGPathSegCurvetoCubicSmoothAbs, JSSVGPathSegCurvetoCubicSmoothAbs, JSSVGPathSegCurvetoCubicSmoothAbsPrototype>(exec, static_cast<SVGPathSegCurvetoCubicSmoothAbs *>(obj), context);
102  case SVGPathSeg::PATHSEG_CURVETO_CUBIC_SMOOTH_REL:
103  return cacheSVGDOMObject<SVGPathSegCurvetoCubicSmoothRel, JSSVGPathSegCurvetoCubicSmoothRel, JSSVGPathSegCurvetoCubicSmoothRelPrototype>(exec, static_cast<SVGPathSegCurvetoCubicSmoothRel *>(obj), context);
104  case SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS:
105  return cacheSVGDOMObject<SVGPathSegCurvetoQuadraticSmoothAbs, JSSVGPathSegCurvetoQuadraticSmoothAbs, JSSVGPathSegCurvetoQuadraticSmoothAbsPrototype>(exec, static_cast<SVGPathSegCurvetoQuadraticSmoothAbs *>(obj), context);
106  case SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL:
107  return cacheSVGDOMObject<SVGPathSegCurvetoQuadraticSmoothRel, JSSVGPathSegCurvetoQuadraticSmoothRel, JSSVGPathSegCurvetoQuadraticSmoothRelPrototype>(exec, static_cast<SVGPathSegCurvetoQuadraticSmoothRel *>(obj), context);
108  case SVGPathSeg::PATHSEG_UNKNOWN:
109  default:
110  return cacheSVGDOMObject<SVGPathSeg, JSSVGPathSeg, JSSVGPathSegPrototype>(exec, obj, context);
111  }
112 }
113 
114 }
115 
116 #endif // ENABLE(SVG)
117 
This file is part of the HTML rendering engine for KDE.
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Tue Oct 26 2021 22:48:03 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.