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

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

Issue 22859012: Add support for DOM Level 3 WheelEvent (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rename prefixedType() to legacyType() Created 7 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/dom/EventNames.h ('k') | Source/core/dom/Node.cpp » ('j') | 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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 event->setEventPhase(Event::AT_TARGET); 169 event->setEventPhase(Event::AT_TARGET);
170 bool defaultPrevented = fireEventListeners(event.get()); 170 bool defaultPrevented = fireEventListeners(event.get());
171 event->setEventPhase(0); 171 event->setEventPhase(0);
172 return defaultPrevented; 172 return defaultPrevented;
173 } 173 }
174 174
175 void EventTarget::uncaughtExceptionInEventHandler() 175 void EventTarget::uncaughtExceptionInEventHandler()
176 { 176 {
177 } 177 }
178 178
179 static AtomicString prefixedType(const Event* event) 179 static AtomicString legacyType(const Event* event)
180 { 180 {
181 if (event->type() == eventNames().transitionendEvent) 181 if (event->type() == eventNames().transitionendEvent)
182 return eventNames().webkitTransitionEndEvent; 182 return eventNames().webkitTransitionEndEvent;
183 183
184 if (event->type() == eventNames().wheelEvent)
185 return eventNames().mousewheelEvent;
186
184 return emptyString(); 187 return emptyString();
185 } 188 }
186 189
187 bool EventTarget::fireEventListeners(Event* event) 190 bool EventTarget::fireEventListeners(Event* event)
188 { 191 {
189 ASSERT(!NoEventDispatchAssertion::isEventDispatchForbidden()); 192 ASSERT(!NoEventDispatchAssertion::isEventDispatchForbidden());
190 ASSERT(event && !event->type().isEmpty()); 193 ASSERT(event && !event->type().isEmpty());
191 194
192 EventTargetData* d = eventTargetData(); 195 EventTargetData* d = eventTargetData();
193 if (!d) 196 if (!d)
194 return true; 197 return true;
195 198
196 EventListenerVector* listenerPrefixedVector = 0; 199 EventListenerVector* listenerPrefixedVector = 0;
197 AtomicString prefixedTypeName = prefixedType(event); 200 AtomicString prefixedTypeName = legacyType(event);
198 if (!prefixedTypeName.isEmpty()) 201 if (!prefixedTypeName.isEmpty())
199 listenerPrefixedVector = d->eventListenerMap.find(prefixedTypeName); 202 listenerPrefixedVector = d->eventListenerMap.find(prefixedTypeName);
200 203
201 EventListenerVector* listenerUnprefixedVector = d->eventListenerMap.find(eve nt->type()); 204 EventListenerVector* listenerUnprefixedVector = d->eventListenerMap.find(eve nt->type());
202 205
203 if (listenerUnprefixedVector) 206 if (listenerUnprefixedVector)
204 fireEventListeners(event, d, *listenerUnprefixedVector); 207 fireEventListeners(event, d, *listenerUnprefixedVector);
205 else if (listenerPrefixedVector) { 208 else if (listenerPrefixedVector) {
206 AtomicString unprefixedTypeName = event->type(); 209 AtomicString unprefixedTypeName = event->type();
207 event->setType(prefixedTypeName); 210 event->setType(prefixedTypeName);
208 fireEventListeners(event, d, *listenerPrefixedVector); 211 fireEventListeners(event, d, *listenerPrefixedVector);
209 event->setType(unprefixedTypeName); 212 event->setType(unprefixedTypeName);
210 } 213 }
211 214
212 if (!prefixedTypeName.isEmpty()) { 215 if (prefixedTypeName == eventNames().webkitTransitionEndEvent) {
213 if (DOMWindow* executingWindow = this->executingWindow()) { 216 if (DOMWindow* executingWindow = this->executingWindow()) {
214 if (listenerPrefixedVector) { 217 if (listenerPrefixedVector) {
215 if (listenerUnprefixedVector) 218 if (listenerUnprefixedVector)
216 UseCounter::count(executingWindow, UseCounter::PrefixedAndUn prefixedTransitionEndEvent); 219 UseCounter::count(executingWindow, UseCounter::PrefixedAndUn prefixedTransitionEndEvent);
217 else 220 else
218 UseCounter::count(executingWindow, UseCounter::PrefixedTrans itionEndEvent); 221 UseCounter::count(executingWindow, UseCounter::PrefixedTrans itionEndEvent);
219 } else if (listenerUnprefixedVector) { 222 } else if (listenerUnprefixedVector) {
220 UseCounter::count(executingWindow, UseCounter::UnprefixedTransit ionEndEvent); 223 UseCounter::count(executingWindow, UseCounter::UnprefixedTransit ionEndEvent);
221 } 224 }
222 } 225 }
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 // they have one less listener to invoke. 305 // they have one less listener to invoke.
303 if (d->firingEventIterators) { 306 if (d->firingEventIterators) {
304 for (size_t i = 0; i < d->firingEventIterators->size(); ++i) { 307 for (size_t i = 0; i < d->firingEventIterators->size(); ++i) {
305 d->firingEventIterators->at(i).iterator = 0; 308 d->firingEventIterators->at(i).iterator = 0;
306 d->firingEventIterators->at(i).end = 0; 309 d->firingEventIterators->at(i).end = 0;
307 } 310 }
308 } 311 }
309 } 312 }
310 313
311 } // namespace WebCore 314 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/EventNames.h ('k') | Source/core/dom/Node.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698