Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(788)

Unified Diff: Source/core/svg/SVGElement.cpp

Issue 547103002: Make SVGElement::removeEventListener() mirror its addEventListener() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Simplify further Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698