[webkit-changes] cvs commit: SVGSupport/ksvg2/svg
SVGAnimationElementImpl.cpp SVGElementImpl.h
SVGFilterPrimitiveStandardAttributesImpl.cpp SVGHelper.cpp
SVGLocatableImpl.cpp SVGPatternElementImpl.cpp
SVGSVGElementImpl.h SVGStyledElementImpl.cpp
SVGStyledElementImpl.h SVGUseElementImpl.cpp
Eric
eseidel at opensource.apple.com
Tue Sep 27 22:06:10 PDT 2005
eseidel 05/09/27 22:06:10
Modified: . ChangeLog
kdom Helper.h
kdom/bindings IDLCodeGeneratorJs.pm
kdom/core NodeImpl.cpp NodeImpl.h
kdom/events EventTargetImpl.cpp EventTargetImpl.h
kdom/ls DOMImplementationLSImpl.cpp
ksvg2/ecma Ecma.cpp
ksvg2/misc KSVGTimeScheduler.cpp
ksvg2/svg SVGAnimationElementImpl.cpp SVGElementImpl.h
SVGFilterPrimitiveStandardAttributesImpl.cpp
SVGHelper.cpp SVGLocatableImpl.cpp
SVGPatternElementImpl.cpp SVGSVGElementImpl.h
SVGStyledElementImpl.cpp SVGStyledElementImpl.h
SVGUseElementImpl.cpp
Log:
Bug #: 3914
Submitted by: eseidel
Reviewed by: mjs
Removed 19 uses of dynamic_cast.
Part of this came by making EventTarget abstract, and moving
the necessary implementations up into NodeImpl.
http://bugzilla.opendarwin.org/show_bug.cgi?id=3914
* kdom/Helper.h: comment cleanup
* kdom/bindings/IDLCodeGeneratorJs.pm: tabs -> spaces
* kdom/core/NodeImpl.cpp: Moved EventTarget methods
(NodeImpl::addEventListener):
(NodeImpl::removeEventListener):
(NodeImpl::dispatchEvent):
* kdom/core/NodeImpl.h:
(KDOM::NodeImpl::isSVGElement):
* kdom/events/EventTargetImpl.cpp: Moved methods to NodeImpl
* kdom/events/EventTargetImpl.h:
* kdom/ls/DOMImplementationLSImpl.cpp: disabled LSParserImpl
(DOMImplementationLSImpl::createLSParser):
* ksvg2/ecma/Ecma.cpp:
(Ecma::setupDocument):
* ksvg2/misc/KSVGTimeScheduler.cpp:
(SVGTimer::notifyAll):
* ksvg2/svg/SVGAnimationElementImpl.cpp:
(SVGAnimationElementImpl::targetElement):
(SVGAnimationElementImpl::targetAttribute):
(SVGAnimationElementImpl::setTargetAttribute):
* ksvg2/svg/SVGElementImpl.h:
(KSVG::SVGElementImpl::isSVGElement):
(KSVG::SVGElementImpl::isStyled):
(KSVG::SVGElementImpl::isSVG):
(KSVG::svg_dynamic_cast):
* ksvg2/svg/SVGFilterPrimitiveStandardAttributesImpl.cpp:
(SVGFilterPrimitiveStandardAttributesImpl::x):
(SVGFilterPrimitiveStandardAttributesImpl::y):
(SVGFilterPrimitiveStandardAttributesImpl::width):
(SVGFilterPrimitiveStandardAttributesImpl::height):
(SVGFilterPrimitiveStandardAttributesImpl::result):
* ksvg2/svg/SVGHelper.cpp:
(SVGHelper::PercentageOfViewport):
* ksvg2/svg/SVGLocatableImpl.cpp:
(SVGLocatableImpl::getCTM):
* ksvg2/svg/SVGPatternElementImpl.cpp:
(SVGPatternElementImpl::notifyAttributeChange):
* ksvg2/svg/SVGSVGElementImpl.h:
(KSVG::SVGSVGElementImpl::isSVG):
* ksvg2/svg/SVGStyledElementImpl.cpp:
(SVGStyledElementImpl::attach):
(SVGStyledElementImpl::detach):
* ksvg2/svg/SVGStyledElementImpl.h:
(KSVG::SVGStyledElementImpl::isStyled):
* ksvg2/svg/SVGUseElementImpl.cpp:
(SVGUseElementImpl::close):
Revision Changes Path
1.171 +56 -0 WebCore/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /cvs/root/WebCore/ChangeLog,v
retrieving revision 1.170
retrieving revision 1.171
diff -u -r1.170 -r1.171
--- ChangeLog 28 Sep 2005 02:25:50 -0000 1.170
+++ ChangeLog 28 Sep 2005 05:06:01 -0000 1.171
@@ -1,3 +1,59 @@
+2005-09-27 Eric Seidel <eseidel at apple.com>
+
+ Reviewed by mjs.
+
+ Removed 19 uses of dynamic_cast.
+ Part of this came by making EventTarget abstract, and moving
+ the necessary implementations up into NodeImpl.
+ http://bugzilla.opendarwin.org/show_bug.cgi?id=3914
+
+ * kdom/Helper.h: comment cleanup
+ * kdom/bindings/IDLCodeGeneratorJs.pm: tabs -> spaces
+ * kdom/core/NodeImpl.cpp: Moved EventTarget methods
+ (NodeImpl::addEventListener):
+ (NodeImpl::removeEventListener):
+ (NodeImpl::dispatchEvent):
+ * kdom/core/NodeImpl.h:
+ (KDOM::NodeImpl::isSVGElement):
+ * kdom/events/EventTargetImpl.cpp: Moved methods to NodeImpl
+ * kdom/events/EventTargetImpl.h:
+ * kdom/ls/DOMImplementationLSImpl.cpp: disabled LSParserImpl
+ (DOMImplementationLSImpl::createLSParser):
+ * ksvg2/ecma/Ecma.cpp:
+ (Ecma::setupDocument):
+ * ksvg2/misc/KSVGTimeScheduler.cpp:
+ (SVGTimer::notifyAll):
+ * ksvg2/svg/SVGAnimationElementImpl.cpp:
+ (SVGAnimationElementImpl::targetElement):
+ (SVGAnimationElementImpl::targetAttribute):
+ (SVGAnimationElementImpl::setTargetAttribute):
+ * ksvg2/svg/SVGElementImpl.h:
+ (KSVG::SVGElementImpl::isSVGElement):
+ (KSVG::SVGElementImpl::isStyled):
+ (KSVG::SVGElementImpl::isSVG):
+ (KSVG::svg_dynamic_cast):
+ * ksvg2/svg/SVGFilterPrimitiveStandardAttributesImpl.cpp:
+ (SVGFilterPrimitiveStandardAttributesImpl::x):
+ (SVGFilterPrimitiveStandardAttributesImpl::y):
+ (SVGFilterPrimitiveStandardAttributesImpl::width):
+ (SVGFilterPrimitiveStandardAttributesImpl::height):
+ (SVGFilterPrimitiveStandardAttributesImpl::result):
+ * ksvg2/svg/SVGHelper.cpp:
+ (SVGHelper::PercentageOfViewport):
+ * ksvg2/svg/SVGLocatableImpl.cpp:
+ (SVGLocatableImpl::getCTM):
+ * ksvg2/svg/SVGPatternElementImpl.cpp:
+ (SVGPatternElementImpl::notifyAttributeChange):
+ * ksvg2/svg/SVGSVGElementImpl.h:
+ (KSVG::SVGSVGElementImpl::isSVG):
+ * ksvg2/svg/SVGStyledElementImpl.cpp:
+ (SVGStyledElementImpl::attach):
+ (SVGStyledElementImpl::detach):
+ * ksvg2/svg/SVGStyledElementImpl.h:
+ (KSVG::SVGStyledElementImpl::isStyled):
+ * ksvg2/svg/SVGUseElementImpl.cpp:
+ (SVGUseElementImpl::close):
+
2005-09-27 Adele Peterson <adele at apple.com>
Reviewed by Maciej.
1.5 +3 -4 SVGSupport/kdom/Helper.h
Index: Helper.h
===================================================================
RCS file: /cvs/root/SVGSupport/kdom/Helper.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- Helper.h 1 Sep 2005 07:32:56 -0000 1.4
+++ Helper.h 28 Sep 2005 05:06:04 -0000 1.5
@@ -32,7 +32,6 @@
class Length;
class AttrImpl;
class NodeImpl;
- class DOMString;
class ElementImpl;
class DocumentImpl;
class DOMStringImpl;
@@ -180,10 +179,10 @@
* \code
* Element element = document.getElementByID "foobar");
*
- * DOMString href = element.getAttribute("href");
- * DOMString documentBase = element.baseURI();
+ * DOMStringImpl href = element.getAttribute("href");
+ * DOMStringImpl documentBase = element.baseURI();
*
- * DOMString theCompleteURL(Helper::BuildURI(documentBase.handle(), href.handle());
+ * DOMStringImpl theCompleteURL(Helper::BuildURI(documentBase.handle(), href.handle());
* \endcode
*
* @param base the base URI to resolve against
1.5 +6 -6 SVGSupport/kdom/bindings/IDLCodeGeneratorJs.pm
Index: IDLCodeGeneratorJs.pm
===================================================================
RCS file: /cvs/root/SVGSupport/kdom/bindings/IDLCodeGeneratorJs.pm,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- IDLCodeGeneratorJs.pm 20 Sep 2005 22:07:59 -0000 1.4
+++ IDLCodeGeneratorJs.pm 28 Sep 2005 05:06:05 -0000 1.5
@@ -794,7 +794,7 @@
push(@implContent, "\n{\n if(exec)\n return " . $extractedType{'type'} . "Proto::self(exec);");
}
- push(@implContent, "\n\n\treturn NULL;\n}\n");
+ push(@implContent, "\n\n return NULL;\n}\n");
# - Add 'bridge' function (always needed!)
my $useBridge = "${showNS}DOMBridge";
@@ -1166,14 +1166,14 @@
# push(@implContent, "static const char $nameStringTable\[\] =\n\{\n");
#
# my $s = "\0";
-# push(@implContent, "\t\"\\0\"\n");
+# push(@implContent, " \"\\0\"\n");
#
# for my $k (sort { length($b) <=> length($a) || $a cmp $b } @$keys) {
# if ($s =~ /^(.*)\Q$k\E\0/) {
# $soffset{$k} = length($1);
# } else {
# $soffset{$k} = length($s);
-# push(@implContent, "\t\"$k\\0\"\n");
+# push(@implContent, " \"$k\\0\"\n");
#
# $s .= $k;
# $s .= "\0";
@@ -1190,8 +1190,8 @@
if(defined($entry)) {
my $key = @$keys[$entry];
-# push(@implContent, "\t\{ " . $soffset{$key});
- push(@implContent, "\t\{ \"" . $key . "\"");
+# push(@implContent, " \{ " . $soffset{$key});
+ push(@implContent, " \{ \"" . $key . "\"");
push(@implContent, ", " . @$values[$entry]);
push(@implContent, ", " . @$specials[$entry]);
push(@implContent, ", " . @$parameters[$entry]);
@@ -1205,7 +1205,7 @@
# push(@implContent, "-1 \}");
}
} else {
- push(@implContent, "\t\{ 0, 0, 0, 0, 0 \}");
+ push(@implContent, " \{ 0, 0, 0, 0, 0 \}");
}
push(@implContent, ",") unless($i eq $size - 1);
1.7 +146 -0 SVGSupport/kdom/core/NodeImpl.cpp
Index: NodeImpl.cpp
===================================================================
RCS file: /cvs/root/SVGSupport/kdom/core/NodeImpl.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- NodeImpl.cpp 8 Sep 2005 08:03:20 -0000 1.6
+++ NodeImpl.cpp 28 Sep 2005 05:06:05 -0000 1.7
@@ -31,6 +31,8 @@
#include "NodeImpl.h"
#include "TextImpl.h"
#include "kdomevents.h"
+#include "RegisteredEventListener.h"
+#include "EventExceptionImpl.h"
#include "RenderStyle.h"
#include "ElementImpl.h"
#include "DocumentImpl.h"
@@ -1182,6 +1184,150 @@
}
}
+void NodeImpl::addEventListener(DOMStringImpl *type, EventListenerImpl *listener, bool useCapture)
+{
+ if(!listener)
+ return;
+
+ if(type)
+ type->ref();
+
+ // If the requested listener is builtin (ie. DOMNODEREMOVED_EVENT)
+ // we'll cache the specific enumeration value to save space
+ // but in case of a custom event (ie. as used in the dom2 events test suite)
+ // for example 'foo' just don't cache it; kdom internally won't fire any
+ // 'foo' events, which means it doesn't need to know anything about it...
+
+ if(!m_eventListeners)
+ {
+ m_eventListeners = new Q3PtrList<RegisteredEventListener>();
+ m_eventListeners->setAutoDelete(true);
+ }
+ else
+ {
+ // If there is an existing listener forget this call...
+ RegisteredEventListener compare(type, listener, useCapture);
+
+ Q3PtrListIterator<RegisteredEventListener> it(*m_eventListeners);
+ for(; it.current(); ++it)
+ {
+ if(*(it.current()) == compare)
+ return;
+ }
+ }
+
+ DocumentImpl *doc = (nodeType() == DOCUMENT_NODE) ? static_cast<DocumentImpl *>(this) : ownerDocument();
+ addListenerType(doc->addListenerType(type));
+ m_eventListeners->append(new RegisteredEventListener(type, listener, useCapture));
+
+ if(type)
+ type->deref();
+}
+
+void NodeImpl::removeEventListener(DOMStringImpl *type, EventListenerImpl *listener, bool useCapture)
+{
+ if(!m_eventListeners || !listener)
+ return;
+
+ DocumentImpl *doc = (nodeType() == DOCUMENT_NODE) ? static_cast<DocumentImpl *>(this) : ownerDocument();
+ if(!doc)
+ {
+ kdError() << "Couldn't remove listener type! No document available!" << endl;
+ return;
+ }
+
+ RegisteredEventListener compare(type, listener, useCapture);
+
+ Q3PtrListIterator<RegisteredEventListener> it(*m_eventListeners);
+ for(; it.current(); ++it)
+ {
+ if((*it.current()) == compare)
+ {
+ m_eventListeners->removeRef(it.current());
+ removeListenerType(doc->removeListenerType(type));
+ return;
+ }
+ }
+}
+
+bool NodeImpl::dispatchEvent(EventImpl *evt)
+{
+ if(!evt || (evt->id() == UNKNOWN_EVENT && (!evt->type() || evt->type()->isEmpty())))
+ throw new EventExceptionImpl(UNSPECIFIED_EVENT_TYPE_ERR);
+
+ evt->setTarget(this);
+
+ // Find out, where to send to -> collect parent nodes,
+ // cast them to EventTargets and add them to list
+ Q3PtrList<EventTargetImpl> targetChain;
+ for(NodeImpl *n = this; n != 0; n = n->parentNode())
+ targetChain.prepend(n);
+
+ // Trigger any capturing event handlers on our way down
+ evt->setEventPhase(CAPTURING_PHASE);
+
+ Q3PtrListIterator<EventTargetImpl> it(targetChain);
+ for(; it.current() && it.current() != this && !evt->propagationStopped(); ++it)
+ {
+ EventTargetImpl *i = it.current();
+ evt->setCurrentTarget(i);
+
+ if(i)
+ i->handleLocalEvents(evt, true);
+ }
+
+ // Dispatch to the actual target node
+ it.toLast();
+ if(!evt->propagationStopped())
+ {
+ EventTargetImpl *i = it.current();
+
+ evt->setCurrentTarget(i);
+ evt->setEventPhase(AT_TARGET);
+
+ if(i)
+ i->handleLocalEvents(evt, false);
+ }
+
+ --it;
+
+ // Bubble up again
+ if(evt->bubbles())
+ {
+ evt->setEventPhase(BUBBLING_PHASE);
+ for(; it.current() && !evt->propagationStopped(); --it)
+ {
+ EventTargetImpl *i = it.current();
+ evt->setCurrentTarget(i);
+
+ if(i)
+ i->handleLocalEvents(evt, false);
+ }
+ }
+
+ evt->setCurrentTarget(0);
+ evt->setEventPhase(0); // I guess this is correct, the spec does not seem to say
+ // anything about the default event handler phase.
+ if(evt->bubbles())
+ {
+ // now we call all default event handlers (this is not part of DOM - it is internal to khtml)
+ it.toLast();
+ for(; it.current() && !evt->propagationStopped() && !evt->defaultPrevented() && !evt->defaultHandled(); --it)
+ it.current()->defaultEventHandler(evt);
+ }
+
+ DocumentImpl *doc = (nodeType() == DOCUMENT_NODE) ? static_cast<DocumentImpl *>(this) : ownerDocument();
+ doc->updateRendering(); // any changes during event handling need to be rendered
+
+/* FIXME
+ Ecma *ecmaEngine = doc->ecmaEngine();
+ if(ecmaEngine)
+ ecmaEngine->finishedWithEvent(evt);
+*/
+ bool retVal = !evt->defaultPrevented(); // What if defaultPrevented was called before dispatchEvent?
+ return retVal;
+}
+
NodeImpl *NodeImpl::traverseNextNode(NodeImpl *stayWithin) const
{
if(firstChild() || stayWithin == this)
1.6 +8 -1 SVGSupport/kdom/core/NodeImpl.h
Index: NodeImpl.h
===================================================================
RCS file: /cvs/root/SVGSupport/kdom/core/NodeImpl.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- NodeImpl.h 1 Sep 2005 09:39:02 -0000 1.5
+++ NodeImpl.h 28 Sep 2005 05:06:05 -0000 1.6
@@ -147,6 +147,11 @@
void dispatchChildRemovalEvents(NodeImpl *child);
void dispatchChildInsertedEvents(NodeImpl *child);
void dispatchEventToSubTree(NodeImpl *node, EventImpl *event);
+
+ // EventTarget abstract methods
+ virtual void addEventListener(DOMStringImpl *type, EventListenerImpl *listener, bool useCapture);
+ virtual void removeEventListener(DOMStringImpl *type, EventListenerImpl *listener, bool useCapture);
+ virtual bool dispatchEvent(EventImpl *evt);
// Internal
virtual bool isReadOnly() const;
@@ -268,7 +273,9 @@
bool inDocument() const { return m_inDocument; }
void setInDocument(bool b = true) { m_inDocument = b; }
-
+#if APPLE_CHANGES
+ virtual bool isSVGElement() { return false; }
+#endif
protected:
// Helper methods (They will eventually throw exceptions!)
bool isAncestor(NodeImpl *current, NodeImpl *other);
1.7 +0 -171 SVGSupport/kdom/events/EventTargetImpl.cpp
Index: EventTargetImpl.cpp
===================================================================
RCS file: /cvs/root/SVGSupport/kdom/events/EventTargetImpl.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- EventTargetImpl.cpp 8 Sep 2005 08:03:27 -0000 1.6
+++ EventTargetImpl.cpp 28 Sep 2005 05:06:05 -0000 1.7
@@ -44,177 +44,6 @@
delete m_eventListeners;
}
-void EventTargetImpl::addEventListener(DOMStringImpl *type, EventListenerImpl *listener, bool useCapture)
-{
- if(!listener)
- return;
-
- if(type)
- type->ref();
-
- // If the requested listener is builtin (ie. DOMNODEREMOVED_EVENT)
- // we'll cache the specific enumeration value to save space
- // but in case of a custom event (ie. as used in the dom2 events test suite)
- // for example 'foo' just don't cache it; kdom internally won't fire any
- // 'foo' events, which means it doesn't need to know anything about it...
- NodeImpl *dynObj = const_cast<NodeImpl *>(dynamic_cast<const NodeImpl *>(this));
- if(!dynObj)
- {
- kdFatal() << "Upcast failed! The 'impossible' happened...!" << endl;
- return;
- }
-
- DocumentImpl *doc = (dynObj->nodeType() == DOCUMENT_NODE) ? static_cast<DocumentImpl *>(dynObj) : dynObj->ownerDocument();
- if(!doc)
- {
- kdError() << "Couldn't register listener type! No document available!" << endl;
- return;
- }
-
- if(!m_eventListeners)
- {
- m_eventListeners = new Q3PtrList<RegisteredEventListener>();
- m_eventListeners->setAutoDelete(true);
- }
- else
- {
- // If there is an existing listener forget this call...
- RegisteredEventListener compare(type, listener, useCapture);
-
- Q3PtrListIterator<RegisteredEventListener> it(*m_eventListeners);
- for(; it.current(); ++it)
- {
- if(*(it.current()) == compare)
- return;
- }
- }
-
- addListenerType(doc->addListenerType(type));
- m_eventListeners->append(new RegisteredEventListener(type, listener, useCapture));
-
- if(type)
- type->deref();
-}
-
-void EventTargetImpl::removeEventListener(DOMStringImpl *type, EventListenerImpl *listener, bool useCapture)
-{
- if(!m_eventListeners || !listener)
- return;
-
- NodeImpl *dynObj = const_cast<NodeImpl *>(dynamic_cast<const NodeImpl *>(this));
- if(!dynObj)
- {
- kdFatal() << "Upcast failed! The 'impossible' happened...!" << endl;
- return;
- }
-
- DocumentImpl *doc = (dynObj->nodeType() == DOCUMENT_NODE) ? static_cast<DocumentImpl *>(dynObj) : dynObj->ownerDocument();
- if(!doc)
- {
- kdError() << "Couldn't remove listener type! No document available!" << endl;
- return;
- }
-
- RegisteredEventListener compare(type, listener, useCapture);
-
- Q3PtrListIterator<RegisteredEventListener> it(*m_eventListeners);
- for(; it.current(); ++it)
- {
- if((*it.current()) == compare)
- {
- m_eventListeners->removeRef(it.current());
- removeListenerType(doc->removeListenerType(type));
- return;
- }
- }
-}
-
-bool EventTargetImpl::dispatchEvent(EventImpl *evt)
-{
- if(!evt || (evt->id() == UNKNOWN_EVENT && (!evt->type() || evt->type()->isEmpty())))
- throw new EventExceptionImpl(UNSPECIFIED_EVENT_TYPE_ERR);
-
- evt->setTarget(const_cast<EventTargetImpl *>(this));
-
- // Find out, where to send to -> collect parent nodes,
- // cast them to EventTargets and add them to list
- Q3PtrList<EventTargetImpl> targetChain;
-
- NodeImpl *i = dynamic_cast<NodeImpl *>(this);
- if(!i)
- {
- kdError() << k_funcinfo << " EventTarget must be inherited by Node! This should never happen." << endl;
- return false;
- }
-
- for(NodeImpl *n = i; n != 0; n = n->parentNode())
- targetChain.prepend(n);
-
- // Trigger any capturing event handlers on our way down
- evt->setEventPhase(CAPTURING_PHASE);
-
- Q3PtrListIterator<EventTargetImpl> it(targetChain);
- for(; it.current() && it.current() != this && !evt->propagationStopped(); ++it)
- {
- EventTargetImpl *i = it.current();
- evt->setCurrentTarget(i);
-
- if(i)
- i->handleLocalEvents(evt, true);
- }
-
- // Dispatch to the actual target node
- it.toLast();
- if(!evt->propagationStopped())
- {
- EventTargetImpl *i = it.current();
-
- evt->setCurrentTarget(i);
- evt->setEventPhase(AT_TARGET);
-
- if(i)
- i->handleLocalEvents(evt, false);
- }
-
- --it;
-
- // Bubble up again
- if(evt->bubbles())
- {
- evt->setEventPhase(BUBBLING_PHASE);
- for(; it.current() && !evt->propagationStopped(); --it)
- {
- EventTargetImpl *i = it.current();
- evt->setCurrentTarget(i);
-
- if(i)
- i->handleLocalEvents(evt, false);
- }
- }
-
- evt->setCurrentTarget(0);
- evt->setEventPhase(0); // I guess this is correct, the spec does not seem to say
- // anything about the default event handler phase.
- if(evt->bubbles())
- {
- // now we call all default event handlers (this is not part of DOM - it is internal to khtml)
- it.toLast();
- for(; it.current() && !evt->propagationStopped() && !evt->defaultPrevented() && !evt->defaultHandled(); --it)
- it.current()->defaultEventHandler(evt);
- }
-
- DocumentImpl *doc = (i->nodeType() == DOCUMENT_NODE) ? static_cast<DocumentImpl *>(i) : i->ownerDocument();
- doc->updateRendering(); // any changes during event handling need to be rendered
-
-/* FIXME
- Ecma *ecmaEngine = doc->ecmaEngine();
- if(ecmaEngine)
- ecmaEngine->finishedWithEvent(evt);
-*/
- bool retVal = !evt->defaultPrevented(); // What if defaultPrevented was called before dispatchEvent?
- return retVal;
-}
-
void EventTargetImpl::handleLocalEvents(EventImpl *evt, bool useCapture)
{
if(!m_eventListeners || !evt)
1.6 +6 -5 SVGSupport/kdom/events/EventTargetImpl.h
Index: EventTargetImpl.h
===================================================================
RCS file: /cvs/root/SVGSupport/kdom/events/EventTargetImpl.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- EventTargetImpl.h 2 Sep 2005 10:03:10 -0000 1.5
+++ EventTargetImpl.h 28 Sep 2005 05:06:06 -0000 1.6
@@ -39,9 +39,9 @@
EventTargetImpl();
virtual ~EventTargetImpl();
- void addEventListener(DOMStringImpl *type, EventListenerImpl *listener, bool useCapture);
- void removeEventListener(DOMStringImpl *type, EventListenerImpl *listener, bool useCapture);
- bool dispatchEvent(EventImpl *evt);
+ virtual void addEventListener(DOMStringImpl *type, EventListenerImpl *listener, bool useCapture) = 0;
+ virtual void removeEventListener(DOMStringImpl *type, EventListenerImpl *listener, bool useCapture) = 0;
+ virtual bool dispatchEvent(EventImpl *evt) = 0;
void handleLocalEvents(EventImpl *evt, bool useCapture);
@@ -55,10 +55,11 @@
*/
virtual void defaultEventHandler(EventImpl *) {}
+ protected:
+ Q3PtrList<RegisteredEventListener> *m_eventListeners;
+
private:
int m_listenerTypes;
-
- Q3PtrList<RegisteredEventListener> *m_eventListeners;
};
};
1.2 +4 -0 SVGSupport/kdom/ls/DOMImplementationLSImpl.cpp
Index: DOMImplementationLSImpl.cpp
===================================================================
RCS file: /cvs/root/SVGSupport/kdom/ls/DOMImplementationLSImpl.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DOMImplementationLSImpl.cpp 8 Sep 2005 08:03:28 -0000 1.1
+++ DOMImplementationLSImpl.cpp 28 Sep 2005 05:06:06 -0000 1.2
@@ -44,6 +44,7 @@
LSParserImpl *DOMImplementationLSImpl::createLSParser(unsigned short mode, DOMStringImpl *schemaTypeImpl) const
{
+#ifndef APPLE_COMPILE_HACK
QString schemaType = schemaTypeImpl ? schemaTypeImpl->string() : QString();
// NOT_SUPPORTED_ERR: Raised if the requested mode or schema type is not supported.
@@ -54,6 +55,9 @@
LSParserImpl *ret = new LSParserImpl();
ret->setASync(mode == MODE_ASYNCHRONOUS);
return ret;
+#else
+ throw new DOMExceptionImpl(NOT_SUPPORTED_ERR);
+#endif
}
LSInputImpl *DOMImplementationLSImpl::createLSInput() const
1.6 +2 -6 SVGSupport/ksvg2/ecma/Ecma.cpp
Index: Ecma.cpp
===================================================================
RCS file: /cvs/root/SVGSupport/ksvg2/ecma/Ecma.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- Ecma.cpp 1 Sep 2005 09:39:13 -0000 1.5
+++ Ecma.cpp 28 Sep 2005 05:06:06 -0000 1.6
@@ -109,12 +109,8 @@
void Ecma::setupDocument(KDOM::DocumentImpl *document)
{
- SVGDocumentImpl *svgDocument = dynamic_cast<SVGDocumentImpl *>(document);
- if(!svgDocument)
- {
- kdFatal() << "Ecma::setupDocument -> The impossible happened..." << endl;
- return;
- }
+ ASSERT(KDOM::DOMString(document->namespaceURI()) == NS_SVG)
+ SVGDocumentImpl *svgDocument = static_cast<SVGDocumentImpl *>(document);
// Create base bridge for document
SVGDocument docObj(svgDocument);
1.7 +7 -6 SVGSupport/ksvg2/misc/KSVGTimeScheduler.cpp
Index: KSVGTimeScheduler.cpp
===================================================================
RCS file: /cvs/root/SVGSupport/ksvg2/misc/KSVGTimeScheduler.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- KSVGTimeScheduler.cpp 8 Sep 2005 08:03:33 -0000 1.6
+++ KSVGTimeScheduler.cpp 28 Sep 2005 05:06:07 -0000 1.7
@@ -296,10 +296,10 @@
// Handle <animateTransform>...
if(targetTransforms)
{
- SVGStyledElementImpl *styled = dynamic_cast<SVGStyledElementImpl *>(tit.key());
- SVGTransformableImpl *transform = dynamic_cast<SVGTransformableImpl *>(tit.key());
+ SVGElementImpl *key = tit.key();
+ SVGTransformableImpl *transform = dynamic_cast<SVGTransformableImpl *>(key);
- if(styled && transform)
+ if(key && key->isStyled() && transform)
{
transform->transform()->setAnimVal(targetTransforms);
@@ -307,6 +307,7 @@
transform->updateLocalTransform(transform->transform()->animVal());
// ... update element & child elements ...
+ SVGStyledElementImpl *styled = static_cast<SVGStyledElementImpl *>(key);
transform->updateSubtreeMatrices(styled);
// ... and switch back to baseVal (and do not update!)
@@ -331,9 +332,9 @@
// Optimized update logic (to avoid 4 updates, on the same element)
for(tit = targetMap.begin(); tit != tend; ++tit)
{
- SVGStyledElementImpl *styled = dynamic_cast<SVGStyledElementImpl *>(tit.key());
- if(styled)
- styled->setChanged(true);
+ SVGElementImpl *key = tit.key();
+ if(key && key->isStyled())
+ static_cast<SVGStyledElementImpl *>(key)->setChanged(true);
}
}
1.7 +10 -5 SVGSupport/ksvg2/svg/SVGAnimationElementImpl.cpp
Index: SVGAnimationElementImpl.cpp
===================================================================
RCS file: /cvs/root/SVGSupport/ksvg2/svg/SVGAnimationElementImpl.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- SVGAnimationElementImpl.cpp 8 Sep 2005 08:03:34 -0000 1.6
+++ SVGAnimationElementImpl.cpp 28 Sep 2005 05:06:07 -0000 1.7
@@ -88,9 +88,9 @@
{
if(!m_href.isEmpty())
{
- KDOM::ElementImpl *element = ownerDocument()->getElementById(KDOM::DOMString(SVGURIReferenceImpl::getTarget(m_href)).handle());
- if(element)
- m_targetElement = dynamic_cast<SVGElementImpl *>(element);
+ KDOM::DOMString targetId = SVGURIReferenceImpl::getTarget(m_href);
+ KDOM::ElementImpl *element = ownerDocument()->getElementById(targetId.handle());
+ m_targetElement = svg_dynamic_cast(element);
}
else if(parentNode())
{
@@ -498,7 +498,10 @@
if(!targetElement())
return 0;
- SVGStyledElementImpl *styled = dynamic_cast<SVGStyledElementImpl *>(targetElement());
+ SVGElementImpl *target = targetElement();
+ SVGStyledElementImpl *styled = NULL;
+ if (target && target->isStyled())
+ styled = static_cast<SVGStyledElementImpl *>(target);
KDOM::CDFInterface *interface = (styled ? styled->ownerDocument()->implementation()->cdfInterface() : 0);
KDOM::DOMStringImpl *ret = 0;
@@ -545,7 +548,9 @@
if(!target || !name || !value)
return;
- SVGStyledElementImpl *styled = dynamic_cast<SVGStyledElementImpl *>(target);
+ SVGStyledElementImpl *styled = NULL;
+ if (target && target->isStyled())
+ styled = static_cast<SVGStyledElementImpl *>(target);
KDOM::CDFInterface *interface = (styled ? styled->ownerDocument()->implementation()->cdfInterface() : 0);
EAttributeType attributeType = type;
1.7 +29 -1 SVGSupport/ksvg2/svg/SVGElementImpl.h
Index: SVGElementImpl.h
===================================================================
RCS file: /cvs/root/SVGSupport/ksvg2/svg/SVGElementImpl.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- SVGElementImpl.h 8 Sep 2005 08:03:35 -0000 1.6
+++ SVGElementImpl.h 28 Sep 2005 05:06:07 -0000 1.7
@@ -44,7 +44,9 @@
public:
SVGElementImpl(KDOM::DocumentPtr *doc, KDOM::NodeImpl::Id id, KDOM::DOMStringImpl *prefix);
virtual ~SVGElementImpl();
-
+#if APPLE_CHANGES
+ virtual bool isSVGElement() { return true; }
+#endif
virtual bool isSupported(KDOM::DOMStringImpl *feature, KDOM::DOMStringImpl *version) const;
// 'SVGElement' functions
@@ -70,6 +72,9 @@
virtual QString adjustViewportClipping() const { return QString::null; }
SVGDocumentImpl *getDocument() const;
+
+ virtual bool isStyled() const { return false; }
+ virtual bool isSVG() const { return false; }
private:
#if 0
@@ -92,6 +97,29 @@
return !operator==(other); \
} \
+
+// Helper for DOMNode -> SVGElement conversion
+#include <kdom/kdom.h>
+#include <kdom/Namespace.h>
+#include <kdom/DOMString.h>
+
+namespace KSVG {
+ static inline SVGElementImpl *svg_dynamic_cast(KDOM::NodeImpl *node) {
+ SVGElementImpl *svgElement = NULL;
+#if APPLE_CHANGES
+ if (node && node->isSVGElement())
+ svgElement = static_cast<SVGElementImpl *>(node);
+#else
+ if (node && (node->nodeType() == KDOM::ELEMENT_NODE)) {
+ KDOM::ElementImpl *element = static_cast<KDOM::ElementImpl *>(node);
+ if (element && (KDOM::DOMString(element->namespaceURI()) == KDOM::NS_SVG))
+ svgElement = static_cast<SVGElementImpl *>(element);
+ }
+#endif
+ return svgElement;
+ }
+};
+
#endif
// vim:ts=4:noet
1.6 +5 -10 SVGSupport/ksvg2/svg/SVGFilterPrimitiveStandardAttributesImpl.cpp
Index: SVGFilterPrimitiveStandardAttributesImpl.cpp
===================================================================
RCS file: /cvs/root/SVGSupport/ksvg2/svg/SVGFilterPrimitiveStandardAttributesImpl.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- SVGFilterPrimitiveStandardAttributesImpl.cpp 1 Sep 2005 09:39:15 -0000 1.5
+++ SVGFilterPrimitiveStandardAttributesImpl.cpp 28 Sep 2005 05:06:07 -0000 1.6
@@ -59,24 +59,21 @@
SVGAnimatedLengthImpl *SVGFilterPrimitiveStandardAttributesImpl::x() const
{
// Spec : If the attribute is not specified, the effect is as if a value of "0%" were specified.
- const SVGStyledElementImpl *context = dynamic_cast<const SVGStyledElementImpl *>(this);
- return lazy_create<SVGAnimatedLengthImpl>(m_x, context, LM_WIDTH);
+ return lazy_create<SVGAnimatedLengthImpl>(m_x, this, LM_WIDTH);
}
SVGAnimatedLengthImpl *SVGFilterPrimitiveStandardAttributesImpl::y() const
{
// Spec : If the attribute is not specified, the effect is as if a value of "0%" were specified.
- const SVGStyledElementImpl *context = dynamic_cast<const SVGStyledElementImpl *>(this);
- return lazy_create<SVGAnimatedLengthImpl>(m_y, context, LM_HEIGHT);
+ return lazy_create<SVGAnimatedLengthImpl>(m_y, this, LM_HEIGHT);
}
SVGAnimatedLengthImpl *SVGFilterPrimitiveStandardAttributesImpl::width() const
{
- const SVGStyledElementImpl *context = dynamic_cast<const SVGStyledElementImpl *>(this);
// Spec : If the attribute is not specified, the effect is as if a value of "100%" were specified.
if(!m_width)
{
- lazy_create<SVGAnimatedLengthImpl>(m_width, context, LM_WIDTH);
+ lazy_create<SVGAnimatedLengthImpl>(m_width, this, LM_WIDTH);
m_width->baseVal()->setValueAsString(KDOM::DOMString("100%").handle());
return m_width;
}
@@ -86,11 +83,10 @@
SVGAnimatedLengthImpl *SVGFilterPrimitiveStandardAttributesImpl::height() const
{
- const SVGStyledElementImpl *context = dynamic_cast<const SVGStyledElementImpl *>(this);
// Spec : If the attribute is not specified, the effect is as if a value of "100%" were specified.
if(!m_height)
{
- lazy_create<SVGAnimatedLengthImpl>(m_height, context, LM_HEIGHT);
+ lazy_create<SVGAnimatedLengthImpl>(m_height, this, LM_HEIGHT);
m_height->baseVal()->setValueAsString(KDOM::DOMString("100%").handle());
return m_height;
}
@@ -100,8 +96,7 @@
SVGAnimatedStringImpl *SVGFilterPrimitiveStandardAttributesImpl::result() const
{
- const SVGStyledElementImpl *context = dynamic_cast<const SVGStyledElementImpl *>(this);
- return lazy_create<SVGAnimatedStringImpl>(m_result, context);
+ return lazy_create<SVGAnimatedStringImpl>(m_result, this);
}
void SVGFilterPrimitiveStandardAttributesImpl::parseAttribute(KDOM::AttributeImpl *attr)
1.6 +2 -2 SVGSupport/ksvg2/svg/SVGHelper.cpp
Index: SVGHelper.cpp
===================================================================
RCS file: /cvs/root/SVGSupport/ksvg2/svg/SVGHelper.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- SVGHelper.cpp 8 Sep 2005 08:03:35 -0000 1.5
+++ SVGHelper.cpp 28 Sep 2005 05:06:07 -0000 1.6
@@ -41,9 +41,9 @@
if(!viewportElement)
return 0.0;
- const SVGSVGElementImpl *svg = dynamic_cast<const SVGSVGElementImpl *>(viewportElement);
- if(svg)
+ if(viewportElement->isSVG())
{
+ const SVGSVGElementImpl *svg = static_cast<const SVGSVGElementImpl *>(viewportElement);
KDOM::DOMString viewBox("viewBox");
if(svg->hasAttribute(viewBox.handle()))
{
1.5 +2 -3 SVGSupport/ksvg2/svg/SVGLocatableImpl.cpp
Index: SVGLocatableImpl.cpp
===================================================================
RCS file: /cvs/root/SVGSupport/ksvg2/svg/SVGLocatableImpl.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- SVGLocatableImpl.cpp 1 Sep 2005 07:35:44 -0000 1.4
+++ SVGLocatableImpl.cpp 28 Sep 2005 05:06:07 -0000 1.5
@@ -104,10 +104,9 @@
SVGMatrixImpl *ctm = SVGSVGElementImpl::createSVGMatrix();
- KDOM::NodeImpl *parent = element->parentNode();
- if(parent && parent->nodeType() == KDOM::ELEMENT_NODE)
+ SVGElementImpl *parentElement = svg_dynamic_cast(element->parentNode());
+ if(parentElement)
{
- SVGElementImpl *parentElement = static_cast<SVGElementImpl *>(parent);
SVGLocatableImpl *parentLocatable = dynamic_cast<SVGLocatableImpl *>(parentElement);
if(parentLocatable)
{
1.7 +1 -1 SVGSupport/ksvg2/svg/SVGPatternElementImpl.cpp
Index: SVGPatternElementImpl.cpp
===================================================================
RCS file: /cvs/root/SVGSupport/ksvg2/svg/SVGPatternElementImpl.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- SVGPatternElementImpl.cpp 8 Sep 2005 08:03:36 -0000 1.6
+++ SVGPatternElementImpl.cpp 28 Sep 2005 05:06:08 -0000 1.7
@@ -228,7 +228,7 @@
// Find first pattern def that has children
const KDOM::ElementImpl *target = this;
- const KDOM::NodeImpl *test = static_cast<const KDOM::NodeImpl *>(target);
+ const KDOM::NodeImpl *test = this;
while(test && !test->hasChildNodes())
{
QString ref = KDOM::DOMString(href()->baseVal()).string();
1.7 +2 -0 SVGSupport/ksvg2/svg/SVGSVGElementImpl.h
Index: SVGSVGElementImpl.h
===================================================================
RCS file: /cvs/root/SVGSupport/ksvg2/svg/SVGSVGElementImpl.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- SVGSVGElementImpl.h 8 Sep 2005 08:03:36 -0000 1.6
+++ SVGSVGElementImpl.h 28 Sep 2005 05:06:08 -0000 1.7
@@ -64,6 +64,8 @@
public:
SVGSVGElementImpl(KDOM::DocumentPtr *doc, KDOM::NodeImpl::Id id, KDOM::DOMStringImpl *prefix);
virtual ~SVGSVGElementImpl();
+
+ virtual bool isSVG() const { return true; }
// 'SVGSVGElement' functions
SVGAnimatedLengthImpl *x() const;
1.7 +17 -12 SVGSupport/ksvg2/svg/SVGStyledElementImpl.cpp
Index: SVGStyledElementImpl.cpp
===================================================================
RCS file: /cvs/root/SVGSupport/ksvg2/svg/SVGStyledElementImpl.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- SVGStyledElementImpl.cpp 8 Sep 2005 08:03:37 -0000 1.6
+++ SVGStyledElementImpl.cpp 28 Sep 2005 05:06:08 -0000 1.7
@@ -217,22 +217,23 @@
finalizeStyle(renderingStyle);
// Apply transformations if possible...
- SVGLocatableImpl *transformable = dynamic_cast<SVGLocatableImpl *>(this);
- if(transformable)
+ SVGLocatableImpl *locatable = dynamic_cast<SVGLocatableImpl *>(this);
+ if(locatable)
{
- SVGMatrixImpl *ctm = transformable->getScreenCTM();
+ SVGMatrixImpl *ctm = locatable->getScreenCTM();
renderingStyle->setObjectMatrix(KCanvasMatrix(ctm->qmatrix()));
ctm->deref();
}
- SVGStyledElementImpl *parent = dynamic_cast<SVGStyledElementImpl *>(parentNode());
- if(parent && parent->canvasItem() && parent->allowAttachChildren(this))
- parent->canvasItem()->appendItem(m_canvasItem);
- else if (parent) {
+ SVGElementImpl *parentElement = svg_dynamic_cast(parentNode());
+ SVGStyledElementImpl *styledParent = NULL;
+ if (parentElement && parentElement->isStyled())
+ styledParent = static_cast<SVGStyledElementImpl *>(parentElement);
+ if(styledParent && styledParent->canvasItem() && styledParent->allowAttachChildren(this))
+ styledParent->canvasItem()->appendItem(m_canvasItem);
+ else if (styledParent) {
// FIXME: This exists until we can find a better way to create the root node. -- ecs 8/7/05
fprintf(stderr, "FAILED CANVAS INSERTION: <%s>, leaking %p\n", KDOM::DOMString(nodeName()).string().ascii(), this);
- //delete m_canvasItem; // FIXME leaking items here, until we find a fix for patterns.
- //m_canvasItem = NULL;
}
#ifndef APPLE_COMPILE_HACK
@@ -261,9 +262,13 @@
if(m_canvasItem)
{
- SVGStyledElementImpl *parent = dynamic_cast<SVGStyledElementImpl *>(parentNode());
- if(parent && parent->canvasItem())
- parent->canvasItem()->removeItem(m_canvasItem);
+ SVGElementImpl *parent = svg_dynamic_cast(parentNode());
+ SVGStyledElementImpl *styled = NULL;
+ if (parent && parent->isStyled())
+ styled = static_cast<SVGStyledElementImpl *>(parent);
+
+ if(styled && styled->canvasItem())
+ styled->canvasItem()->removeItem(m_canvasItem);
}
kdDebug(26002) << "[SVGStyledElementImpl::detach] Detached canvas item: " << m_canvasItem << endl;
1.6 +2 -0 SVGSupport/ksvg2/svg/SVGStyledElementImpl.h
Index: SVGStyledElementImpl.h
===================================================================
RCS file: /cvs/root/SVGSupport/ksvg2/svg/SVGStyledElementImpl.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- SVGStyledElementImpl.h 1 Sep 2005 09:39:17 -0000 1.5
+++ SVGStyledElementImpl.h 28 Sep 2005 05:06:08 -0000 1.6
@@ -46,6 +46,8 @@
public:
SVGStyledElementImpl(KDOM::DocumentPtr *doc, KDOM::NodeImpl::Id id, KDOM::DOMStringImpl *prefix);
virtual ~SVGStyledElementImpl();
+
+ virtual bool isStyled() const { return true; }
// 'SVGStylable' functions
virtual SVGAnimatedStringImpl *className() const;
1.6 +4 -3 SVGSupport/ksvg2/svg/SVGUseElementImpl.cpp
Index: SVGUseElementImpl.cpp
===================================================================
RCS file: /cvs/root/SVGSupport/ksvg2/svg/SVGUseElementImpl.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- SVGUseElementImpl.cpp 1 Sep 2005 09:39:17 -0000 1.5
+++ SVGUseElementImpl.cpp 28 Sep 2005 05:06:09 -0000 1.6
@@ -124,9 +124,10 @@
void SVGUseElementImpl::close()
{
QString ref = KDOM::DOMString(href()->baseVal()).string();
- QString targetId = SVGURIReferenceImpl::getTarget(ref);
- SVGElementImpl *target = dynamic_cast<SVGElementImpl *>(ownerDocument()->getElementById(KDOM::DOMString(targetId).handle()));
- if(!target)
+ KDOM::DOMString targetId = SVGURIReferenceImpl::getTarget(ref);
+ KDOM::ElementImpl *targetElement = ownerDocument()->getElementById(targetId.handle());
+ SVGElementImpl *target = svg_dynamic_cast(targetElement);
+ if (!target)
return;
float _x = x()->baseVal()->value(), _y = y()->baseVal()->value();
More information about the webkit-changes
mailing list