don't discard iframe children.
[kdelibs.git] / khtml / svg / SVGDocument.cpp
blobeb3d49252e7a9f3cc9b18b2d4726f4415844962e
1 /*
2 Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
3 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
5 This file is part of the KDE project
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public
9 License as published by the Free Software Foundation; either
10 version 2 of the License, or (at your option) any later version.
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Library General Public License for more details.
17 You should have received a copy of the GNU Library General Public License
18 along with this library; see the file COPYING.LIB. If not, write to
19 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 Boston, MA 02110-1301, USA.
23 #include "config.h"
24 #include "SVGDocument.h"
25 #if ENABLE(SVG)
27 /*#include "EventNames.h"
28 #include "ExceptionCode.h"
29 #include "FrameView.h"*/
30 #include "RenderView.h"
31 #include "SVGElement.h"
32 #include "SVGNames.h"
33 #include "SVGSVGElement.h"
34 /*#include "SVGViewSpec.h"
35 #include "SVGZoomEvent.h"
36 #include "SVGZoomAndPan.h"*/
38 namespace WebCore {
40 SVGDocument::SVGDocument(DOMImplementation* i, Frame* frame)
41 : Document(i, frame)
45 SVGDocument::~SVGDocument()
49 SVGSVGElement* SVGDocument::rootElement() const
51 Element* elem = documentElement();
52 if (elem && elem->hasTagName(SVGNames::svgTag))
53 return static_cast<SVGSVGElement*>(elem);
55 return 0;
58 void SVGDocument::dispatchZoomEvent(float prevScale, float newScale)
60 /*ExceptionCode ec = 0;
61 RefPtr<SVGZoomEvent> event = static_pointer_cast<SVGZoomEvent>(createEvent("SVGZoomEvents", ec));
62 event->initEvent(EventNames::zoomEvent, true, false);
63 event->setPreviousScale(prevScale);
64 event->setNewScale(newScale);
65 rootElement()->dispatchEvent(event.release(), ec);*/
68 void SVGDocument::dispatchScrollEvent()
70 /*ExceptionCode ec = 0;
71 RefPtr<Event> event = createEvent("SVGEvents", ec);
72 event->initEvent(EventNames::scrollEvent, true, false);
73 rootElement()->dispatchEvent(event.release(), ec);*/
76 bool SVGDocument::zoomAndPanEnabled() const
78 /*if (rootElement()) {
79 if (rootElement()->useCurrentView()) {
80 if (rootElement()->currentView())
81 return rootElement()->currentView()->zoomAndPan() == SVGZoomAndPan::SVG_ZOOMANDPAN_MAGNIFY;
82 } else
83 return rootElement()->zoomAndPan() == SVGZoomAndPan::SVG_ZOOMANDPAN_MAGNIFY;
84 }*/
86 return false;
89 void SVGDocument::startPan(const FloatPoint& start)
91 /*if (rootElement())
92 m_translate = FloatPoint(start.x() - rootElement()->currentTranslate().x(), rootElement()->currentTranslate().y() + start.y());*/
95 void SVGDocument::updatePan(const FloatPoint& pos) const
97 if (rootElement()) {
98 /*rootElement()->setCurrentTranslate(FloatPoint(pos.x() - m_translate.x(), m_translate.y() - pos.y()));
99 if (renderer())
100 renderer()->repaint();*/
104 void SVGDocument::close()
106 bool doload = !parsing() && m_tokenizer;
108 DocumentImpl::close();
110 if (doload) {
111 document()->dispatchWindowEvent(EventImpl::LOAD_EVENT, false, false);
117 // vim:ts=4:noet
118 #endif // ENABLE(SVG)