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

Side by Side Diff: third_party/WebKit/Source/core/events/EventListenerMap.cpp

Issue 2186823002: Do not call an event listener on a cloned node in svg <use>'s UA shadow tree (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: skip timeout test Created 4 years, 4 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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
6 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) 6 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org)
7 * (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> 7 * (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
8 * Copyright (C) 2011 Andreas Kling (kling@webkit.org) 8 * Copyright (C) 2011 Andreas Kling (kling@webkit.org)
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 assertNoActiveIterators(); 172 assertNoActiveIterators();
173 173
174 for (const auto& entry : m_entries) { 174 for (const auto& entry : m_entries) {
175 if (entry.first == eventType) 175 if (entry.first == eventType)
176 return entry.second.get(); 176 return entry.second.get();
177 } 177 }
178 178
179 return nullptr; 179 return nullptr;
180 } 180 }
181 181
182 static void copyListenersNotCreatedFromMarkupToTarget(const AtomicString& eventT ype, EventListenerVector* listenerVector, EventTarget* target)
183 {
184 for (auto& eventListener : *listenerVector) {
185 // Event listeners created from markup have already been transfered to t he shadow tree during cloning.
186 if (eventListener.listener()->wasCreatedFromMarkup())
187 continue;
188 AddEventListenerOptionsResolved options = eventListener.options();
189 target->addEventListener(eventType, eventListener.listener(), options);
190 }
191 }
192
193 void EventListenerMap::copyEventListenersNotCreatedFromMarkupToTarget(EventTarge t* target)
194 {
195 assertNoActiveIterators();
196
197 for (const auto& eventListener : m_entries)
198 copyListenersNotCreatedFromMarkupToTarget(eventListener.first, eventList ener.second.get(), target);
199 }
200
201 DEFINE_TRACE(EventListenerMap) 182 DEFINE_TRACE(EventListenerMap)
202 { 183 {
203 visitor->trace(m_entries); 184 visitor->trace(m_entries);
204 } 185 }
205 186
206 EventListenerIterator::EventListenerIterator(EventTarget* target) 187 EventListenerIterator::EventListenerIterator(EventTarget* target)
207 : m_map(nullptr) 188 : m_map(nullptr)
208 , m_entryIndex(0) 189 , m_entryIndex(0)
209 , m_index(0) 190 , m_index(0)
210 { 191 {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 EventListenerVector& listeners = *m_map->m_entries[m_entryIndex].second; 224 EventListenerVector& listeners = *m_map->m_entries[m_entryIndex].second;
244 if (m_index < listeners.size()) 225 if (m_index < listeners.size())
245 return listeners[m_index++].listener(); 226 return listeners[m_index++].listener();
246 m_index = 0; 227 m_index = 0;
247 } 228 }
248 229
249 return nullptr; 230 return nullptr;
250 } 231 }
251 232
252 } // namespace blink 233 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/events/EventListenerMap.h ('k') | third_party/WebKit/Source/core/events/EventPath.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698