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

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

Issue 1233233003: Add Event.isTrusted support (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master_event_trusted_main2
Patch Set: Fix nits 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
« no previous file with comments | « Source/core/events/Event.idl ('k') | Source/core/events/MouseEvent.h » ('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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 return false; 179 return false;
180 } 180 }
181 if (event->isBeingDispatched()) { 181 if (event->isBeingDispatched()) {
182 exceptionState.throwDOMException(InvalidStateError, "The event is alread y being dispatched."); 182 exceptionState.throwDOMException(InvalidStateError, "The event is alread y being dispatched.");
183 return false; 183 return false;
184 } 184 }
185 185
186 if (!executionContext()) 186 if (!executionContext())
187 return false; 187 return false;
188 188
189 event->setTrusted(false);
189 return dispatchEventInternal(event); 190 return dispatchEventInternal(event);
190 } 191 }
191 192
192 bool EventTarget::dispatchEvent(PassRefPtrWillBeRawPtr<Event> event) 193 bool EventTarget::dispatchEvent(PassRefPtrWillBeRawPtr<Event> event)
193 { 194 {
195 event->setTrusted(true);
194 return dispatchEventInternal(event); 196 return dispatchEventInternal(event);
195 } 197 }
196 198
197 bool EventTarget::dispatchEventInternal(PassRefPtrWillBeRawPtr<Event> event) 199 bool EventTarget::dispatchEventInternal(PassRefPtrWillBeRawPtr<Event> event)
198 { 200 {
199 event->setTarget(this); 201 event->setTarget(this);
200 event->setCurrentTarget(this); 202 event->setCurrentTarget(this);
201 event->setEventPhase(Event::AT_TARGET); 203 event->setEventPhase(Event::AT_TARGET);
202 bool defaultWasNotPrevented = fireEventListeners(event.get()); 204 bool defaultWasNotPrevented = fireEventListeners(event.get());
203 event->setEventPhase(0); 205 event->setEventPhase(0);
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 // they have one less listener to invoke. 398 // they have one less listener to invoke.
397 if (d->firingEventIterators) { 399 if (d->firingEventIterators) {
398 for (size_t i = 0; i < d->firingEventIterators->size(); ++i) { 400 for (size_t i = 0; i < d->firingEventIterators->size(); ++i) {
399 d->firingEventIterators->at(i).iterator = 0; 401 d->firingEventIterators->at(i).iterator = 0;
400 d->firingEventIterators->at(i).end = 0; 402 d->firingEventIterators->at(i).end = 0;
401 } 403 }
402 } 404 }
403 } 405 }
404 406
405 } // namespace blink 407 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/events/Event.idl ('k') | Source/core/events/MouseEvent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698