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

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

Issue 671173006: Remove lots of machinery related to inline event handlers. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 2 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/frame/DOMWindowEventHandlers.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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 continue; 116 continue;
117 117
118 --firingIterator.end; 118 --firingIterator.end;
119 if (indexOfRemovedListener <= firingIterator.iterator) 119 if (indexOfRemovedListener <= firingIterator.iterator)
120 --firingIterator.iterator; 120 --firingIterator.iterator;
121 } 121 }
122 122
123 return true; 123 return true;
124 } 124 }
125 125
126 bool EventTarget::setAttributeEventListener(const AtomicString& eventType, PassR efPtr<EventListener> listener)
127 {
128 clearAttributeEventListener(eventType);
129 if (!listener)
130 return false;
131 return addEventListener(eventType, listener, false);
132 }
133
134 EventListener* EventTarget::getAttributeEventListener(const AtomicString& eventT ype)
135 {
136 const EventListenerVector& entry = getEventListeners(eventType);
137 for (size_t i = 0; i < entry.size(); ++i) {
138 EventListener* listener = entry[i].listener.get();
139 if (listener->isAttribute() && listener->belongsToTheCurrentWorld())
140 return listener;
141 }
142 return 0;
143 }
144
145 bool EventTarget::clearAttributeEventListener(const AtomicString& eventType)
146 {
147 EventListener* listener = getAttributeEventListener(eventType);
148 if (!listener)
149 return false;
150 return removeEventListener(eventType, listener, false);
151 }
152
153 bool EventTarget::dispatchEvent(PassRefPtrWillBeRawPtr<Event> event, ExceptionSt ate& exceptionState) 126 bool EventTarget::dispatchEvent(PassRefPtrWillBeRawPtr<Event> event, ExceptionSt ate& exceptionState)
154 { 127 {
155 if (!event) { 128 if (!event) {
156 exceptionState.throwDOMException(InvalidStateError, "The event provided is null."); 129 exceptionState.throwDOMException(InvalidStateError, "The event provided is null.");
157 return false; 130 return false;
158 } 131 }
159 if (event->type().isEmpty()) { 132 if (event->type().isEmpty()) {
160 exceptionState.throwDOMException(InvalidStateError, "The event provided is uninitialized."); 133 exceptionState.throwDOMException(InvalidStateError, "The event provided is uninitialized.");
161 return false; 134 return false;
162 } 135 }
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 // they have one less listener to invoke. 333 // they have one less listener to invoke.
361 if (d->firingEventIterators) { 334 if (d->firingEventIterators) {
362 for (size_t i = 0; i < d->firingEventIterators->size(); ++i) { 335 for (size_t i = 0; i < d->firingEventIterators->size(); ++i) {
363 d->firingEventIterators->at(i).iterator = 0; 336 d->firingEventIterators->at(i).iterator = 0;
364 d->firingEventIterators->at(i).end = 0; 337 d->firingEventIterators->at(i).end = 0;
365 } 338 }
366 } 339 }
367 } 340 }
368 341
369 } // namespace blink 342 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/events/EventTarget.h ('k') | sky/engine/core/frame/DOMWindowEventHandlers.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698