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

Side by Side Diff: Source/core/dom/EventTarget.cpp

Issue 15179010: Regression: Event#stopPropagation() does not halt bubbling for webkitTransitionEnd (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: correct upload Created 7 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/dom/Event.h ('k') | 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) 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 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 event->setEventPhase(Event::AT_TARGET); 155 event->setEventPhase(Event::AT_TARGET);
156 bool defaultPrevented = fireEventListeners(event.get()); 156 bool defaultPrevented = fireEventListeners(event.get());
157 event->setEventPhase(0); 157 event->setEventPhase(0);
158 return defaultPrevented; 158 return defaultPrevented;
159 } 159 }
160 160
161 void EventTarget::uncaughtExceptionInEventHandler() 161 void EventTarget::uncaughtExceptionInEventHandler()
162 { 162 {
163 } 163 }
164 164
165 static PassRefPtr<Event> createMatchingPrefixedEvent(const Event* event)
166 {
167 if (event->type() == eventNames().transitionendEvent) {
168 const TransitionEvent* transitionEvent = static_cast<const TransitionEve nt*>(event);
169 RefPtr<Event> prefixedEvent = TransitionEvent::create(eventNames().webki tTransitionEndEvent, transitionEvent->propertyName(), transitionEvent->elapsedTi me(), transitionEvent->pseudoElement());
170 prefixedEvent->setTarget(event->target());
171 prefixedEvent->setCurrentTarget(event->currentTarget());
172 prefixedEvent->setEventPhase(event->eventPhase());
173 return prefixedEvent.release();
174 }
175 ASSERT_NOT_REACHED();
176 return 0;
177 }
178
179 static AtomicString prefixedType(const Event* event) 165 static AtomicString prefixedType(const Event* event)
180 { 166 {
181 if (event->type() == eventNames().transitionendEvent) 167 if (event->type() == eventNames().transitionendEvent)
182 return eventNames().webkitTransitionEndEvent; 168 return eventNames().webkitTransitionEndEvent;
183 169
184 return emptyString(); 170 return emptyString();
185 } 171 }
186 172
187 bool EventTarget::fireEventListeners(Event* event) 173 bool EventTarget::fireEventListeners(Event* event)
188 { 174 {
189 ASSERT(!NoEventDispatchAssertion::isEventDispatchForbidden()); 175 ASSERT(!NoEventDispatchAssertion::isEventDispatchForbidden());
190 ASSERT(event && !event->type().isEmpty()); 176 ASSERT(event && !event->type().isEmpty());
191 177
192 EventTargetData* d = eventTargetData(); 178 EventTargetData* d = eventTargetData();
193 if (!d) 179 if (!d)
194 return true; 180 return true;
195 181
196 EventListenerVector* listenerPrefixedVector = 0; 182 EventListenerVector* listenerPrefixedVector = 0;
197 AtomicString prefixedTypeName = prefixedType(event); 183 AtomicString prefixedTypeName = prefixedType(event);
198 if (!prefixedTypeName.isEmpty()) 184 if (!prefixedTypeName.isEmpty())
199 listenerPrefixedVector = d->eventListenerMap.find(prefixedTypeName); 185 listenerPrefixedVector = d->eventListenerMap.find(prefixedTypeName);
200 186
201 EventListenerVector* listenerUnprefixedVector = d->eventListenerMap.find(eve nt->type()); 187 EventListenerVector* listenerUnprefixedVector = d->eventListenerMap.find(eve nt->type());
202 188
203 if (listenerUnprefixedVector) 189 if (listenerUnprefixedVector)
204 fireEventListeners(event, d, *listenerUnprefixedVector); 190 fireEventListeners(event, d, *listenerUnprefixedVector);
205 else if (listenerPrefixedVector) 191 else if (listenerPrefixedVector) {
206 fireEventListeners(createMatchingPrefixedEvent(event).get(), d, *listene rPrefixedVector); 192 AtomicString unprefixedTypeName = event->type();
193 event->setType(prefixedTypeName);
194 fireEventListeners(event, d, *listenerPrefixedVector);
195 event->setType(unprefixedTypeName);
abarth-chromium 2013/05/16 21:11:57 Woah
196 }
207 197
208 if (!prefixedTypeName.isEmpty()) { 198 if (!prefixedTypeName.isEmpty()) {
209 ScriptExecutionContext* context = scriptExecutionContext(); 199 ScriptExecutionContext* context = scriptExecutionContext();
210 if (context && context->isDocument()) { 200 if (context && context->isDocument()) {
211 Document* document = toDocument(context); 201 Document* document = toDocument(context);
212 if (document->domWindow()) { 202 if (document->domWindow()) {
213 if (listenerPrefixedVector) 203 if (listenerPrefixedVector)
214 if (listenerUnprefixedVector) 204 if (listenerUnprefixedVector)
215 UseCounter::count(document->domWindow(), UseCounter::Pre fixedAndUnprefixedTransitionEndEvent); 205 UseCounter::count(document->domWindow(), UseCounter::Pre fixedAndUnprefixedTransitionEndEvent);
216 else 206 else
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 // they have one less listener to invoke. 286 // they have one less listener to invoke.
297 if (d->firingEventIterators) { 287 if (d->firingEventIterators) {
298 for (size_t i = 0; i < d->firingEventIterators->size(); ++i) { 288 for (size_t i = 0; i < d->firingEventIterators->size(); ++i) {
299 d->firingEventIterators->at(i).iterator = 0; 289 d->firingEventIterators->at(i).iterator = 0;
300 d->firingEventIterators->at(i).end = 0; 290 d->firingEventIterators->at(i).end = 0;
301 } 291 }
302 } 292 }
303 } 293 }
304 294
305 } // namespace WebCore 295 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/Event.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698