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

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

Issue 293983020: SVG: Remove JSC specific workaround in SVGElement::removeEventListener (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebased Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 825 matching lines...) Expand 10 before | Expand all | Expand 10 after
836 // Remove event listener from regular DOM element 836 // Remove event listener from regular DOM element
837 if (!Node::removeEventListener(eventType, listener, useCapture)) 837 if (!Node::removeEventListener(eventType, listener, useCapture))
838 return false; 838 return false;
839 839
840 // Remove event listener from all shadow tree DOM element instances 840 // Remove event listener from all shadow tree DOM element instances
841 const WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement> >::const_iterator end = instances.end(); 841 const WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement> >::const_iterator end = instances.end();
842 for (WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement> >::const_iterator it = instances.begin(); it != end; ++it) { 842 for (WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement> >::const_iterator it = instances.begin(); it != end; ++it) {
843 SVGElement* shadowTreeElement = *it; 843 SVGElement* shadowTreeElement = *it;
844 ASSERT(shadowTreeElement); 844 ASSERT(shadowTreeElement);
845 845
846 if (shadowTreeElement->Node::removeEventListener(eventType, listener, us eCapture)) 846 shadowTreeElement->Node::removeEventListener(eventType, listener, useCap ture);
847 continue;
848
849 // This case can only be hit for event listeners created from markup
850 ASSERT(listener->wasCreatedFromMarkup());
851
852 // If the event listener 'listener' has been created from markup and has been fired before
853 // then JSLazyEventListener::parseCode() has been called and m_jsFunctio n of that listener
854 // has been created (read: it's not 0 anymore). During shadow tree creat ion, the event
855 // listener DOM attribute has been cloned, and another event listener ha s been setup in
856 // the shadow tree. If that event listener has not been used yet, m_jsFu nction is still 0,
857 // and tryRemoveEventListener() above will fail. Work around that very s eldom problem.
858 EventTargetData* data = shadowTreeElement->eventTargetData();
859 ASSERT(data);
860
861 data->eventListenerMap.removeFirstEventListenerCreatedFromMarkup(eventTy pe);
862 } 847 }
863 848
864 return true; 849 return true;
865 } 850 }
866 851
867 static bool hasLoadListener(Element* element) 852 static bool hasLoadListener(Element* element)
868 { 853 {
869 if (element->hasEventListeners(EventTypeNames::load)) 854 if (element->hasEventListeners(EventTypeNames::load))
870 return true; 855 return true;
871 856
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
1185 #endif 1170 #endif
1186 1171
1187 void SVGElement::trace(Visitor* visitor) 1172 void SVGElement::trace(Visitor* visitor)
1188 { 1173 {
1189 visitor->trace(m_elementsWithRelativeLengths); 1174 visitor->trace(m_elementsWithRelativeLengths);
1190 visitor->trace(m_SVGRareData); 1175 visitor->trace(m_SVGRareData);
1191 Element::trace(visitor); 1176 Element::trace(visitor);
1192 } 1177 }
1193 1178
1194 } 1179 }
OLDNEW
« 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