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

Side by Side Diff: sky/engine/core/events/EventTarget.cpp

Issue 922893002: Merge the Sky Engine changes from the SkyDart branch (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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 | « sky/engine/core/events/EventTarget.h ('k') | sky/engine/core/events/EventTarget.idl » ('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 15 matching lines...) Expand all
26 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 * 29 *
30 */ 30 */
31 31
32 #include "sky/engine/config.h" 32 #include "sky/engine/config.h"
33 #include "sky/engine/core/events/EventTarget.h" 33 #include "sky/engine/core/events/EventTarget.h"
34 34
35 #include "gen/sky/platform/RuntimeEnabledFeatures.h" 35 #include "gen/sky/platform/RuntimeEnabledFeatures.h"
36 #include "sky/engine/bindings/core/v8/ExceptionState.h" 36 #include "sky/engine/bindings2/exception_state.h"
37 #include "sky/engine/core/dom/Document.h" 37 #include "sky/engine/core/dom/Document.h"
38 #include "sky/engine/core/dom/ExceptionCode.h" 38 #include "sky/engine/core/dom/ExceptionCode.h"
39 #include "sky/engine/core/dom/ExecutionContext.h" 39 #include "sky/engine/core/dom/ExecutionContext.h"
40 #include "sky/engine/core/editing/Editor.h" 40 #include "sky/engine/core/editing/Editor.h"
41 #include "sky/engine/core/events/Event.h" 41 #include "sky/engine/core/events/Event.h"
42 #include "sky/engine/core/frame/LocalDOMWindow.h" 42 #include "sky/engine/core/frame/LocalDOMWindow.h"
43 #include "sky/engine/platform/EventDispatchForbiddenScope.h" 43 #include "sky/engine/platform/EventDispatchForbiddenScope.h"
44 #include "sky/engine/tonic/dart_gc_visitor.h"
44 #include "sky/engine/wtf/StdLibExtras.h" 45 #include "sky/engine/wtf/StdLibExtras.h"
45 #include "sky/engine/wtf/Vector.h" 46 #include "sky/engine/wtf/Vector.h"
46 47
47 using namespace WTF; 48 using namespace WTF;
48 49
49 namespace blink { 50 namespace blink {
50 51
51 EventTargetData::EventTargetData() 52 EventTargetData::EventTargetData()
52 { 53 {
53 } 54 }
54 55
55 EventTargetData::~EventTargetData() 56 EventTargetData::~EventTargetData()
56 { 57 {
57 } 58 }
58 59
59 EventTarget::EventTarget() 60 EventTarget::EventTarget()
60 { 61 {
61 } 62 }
62 63
63 EventTarget::~EventTarget() 64 EventTarget::~EventTarget()
64 { 65 {
65 } 66 }
66 67
68 void EventTarget::AcceptDartGCVisitor(DartGCVisitor& visitor) const
69 {
70 if (!visitor.have_found_set())
71 visitor.AddToSetForRoot(this, dart_wrapper());
72 EventListenerIterator iterator(this);
73 while (EventListener* listener = iterator.nextListener())
74 listener->AcceptDartGCVisitor(visitor);
75 DartWrappable::AcceptDartGCVisitor(visitor);
76 }
77
67 Node* EventTarget::toNode() 78 Node* EventTarget::toNode()
68 { 79 {
69 return 0; 80 return 0;
70 } 81 }
71 82
72 LocalDOMWindow* EventTarget::toDOMWindow() 83 LocalDOMWindow* EventTarget::toDOMWindow()
73 { 84 {
74 return 0; 85 return 0;
75 } 86 }
76 87
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 if (indexOfRemovedListener <= firingIterator.iterator) 128 if (indexOfRemovedListener <= firingIterator.iterator)
118 --firingIterator.iterator; 129 --firingIterator.iterator;
119 } 130 }
120 131
121 return true; 132 return true;
122 } 133 }
123 134
124 bool EventTarget::dispatchEvent(PassRefPtr<Event> event, ExceptionState& excepti onState) 135 bool EventTarget::dispatchEvent(PassRefPtr<Event> event, ExceptionState& excepti onState)
125 { 136 {
126 if (!event) { 137 if (!event) {
127 exceptionState.throwDOMException(InvalidStateError, "The event provided is null."); 138 exceptionState.ThrowDOMException(InvalidStateError, "The event provided is null.");
128 return false; 139 return false;
129 } 140 }
130 if (event->type().isEmpty()) { 141 if (event->type().isEmpty()) {
131 exceptionState.throwDOMException(InvalidStateError, "The event provided is uninitialized."); 142 exceptionState.ThrowDOMException(InvalidStateError, "The event provided is uninitialized.");
132 return false; 143 return false;
133 } 144 }
134 if (event->isBeingDispatched()) { 145 if (event->isBeingDispatched()) {
135 exceptionState.throwDOMException(InvalidStateError, "The event is alread y being dispatched."); 146 exceptionState.ThrowDOMException(InvalidStateError, "The event is alread y being dispatched.");
136 return false; 147 return false;
137 } 148 }
138 149
139 if (!executionContext()) 150 if (!executionContext())
140 return false; 151 return false;
141 152
142 return dispatchEvent(event); 153 return dispatchEvent(event);
143 } 154 }
144 155
145 bool EventTarget::dispatchEvent(PassRefPtr<Event> event) 156 bool EventTarget::dispatchEvent(PassRefPtr<Event> event)
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 // they have one less listener to invoke. 249 // they have one less listener to invoke.
239 if (d->firingEventIterators) { 250 if (d->firingEventIterators) {
240 for (size_t i = 0; i < d->firingEventIterators->size(); ++i) { 251 for (size_t i = 0; i < d->firingEventIterators->size(); ++i) {
241 d->firingEventIterators->at(i).iterator = 0; 252 d->firingEventIterators->at(i).iterator = 0;
242 d->firingEventIterators->at(i).end = 0; 253 d->firingEventIterators->at(i).end = 0;
243 } 254 }
244 } 255 }
245 } 256 }
246 257
247 } // namespace blink 258 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/events/EventTarget.h ('k') | sky/engine/core/events/EventTarget.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698