OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 19 matching lines...) Expand all Loading... |
30 | 30 |
31 #include "modules/EventModules.h" | 31 #include "modules/EventModules.h" |
32 #include "modules/EventTargetModules.h" | 32 #include "modules/EventTargetModules.h" |
33 | 33 |
34 namespace blink { | 34 namespace blink { |
35 | 35 |
36 DispatchEventResult IDBEventDispatcher::Dispatch( | 36 DispatchEventResult IDBEventDispatcher::Dispatch( |
37 Event* event, | 37 Event* event, |
38 HeapVector<Member<EventTarget>>& event_targets) { | 38 HeapVector<Member<EventTarget>>& event_targets) { |
39 size_t size = event_targets.size(); | 39 size_t size = event_targets.size(); |
40 ASSERT(size); | 40 DCHECK(size); |
41 | 41 |
42 event->SetEventPhase(Event::kCapturingPhase); | 42 event->SetEventPhase(Event::kCapturingPhase); |
43 for (size_t i = size - 1; i; --i) { // Don't do the first element. | 43 for (size_t i = size - 1; i; --i) { // Don't do the first element. |
44 event->SetCurrentTarget(event_targets[i].Get()); | 44 event->SetCurrentTarget(event_targets[i].Get()); |
45 event_targets[i]->FireEventListeners(event); | 45 event_targets[i]->FireEventListeners(event); |
46 if (event->PropagationStopped()) | 46 if (event->PropagationStopped()) |
47 goto doneDispatching; | 47 goto doneDispatching; |
48 } | 48 } |
49 | 49 |
50 event->SetEventPhase(Event::kAtTarget); | 50 event->SetEventPhase(Event::kAtTarget); |
(...skipping 10 matching lines...) Expand all Loading... |
61 goto doneDispatching; | 61 goto doneDispatching; |
62 } | 62 } |
63 | 63 |
64 doneDispatching: | 64 doneDispatching: |
65 event->SetCurrentTarget(nullptr); | 65 event->SetCurrentTarget(nullptr); |
66 event->SetEventPhase(Event::kNone); | 66 event->SetEventPhase(Event::kNone); |
67 return EventTarget::GetDispatchEventResult(*event); | 67 return EventTarget::GetDispatchEventResult(*event); |
68 } | 68 } |
69 | 69 |
70 } // namespace blink | 70 } // namespace blink |
OLD | NEW |