| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde
.org> | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde
.org> |
| 3 * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org> |
| 4 * Copyright (C) 2008 Apple Inc. All rights reserved. | 4 * Copyright (C) 2008 Apple Inc. All rights reserved. |
| 5 * Copyright (C) 2008 Alp Toker <alp@atoker.com> | 5 * Copyright (C) 2008 Alp Toker <alp@atoker.com> |
| 6 * Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> | 6 * Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 751 collectInstancesForSVGElement(this, instances); | 751 collectInstancesForSVGElement(this, instances); |
| 752 const WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement> >::const_iterator
end = instances.end(); | 752 const WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement> >::const_iterator
end = instances.end(); |
| 753 for (WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement> >::const_iterator
it = instances.begin(); it != end; ++it) { | 753 for (WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement> >::const_iterator
it = instances.begin(); it != end; ++it) { |
| 754 bool result = (*it)->Node::addEventListener(eventType, listener, useCapt
ure); | 754 bool result = (*it)->Node::addEventListener(eventType, listener, useCapt
ure); |
| 755 ASSERT_UNUSED(result, result); | 755 ASSERT_UNUSED(result, result); |
| 756 } | 756 } |
| 757 | 757 |
| 758 return true; | 758 return true; |
| 759 } | 759 } |
| 760 | 760 |
| 761 bool SVGElement::removeEventListener(const AtomicString& eventType, PassRefPtr<E
ventListener> listener, bool useCapture) | 761 bool SVGElement::removeEventListener(const AtomicString& eventType, PassRefPtr<E
ventListener> prpListener, bool useCapture) |
| 762 { | 762 { |
| 763 WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement> > instances; | 763 RefPtr<EventListener> listener = prpListener; |
| 764 collectInstancesForSVGElement(this, instances); | |
| 765 if (instances.isEmpty()) | |
| 766 return Node::removeEventListener(eventType, listener.get(), useCapture); | |
| 767 | |
| 768 // EventTarget::removeEventListener creates a PassRefPtr around the given Ev
entListener | |
| 769 // object when creating a temporary RegisteredEventListener object used to l
ook up the | |
| 770 // event listener in a cache. If we want to be able to call removeEventListe
ner() multiple | |
| 771 // times on different nodes, we have to delay its immediate destruction, whi
ch would happen | |
| 772 // after the first call below. | |
| 773 // XXX is that true? | |
| 774 RefPtr<EventListener> protector(listener); | |
| 775 | 764 |
| 776 // Remove event listener from regular DOM element | 765 // Remove event listener from regular DOM element |
| 777 if (!Node::removeEventListener(eventType, listener.get(), useCapture)) | 766 if (!Node::removeEventListener(eventType, listener, useCapture)) |
| 778 return false; | 767 return false; |
| 779 | 768 |
| 780 // Remove event listener from all shadow tree DOM element instances | 769 // Remove event listener from all shadow tree DOM element instances |
| 770 WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement> > instances; |
| 771 collectInstancesForSVGElement(this, instances); |
| 781 const WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement> >::const_iterator
end = instances.end(); | 772 const WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement> >::const_iterator
end = instances.end(); |
| 782 for (WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement> >::const_iterator
it = instances.begin(); it != end; ++it) { | 773 for (WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement> >::const_iterator
it = instances.begin(); it != end; ++it) { |
| 783 SVGElement* shadowTreeElement = *it; | 774 SVGElement* shadowTreeElement = *it; |
| 784 ASSERT(shadowTreeElement); | 775 ASSERT(shadowTreeElement); |
| 785 | 776 |
| 786 shadowTreeElement->Node::removeEventListener(eventType, listener.get(),
useCapture); | 777 shadowTreeElement->Node::removeEventListener(eventType, listener, useCap
ture); |
| 787 } | 778 } |
| 788 | 779 |
| 789 return true; | 780 return true; |
| 790 } | 781 } |
| 791 | 782 |
| 792 static bool hasLoadListener(Element* element) | 783 static bool hasLoadListener(Element* element) |
| 793 { | 784 { |
| 794 if (element->hasEventListeners(EventTypeNames::load)) | 785 if (element->hasEventListeners(EventTypeNames::load)) |
| 795 return true; | 786 return true; |
| 796 | 787 |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1185 Element::trace(visitor); | 1176 Element::trace(visitor); |
| 1186 } | 1177 } |
| 1187 | 1178 |
| 1188 const AtomicString& SVGElement::eventParameterName() | 1179 const AtomicString& SVGElement::eventParameterName() |
| 1189 { | 1180 { |
| 1190 DEFINE_STATIC_LOCAL(const AtomicString, evtString, ("evt", AtomicString::Con
structFromLiteral)); | 1181 DEFINE_STATIC_LOCAL(const AtomicString, evtString, ("evt", AtomicString::Con
structFromLiteral)); |
| 1191 return evtString; | 1182 return evtString; |
| 1192 } | 1183 } |
| 1193 | 1184 |
| 1194 } // namespace blink | 1185 } // namespace blink |
| OLD | NEW |