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

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 win32 signed/unsigned issue 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 713 matching lines...) Expand 10 before | Expand all | Expand 10 after
724 { 724 {
725 ASSERT(element); 725 ASSERT(element);
726 if (element->containingShadowRoot()) 726 if (element->containingShadowRoot())
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 void SVGElement::addedEventListener(const AtomicString& eventType, RegisteredEve ntListener& registeredListener)
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 Node::addedEventListener(eventType, registeredListener);
738 return false;
739 738
740 // Add event listener to all shadow tree DOM element instances 739 // Add event listener to all shadow tree DOM element instances
741 HeapHashSet<WeakMember<SVGElement>> instances; 740 HeapHashSet<WeakMember<SVGElement>> instances;
742 collectInstancesForSVGElement(this, instances); 741 collectInstancesForSVGElement(this, instances);
742 EventListenerOptions options = registeredListener.options();
743 EventListener* listener = registeredListener.listener();
743 for (SVGElement* element : instances) { 744 for (SVGElement* element : instances) {
744 bool result = element->Node::addEventListenerInternal(eventType, listene r, options); 745 bool result = element->Node::addEventListenerInternal(eventType, listene r, options);
745 ASSERT_UNUSED(result, result); 746 ASSERT_UNUSED(result, result);
746 } 747 }
747
748 return true;
749 } 748 }
750 749
751 bool SVGElement::removeEventListenerInternal(const AtomicString& eventType, Even tListener* listener, const EventListenerOptions& options) 750 void SVGElement::removedEventListener(const AtomicString& eventType, const Regis teredEventListener& registeredListener)
752 { 751 {
753 // Remove event listener from regular DOM element 752 Node::removedEventListener(eventType, registeredListener);
754 if (!Node::removeEventListenerInternal(eventType, listener, options))
755 return false;
756 753
757 // Remove event listener from all shadow tree DOM element instances 754 // Remove event listener from all shadow tree DOM element instances
758 HeapHashSet<WeakMember<SVGElement>> instances; 755 HeapHashSet<WeakMember<SVGElement>> instances;
759 collectInstancesForSVGElement(this, instances); 756 collectInstancesForSVGElement(this, instances);
757 EventListenerOptions options = registeredListener.options();
758 const EventListener* listener = registeredListener.listener();
760 for (SVGElement* shadowTreeElement : instances) { 759 for (SVGElement* shadowTreeElement : instances) {
761 ASSERT(shadowTreeElement); 760 ASSERT(shadowTreeElement);
762 761
763 shadowTreeElement->Node::removeEventListenerInternal(eventType, listener , options); 762 shadowTreeElement->Node::removeEventListenerInternal(eventType, listener , options);
764 } 763 }
765
766 return true;
767 } 764 }
768 765
769 static bool hasLoadListener(Element* element) 766 static bool hasLoadListener(Element* element)
770 { 767 {
771 if (element->hasEventListeners(EventTypeNames::load)) 768 if (element->hasEventListeners(EventTypeNames::load))
772 return true; 769 return true;
773 770
774 for (element = element->parentOrShadowHostElement(); element; element = elem ent->parentOrShadowHostElement()) { 771 for (element = element->parentOrShadowHostElement(); element; element = elem ent->parentOrShadowHostElement()) {
775 EventListenerVector* entry = element->getEventListeners(EventTypeNames:: load); 772 EventListenerVector* entry = element->getEventListeners(EventTypeNames:: load);
776 if (!entry) 773 if (!entry)
777 continue; 774 continue;
778 for (size_t i = 0; i < entry->size(); ++i) { 775 for (size_t i = 0; i < entry->size(); ++i) {
779 if (entry->at(i).useCapture) 776 if (entry->at(i).capture())
780 return true; 777 return true;
781 } 778 }
782 } 779 }
783 780
784 return false; 781 return false;
785 } 782 }
786 783
787 bool SVGElement::sendSVGLoadEventIfPossible() 784 bool SVGElement::sendSVGLoadEventIfPossible()
788 { 785 {
789 if (!haveLoadedRequiredResources()) 786 if (!haveLoadedRequiredResources())
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
1178 Element::trace(visitor); 1175 Element::trace(visitor);
1179 } 1176 }
1180 1177
1181 const AtomicString& SVGElement::eventParameterName() 1178 const AtomicString& SVGElement::eventParameterName()
1182 { 1179 {
1183 DEFINE_STATIC_LOCAL(const AtomicString, evtString, ("evt")); 1180 DEFINE_STATIC_LOCAL(const AtomicString, evtString, ("evt"));
1184 return evtString; 1181 return evtString;
1185 } 1182 }
1186 1183
1187 } // namespace blink 1184 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698