21 #include "wtf/Platform.h"
24 #include "JSSVGTransformList.h"
28 #include "JSSVGTransform.h"
33 #include <wtf/Assertions.h>
36 using namespace WebCore;
40 JSValue* JSSVGTransformList::clear(ExecState* exec,
const List&)
44 SVGTransformList* imp =
static_cast<SVGTransformList*
>(impl());
46 setDOMException(exec, ec);
48 m_context->svgAttributeChanged(imp->associatedAttributeName());
53 JSValue* JSSVGTransformList::initialize(ExecState* exec,
const List& args)
56 SVGTransform
newItem = toSVGTransform(args[0]);
58 SVGTransformList* imp =
static_cast<SVGTransformList*
>(impl());
59 SVGList<RefPtr<SVGPODListItem<SVGTransform> > >* listImp = imp;
61 SVGPODListItem<SVGTransform>* listItem = listImp->initialize(SVGPODListItem<SVGTransform>::copy(newItem), ec).get();
62 JSSVGPODTypeWrapperCreatorForList<SVGTransform>* obj =
new JSSVGPODTypeWrapperCreatorForList<SVGTransform>(listItem, imp->associatedAttributeName());
64 KJS::JSValue* result = toJS(exec, obj, m_context.get());
65 setDOMException(exec, ec);
67 m_context->svgAttributeChanged(imp->associatedAttributeName());
72 JSValue* JSSVGTransformList::getItem(ExecState* exec,
const List& args)
77 unsigned index = args[0]->toInt32(exec, indexOk);
79 setDOMException(exec, DOMException::TYPE_MISMATCH_ERR);
83 SVGTransformList* imp =
static_cast<SVGTransformList*
>(impl());
84 SVGList<RefPtr<SVGPODListItem<SVGTransform> > >* listImp = imp;
86 SVGPODListItem<SVGTransform>* listItem = listImp->getItem(index, ec).get();
87 JSSVGPODTypeWrapperCreatorForList<SVGTransform>* obj =
new JSSVGPODTypeWrapperCreatorForList<SVGTransform>(listItem, imp->associatedAttributeName());
89 KJS::JSValue* result = toJS(exec, obj, m_context.get());
90 setDOMException(exec, ec);
94 JSValue* JSSVGTransformList::insertItemBefore(ExecState* exec,
const List& args)
97 SVGTransform newItem = toSVGTransform(args[0]);
100 unsigned index = args[1]->toInt32(exec, indexOk);
102 setDOMException(exec, DOMException::TYPE_MISMATCH_ERR);
103 return jsUndefined();
106 SVGTransformList* imp =
static_cast<SVGTransformList*
>(impl());
107 SVGList<RefPtr<SVGPODListItem<SVGTransform> > >* listImp = imp;
109 SVGPODListItem<SVGTransform>* listItem = listImp->insertItemBefore(SVGPODListItem<SVGTransform>::copy(newItem), index, ec).get();
110 JSSVGPODTypeWrapperCreatorForList<SVGTransform>* obj =
new JSSVGPODTypeWrapperCreatorForList<SVGTransform>(listItem, imp->associatedAttributeName());
112 KJS::JSValue* result = toJS(exec, obj, m_context.get());
113 setDOMException(exec, ec);
115 m_context->svgAttributeChanged(imp->associatedAttributeName());
120 JSValue* JSSVGTransformList::replaceItem(ExecState* exec,
const List& args)
122 ExceptionCode ec = 0;
123 SVGTransform newItem = toSVGTransform(args[0]);
126 unsigned index = args[1]->toInt32(exec, indexOk);
128 setDOMException(exec, DOMException::TYPE_MISMATCH_ERR);
129 return jsUndefined();
132 SVGTransformList* imp =
static_cast<SVGTransformList*
>(impl());
133 SVGList<RefPtr<SVGPODListItem<SVGTransform> > >* listImp = imp;
135 SVGPODListItem<SVGTransform>* listItem = listImp->replaceItem(SVGPODListItem<SVGTransform>::copy(newItem), index, ec).get();
136 JSSVGPODTypeWrapperCreatorForList<SVGTransform>* obj =
new JSSVGPODTypeWrapperCreatorForList<SVGTransform>(listItem, imp->associatedAttributeName());
138 KJS::JSValue* result = toJS(exec, obj, m_context.get());
139 setDOMException(exec, ec);
141 m_context->svgAttributeChanged(imp->associatedAttributeName());
146 JSValue* JSSVGTransformList::removeItem(ExecState* exec,
const List& args)
148 ExceptionCode ec = 0;
151 unsigned index = args[0]->toInt32(exec, indexOk);
153 setDOMException(exec, DOMException::TYPE_MISMATCH_ERR);
154 return jsUndefined();
157 SVGTransformList* imp =
static_cast<SVGTransformList*
>(impl());
158 SVGList<RefPtr<SVGPODListItem<SVGTransform> > >* listImp = imp;
160 RefPtr<SVGPODListItem<SVGTransform> > listItem(listImp->removeItem(index, ec));
161 JSSVGPODTypeWrapper<SVGTransform>* obj =
new JSSVGPODTypeWrapperCreatorReadOnly<SVGTransform>(*listItem.get());
163 KJS::JSValue* result = toJS(exec, obj, m_context.get());
164 setDOMException(exec, ec);
166 m_context->svgAttributeChanged(imp->associatedAttributeName());
171 JSValue* JSSVGTransformList::appendItem(ExecState* exec,
const List& args)
173 ExceptionCode ec = 0;
174 SVGTransform newItem = toSVGTransform(args[0]);
176 SVGTransformList* imp =
static_cast<SVGTransformList*
>(impl());
177 SVGList<RefPtr<SVGPODListItem<SVGTransform> > >* listImp = imp;
179 SVGPODListItem<SVGTransform>* listItem = listImp->appendItem(SVGPODListItem<SVGTransform>::copy(newItem), ec).get();
180 JSSVGPODTypeWrapperCreatorForList<SVGTransform>* obj =
new JSSVGPODTypeWrapperCreatorForList<SVGTransform>(listItem, imp->associatedAttributeName());
182 KJS::JSValue* result = toJS(exec, obj, m_context.get());
183 setDOMException(exec, ec);
185 m_context->svgAttributeChanged(imp->associatedAttributeName());
192 #endif // ENABLE(SVG)
QString newItem(const QString &type, const QString &name, const QString &key, const QString &defaultValue, const CfgConfig &cfg, const QString ¶m=QString())