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

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

Issue 1241613004: Rework dispatchEvent so it is consistent for isTrusted support. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Work around MSVC optimization bug Created 5 years, 5 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 * 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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 return false; 175 return false;
176 } 176 }
177 if (event->isBeingDispatched()) { 177 if (event->isBeingDispatched()) {
178 exceptionState.throwDOMException(InvalidStateError, "The event is alread y being dispatched."); 178 exceptionState.throwDOMException(InvalidStateError, "The event is alread y being dispatched.");
179 return false; 179 return false;
180 } 180 }
181 181
182 if (!executionContext()) 182 if (!executionContext())
183 return false; 183 return false;
184 184
185 return dispatchEvent(event); 185 return dispatchEventInternal(event);
186 } 186 }
187 187
188 bool EventTarget::dispatchEvent(PassRefPtrWillBeRawPtr<Event> event) 188 bool EventTarget::dispatchEvent(PassRefPtrWillBeRawPtr<Event> event)
189 { 189 {
190 return dispatchEventInternal(event);
191 }
192
193 bool EventTarget::dispatchEventInternal(PassRefPtrWillBeRawPtr<Event> event)
194 {
190 event->setTarget(this); 195 event->setTarget(this);
191 event->setCurrentTarget(this); 196 event->setCurrentTarget(this);
192 event->setEventPhase(Event::AT_TARGET); 197 event->setEventPhase(Event::AT_TARGET);
193 bool defaultWasNotPrevented = fireEventListeners(event.get()); 198 bool defaultWasNotPrevented = fireEventListeners(event.get());
194 event->setEventPhase(0); 199 event->setEventPhase(0);
195 return defaultWasNotPrevented; 200 return defaultWasNotPrevented;
196 } 201 }
197 202
198 void EventTarget::uncaughtExceptionInEventHandler() 203 void EventTarget::uncaughtExceptionInEventHandler()
199 { 204 {
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 // they have one less listener to invoke. 383 // they have one less listener to invoke.
379 if (d->firingEventIterators) { 384 if (d->firingEventIterators) {
380 for (size_t i = 0; i < d->firingEventIterators->size(); ++i) { 385 for (size_t i = 0; i < d->firingEventIterators->size(); ++i) {
381 d->firingEventIterators->at(i).iterator = 0; 386 d->firingEventIterators->at(i).iterator = 0;
382 d->firingEventIterators->at(i).end = 0; 387 d->firingEventIterators->at(i).end = 0;
383 } 388 }
384 } 389 }
385 } 390 }
386 391
387 } // namespace blink 392 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698