• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 API Reference
  • KDE Home
  • Contact Us
 

KHTML

  • khtml
  • svg
SVGDocumentExtensions.cpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2006 Apple Computer, Inc.
3 2006 Nikolas Zimmermann <zimmermann@kde.org>
4 2007 Rob Buis <buis@kde.org>
5
6 This file is part of the WebKit project
7
8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Library General Public
10 License as published by the Free Software Foundation; either
11 version 2 of the License, or (at your option) any later version.
12
13 This library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Library General Public License for more details.
17
18 You should have received a copy of the GNU Library General Public License
19 along with this library; see the file COPYING.LIB. If not, write to
20 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 Boston, MA 02110-1301, USA.
22*/
23
24#include "config.h"
25#include <wtf/Platform.h>
26
27#if ENABLE(SVG)
28#include "SVGDocumentExtensions.h"
29
30/*#include "AtomicString.h"
31#include "Console.h"
32#include "DOMWindow.h"*/
33//#include "Document.h"
34#include "xml/Document.h"
35//#include "EventListener.h"
36#include "dom/dom2_events.h"
37/*#include "Frame.h"
38#include "FrameLoader.h"
39#include "Page.h"*/
40#include "SVGSVGElement.h"
41/*#include "SMILTimeContainer.h"
42#include "XMLTokenizer.h"*/
43#include "kjs_proxy.h"
44#include "khtml_part.h"
45
46namespace WebCore {
47
48SVGDocumentExtensions::SVGDocumentExtensions(Document* doc)
49 : m_doc(doc)
50{
51}
52
53SVGDocumentExtensions::~SVGDocumentExtensions()
54{
55 /*deleteAllValues(m_pendingResources);*/
56 deleteAllValues(m_elementInstances);
57}
58
59EventListener* SVGDocumentExtensions::createSVGEventListener(const DOMString& functionName, const DOMString& code, DOM::NodeImpl* node)
60{
61 /*if (Frame* frame = m_doc->frame())
62 if (frame->scriptProxy()->isEnabled())
63 return frame->scriptProxy()->createSVGEventHandler(functionName, code, node);*/
64 if (!m_doc || !m_doc->part())
65 return 0;
66 kDebug() << "create listener: (" << code << functionName << node << ")" << endl;
67 return m_doc->part()->createHTMLEventListener(code.string(), functionName.string(), node, true/*svg*/);
68}
69
70void SVGDocumentExtensions::addTimeContainer(SVGSVGElement* element)
71{
72 Q_UNUSED(element);
73 /*m_timeContainers.add(element);*/
74}
75
76void SVGDocumentExtensions::removeTimeContainer(SVGSVGElement* element)
77{
78 Q_UNUSED(element);
79 /*m_timeContainers.remove(element);*/
80}
81
82void SVGDocumentExtensions::startAnimations()
83{
84 // FIXME: Eventually every "Time Container" will need a way to latch on to some global timer
85 // starting animations for a document will do this "latching"
86#if ENABLE(SVG_ANIMATION)
87 HashSet<SVGSVGElement*>::iterator end = m_timeContainers.end();
88 for (HashSet<SVGSVGElement*>::iterator itr = m_timeContainers.begin(); itr != end; ++itr)
89 (*itr)->timeContainer()->begin();
90#endif
91}
92
93void SVGDocumentExtensions::pauseAnimations()
94{
95 HashSet<SVGSVGElement*>::iterator end = m_timeContainers.end();
96 for (HashSet<SVGSVGElement*>::iterator itr = m_timeContainers.begin(); itr != end; ++itr)
97 (*itr)->pauseAnimations();
98}
99
100void SVGDocumentExtensions::unpauseAnimations()
101{
102 HashSet<SVGSVGElement*>::iterator end = m_timeContainers.end();
103 for (HashSet<SVGSVGElement*>::iterator itr = m_timeContainers.begin(); itr != end; ++itr)
104 (*itr)->unpauseAnimations();
105}
106
107void SVGDocumentExtensions::reportWarning(const String& message)
108{
109 Q_UNUSED(message);
110 /*if (Frame* frame = m_doc->frame())
111 frame->domWindow()->console()->addMessage(JSMessageSource, ErrorMessageLevel, "Warning: " + message, m_doc->tokenizer() ? m_doc->tokenizer()->lineNumber() : 1, String());*/
112}
113
114void SVGDocumentExtensions::reportError(const String& message)
115{
116 Q_UNUSED(message);
117 /*if (Frame* frame = m_doc->frame())
118 frame->domWindow()->console()->addMessage(JSMessageSource, ErrorMessageLevel, "Error: " + message, m_doc->tokenizer() ? m_doc->tokenizer()->lineNumber() : 1, String());*/
119}
120
121void SVGDocumentExtensions::addPendingResource(const AtomicString& id, SVGStyledElement* obj)
122{
123 ASSERT(obj);
124 Q_UNUSED(obj);
125
126 if (id.isEmpty())
127 return;
128
129 /*if (m_pendingResources.contains(id))
130 m_pendingResources.get(id)->add(obj);
131 else {
132 HashSet<SVGStyledElement*>* set = new HashSet<SVGStyledElement*>();
133 set->add(obj);
134
135 m_pendingResources.add(id, set);
136 }*/
137}
138
139bool SVGDocumentExtensions::isPendingResource(const AtomicString& id) const
140{
141 Q_UNUSED(id);
142 /*if (id.isEmpty())
143 return false;
144
145 return m_pendingResources.contains(id);*/
146 ASSERT(false);
147 return false;
148}
149
150std::auto_ptr<HashSet<SVGStyledElement*> > SVGDocumentExtensions::removePendingResource(const AtomicString& id)
151{
152 Q_UNUSED(id);
153 /*ASSERT(m_pendingResources.contains(id));
154
155 std::auto_ptr<HashSet<SVGStyledElement*> > set(m_pendingResources.get(id));
156 m_pendingResources.remove(id);
157 return set;*/
158 ASSERT(false);
159 return std::auto_ptr<HashSet<SVGStyledElement*> >();
160}
161
162void SVGDocumentExtensions::mapInstanceToElement(SVGElementInstance* instance, SVGElement* element)
163{
164 ASSERT(instance);
165 ASSERT(element);
166
167 if (m_elementInstances.contains(element))
168 m_elementInstances.get(element)->add(instance);
169 else {
170 HashSet<SVGElementInstance*>* set = new HashSet<SVGElementInstance*>();
171 set->add(instance);
172
173 m_elementInstances.add(element, set);
174 }
175}
176
177void SVGDocumentExtensions::removeInstanceMapping(SVGElementInstance* instance, SVGElement* element)
178{
179 ASSERT(instance);
180
181 if (!m_elementInstances.contains(element))
182 return;
183
184 m_elementInstances.get(element)->remove(instance);
185}
186
187HashSet<SVGElementInstance*>* SVGDocumentExtensions::instancesForElement(SVGElement* element) const
188{
189 ASSERT(element);
190 return m_elementInstances.get(element);
191}
192
193}
194
195#endif
SVGDocumentExtensions.h
SVGSVGElement.h
dom2_events.h
kDebug
#define kDebug
khtml_part.h
end
const KShortcut & end()
WebCore
Definition: CSSHelper.h:7
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KHTML

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

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal