00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include "config.h"
00021 #include "wtf/Platform.h"
00022
00023 #if ENABLE(SVG)
00024 #include "JSSVGPathSeg.h"
00025 #include "JSSVGPathSegArcAbs.h"
00026 #include "JSSVGPathSegArcRel.h"
00027 #include "JSSVGPathSegClosePath.h"
00028 #include "JSSVGPathSegCurvetoCubicAbs.h"
00029 #include "JSSVGPathSegCurvetoCubicRel.h"
00030 #include "JSSVGPathSegCurvetoCubicSmoothAbs.h"
00031 #include "JSSVGPathSegCurvetoCubicSmoothRel.h"
00032 #include "JSSVGPathSegCurvetoQuadraticAbs.h"
00033 #include "JSSVGPathSegCurvetoQuadraticRel.h"
00034 #include "JSSVGPathSegCurvetoQuadraticSmoothAbs.h"
00035 #include "JSSVGPathSegCurvetoQuadraticSmoothRel.h"
00036 #include "JSSVGPathSegLinetoAbs.h"
00037 #include "JSSVGPathSegLinetoRel.h"
00038 #include "JSSVGPathSegLinetoHorizontalAbs.h"
00039 #include "JSSVGPathSegLinetoHorizontalRel.h"
00040 #include "JSSVGPathSegLinetoVerticalAbs.h"
00041 #include "JSSVGPathSegLinetoVerticalRel.h"
00042 #include "JSSVGPathSegMovetoAbs.h"
00043 #include "JSSVGPathSegMovetoRel.h"
00044
00045 #include "kjs_binding.h"
00046
00047 #include "SVGPathSeg.h"
00048 #include "SVGPathSegArc.h"
00049 #include "SVGPathSegClosePath.h"
00050 #include "SVGPathSegCurvetoCubic.h"
00051 #include "SVGPathSegCurvetoCubicSmooth.h"
00052 #include "SVGPathSegCurvetoQuadratic.h"
00053 #include "SVGPathSegCurvetoQuadraticSmooth.h"
00054 #include "SVGPathSegLineto.h"
00055 #include "SVGPathSegLinetoHorizontal.h"
00056 #include "SVGPathSegLinetoVertical.h"
00057 #include "SVGPathSegMoveto.h"
00058
00059 using namespace KJS;
00060
00061 namespace khtml {
00062
00063 JSValue* toJS(ExecState* exec, SVGPathSeg* obj, SVGElement* context)
00064 {
00065 if (!obj)
00066 return jsNull();
00067
00068 switch (obj->pathSegType()) {
00069 case SVGPathSeg::PATHSEG_CLOSEPATH:
00070 return cacheSVGDOMObject<SVGPathSegClosePath, JSSVGPathSegClosePath, JSSVGPathSegClosePathPrototype>(exec, static_cast<SVGPathSegClosePath*>(obj), context);
00071 case SVGPathSeg::PATHSEG_MOVETO_ABS:
00072 return cacheSVGDOMObject<SVGPathSegMovetoAbs, JSSVGPathSegMovetoAbs, JSSVGPathSegMovetoAbsPrototype>(exec, static_cast<SVGPathSegMovetoAbs*>(obj), context);
00073 case SVGPathSeg::PATHSEG_MOVETO_REL:
00074 return cacheSVGDOMObject<SVGPathSegMovetoRel, JSSVGPathSegMovetoRel, JSSVGPathSegMovetoRelPrototype>(exec, static_cast<SVGPathSegMovetoRel*>(obj), context);
00075 case SVGPathSeg::PATHSEG_LINETO_ABS:
00076 return cacheSVGDOMObject<SVGPathSegLinetoAbs, JSSVGPathSegLinetoAbs, JSSVGPathSegLinetoAbsPrototype>(exec, static_cast<SVGPathSegLinetoAbs*>(obj), context);
00077 case SVGPathSeg::PATHSEG_LINETO_REL:
00078 return cacheSVGDOMObject<SVGPathSegLinetoRel, JSSVGPathSegLinetoRel, JSSVGPathSegLinetoRelPrototype>(exec, static_cast<SVGPathSegLinetoRel*>(obj), context);
00079 case SVGPathSeg::PATHSEG_CURVETO_CUBIC_ABS:
00080 return cacheSVGDOMObject<SVGPathSegCurvetoCubicAbs, JSSVGPathSegCurvetoCubicAbs, JSSVGPathSegCurvetoCubicAbsPrototype>(exec, static_cast<SVGPathSegCurvetoCubicAbs*>(obj), context);
00081 case SVGPathSeg::PATHSEG_CURVETO_CUBIC_REL:
00082 return cacheSVGDOMObject<SVGPathSegCurvetoCubicRel, JSSVGPathSegCurvetoCubicRel, JSSVGPathSegCurvetoCubicRelPrototype>(exec, static_cast<SVGPathSegCurvetoCubicRel*>(obj), context);
00083 case SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_ABS:
00084 return cacheSVGDOMObject<SVGPathSegCurvetoQuadraticAbs, JSSVGPathSegCurvetoQuadraticAbs, JSSVGPathSegCurvetoQuadraticAbsPrototype>(exec, static_cast<SVGPathSegCurvetoQuadraticAbs*>(obj), context);
00085 case SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_REL:
00086 return cacheSVGDOMObject<SVGPathSegCurvetoQuadraticRel, JSSVGPathSegCurvetoQuadraticRel, JSSVGPathSegCurvetoQuadraticRelPrototype>(exec, static_cast<SVGPathSegCurvetoQuadraticRel*>(obj), context);
00087 case SVGPathSeg::PATHSEG_ARC_ABS:
00088 return cacheSVGDOMObject<SVGPathSegArcAbs, JSSVGPathSegArcAbs, JSSVGPathSegArcAbsPrototype>(exec, static_cast<SVGPathSegArcAbs*>(obj), context);
00089 case SVGPathSeg::PATHSEG_ARC_REL:
00090 return cacheSVGDOMObject<SVGPathSegArcRel, JSSVGPathSegArcRel, JSSVGPathSegArcRelPrototype>(exec, static_cast<SVGPathSegArcRel*>(obj), context);
00091 case SVGPathSeg::PATHSEG_LINETO_HORIZONTAL_ABS:
00092 return cacheSVGDOMObject<SVGPathSegLinetoHorizontalAbs, JSSVGPathSegLinetoHorizontalAbs, JSSVGPathSegLinetoHorizontalAbsPrototype>(exec, static_cast<SVGPathSegLinetoHorizontalAbs*>(obj), context);
00093 case SVGPathSeg::PATHSEG_LINETO_HORIZONTAL_REL:
00094 return cacheSVGDOMObject<SVGPathSegLinetoHorizontalRel, JSSVGPathSegLinetoHorizontalRel, JSSVGPathSegLinetoHorizontalRelPrototype>(exec, static_cast<SVGPathSegLinetoHorizontalRel*>(obj), context);
00095 case SVGPathSeg::PATHSEG_LINETO_VERTICAL_ABS:
00096 return cacheSVGDOMObject<SVGPathSegLinetoVerticalAbs, JSSVGPathSegLinetoVerticalAbs, JSSVGPathSegLinetoVerticalAbsPrototype>(exec, static_cast<SVGPathSegLinetoVerticalAbs*>(obj), context);
00097 case SVGPathSeg::PATHSEG_LINETO_VERTICAL_REL:
00098 return cacheSVGDOMObject<SVGPathSegLinetoVerticalRel, JSSVGPathSegLinetoVerticalRel, JSSVGPathSegLinetoVerticalRelPrototype>(exec, static_cast<SVGPathSegLinetoVerticalRel*>(obj), context);
00099 case SVGPathSeg::PATHSEG_CURVETO_CUBIC_SMOOTH_ABS:
00100 return cacheSVGDOMObject<SVGPathSegCurvetoCubicSmoothAbs, JSSVGPathSegCurvetoCubicSmoothAbs, JSSVGPathSegCurvetoCubicSmoothAbsPrototype>(exec, static_cast<SVGPathSegCurvetoCubicSmoothAbs*>(obj), context);
00101 case SVGPathSeg::PATHSEG_CURVETO_CUBIC_SMOOTH_REL:
00102 return cacheSVGDOMObject<SVGPathSegCurvetoCubicSmoothRel, JSSVGPathSegCurvetoCubicSmoothRel, JSSVGPathSegCurvetoCubicSmoothRelPrototype>(exec, static_cast<SVGPathSegCurvetoCubicSmoothRel*>(obj), context);
00103 case SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS:
00104 return cacheSVGDOMObject<SVGPathSegCurvetoQuadraticSmoothAbs, JSSVGPathSegCurvetoQuadraticSmoothAbs, JSSVGPathSegCurvetoQuadraticSmoothAbsPrototype>(exec, static_cast<SVGPathSegCurvetoQuadraticSmoothAbs*>(obj), context);
00105 case SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL:
00106 return cacheSVGDOMObject<SVGPathSegCurvetoQuadraticSmoothRel, JSSVGPathSegCurvetoQuadraticSmoothRel, JSSVGPathSegCurvetoQuadraticSmoothRelPrototype>(exec, static_cast<SVGPathSegCurvetoQuadraticSmoothRel*>(obj), context);
00107 case SVGPathSeg::PATHSEG_UNKNOWN:
00108 default:
00109 return cacheSVGDOMObject<SVGPathSeg, JSSVGPathSeg, JSSVGPathSegPrototype>(exec, obj, context);
00110 }
00111 }
00112
00113 }
00114
00115 #endif // ENABLE(SVG)
00116
00117