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

KHTML

SVGDocumentExtensions.cpp

Go to the documentation of this file.
00001 /*
00002     Copyright (C) 2006 Apple Computer, Inc.
00003                   2006 Nikolas Zimmermann <zimmermann@kde.org>
00004                   2007 Rob Buis <buis@kde.org>
00005 
00006     This file is part of the WebKit project
00007 
00008     This library is free software; you can redistribute it and/or
00009     modify it under the terms of the GNU Library General Public
00010     License as published by the Free Software Foundation; either
00011     version 2 of the License, or (at your option) any later version.
00012 
00013     This library is distributed in the hope that it will be useful,
00014     but WITHOUT ANY WARRANTY; without even the implied warranty of
00015     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016     Library General Public License for more details.
00017 
00018     You should have received a copy of the GNU Library General Public License
00019     along with this library; see the file COPYING.LIB.  If not, write to
00020     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00021     Boston, MA 02110-1301, USA.
00022 */
00023 
00024 #include "config.h"
00025 #include <wtf/Platform.h>
00026 
00027 #if ENABLE(SVG)
00028 #include "SVGDocumentExtensions.h"
00029 
00030 /*#include "AtomicString.h"
00031 #include "Console.h"
00032 #include "DOMWindow.h"*/
00033 //#include "Document.h"
00034 #include "xml/Document.h"
00035 //#include "EventListener.h"
00036 #include "dom/dom2_events.h"
00037 /*#include "Frame.h"
00038 #include "FrameLoader.h"
00039 #include "Page.h"*/
00040 #include "SVGSVGElement.h"
00041 /*#include "SMILTimeContainer.h"
00042 #include "XMLTokenizer.h"*/
00043 #include "kjs_proxy.h"
00044 #include "khtml_part.h"
00045 
00046 namespace WebCore {
00047 
00048 SVGDocumentExtensions::SVGDocumentExtensions(Document* doc)
00049     : m_doc(doc)
00050 {
00051 }
00052 
00053 SVGDocumentExtensions::~SVGDocumentExtensions()
00054 {
00055     /*deleteAllValues(m_pendingResources);*/
00056     deleteAllValues(m_elementInstances);
00057 }
00058 
00059 EventListener* SVGDocumentExtensions::createSVGEventListener(const String& functionName, const String& code, Node *node)
00060 {
00061     /*if (Frame* frame = m_doc->frame())
00062         if (frame->scriptProxy()->isEnabled())
00063             return frame->scriptProxy()->createSVGEventHandler(functionName, code, node);*/
00064     if (!m_doc || !m_doc->part())
00065         return 0;
00066     kDebug() << "create listener: (" << code << functionName << node << ")" << endl;
00067     return m_doc->part()->createHTMLEventListener(code.string(), functionName.string(), node, true/*svg*/);
00068 }
00069 
00070 void SVGDocumentExtensions::addTimeContainer(SVGSVGElement* element)
00071 {
00072     /*m_timeContainers.add(element);*/
00073 }
00074 
00075 void SVGDocumentExtensions::removeTimeContainer(SVGSVGElement* element)
00076 {
00077     /*m_timeContainers.remove(element);*/
00078 }
00079 
00080 void SVGDocumentExtensions::startAnimations()
00081 {
00082     // FIXME: Eventually every "Time Container" will need a way to latch on to some global timer
00083     // starting animations for a document will do this "latching"
00084 #if ENABLE(SVG_ANIMATION)    
00085     HashSet<SVGSVGElement*>::iterator end = m_timeContainers.end();
00086     for (HashSet<SVGSVGElement*>::iterator itr = m_timeContainers.begin(); itr != end; ++itr)
00087         (*itr)->timeContainer()->begin();
00088 #endif
00089 }
00090     
00091 void SVGDocumentExtensions::pauseAnimations()
00092 {
00093     HashSet<SVGSVGElement*>::iterator end = m_timeContainers.end();
00094     for (HashSet<SVGSVGElement*>::iterator itr = m_timeContainers.begin(); itr != end; ++itr)
00095         (*itr)->pauseAnimations();
00096 }
00097 
00098 void SVGDocumentExtensions::unpauseAnimations()
00099 {
00100     HashSet<SVGSVGElement*>::iterator end = m_timeContainers.end();
00101     for (HashSet<SVGSVGElement*>::iterator itr = m_timeContainers.begin(); itr != end; ++itr)
00102         (*itr)->unpauseAnimations();
00103 }
00104 
00105 void SVGDocumentExtensions::reportWarning(const String& message)
00106 {
00107     /*if (Frame* frame = m_doc->frame())
00108         frame->domWindow()->console()->addMessage(JSMessageSource, ErrorMessageLevel, "Warning: " + message, m_doc->tokenizer() ? m_doc->tokenizer()->lineNumber() : 1, String());*/
00109 }
00110 
00111 void SVGDocumentExtensions::reportError(const String& message)
00112 {
00113     /*if (Frame* frame = m_doc->frame())
00114         frame->domWindow()->console()->addMessage(JSMessageSource, ErrorMessageLevel, "Error: " + message, m_doc->tokenizer() ? m_doc->tokenizer()->lineNumber() : 1, String());*/
00115 }
00116 
00117 void SVGDocumentExtensions::addPendingResource(const AtomicString& id, SVGStyledElement* obj)
00118 {
00119     ASSERT(obj);
00120 
00121     if (id.isEmpty())
00122         return;
00123 
00124     /*if (m_pendingResources.contains(id))
00125         m_pendingResources.get(id)->add(obj);
00126     else {
00127         HashSet<SVGStyledElement*>* set = new HashSet<SVGStyledElement*>();
00128         set->add(obj);
00129 
00130         m_pendingResources.add(id, set);
00131     }*/
00132 }
00133 
00134 bool SVGDocumentExtensions::isPendingResource(const AtomicString& id) const
00135 {
00136     /*if (id.isEmpty())
00137         return false;
00138 
00139     return m_pendingResources.contains(id);*/
00140     ASSERT(false);
00141     return false;
00142 }
00143 
00144 std::auto_ptr<HashSet<SVGStyledElement*> > SVGDocumentExtensions::removePendingResource(const AtomicString& id)
00145 {
00146     /*ASSERT(m_pendingResources.contains(id));
00147 
00148     std::auto_ptr<HashSet<SVGStyledElement*> > set(m_pendingResources.get(id));
00149     m_pendingResources.remove(id);
00150     return set;*/
00151     ASSERT(false);
00152     return std::auto_ptr<HashSet<SVGStyledElement*> >();
00153 }
00154 
00155 void SVGDocumentExtensions::mapInstanceToElement(SVGElementInstance* instance, SVGElement* element)
00156 {
00157     ASSERT(instance);
00158     ASSERT(element);
00159 
00160     if (m_elementInstances.contains(element))
00161         m_elementInstances.get(element)->add(instance);
00162     else {
00163         HashSet<SVGElementInstance*>* set = new HashSet<SVGElementInstance*>();
00164         set->add(instance);
00165 
00166         m_elementInstances.add(element, set);
00167     }
00168 }
00169 
00170 void SVGDocumentExtensions::removeInstanceMapping(SVGElementInstance* instance, SVGElement* element)
00171 {
00172     ASSERT(instance);
00173 
00174     if (!m_elementInstances.contains(element))
00175         return;
00176 
00177     m_elementInstances.get(element)->remove(instance);
00178 }
00179 
00180 HashSet<SVGElementInstance*>* SVGDocumentExtensions::instancesForElement(SVGElement* element) const
00181 {
00182     ASSERT(element);
00183     return m_elementInstances.get(element);
00184 }
00185 
00186 }
00187 
00188 #endif

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