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

Side by Side Diff: third_party/WebKit/Source/core/svg/SVGElement.cpp

Issue 1942723004: Change EventTarget callback APIs for add/RemoveEventListenerInternal. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix gypi Created 4 years, 7 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 unified diff | Download patch
OLDNEW
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 716 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 return; 727 return;
728 728
729 ASSERT(!element->instanceUpdatesBlocked()); 729 ASSERT(!element->instanceUpdatesBlocked());
730 730
731 instances = element->instancesForElement(); 731 instances = element->instancesForElement();
732 } 732 }
733 733
734 bool SVGElement::addEventListenerInternal(const AtomicString& eventType, EventLi stener* listener, const EventListenerOptions& options) 734 bool SVGElement::addEventListenerInternal(const AtomicString& eventType, EventLi stener* listener, const EventListenerOptions& options)
735 { 735 {
736 // Add event listener to regular DOM element 736 // Add event listener to regular DOM element
737 if (!Node::addEventListenerInternal(eventType, listener, options)) 737 if (!Node::addEventListenerInternal(eventType, listener, options))
bokan 2016/05/03 15:52:46 I'm probably missing something, but why can't thes
bokan 2016/05/03 17:42:02 Ok, chatted off-review, because addedEventListener
738 return false; 738 return false;
739 739
740 // Add event listener to all shadow tree DOM element instances 740 // Add event listener to all shadow tree DOM element instances
741 HeapHashSet<WeakMember<SVGElement>> instances; 741 HeapHashSet<WeakMember<SVGElement>> instances;
742 collectInstancesForSVGElement(this, instances); 742 collectInstancesForSVGElement(this, instances);
743 for (SVGElement* element : instances) { 743 for (SVGElement* element : instances) {
744 bool result = element->Node::addEventListenerInternal(eventType, listene r, options); 744 bool result = element->Node::addEventListenerInternal(eventType, listene r, options);
745 ASSERT_UNUSED(result, result); 745 ASSERT_UNUSED(result, result);
746 } 746 }
747 747
748 return true; 748 return true;
749 } 749 }
750 750
751 bool SVGElement::removeEventListenerInternal(const AtomicString& eventType, Even tListener* listener, const EventListenerOptions& options) 751 bool SVGElement::removeEventListenerInternal(const AtomicString& eventType, cons t EventListener* listener, const EventListenerOptions& options)
752 { 752 {
753 // Remove event listener from regular DOM element 753 // Remove event listener from regular DOM element
754 if (!Node::removeEventListenerInternal(eventType, listener, options)) 754 if (!Node::removeEventListenerInternal(eventType, listener, options))
755 return false; 755 return false;
756 756
757 // Remove event listener from all shadow tree DOM element instances 757 // Remove event listener from all shadow tree DOM element instances
758 HeapHashSet<WeakMember<SVGElement>> instances; 758 HeapHashSet<WeakMember<SVGElement>> instances;
759 collectInstancesForSVGElement(this, instances); 759 collectInstancesForSVGElement(this, instances);
760 for (SVGElement* shadowTreeElement : instances) { 760 for (SVGElement* shadowTreeElement : instances) {
761 ASSERT(shadowTreeElement); 761 ASSERT(shadowTreeElement);
762 762
763 shadowTreeElement->Node::removeEventListenerInternal(eventType, listener , options); 763 shadowTreeElement->Node::removeEventListenerInternal(eventType, listener , options);
764 } 764 }
765 765
766 return true; 766 return true;
767 } 767 }
768 768
769 static bool hasLoadListener(Element* element) 769 static bool hasLoadListener(Element* element)
770 { 770 {
771 if (element->hasEventListeners(EventTypeNames::load)) 771 if (element->hasEventListeners(EventTypeNames::load))
772 return true; 772 return true;
773 773
774 for (element = element->parentOrShadowHostElement(); element; element = elem ent->parentOrShadowHostElement()) { 774 for (element = element->parentOrShadowHostElement(); element; element = elem ent->parentOrShadowHostElement()) {
775 EventListenerVector* entry = element->getEventListeners(EventTypeNames:: load); 775 EventListenerVector* entry = element->getEventListeners(EventTypeNames:: load);
776 if (!entry) 776 if (!entry)
777 continue; 777 continue;
778 for (size_t i = 0; i < entry->size(); ++i) { 778 for (size_t i = 0; i < entry->size(); ++i) {
779 if (entry->at(i).useCapture) 779 if (entry->at(i).capture())
780 return true; 780 return true;
781 } 781 }
782 } 782 }
783 783
784 return false; 784 return false;
785 } 785 }
786 786
787 bool SVGElement::sendSVGLoadEventIfPossible() 787 bool SVGElement::sendSVGLoadEventIfPossible()
788 { 788 {
789 if (!haveLoadedRequiredResources()) 789 if (!haveLoadedRequiredResources())
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
1178 Element::trace(visitor); 1178 Element::trace(visitor);
1179 } 1179 }
1180 1180
1181 const AtomicString& SVGElement::eventParameterName() 1181 const AtomicString& SVGElement::eventParameterName()
1182 { 1182 {
1183 DEFINE_STATIC_LOCAL(const AtomicString, evtString, ("evt")); 1183 DEFINE_STATIC_LOCAL(const AtomicString, evtString, ("evt"));
1184 return evtString; 1184 return evtString;
1185 } 1185 }
1186 1186
1187 } // namespace blink 1187 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698