Index: Source/core/svg/SVGElement.cpp |
diff --git a/Source/core/svg/SVGElement.cpp b/Source/core/svg/SVGElement.cpp |
index 2c3050f3a6caa1c4b2717bd81d90e0b2d38a1cab..e622e24c316ed7032734f717e2b808504cc085d4 100644 |
--- a/Source/core/svg/SVGElement.cpp |
+++ b/Source/core/svg/SVGElement.cpp |
@@ -758,32 +758,23 @@ bool SVGElement::addEventListener(const AtomicString& eventType, PassRefPtr<Even |
return true; |
} |
-bool SVGElement::removeEventListener(const AtomicString& eventType, PassRefPtr<EventListener> listener, bool useCapture) |
+bool SVGElement::removeEventListener(const AtomicString& eventType, PassRefPtr<EventListener> prpListener, bool useCapture) |
{ |
- WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement> > instances; |
- collectInstancesForSVGElement(this, instances); |
- if (instances.isEmpty()) |
- return Node::removeEventListener(eventType, listener.get(), useCapture); |
- |
- // EventTarget::removeEventListener creates a PassRefPtr around the given EventListener |
- // object when creating a temporary RegisteredEventListener object used to look up the |
- // event listener in a cache. If we want to be able to call removeEventListener() multiple |
- // times on different nodes, we have to delay its immediate destruction, which would happen |
- // after the first call below. |
- // XXX is that true? |
- RefPtr<EventListener> protector(listener); |
+ RefPtr<EventListener> listener = prpListener; |
// Remove event listener from regular DOM element |
- if (!Node::removeEventListener(eventType, listener.get(), useCapture)) |
+ if (!Node::removeEventListener(eventType, listener, useCapture)) |
return false; |
// Remove event listener from all shadow tree DOM element instances |
+ WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement> > instances; |
+ collectInstancesForSVGElement(this, instances); |
const WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement> >::const_iterator end = instances.end(); |
for (WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement> >::const_iterator it = instances.begin(); it != end; ++it) { |
SVGElement* shadowTreeElement = *it; |
ASSERT(shadowTreeElement); |
- shadowTreeElement->Node::removeEventListener(eventType, listener.get(), useCapture); |
+ shadowTreeElement->Node::removeEventListener(eventType, listener, useCapture); |
} |
return true; |