21 #include "wtf/Platform.h"
24 #include "JSSVGPathSegList.h"
28 #include "JSSVGPathSeg.h"
33 #include <wtf/Assertions.h>
40 KJS::JSValue* JSSVGPathSegList::clear(ExecState* exec,
const List& args)
44 SVGPathSegList* imp =
static_cast<SVGPathSegList*
>(impl());
47 setDOMException(exec, ec);
49 m_context->svgAttributeChanged(imp->associatedAttributeName());
53 KJS::JSValue* JSSVGPathSegList::initialize(ExecState* exec,
const List& args)
56 SVGPathSeg*
newItem = toSVGPathSeg(args[0]);
58 SVGPathSegList* imp =
static_cast<SVGPathSegList*
>(impl());
60 SVGPathSeg* obj = WTF::getPtr(imp->initialize(newItem, ec));
62 KJS::JSValue* result = toJS(exec, obj, m_context.get());
63 setDOMException(exec, ec);
65 m_context->svgAttributeChanged(imp->associatedAttributeName());
69 KJS::JSValue* JSSVGPathSegList::getItem(ExecState* exec,
const List& args)
74 unsigned index = args[0]->toInt32(exec, indexOk);
76 setDOMException(exec, DOMException::TYPE_MISMATCH_ERR);
80 SVGPathSegList* imp =
static_cast<SVGPathSegList*
>(impl());
81 SVGPathSeg* obj = WTF::getPtr(imp->getItem(index, ec));
83 KJS::JSValue* result = toJS(exec, obj, m_context.get());
84 setDOMException(exec, ec);
88 KJS::JSValue* JSSVGPathSegList::insertItemBefore(ExecState* exec,
const List& args)
91 SVGPathSeg* newItem = toSVGPathSeg(args[0]);
94 unsigned index = args[1]->toInt32(exec, indexOk);
96 setDOMException(exec, DOMException::TYPE_MISMATCH_ERR);
100 SVGPathSegList* imp =
static_cast<SVGPathSegList*
>(impl());
102 KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->insertItemBefore(newItem, index, ec)), m_context.get());
103 setDOMException(exec, ec);
105 m_context->svgAttributeChanged(imp->associatedAttributeName());
109 KJS::JSValue* JSSVGPathSegList::replaceItem(ExecState* exec,
const List& args)
111 ExceptionCode ec = 0;
112 SVGPathSeg* newItem = toSVGPathSeg(args[0]);
115 unsigned index = args[1]->toInt32(exec, indexOk);
117 setDOMException(exec, DOMException::TYPE_MISMATCH_ERR);
118 return jsUndefined();
121 SVGPathSegList* imp =
static_cast<SVGPathSegList*
>(impl());
123 KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->replaceItem(newItem, index, ec)), m_context.get());
124 setDOMException(exec, ec);
126 m_context->svgAttributeChanged(imp->associatedAttributeName());
130 KJS::JSValue* JSSVGPathSegList::removeItem(ExecState* exec,
const List& args)
132 ExceptionCode ec = 0;
135 unsigned index = args[0]->toInt32(exec, indexOk);
137 setDOMException(exec, DOMException::TYPE_MISMATCH_ERR);
138 return jsUndefined();
141 SVGPathSegList* imp =
static_cast<SVGPathSegList*
>(impl());
143 RefPtr<SVGPathSeg> obj(imp->removeItem(index, ec));
145 KJS::JSValue* result = toJS(exec, obj.get(), m_context.get());
146 setDOMException(exec, ec);
148 m_context->svgAttributeChanged(imp->associatedAttributeName());
152 KJS::JSValue* JSSVGPathSegList::appendItem(ExecState* exec,
const List& args)
154 ExceptionCode ec = 0;
155 SVGPathSeg* newItem = toSVGPathSeg(args[0]);
157 SVGPathSegList* imp =
static_cast<SVGPathSegList*
>(impl());
159 KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->appendItem(newItem, ec)), m_context.get());
160 setDOMException(exec, ec);
162 m_context->svgAttributeChanged(imp->associatedAttributeName());
168 #endif // ENABLE(SVG)
QString newItem(const QString &type, const QString &name, const QString &key, const QString &defaultValue, const CfgConfig &cfg, const QString ¶m=QString())