• Skip to content
  • Skip to link menu
KDE 4.3 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

KHTML

JSSVGTransformListCustom.cpp

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
00003  *
00004  * This library is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU Library General Public
00006  * License as published by the Free Software Foundation; either
00007  * version 2 of the License, or (at your option) any later version.
00008  *
00009  * This library is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * Library General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU Library General Public License
00015  * along with this library; see the file COPYING.LIB.  If not, write to
00016  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017  * Boston, MA 02110-1301, USA.
00018  */
00019 
00020 #include "config.h"
00021 #include "wtf/Platform.h"
00022 
00023 #if ENABLE(SVG)
00024 #include "JSSVGTransformList.h"
00025 
00026 #include "Document.h"
00027 #include "Frame.h"
00028 #include "JSSVGTransform.h"
00029 #include "SVGDocumentExtensions.h"
00030 #include "SVGTransformList.h"
00031 #include "SVGStyledElement.h"
00032 
00033 #include <wtf/Assertions.h>
00034 
00035 using namespace KJS;
00036 using namespace WebCore;
00037 
00038 namespace khtml {
00039 
00040 JSValue* JSSVGTransformList::clear(ExecState* exec, const List&)
00041 {
00042     ExceptionCode ec = 0;
00043 
00044     SVGTransformList* imp = static_cast<SVGTransformList*>(impl());
00045     imp->clear(ec);
00046     setDOMException(exec, ec);
00047 
00048     m_context->svgAttributeChanged(imp->associatedAttributeName());
00049 
00050     return jsUndefined();
00051 }
00052 
00053 JSValue* JSSVGTransformList::initialize(ExecState* exec, const List& args)
00054 {
00055     ExceptionCode ec = 0;
00056     SVGTransform newItem = toSVGTransform(args[0]);
00057 
00058     SVGTransformList* imp = static_cast<SVGTransformList*>(impl());
00059     SVGList<RefPtr<SVGPODListItem<SVGTransform> > >* listImp = imp;
00060 
00061     SVGPODListItem<SVGTransform>* listItem = listImp->initialize(SVGPODListItem<SVGTransform>::copy(newItem), ec).get(); 
00062     JSSVGPODTypeWrapperCreatorForList<SVGTransform>* obj = new JSSVGPODTypeWrapperCreatorForList<SVGTransform>(listItem, imp->associatedAttributeName());
00063 
00064     KJS::JSValue* result = toJS(exec, obj, m_context.get());
00065     setDOMException(exec, ec);
00066 
00067     m_context->svgAttributeChanged(imp->associatedAttributeName());
00068 
00069     return result;
00070 }
00071 
00072 JSValue* JSSVGTransformList::getItem(ExecState* exec, const List& args)
00073 {
00074     ExceptionCode ec = 0;
00075 
00076     bool indexOk;
00077     unsigned index = args[0]->toInt32(exec, indexOk);
00078     if (!indexOk) {
00079         setDOMException(exec, DOMException::TYPE_MISMATCH_ERR);
00080         return jsUndefined();
00081     }
00082 
00083     SVGTransformList* imp = static_cast<SVGTransformList*>(impl());
00084     SVGList<RefPtr<SVGPODListItem<SVGTransform> > >* listImp = imp;
00085 
00086     SVGPODListItem<SVGTransform>* listItem = listImp->getItem(index, ec).get();
00087     JSSVGPODTypeWrapperCreatorForList<SVGTransform>* obj = new JSSVGPODTypeWrapperCreatorForList<SVGTransform>(listItem, imp->associatedAttributeName());
00088 
00089     KJS::JSValue* result = toJS(exec, obj, m_context.get());
00090     setDOMException(exec, ec);
00091     return result;
00092 }
00093 
00094 JSValue* JSSVGTransformList::insertItemBefore(ExecState* exec, const List& args)
00095 {
00096     ExceptionCode ec = 0;
00097     SVGTransform newItem = toSVGTransform(args[0]);
00098 
00099     bool indexOk;
00100     unsigned index = args[1]->toInt32(exec, indexOk);
00101     if (!indexOk) {
00102         setDOMException(exec, DOMException::TYPE_MISMATCH_ERR);
00103         return jsUndefined();
00104     }
00105 
00106     SVGTransformList* imp = static_cast<SVGTransformList*>(impl());
00107     SVGList<RefPtr<SVGPODListItem<SVGTransform> > >* listImp = imp;
00108 
00109     SVGPODListItem<SVGTransform>* listItem = listImp->insertItemBefore(SVGPODListItem<SVGTransform>::copy(newItem), index, ec).get();
00110     JSSVGPODTypeWrapperCreatorForList<SVGTransform>* obj = new JSSVGPODTypeWrapperCreatorForList<SVGTransform>(listItem, imp->associatedAttributeName());
00111 
00112     KJS::JSValue* result = toJS(exec, obj, m_context.get());
00113     setDOMException(exec, ec);
00114 
00115     m_context->svgAttributeChanged(imp->associatedAttributeName());
00116 
00117     return result;
00118 }
00119 
00120 JSValue* JSSVGTransformList::replaceItem(ExecState* exec, const List& args)
00121 {
00122     ExceptionCode ec = 0;
00123     SVGTransform newItem = toSVGTransform(args[0]);
00124 
00125     bool indexOk;
00126     unsigned index = args[1]->toInt32(exec, indexOk);
00127     if (!indexOk) {
00128         setDOMException(exec, DOMException::TYPE_MISMATCH_ERR);
00129         return jsUndefined();
00130     }
00131 
00132     SVGTransformList* imp = static_cast<SVGTransformList*>(impl());
00133     SVGList<RefPtr<SVGPODListItem<SVGTransform> > >* listImp = imp;
00134 
00135     SVGPODListItem<SVGTransform>* listItem = listImp->replaceItem(SVGPODListItem<SVGTransform>::copy(newItem), index, ec).get(); 
00136     JSSVGPODTypeWrapperCreatorForList<SVGTransform>* obj = new JSSVGPODTypeWrapperCreatorForList<SVGTransform>(listItem, imp->associatedAttributeName());
00137 
00138     KJS::JSValue* result = toJS(exec, obj, m_context.get());
00139     setDOMException(exec, ec);
00140 
00141     m_context->svgAttributeChanged(imp->associatedAttributeName());
00142 
00143     return result;
00144 }
00145 
00146 JSValue* JSSVGTransformList::removeItem(ExecState* exec, const List& args)
00147 {
00148     ExceptionCode ec = 0;
00149     
00150     bool indexOk;
00151     unsigned index = args[0]->toInt32(exec, indexOk);
00152     if (!indexOk) {
00153         setDOMException(exec, DOMException::TYPE_MISMATCH_ERR);
00154         return jsUndefined();
00155     }
00156 
00157     SVGTransformList* imp = static_cast<SVGTransformList*>(impl());
00158     SVGList<RefPtr<SVGPODListItem<SVGTransform> > >* listImp = imp;
00159 
00160     RefPtr<SVGPODListItem<SVGTransform> > listItem(listImp->removeItem(index, ec));
00161     JSSVGPODTypeWrapper<SVGTransform>* obj = new JSSVGPODTypeWrapperCreatorReadOnly<SVGTransform>(*listItem.get());
00162 
00163     KJS::JSValue* result = toJS(exec, obj, m_context.get());
00164     setDOMException(exec, ec);
00165 
00166     m_context->svgAttributeChanged(imp->associatedAttributeName());
00167 
00168     return result;
00169 }
00170 
00171 JSValue* JSSVGTransformList::appendItem(ExecState* exec, const List& args)
00172 {
00173     ExceptionCode ec = 0;
00174     SVGTransform newItem = toSVGTransform(args[0]);
00175 
00176     SVGTransformList* imp = static_cast<SVGTransformList*>(impl());
00177     SVGList<RefPtr<SVGPODListItem<SVGTransform> > >* listImp = imp;
00178 
00179     SVGPODListItem<SVGTransform>* listItem = listImp->appendItem(SVGPODListItem<SVGTransform>::copy(newItem), ec).get(); 
00180     JSSVGPODTypeWrapperCreatorForList<SVGTransform>* obj = new JSSVGPODTypeWrapperCreatorForList<SVGTransform>(listItem, imp->associatedAttributeName());
00181 
00182     KJS::JSValue* result = toJS(exec, obj, m_context.get());
00183     setDOMException(exec, ec);
00184 
00185     m_context->svgAttributeChanged(imp->associatedAttributeName());
00186 
00187     return result;
00188 }
00189 
00190 }
00191 
00192 #endif // ENABLE(SVG)

KHTML

Skip menu "KHTML"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.6.1
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal